@stytch/react 18.3.0 → 18.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/adminPortal/index.d.ts +6 -22
- package/dist/adminPortal/index.esm.d.ts +6 -22
- package/dist/adminPortal/index.esm.js +388 -335
- package/dist/adminPortal/index.js +388 -335
- package/dist/index-b14d4efe.d.ts +1 -1
- package/package.json +2 -2
|
@@ -8590,7 +8590,7 @@ else {
|
|
|
8590
8590
|
}
|
|
8591
8591
|
} var mergedPopperProps = F$3(function () { return deepmerge({ popperOptions: { modifiers: { arrow: { enabled: Boolean(arrowRef), element: arrowRef } } } }, PopperProps); }, [arrowRef, PopperProps]); return /*#__PURE__*/ y$3(g$5, null, /*#__PURE__*/ sn(children, childrenProps), /*#__PURE__*/ y$3(PopperComponent, _extends$4({ className: clsx(classes.popper, interactive && classes.popperInteractive, arrow && classes.popperArrow), placement: placement, anchorEl: childNode, open: childNode ? open : false, id: childrenProps['aria-describedby'], transition: true }, interactiveWrapperListeners, mergedPopperProps), function (_ref) { var placementInner = _ref.placement, TransitionPropsInner = _ref.TransitionProps; return /*#__PURE__*/ y$3(TransitionComponent, _extends$4({ timeout: theme.transitions.duration.shorter }, TransitionPropsInner, TransitionProps), /*#__PURE__*/ y$3("div", { className: clsx(classes.tooltip, classes["tooltipPlacement".concat(capitalize(placementInner.split('-')[0]))], ignoreNonTouchEvents.current && classes.touch, arrow && classes.tooltipArrow) }, title, arrow ? /*#__PURE__*/ y$3("span", { className: classes.arrow, ref: setArrowRef }) : null)); })); });
|
|
8592
8592
|
var Tooltip$2 = withStyles(styles$2, { name: 'MuiTooltip', flip: false })(Tooltip$1);
|
|
8593
|
-
var useStyles$q = makeStyles(function (theme) { return { root: { background: theme.styleConfig.container.backgroundColor,
|
|
8593
|
+
var useStyles$q = makeStyles(function (theme) { return { root: { background: theme.styleConfig.container.backgroundColor, borderStyle: 'solid', borderWidth: theme.styleConfig.container.borderWidth, borderColor: theme.styleConfig.container.borderColor, borderRadius: theme.styleConfig.container.borderRadius, color: theme.styleConfig.colors.primary, width: theme.styleConfig.container.width, padding: theme.styleConfig.container.padding, boxSizing: 'border-box' } }; });
|
|
8594
8594
|
var MainContainer = function MainContainer(_ref6) { var children = _ref6.children; var classes = useStyles$q(); return /*#__PURE__*/ wn.createElement("div", { className: classes.root }, children); };
|
|
8595
8595
|
var StytchClientContext = /*#__PURE__*/ wn.createContext({ client: null });
|
|
8596
8596
|
var useAdminPortalContext = function useAdminPortalContext() { return q$5(StytchClientContext); };
|
|
@@ -8740,7 +8740,7 @@ var Toast = function Toast(_ref7) { var children = _ref7.children, _ref7$type =
|
|
|
8740
8740
|
var DEFAULT_STATE$1 = { openToast: noop, closeToast: noop };
|
|
8741
8741
|
var ToastContext = /*#__PURE__*/ F$4(DEFAULT_STATE$1);
|
|
8742
8742
|
var useToast = function useToast() { return q$5(ToastContext); };
|
|
8743
|
-
var ToastContextProviderCore = function ToastContextProviderCore(_ref8) { var children = _ref8.children, classes = _ref8.classes, TypographyComponent = _ref8.TypographyComponent; var
|
|
8743
|
+
var ToastContextProviderCore = function ToastContextProviderCore(_ref8) { var children = _ref8.children, classes = _ref8.classes, TypographyComponent = _ref8.TypographyComponent; var _h2 = h$4(false), _h3 = _slicedToArray2(_h2, 2), open = _h3[0], setOpen = _h3[1]; var _h4 = h$4(''), _h5 = _slicedToArray2(_h4, 2), toastText = _h5[0], setToastText = _h5[1]; var _h6 = h$4('success'), _h7 = _slicedToArray2(_h6, 2), toastType = _h7[0], setToastType = _h7[1]; var timeoutRef = _$1(null); var closeToast = function closeToast() { return setOpen(false); }; var triggerOpen = T$2(function (openDurationMS) { setOpen(true); if (timeoutRef.current) {
|
|
8744
8744
|
clearTimeout(timeoutRef.current);
|
|
8745
8745
|
} timeoutRef.current = setTimeout(function () { setOpen(false); }, openDurationMS); }, []); var openToast = T$2(function (_ref9) { var type = _ref9.type, text = _ref9.text, _ref9$openDurationMS = _ref9.openDurationMS, openDurationMS = _ref9$openDurationMS === void 0 ? 5000 : _ref9$openDurationMS; setToastType(type); setToastText(text); triggerOpen(openDurationMS); }, [triggerOpen]); return /*#__PURE__*/ wn.createElement(ToastContext.Provider, { value: { openToast: openToast, closeToast: closeToast } }, /*#__PURE__*/ wn.createElement(Snackbar$1, { anchorOrigin: { horizontal: 'center', vertical: 'bottom' }, className: classes.snackbar, open: open }, /*#__PURE__*/ wn.createElement(Toast, { TypographyComponent: TypographyComponent, classes: classes, onClose: closeToast, type: toastType }, toastText)), children); };
|
|
8746
8746
|
var makeTypographyStyles = makeStylesFactory(function (theme) { return { typography: { '& ul': { margin: theme.spacing(1, 0, 0) } }, disabled: {} }; });
|
|
@@ -8751,7 +8751,7 @@ var Typography = function Typography(props) { var rest = __rest(props, ["disable
|
|
|
8751
8751
|
var useStyles$o = makeToastStyles(function (theme) { return { toast: { backgroundColor: theme.styleConfig.container.backgroundColor, boxShadow: '0px 5px 10px 0px rgba(0, 0, 0, 0.20)', border: '1px solid', borderColor: theme.styleConfig.container.borderColor, borderRadius: theme.styleConfig.borderRadius }, error: { '& p': { color: theme.styleConfig.colors.error }, backgroundColor: theme.styleConfig.container.backgroundColor, color: theme.styleConfig.colors.error }, errorIcon: { color: theme.styleConfig.colors.error }, success: { '& p': { color: theme.styleConfig.colors.success }, backgroundColor: theme.styleConfig.container.backgroundColor, color: theme.styleConfig.colors.success }, successIcon: { color: theme.styleConfig.colors.success } }; });
|
|
8752
8752
|
var ToastContextProvider = function ToastContextProvider(props) { var classes = useStyles$o(); return /*#__PURE__*/ wn.createElement(ToastContextProviderCore, Object.assign({ TypographyComponent: Typography, classes: classes }, props)); };
|
|
8753
8753
|
var DEFAULT_ADMIN_PORTAL_STYLE_CONFIG = { container: { backgroundColor: '#FFFFFF', borderColor: '#FFFFFF', width: '100%' }, colors: { primary: '#000000', secondary: '#5C727D', success: '#005D26', error: '#BB0003', accent: '#ECFAFF', accentText: '#000000', subtle: '#EFEFEF' }, buttons: { primary: { backgroundColor: '#000000', textColor: '#FFFFFF', borderColor: '#000000' }, secondary: { backgroundColor: '#FFFFFF', textColor: '#000000', borderColor: '#000000' }, disabled: { backgroundColor: '#EFEFEF', textColor: '#B4B4B4', borderColor: '#EFEFEF' } }, inputs: { backgroundColor: '#FFFFFF', borderColor: '#D9D9D9', placeholderColor: '#5C727D', textColor: '#000000' }, borderRadius: '4px', fontFamily: 'Arial, Helvetica, sans-serif' };
|
|
8754
|
-
var getTheme = function getTheme(styles) { var _a, _b, _c, _d, _e, _f; var styleConfig = merge({}, DEFAULT_ADMIN_PORTAL_STYLE_CONFIG, styles); var resolvedConfig = Object.assign(Object.assign({}, styleConfig), { buttons: { primary: Object.assign(Object.assign({}, styleConfig.buttons.primary), { borderRadius: (_a = styleConfig.buttons.primary.borderRadius) !== null && _a !== void 0 ? _a : styleConfig.borderRadius }), secondary: Object.assign(Object.assign({}, styleConfig.buttons.secondary), { borderRadius: (_b = styleConfig.buttons.secondary.borderRadius) !== null && _b !== void 0 ? _b : styleConfig.borderRadius }), disabled: Object.assign(Object.assign({}, styleConfig.buttons.disabled), { borderRadius: (_d = (_c = styleConfig.buttons.disabled) === null || _c === void 0 ? void 0 : _c.borderRadius) !== null && _d !== void 0 ? _d : styleConfig.borderRadius }) }, container: Object.assign(Object.assign({}, styleConfig.container), { borderRadius: (_e = styleConfig.container.borderRadius) !== null && _e !== void 0 ? _e : styleConfig.borderRadius }), inputs: Object.assign(Object.assign({}, styleConfig.inputs), { borderRadius: (
|
|
8754
|
+
var getTheme = function getTheme(styles) { var _a, _b, _c, _d, _e, _f, _g, _h; var styleConfig = merge({}, DEFAULT_ADMIN_PORTAL_STYLE_CONFIG, styles); var resolvedConfig = Object.assign(Object.assign({}, styleConfig), { buttons: { primary: Object.assign(Object.assign({}, styleConfig.buttons.primary), { borderRadius: (_a = styleConfig.buttons.primary.borderRadius) !== null && _a !== void 0 ? _a : styleConfig.borderRadius }), secondary: Object.assign(Object.assign({}, styleConfig.buttons.secondary), { borderRadius: (_b = styleConfig.buttons.secondary.borderRadius) !== null && _b !== void 0 ? _b : styleConfig.borderRadius }), disabled: Object.assign(Object.assign({}, styleConfig.buttons.disabled), { borderRadius: (_d = (_c = styleConfig.buttons.disabled) === null || _c === void 0 ? void 0 : _c.borderRadius) !== null && _d !== void 0 ? _d : styleConfig.borderRadius }) }, container: Object.assign(Object.assign({}, styleConfig.container), { borderRadius: (_e = styleConfig.container.borderRadius) !== null && _e !== void 0 ? _e : styleConfig.borderRadius, borderWidth: (_f = styleConfig.container.borderWidth) !== null && _f !== void 0 ? _f : 1, padding: (_g = styleConfig.container.padding) !== null && _g !== void 0 ? _g : 48 }), inputs: Object.assign(Object.assign({}, styleConfig.inputs), { borderRadius: (_h = styleConfig.inputs.borderRadius) !== null && _h !== void 0 ? _h : styleConfig.borderRadius }) }); var theme = createTheme({ typography: { allVariants: { color: resolvedConfig.colors.primary }, button: { textTransform: 'none', fontSize: 14, fontWeight: 600, lineHeight: '250%' }, fontFamily: styleConfig.fontFamily, h1: { fontSize: 24, fontWeight: 600, lineHeight: '125%' }, h2: { fontSize: 20, fontWeight: 600, lineHeight: '125%' }, h3: { fontSize: 16, fontWeight: 600, lineHeight: '125%' }, h4: { fontSize: 14, fontWeight: 600, lineHeight: '150%' }, body1: { fontSize: 14, fontWeight: 400, lineHeight: '150%' }, body2: { fontSize: 12, fontWeight: 400, lineHeight: '150%' }, caption: { fontSize: 10, fontWeight: 400, lineHeight: '120%' } }, overrides: { MuiRadio: { root: { color: resolvedConfig.colors.primary }, colorPrimary: { '&$checked': { color: resolvedConfig.colors.primary }, '&.Mui-disabled': { color: resolvedConfig.colors.secondary } } }, MuiIconButton: { root: { color: resolvedConfig.colors.primary } }, MuiPaper: { root: { backgroundColor: resolvedConfig.container.backgroundColor, border: '1px solid', borderColor: resolvedConfig.colors.subtle, borderRadius: resolvedConfig.container.borderRadius } }, MuiTypography: { colorPrimary: { color: resolvedConfig.colors.primary }, colorTextSecondary: { color: resolvedConfig.colors.secondary }, colorError: { color: resolvedConfig.colors.error } } }, styleConfig: resolvedConfig }); return theme; };
|
|
8755
8755
|
var generateClassName = createGenerateClassName({ seed: classNameSeed });
|
|
8756
8756
|
var ContextProvider = function ContextProvider(_ref11) { var theme = _ref11.theme, options = _ref11.options, children = _ref11.children; var clientAndConfig = F$3(function () { return { client: options.client, config: options.config }; }, [options]); return /*#__PURE__*/ wn.createElement(StylesProvider, { generateClassName: generateClassName }, /*#__PURE__*/ wn.createElement(ThemeProvider, { theme: theme }, /*#__PURE__*/ wn.createElement(StytchClientContext.Provider, { value: clientAndConfig }, children))); };
|
|
8757
8757
|
var AdminPortalWrapper = function AdminPortalWrapper(_ref12) { var children = _ref12.children, options = _ref12.options; var theme = getTheme(options.styles); return /*#__PURE__*/ wn.createElement(ContextProvider, { options: options, theme: theme }, /*#__PURE__*/ wn.createElement(MainContainer, null, /*#__PURE__*/ wn.createElement(ToastContextProvider, null, children))); };
|
|
@@ -8788,7 +8788,7 @@ var makeButtonStyles = makeStylesFactory(function (theme) { return { button: _de
|
|
|
8788
8788
|
var variantToMUIVariant = { ghost: 'outlined', primary: 'contained', secondary: 'contained', text: 'text' };
|
|
8789
8789
|
var ButtonCore = function ButtonCore(_a) { var children = _a.children, className = _a.className, compact = _a.compact, component = _a.component, variant = _a.variant, warning = _a.warning, classes = _a.classes, props = __rest(_a, ["children", "className", "compact", "component", "variant", "warning", "classes"]); var variantStyles = { ghost: classes.ghost, primary: classes.primary, secondary: classes.secondary, text: classes.text }; var buttonWarningStyles = { ghost: classes.warningGhost, primary: classes.warningPrimary, secondary: classes.warningPrimary, text: classes.warningText }; var buttonVariant = variant !== null && variant !== void 0 ? variant : 'primary'; var buttonStyles = warning ? buttonWarningStyles[buttonVariant] : variantStyles[buttonVariant]; return /*#__PURE__*/ wn.createElement(MUIButton, Object.assign({}, props, { className: C(classes.button, buttonStyles, _defineProperty2({}, classes.compact, compact), _defineProperty2({}, classes.iconOnly, !children), className), component: component !== null && component !== void 0 ? component : 'button', disableRipple: true, variant: variantToMUIVariant[buttonVariant] }), children); };
|
|
8790
8790
|
var mixed = function mixed(color) { return "color-mix(in srgb, ".concat(color, " 80%, #333)"); };
|
|
8791
|
-
var useStyles$m = makeButtonStyles(function (theme) { var disabledStyle = { backgroundColor: theme.styleConfig.buttons.disabled.backgroundColor, borderColor: theme.styleConfig.buttons.disabled.borderColor,
|
|
8791
|
+
var useStyles$m = makeButtonStyles(function (theme) { var disabledStyle = { backgroundColor: theme.styleConfig.buttons.disabled.backgroundColor, borderColor: theme.styleConfig.buttons.disabled.borderColor, color: theme.styleConfig.buttons.disabled.textColor }; return { button: { borderRadius: theme.styleConfig.borderRadius, fontSize: theme.typography.button.fontSize, fontWeight: 700, minHeight: 44, borderWidth: 1, borderStyle: 'solid' }, compact: { fontSize: 12 }, ghost: { '&:disabled': disabledStyle, '&:hover': { backgroundColor: mixed(theme.styleConfig.buttons.secondary.backgroundColor) }, backgroundColor: theme.styleConfig.buttons.secondary.backgroundColor, color: theme.styleConfig.buttons.secondary.textColor, borderRadius: theme.styleConfig.buttons.secondary.borderRadius, borderColor: theme.styleConfig.buttons.secondary.borderColor }, primary: { '&:disabled': disabledStyle, '&:hover': { backgroundColor: mixed(theme.styleConfig.buttons.primary.backgroundColor) }, backgroundColor: theme.styleConfig.buttons.primary.backgroundColor, color: theme.styleConfig.buttons.primary.textColor, borderRadius: theme.styleConfig.buttons.primary.borderRadius, borderColor: theme.styleConfig.buttons.primary.borderColor }, secondary: { '&:disabled': disabledStyle, '&:hover': { backgroundColor: mixed(theme.styleConfig.buttons.secondary.backgroundColor) }, backgroundColor: theme.styleConfig.buttons.secondary.backgroundColor, color: theme.styleConfig.buttons.secondary.textColor, borderRadius: theme.styleConfig.buttons.secondary.borderRadius, borderColor: theme.styleConfig.buttons.secondary.borderColor }, text: { '&:disabled': Object.assign(Object.assign({}, disabledStyle), { borderRadius: theme.styleConfig.buttons.disabled.borderRadius }), '&:hover': { backgroundColor: 'rgba(0, 0, 0, 0.1)' }, backgroundColor: 'transparent', color: theme.styleConfig.colors.primary, borderWidth: 0 }, warningGhost: { '&:disabled': disabledStyle, '&:hover': { backgroundColor: mixed(theme.styleConfig.buttons.secondary.backgroundColor), borderColor: theme.styleConfig.colors.error, color: theme.styleConfig.colors.error }, backgroundColor: theme.styleConfig.buttons.secondary.backgroundColor, borderColor: theme.styleConfig.colors.error, borderRadius: theme.styleConfig.buttons.secondary.borderRadius, color: theme.styleConfig.colors.error }, warningPrimary: { '&:disabled': disabledStyle, '&:hover': { backgroundColor: mixed(theme.styleConfig.colors.error), color: theme.styleConfig.buttons.primary.textColor }, backgroundColor: theme.styleConfig.colors.error, borderRadius: theme.styleConfig.buttons.primary.borderRadius, color: theme.styleConfig.buttons.primary.textColor }, warningText: { '&:disabled': Object.assign(Object.assign({}, disabledStyle), { borderRadius: theme.styleConfig.buttons.disabled.borderRadius }), '&:hover': { backgroundColor: 'rgba(0, 0, 0, 0.1)', color: theme.styleConfig.colors.error }, backgroundColor: 'transparent', color: theme.styleConfig.colors.error, borderWidth: 0 } }; });
|
|
8792
8792
|
var Button = function Button(_a) { var props = __rest(_a, []); var classes = useStyles$m(); return /*#__PURE__*/ wn.createElement(ButtonCore, Object.assign({}, props, { classes: classes })); };
|
|
8793
8793
|
var getShortId = function getShortId(prefix) { return "".concat(prefix !== null && prefix !== void 0 ? prefix : '').concat(Math.random().toString(36).slice(-6)); };
|
|
8794
8794
|
var useShortId = function useShortId(prefix) { return F$3(function () { return getShortId(prefix); }, [prefix]); };
|
|
@@ -8796,7 +8796,7 @@ var DEFAULT_GAP = 1;
|
|
|
8796
8796
|
var DEFAULT_GRID_COLUMN_WIDTH = 360;
|
|
8797
8797
|
var DEFAULT_MAX_ITEM_WIDTH = 720 + DEFAULT_GAP;
|
|
8798
8798
|
var FlexBox = function FlexBox(_ref14) { var children = _ref14.children, gap = _ref14.gap, alignItems = _ref14.alignItems, flexDirection = _ref14.flexDirection, justifyContent = _ref14.justifyContent, flexWrap = _ref14.flexWrap; var theme = useTheme(); return /*#__PURE__*/ wn.createElement("div", { style: { display: 'flex', gap: theme.spacing(gap !== null && gap !== void 0 ? gap : DEFAULT_GAP), alignItems: alignItems, justifyContent: justifyContent, flexDirection: flexDirection, flexWrap: flexWrap } }, children); };
|
|
8799
|
-
var useToggleState = function useToggleState(initialState) { var
|
|
8799
|
+
var useToggleState = function useToggleState(initialState) { var _h8 = h$4(false), _h9 = _slicedToArray2(_h8, 2), isOpen = _h9[0], setIsOpen = _h9[1]; var toggle = function toggle() { return setIsOpen(function (prev) { return !prev; }); }; var open = function open() { return setIsOpen(true); }; var close = function close() { return setIsOpen(false); }; return { close: close, isOpen: isOpen, open: open, toggle: toggle }; };
|
|
8800
8800
|
var promiseNoop = function promiseNoop() { return Promise.resolve(); };
|
|
8801
8801
|
var useModalState = function useModalState() { var confirmAction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : promiseNoop; var _useToggleState = useToggleState(), isOpen = _useToggleState.isOpen, open = _useToggleState.open, close = _useToggleState.close; var _useToast = useToast(), openToast = _useToast.openToast; var confirm = function confirm() { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1)
|
|
8802
8802
|
switch (_context.prev = _context.next) {
|
|
@@ -8856,14 +8856,14 @@ var useMutateWithToast = function useMutateWithToast(callback) { var _useToast2
|
|
|
8856
8856
|
case "end": return _context3.stop();
|
|
8857
8857
|
} }, _callee3, null, [[0, 6]]); })); }, [callback, openToast]); return { mutate: mutate }; };
|
|
8858
8858
|
var ssoGetConnectionsKey = function ssoGetConnectionsKey(orgId) { return ['sso.getConnections', orgId]; };
|
|
8859
|
-
var useSsoConnections = function useSsoConnections(
|
|
8859
|
+
var useSsoConnections = function useSsoConnections(_ref17) { var shouldFetch = _ref17.shouldFetch; var _a; var client = useStytchClient(); var orgId = (_a = client.organization.getSync()) === null || _a === void 0 ? void 0 : _a.organization_id; return useSWR(shouldFetch ? ssoGetConnectionsKey(orgId) : null, function () { return client.sso.getConnections(); }); };
|
|
8860
8860
|
var useRevalidateConnectionList = function useRevalidateConnectionList() { var _useSWRConfig = useSWRConfig(), mutate = _useSWRConfig.mutate; var client = useStytchClient(); return T$2(function () { var _a; var orgId = (_a = client.organization.getSync()) === null || _a === void 0 ? void 0 : _a.organization_id; if (orgId) {
|
|
8861
8861
|
return mutate(ssoGetConnectionsKey(orgId));
|
|
8862
8862
|
} }, [client.organization, mutate]); };
|
|
8863
8863
|
var mutateSamlConnection = function mutateSamlConnection(client) { return function (options) { return client.sso.saml.updateConnection(options); }; };
|
|
8864
8864
|
var mutateOidcConnection = function mutateOidcConnection(client) { return function (options) { return client.sso.oidc.updateConnection(options); }; };
|
|
8865
8865
|
var updateConnectionByURL = function updateConnectionByURL(client) { return function (options) { return client.sso.saml.updateConnectionByURL(options); }; };
|
|
8866
|
-
var deleteConnection = function deleteConnection(client) { return function (
|
|
8866
|
+
var deleteConnection = function deleteConnection(client) { return function (_ref18) { var connection_id = _ref18.connection_id; return client.sso.deleteConnection(connection_id); }; };
|
|
8867
8867
|
var deleteVerificationCertificate = function deleteVerificationCertificate(client) { return function (options) { return client.sso.saml.deleteVerificationCertificate(options); }; };
|
|
8868
8868
|
var useMutateFnSsoConnection = function useMutateFnSsoConnection(mutateFn) { var _useSWRConfig2 = useSWRConfig(), mutateSWR = _useSWRConfig2.mutate; var client = useStytchClient(); var revalidateConnectionList = useRevalidateConnectionList(); return useMutateWithToast(T$2(function (options) { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee4() { return _regeneratorRuntime().wrap(function _callee4$(_context4) { while (1)
|
|
8869
8869
|
switch (_context4.prev = _context4.next) {
|
|
@@ -8879,9 +8879,9 @@ var useDeleteSsoConnection = function useDeleteSsoConnection() { return useMutat
|
|
|
8879
8879
|
var useDeleteSsoConnectionCert = function useDeleteSsoConnectionCert() { return useMutateFnSsoConnection(deleteVerificationCertificate); };
|
|
8880
8880
|
var useMutateSsoConnection = function useMutateSsoConnection(connectionType) { return useMutateFnSsoConnection(connectionType === 'saml' ? mutateSamlConnection : mutateOidcConnection); };
|
|
8881
8881
|
var useMutateSamlConnection = function useMutateSamlConnection() { return useMutateSsoConnection('saml'); };
|
|
8882
|
-
var DeleteConfirmModal = function DeleteConfirmModal(_a) { var connectionName = _a.connectionName, modalProps = __rest(_a, ["connectionName"]); return /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, modalProps, { title: "Delete ".concat(connectionName || 'connection', "?"), confirmButtonText: "Delete", warning: true }), /*#__PURE__*/ wn.createElement(Typography, null, "Once deleted, the connection cannot be restored. Any members assigned
|
|
8883
|
-
var useMutateDeleteConnection = function useMutateDeleteConnection() { var _useDeleteSsoConnecti = useDeleteSsoConnection(), mutate = _useDeleteSsoConnecti.mutate; var deleteConnection = function deleteConnection(
|
|
8884
|
-
var useDeleteConnection = function useDeleteConnection() { var
|
|
8882
|
+
var DeleteConfirmModal = function DeleteConfirmModal(_a) { var connectionName = _a.connectionName, modalProps = __rest(_a, ["connectionName"]); return /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, modalProps, { title: "Delete ".concat(connectionName || 'connection', "?"), confirmButtonText: "Delete", warning: true }), /*#__PURE__*/ wn.createElement(Typography, null, "Once deleted, the SSO connection cannot be restored. Any members assigned automatic roles via this connection, as well as members allowed to JIT provision via this SSO connection, will lose access immediately.")); };
|
|
8883
|
+
var useMutateDeleteConnection = function useMutateDeleteConnection() { var _useDeleteSsoConnecti = useDeleteSsoConnection(), mutate = _useDeleteSsoConnecti.mutate; var deleteConnection = function deleteConnection(_ref19) { var connectionId = _ref19.connectionId; return mutate({ connection_id: connectionId }); }; return { deleteConnection: deleteConnection }; };
|
|
8884
|
+
var useDeleteConnection = function useDeleteConnection() { var _ref20 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, onConfirm = _ref20.onConfirm; var _h10 = h$4(), _h11 = _slicedToArray2(_h10, 2), connection = _h11[0], setConnection = _h11[1]; var _useMutateDeleteConne = useMutateDeleteConnection(), deleteConnection = _useMutateDeleteConne.deleteConnection; var handleConfirm = function handleConfirm() { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee5() { return _regeneratorRuntime().wrap(function _callee5$(_context5) { while (1)
|
|
8885
8885
|
switch (_context5.prev = _context5.next) {
|
|
8886
8886
|
case 0:
|
|
8887
8887
|
if (!connection) {
|
|
@@ -8903,8 +8903,8 @@ var useDeleteConnection = function useDeleteConnection() { var _ref19 = argument
|
|
|
8903
8903
|
case "end": return _context5.stop();
|
|
8904
8904
|
} }, _callee5, null, [[1, 6]]); })); }; var _useModalState = useModalState(handleConfirm), close = _useModalState.close, confirm = _useModalState.confirm, isOpen = _useModalState.isOpen, open = _useModalState.open; var handleRequestDelete = T$2(function (connection) { setConnection(connection); open(); }, [open]); return { handleRequestDelete: handleRequestDelete, modalProps: { connectionName: connection === null || connection === void 0 ? void 0 : connection.displayName, isOpen: isOpen, close: close, confirm: confirm } }; };
|
|
8905
8905
|
var makeTagStyles = makeStylesFactory(function (theme) { return { tag: { fontFamily: 'IBM Plex Mono, monospace', fontSize: 18, fontWeight: 400, lineHeight: '150%', padding: theme.spacing(0, 1), borderRadius: 4, width: 'fit-content' } }; });
|
|
8906
|
-
var TagCore = function TagCore(
|
|
8907
|
-
var useStyles$k = makeTagStyles(function (theme) { return { tag: { fontFamily: theme.styleConfig.fontFamily, fontSize: function fontSize(
|
|
8906
|
+
var TagCore = function TagCore(_ref21) { var children = _ref21.children, classes = _ref21.classes; return /*#__PURE__*/ wn.createElement("span", { className: classes.tag }, children); };
|
|
8907
|
+
var useStyles$k = makeTagStyles(function (theme) { return { tag: { fontFamily: theme.styleConfig.fontFamily, fontSize: function fontSize(_ref22) { var size = _ref22.size; return size === 'small' ? theme.typography.caption.fontSize : theme.typography.body2.fontSize; }, backgroundColor: theme.styleConfig.colors.accent, padding: function padding(_ref23) { var _ref23$hasTopAndBotto = _ref23.hasTopAndBottomPadding, hasTopAndBottomPadding = _ref23$hasTopAndBotto === void 0 ? true : _ref23$hasTopAndBotto; return "".concat(hasTopAndBottomPadding ? 8 : 0, "px 11px"); }, height: 'fit-content', color: theme.styleConfig.colors.accentText } }; });
|
|
8908
8908
|
var Tag = function Tag(props) { var classes = useStyles$k(props); return /*#__PURE__*/ wn.createElement(TagCore, Object.assign({}, props, { classes: classes })); };
|
|
8909
8909
|
var organizationGetKey = function organizationGetKey(orgId) { return ['organization.get', orgId]; };
|
|
8910
8910
|
var useOrgInfo = function useOrgInfo() { var _a; var client = useStytchClient(); var orgId = (_a = client.organization.getSync()) === null || _a === void 0 ? void 0 : _a.organization_id; return useSWR(organizationGetKey(orgId), function () { return client.organization.get(); }); };
|
|
@@ -8912,15 +8912,15 @@ var deepEqual = createDeepEqual();
|
|
|
8912
8912
|
var CODE_HORIZONTAL_PADDING = 1;
|
|
8913
8913
|
var commonCodeStyles$1 = { code: { borderRadius: 4, width: 'fit-content' } };
|
|
8914
8914
|
var makeCodeStyles = makeStylesFactory(commonCodeStyles$1, function (theme) { return { code: { fontFamily: 'IBM Plex Mono, monospace', fontSize: 16, fontWeight: 400, lineHeight: '150%', padding: theme.spacing(0.5, CODE_HORIZONTAL_PADDING), wordBreak: 'break-word' } }; });
|
|
8915
|
-
var CodeCore = function CodeCore(
|
|
8915
|
+
var CodeCore = function CodeCore(_ref24) { var children = _ref24.children, classes = _ref24.classes; return /*#__PURE__*/ wn.createElement("span", { className: C(classes.code) }, children); };
|
|
8916
8916
|
var commonCodeStyles = function commonCodeStyles(theme) { return { code: { fontFamily: theme.typography.fontFamily, color: theme.styleConfig.colors.accentText, backgroundColor: theme.styleConfig.colors.accent, fontSize: theme.typography.body2.fontSize, fontWeight: theme.typography.body2.fontWeight, lineHeight: theme.typography.body2.lineHeight, padding: theme.spacing(0.5) } }; };
|
|
8917
8917
|
var useStyles$j = makeCodeStyles(commonCodeStyles);
|
|
8918
8918
|
var Code = function Code(props) { var classes = useStyles$j(); return /*#__PURE__*/ wn.createElement(CodeCore, Object.assign({}, props, { classes: classes })); };
|
|
8919
8919
|
var useStyles$i = makeStyles(function () { return { labelContainer: { display: 'flex', alignItems: 'center' } }; });
|
|
8920
|
-
var LabelCore = function LabelCore(
|
|
8920
|
+
var LabelCore = function LabelCore(_ref25) { var children = _ref25.children, disabled = _ref25.disabled, htmlFor = _ref25.htmlFor, required = _ref25.required, _ref25$variant = _ref25.variant, variant = _ref25$variant === void 0 ? 'body2' : _ref25$variant, Typography = _ref25.TypographyComponent, labelColor = _ref25.labelColor; var classes = useStyles$i(); return /*#__PURE__*/ wn.createElement("span", { className: classes.labelContainer }, /*#__PURE__*/ wn.createElement("label", { "aria-required": required, htmlFor: htmlFor }, /*#__PURE__*/ wn.createElement(Typography, { color: labelColor, disabled: disabled, variant: variant }, children)), required && ( /*#__PURE__*/wn.createElement(Typography, { color: "error", disabled: disabled, variant: "body2" }, "*"))); };
|
|
8921
8921
|
var Label = function Label(props) { return /*#__PURE__*/ wn.createElement(LabelCore, Object.assign({}, props, { TypographyComponent: Typography })); };
|
|
8922
8922
|
var makeCopyableTextStyles = makeStylesFactory(commonCodeStyles$1, function (theme) { return { copyableText: { '&:hover': { marginRight: 0 }, '& svg': { marginRight: theme.spacing(CODE_HORIZONTAL_PADDING) }, borderRadius: 4, display: 'flex', alignItems: 'center', height: 'fit-content', width: 'fit-content', marginRight: theme.spacing(3.5) }, copyIcon: { '& svg': { marginRight: theme.spacing(CODE_HORIZONTAL_PADDING) } }, hasCopiedIcon: { marginRight: 0 }, noWrap: { '& span': { wordBreak: 'unset', whiteSpace: 'nowrap' } } }; });
|
|
8923
|
-
var CopyableTextCore = function CopyableTextCore(
|
|
8923
|
+
var CopyableTextCore = function CopyableTextCore(_ref26) { var children = _ref26.children, textToCopy = _ref26.textToCopy, noWrap = _ref26.noWrap, id = _ref26.id, label = _ref26.label, classes = _ref26.classes, Code = _ref26.CodeComponent, Label = _ref26.LabelComponent, Typography = _ref26.TypographyComponent, useClickToCopy = _ref26.useClickToCopy; var _a; var inputId = useShortId(id); if (children && typeof children !== 'string') {
|
|
8924
8924
|
throw new Error('CopyableText children must be a string');
|
|
8925
8925
|
} var _useClickToCopy = useClickToCopy({ text: (_a = textToCopy !== null && textToCopy !== void 0 ? textToCopy : children) !== null && _a !== void 0 ? _a : '' }), copied = _useClickToCopy.copied, copyToClipboard = _useClickToCopy.copyToClipboard, CopyIcon = _useClickToCopy.CopyIcon, containerHoverClass = _useClickToCopy.containerHoverClass; return /*#__PURE__*/ wn.createElement("div", { className: C(_defineProperty2({}, classes.noWrap, noWrap)) }, label && /*#__PURE__*/ wn.createElement(Label, { htmlFor: inputId }, label), !children && /*#__PURE__*/ wn.createElement(Typography, null, "\u2013"), children && ( /*#__PURE__*/wn.createElement("span", { className: C(containerHoverClass, classes.copyableText, classes.code, _defineProperty2({}, classes.hasCopiedIcon, copied)), onClick: copyToClipboard }, /*#__PURE__*/ wn.createElement(Code, null, children), /*#__PURE__*/ wn.createElement("div", { className: classes.copyIcon }, CopyIcon)))); };
|
|
8926
8926
|
var CheckCircleOutlined = {};
|
|
@@ -8942,24 +8942,24 @@ var _createSvgIcon$d = _interopRequireDefault$d(requireCreateSvgIcon());
|
|
|
8942
8942
|
var _default$d = (0, _createSvgIcon$d["default"])(/*#__PURE__*/ React$d.createElement("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4H8c-1.1 0-1.99.9-1.99 2L6 21c0 1.1.89 2 1.99 2H19c1.1 0 2-.9 2-2V11l-6-6zM8 21V7h6v5h5v9H8z" }), 'FileCopyOutlined');
|
|
8943
8943
|
default_1$d = FileCopyOutlined["default"] = _default$d;
|
|
8944
8944
|
var makeClickToCopyStyles = makeStylesFactory({ checkCircle: { display: 'block !important' }, darkBackground: {}, containerHover: { '&:hover': { '& svg': { display: 'block' }, cursor: 'pointer' }, '& svg': { display: 'none' } } });
|
|
8945
|
-
var useClickToCopyCore = function useClickToCopyCore(
|
|
8945
|
+
var useClickToCopyCore = function useClickToCopyCore(_ref27) { var classes = _ref27.classes, darkBackground = _ref27.darkBackground, _ref27$iconSize = _ref27.iconSize, iconSize = _ref27$iconSize === void 0 ? 'small' : _ref27$iconSize, text = _ref27.text; var _h12 = h$4(false), _h13 = _slicedToArray2(_h12, 2), copied = _h13[0], setCopied = _h13[1]; var copyToClipboard = function copyToClipboard(e) { e.stopPropagation(); setCopied(true); navigator.clipboard.writeText(text); setTimeout(function () { return setCopied(false); }, 1000); }; var CopyIcon = copied ? ( /*#__PURE__*/wn.createElement(default_1$e, { className: C(classes.checkCircle, _defineProperty2({}, classes.darkBackground, darkBackground)), fontSize: iconSize })) : ( /*#__PURE__*/wn.createElement(default_1$d, { fontSize: iconSize })); return { copied: copied, copyToClipboard: copyToClipboard, CopyIcon: CopyIcon, containerHoverClass: classes.containerHover }; };
|
|
8946
8946
|
var useStyles$h = makeClickToCopyStyles(function () { return { containerHover: { '& svg': { height: 18, width: 18 }, '&:hover': { '& svg': { height: 18, width: 18 } } } }; });
|
|
8947
8947
|
var useClickToCopy = function useClickToCopy(params) { var classes = useStyles$h(); return useClickToCopyCore(Object.assign(Object.assign({}, params), { classes: classes, iconSize: 'inherit' })); };
|
|
8948
|
-
var useStyles$g = makeCopyableTextStyles(commonCodeStyles, { copyableText: { whiteSpace: function whiteSpace(
|
|
8948
|
+
var useStyles$g = makeCopyableTextStyles(commonCodeStyles, { copyableText: { whiteSpace: function whiteSpace(_ref28) { var _whiteSpace = _ref28.whiteSpace; return _whiteSpace; } } });
|
|
8949
8949
|
var CopyableText = function CopyableText(props) { var classes = useStyles$g(props); return /*#__PURE__*/ wn.createElement(CopyableTextCore, Object.assign({}, props, { CodeComponent: Code, LabelComponent: Label, TypographyComponent: Typography, classes: classes, useClickToCopy: useClickToCopy })); };
|
|
8950
8950
|
var makeInputStyles = makeStylesFactory(function (theme) { return { inputContainer: _defineProperty2(_defineProperty2(_defineProperty2({}, theme.breakpoints.down('sm'), { width: '100%', minWidth: 'unset', flex: 1 }), "width", DEFAULT_GRID_COLUMN_WIDTH), "minWidth", DEFAULT_GRID_COLUMN_WIDTH), multilineContainer: { width: '100%', maxWidth: DEFAULT_MAX_ITEM_WIDTH }, readOnlyContainer: { display: '-webkit-box', '-webkit-line-clamp': 2, '-webkit-box-orient': 'vertical', overflow: 'hidden', overflowWrap: 'break-word' }, input: _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({}, "& .".concat(classNamePrefix, "MuiOutlinedInput-notchedOutline"), { border: '1px solid', borderRadius: 4 }), "&.".concat(classNamePrefix, "MuiOutlinedInput-multiline"), { padding: 0 }), "& [class*=\"".concat(classNamePrefix, "MuiOutlinedInput-input\"]"), { '&::placeholder': { opacity: 1 }, padding: theme.spacing(1) }), "&:hover .".concat(classNamePrefix, "MuiOutlinedInput-notchedOutline, &.Mui-focused .").concat(classNamePrefix, "MuiOutlinedInput-notchedOutline"), { borderWidth: 1 }), fullWidth: { width: '100%' }, fileUploadContainer: { alignItems: 'center', display: 'flex', marginBottom: theme.spacing(0.5), gap: theme.spacing(0.5) }, fileUploadHidden: { display: 'none' } }; });
|
|
8951
8951
|
var FILE_UPLOAD_ID = 'file-upload';
|
|
8952
|
-
var FileUpload = function FileUpload(
|
|
8952
|
+
var FileUpload = function FileUpload(_ref29) { var onChange = _ref29.onChange, readOnly = _ref29.readOnly, filename = _ref29.filename, setFilename = _ref29.setFilename, classes = _ref29.classes, Button = _ref29.ButtonComponent, Typography = _ref29.TypographyComponent; var _h14 = h$4(new FileReader()), _h15 = _slicedToArray2(_h14, 1), fileReader = _h15[0]; var fileInputKey = Math.floor(Math.random() * 10000); p$3(function () { var onLoad = function onLoad() { if (typeof fileReader.result === 'string') {
|
|
8953
8953
|
onChange === null || onChange === void 0 ? void 0 : onChange(fileReader.result);
|
|
8954
8954
|
} }; fileReader.addEventListener('load', onLoad); return function () { return fileReader.removeEventListener('load', onLoad); }; }, [fileReader, onChange]); p$3(function () { setFilename(null); }, [readOnly, setFilename]); var onFileUpload = function onFileUpload(event) { var file = event.target.files ? event.target.files[0] : null; var filename = (file === null || file === void 0 ? void 0 : file.name) ? file.name.replace('C:\\fakepath\\', '') : null; setFilename(filename); if (file) {
|
|
8955
8955
|
fileReader.readAsText(file);
|
|
8956
8956
|
} }; var resetFileUpload = function resetFileUpload() { var inputElement = document.querySelector('input[type=file]'); if (inputElement) {
|
|
8957
8957
|
inputElement.value = '';
|
|
8958
8958
|
} }; var uploadedFilename = filename !== null && filename !== void 0 ? filename : 'No file chosen'; var fileInputId = "".concat(FILE_UPLOAD_ID, "-").concat(fileInputKey); return /*#__PURE__*/ wn.createElement("label", { className: classes.fileUploadContainer, htmlFor: fileInputId }, /*#__PURE__*/ wn.createElement("input", { className: classes.fileUploadHidden, id: fileInputId, onChange: onFileUpload, onClick: resetFileUpload, type: "file" }), /*#__PURE__*/ wn.createElement(Button, { compact: true, component: "span", variant: "secondary" }, "Choose file"), /*#__PURE__*/ wn.createElement(Typography, null, uploadedFilename)); };
|
|
8959
|
-
var InputCore = function InputCore(
|
|
8959
|
+
var InputCore = function InputCore(_ref30) { var caption = _ref30.caption, copyable = _ref30.copyable, disabled = _ref30.disabled, error = _ref30.error, fileUpload = _ref30.fileUpload, fullWidth = _ref30.fullWidth, id = _ref30.id, inputProps = _ref30.inputProps, inputRef = _ref30.inputRef, label = _ref30.label, multiline = _ref30.multiline, onBlur = _ref30.onBlur, onChange = _ref30.onChange, onFocus = _ref30.onFocus, onKeyDown = _ref30.onKeyDown, placeholder = _ref30.placeholder, readOnly = _ref30.readOnly, readOnlyConcealed = _ref30.readOnlyConcealed, required = _ref30.required, type = _ref30.type, value = _ref30.value, classes = _ref30.classes, ButtonComponent = _ref30.ButtonComponent, CopyableText = _ref30.CopyableTextComponent, Label = _ref30.LabelComponent, Typography = _ref30.TypographyComponent; var inputId = useShortId(id); var _h16 = h$4(null), _h17 = _slicedToArray2(_h16, 2), filename = _h17[0], setFilename = _h17[1]; var handleOnChange = function handleOnChange(e) { onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value); if (fileUpload && filename) {
|
|
8960
8960
|
setFilename(null);
|
|
8961
8961
|
} }; var showCaption = !!caption && !error; var concealedValue = (value === null || value === void 0 ? void 0 : value.length) ? '•'.repeat(Math.min(25, value.length)) : ''; var visibleValue = readOnlyConcealed ? concealedValue : value; var shouldDisable = disabled && !readOnly; var showCopyableText = readOnly && copyable && !!visibleValue; var showPlainText = readOnly && (!copyable || !visibleValue); return /*#__PURE__*/ wn.createElement("div", { className: C(classes.inputContainer, _defineProperty2(_defineProperty2(_defineProperty2({}, classes.multilineContainer, multiline), classes.readOnlyContainer, readOnly), classes.fullWidth, fullWidth)) }, label && ( /*#__PURE__*/wn.createElement(Label, { variant: "caption", disabled: shouldDisable, htmlFor: inputId, required: required }, label)), showPlainText && /*#__PURE__*/ wn.createElement(Typography, null, visibleValue || '–'), showCopyableText && /*#__PURE__*/ wn.createElement(CopyableText, { textToCopy: value }, visibleValue), !readOnly && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, fileUpload && ( /*#__PURE__*/wn.createElement(FileUpload, { ButtonComponent: ButtonComponent, TypographyComponent: Typography, classes: classes, filename: filename, onChange: onChange, readOnly: shouldDisable, setFilename: setFilename })), /*#__PURE__*/ wn.createElement(OutlinedInput$1, { className: classes.input, disabled: shouldDisable, error: !!error, fullWidth: true, id: inputId, inputProps: inputProps, inputRef: inputRef, multiline: multiline, onBlur: onBlur, onChange: handleOnChange, onFocus: onFocus, onKeyDown: onKeyDown, placeholder: placeholder, required: required, rows: 3, type: type, value: value }), showCaption && ( /*#__PURE__*/wn.createElement(Typography, { disabled: shouldDisable, variant: "caption", color: "secondary" }, caption)), error && ( /*#__PURE__*/wn.createElement(Typography, { variant: "caption", color: "error" }, error))))); };
|
|
8962
|
-
var useStyles$f = makeInputStyles(function (theme) { return { input: _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({ color: theme.styleConfig.inputs.textColor, fontSize: theme.typography.body2.fontSize }, "& .".concat(classNamePrefix, "MuiOutlinedInput-notchedOutline"), { borderColor: theme.styleConfig.inputs.borderColor }), "& [class*=\"".concat(classNamePrefix, "MuiOutlinedInput-input\"]"), { '&::placeholder': { color: theme.styleConfig.inputs.placeholderColor } }), "&.Mui-disabled .".concat(classNamePrefix, "MuiOutlinedInput-notchedOutline"), { borderColor: theme.styleConfig.inputs.borderColor }), "&:hover .".concat(classNamePrefix, "MuiOutlinedInput-notchedOutline, &.Mui-focused .").concat(classNamePrefix, "MuiOutlinedInput-notchedOutline"), { borderColor: theme.styleConfig.inputs.borderColor }), '&.Mui-error', { color: theme.styleConfig.colors.error }) }; });
|
|
8962
|
+
var useStyles$f = makeInputStyles(function (theme) { return { input: _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({ color: theme.styleConfig.inputs.textColor, fontSize: theme.typography.body2.fontSize, borderRadius: theme.styleConfig.inputs.borderRadius, borderColor: theme.styleConfig.inputs.borderColor, backgroundColor: theme.styleConfig.inputs.backgroundColor }, "& .".concat(classNamePrefix, "MuiOutlinedInput-notchedOutline"), { borderRadius: theme.styleConfig.inputs.borderRadius, borderColor: theme.styleConfig.inputs.borderColor }), "& [class*=\"".concat(classNamePrefix, "MuiOutlinedInput-input\"]"), { '&::placeholder': { color: theme.styleConfig.inputs.placeholderColor } }), "&.Mui-disabled .".concat(classNamePrefix, "MuiOutlinedInput-notchedOutline"), { borderColor: theme.styleConfig.inputs.borderColor }), "&:hover .".concat(classNamePrefix, "MuiOutlinedInput-notchedOutline, &.Mui-focused .").concat(classNamePrefix, "MuiOutlinedInput-notchedOutline"), { borderColor: theme.styleConfig.inputs.borderColor }), '&.Mui-error', { color: theme.styleConfig.colors.error }) }; });
|
|
8963
8963
|
var LabelBody1 = function LabelBody1(props) { return /*#__PURE__*/ wn.createElement(Label, Object.assign({ variant: "body1" }, props)); };
|
|
8964
8964
|
var Input$1 = function Input$1(_a) { var labelVariant = _a.labelVariant, props = __rest(_a, ["labelVariant"]); var classes = useStyles$f(props); return /*#__PURE__*/ wn.createElement(InputCore, Object.assign({}, props, { classes: classes, ButtonComponent: Button, CopyableTextComponent: CopyableText, LabelComponent: labelVariant === 'body1' ? LabelBody1 : Label, TypographyComponent: Typography })); };
|
|
8965
8965
|
var AddRounded = {};
|
|
@@ -8971,7 +8971,7 @@ var React$c = _interopRequireWildcard$c(require$$2);
|
|
|
8971
8971
|
var _createSvgIcon$c = _interopRequireDefault$c(requireCreateSvgIcon());
|
|
8972
8972
|
var _default$c = (0, _createSvgIcon$c["default"])(/*#__PURE__*/ React$c.createElement("path", { d: "M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1z" }), 'AddRounded');
|
|
8973
8973
|
default_1$c = AddRounded["default"] = _default$c;
|
|
8974
|
-
var ContentSpacingCore = function ContentSpacingCore(
|
|
8974
|
+
var ContentSpacingCore = function ContentSpacingCore(_ref31) { var children = _ref31.children, gap = _ref31.gap; var theme = useTheme(); return /*#__PURE__*/ wn.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: theme.spacing(gap !== null && gap !== void 0 ? gap : DEFAULT_GAP) } }, children); };
|
|
8975
8975
|
var ADD_NEW_BUTTON_TEXT = 'Add new';
|
|
8976
8976
|
var ListEditorCore = function ListEditorCore(_a) { var title = _a.title, description = _a.description, limit = _a.limit, addModalProps = _a.addModalProps, hideAddButton = _a.hideAddButton, onAdd = _a.onAdd, addButtonText = _a.addButtonText, Button = _a.ButtonComponent, EmbeddedTable = _a.EmbeddedTableComponent, Modal = _a.ModalComponent, Typography = _a.TypographyComponent, embeddedTableProps = __rest(_a, ["title", "description", "limit", "addModalProps", "hideAddButton", "onAdd", "addButtonText", "ButtonComponent", "EmbeddedTableComponent", "ModalComponent", "TypographyComponent"]); if (!addModalProps && !onAdd) {
|
|
8977
8977
|
throw new Error('Either addModalProps or onAdd prop must be provided');
|
|
@@ -8986,9 +8986,9 @@ var getTableCellValue = function getTableCellValue(children) { var value = child
|
|
|
8986
8986
|
} return value; };
|
|
8987
8987
|
var useTableActionStyles = makeStyles(function (theme) { return { tableActions: { display: 'flex', gap: theme.spacing(1), margin: theme.spacing(0, -1.25) } }; });
|
|
8988
8988
|
var TABLE_ACTIONS_HEADER = 'Actions';
|
|
8989
|
-
var TableActionsCore = function TableActionsCore(
|
|
8989
|
+
var TableActionsCore = function TableActionsCore(_ref32) { var warningAction = _ref32.warningAction, action = _ref32.action, customAction = _ref32.customAction, Button = _ref32.ButtonComponent; var classes = useTableActionStyles(); return /*#__PURE__*/ wn.createElement("div", { className: classes.tableActions }, action && ( /*#__PURE__*/wn.createElement(Button, { compact: true, onClick: action.onClick, variant: "text" }, action.text)), warningAction && ( /*#__PURE__*/wn.createElement(Button, { compact: true, onClick: warningAction.onClick, variant: "text", warning: true }, warningAction.text)), customAction); };
|
|
8990
8990
|
var makeEmbeddedTableStyles = makeStylesFactory(function (theme) { return { embeddedTableWithActions: { width: 'calc(100% - 2px)' }, tableCell: { padding: theme.spacing(0.5, 1), minWidth: 80 }, tableActionsCell: { position: 'sticky', right: 0, width: '1%' }, tableHeader: {}, bottomAction: { borderBottom: 'none' } }; });
|
|
8991
|
-
var EmbeddedTableCore = function EmbeddedTableCore(
|
|
8991
|
+
var EmbeddedTableCore = function EmbeddedTableCore(_ref33) { var itemRenderer = _ref33.itemRenderer, items = _ref33.items, rowKeyExtractor = _ref33.rowKeyExtractor, getItemActionProps = _ref33.getItemActionProps, readOnly = _ref33.readOnly, bottomAction = _ref33.bottomAction, initialItemState = _ref33.initialItemState, classes = _ref33.classes, TableActions = _ref33.TableActionsComponent, Typography = _ref33.TypographyComponent; var tableActionClasses = useTableActionStyles(); validateRowKey(items, rowKeyExtractor); var getId = T$2(function (item) { return rowKeyExtractor ? rowKeyExtractor(item) : typeof item === 'string' ? item : item.id; }, [rowKeyExtractor]); var itemState = initialItemState !== null && initialItemState !== void 0 ? initialItemState : {}; var _h18 = h$4(items.reduce(function (acc, item) { return Object.assign(Object.assign({}, acc), _defineProperty2({}, getId(item), itemState)); }, {})), _h19 = _slicedToArray2(_h18, 2), itemsState = _h19[0], setItemsState = _h19[1]; var setItemState = function setItemState(item, state) { var id = getId(item); setItemsState(function (prevState) { return Object.assign(Object.assign({}, prevState), _defineProperty2({}, id, state)); }); }; p$3(function () { setItemsState(items.reduce(function (acc, item) { var _a; return Object.assign(Object.assign({}, acc), _defineProperty2({}, getId(item), (_a = itemsState[getId(item)]) !== null && _a !== void 0 ? _a : itemState)); }, {})); }, [items, getId]); return /*#__PURE__*/ wn.createElement(TableContainer$1, null, /*#__PURE__*/ wn.createElement(MUITable, { className: C(_defineProperty2({}, classes.embeddedTableWithActions, getItemActionProps)) }, /*#__PURE__*/ wn.createElement(TableHead$1, null, /*#__PURE__*/ wn.createElement(MUITableRow, null, itemRenderer.map(function (column) { return /*#__PURE__*/ wn.createElement(MUITableCell, { className: C(classes.tableCell, classes.tableHeader), key: "col-header-".concat(column.title) }, /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, column.title)); }), !readOnly && getItemActionProps && ( /*#__PURE__*/wn.createElement(MUITableCell, { className: C(classes.tableCell, classes.tableActionsCell, classes.tableHeader) }, /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, TABLE_ACTIONS_HEADER))))), /*#__PURE__*/ wn.createElement(TableBody$1, null, items.map(function (item) { var id = getId(item); return /*#__PURE__*/ wn.createElement(MUITableRow, { key: id }, itemRenderer.map(function (column, i) { var children = column.getValue(item, itemsState[id]); var value = getTableCellValue(children); return /*#__PURE__*/ wn.createElement(MUITableCell, { className: classes.tableCell, key: "col-".concat(column.title, "-").concat(i) }, typeof value === 'string' ? /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, value) : value); }), !readOnly && getItemActionProps && ( /*#__PURE__*/wn.createElement(MUITableCell, { className: C(classes.tableCell, classes.tableActionsCell) }, /*#__PURE__*/ wn.createElement(TableActions, Object.assign({}, getItemActionProps(item, function (state) { return state && setItemState(item, state); }, itemsState[id])))))); }), !readOnly && bottomAction && ( /*#__PURE__*/wn.createElement(MUITableRow, null, /*#__PURE__*/ wn.createElement(MUITableCell, { className: C(classes.tableCell, classes.bottomAction), colSpan: getItemActionProps ? itemRenderer.length : itemRenderer.length - 1 }), /*#__PURE__*/ wn.createElement(MUITableCell, { className: C(classes.tableCell, classes.tableActionsCell, classes.bottomAction) }, /*#__PURE__*/ wn.createElement("div", { className: tableActionClasses.tableActions }, bottomAction))))))); };
|
|
8992
8992
|
makeStyles(function (theme) { return { tableActions: { display: 'flex', gap: theme.spacing(1), margin: theme.spacing(0, -1.25) } }; });
|
|
8993
8993
|
var TableActions = function TableActions(props) { return /*#__PURE__*/ wn.createElement(TableActionsCore, Object.assign({}, props, { ButtonComponent: Button })); };
|
|
8994
8994
|
var useStyles$e = makeEmbeddedTableStyles(function (theme) { return { tableHeader: { borderBottomColor: theme.styleConfig.colors.subtle } }; });
|
|
@@ -9033,7 +9033,7 @@ var _default$8 = (0, _createSvgIcon$8["default"])(/*#__PURE__*/ React$8.createEl
|
|
|
9033
9033
|
default_1$8 = RemoveRounded["default"] = _default$8;
|
|
9034
9034
|
var MULTISELECT_VALUE = 'all_values';
|
|
9035
9035
|
var makeSelectStyles = makeStylesFactory(function (theme) { return { checkIcon: {}, menuPaper: { marginTop: theme.spacing(0.5), maxHeight: 280, maxWidth: DEFAULT_GRID_COLUMN_WIDTH }, readOnlyContainer: { display: '-webkit-box', '-webkit-line-clamp': 2, '-webkit-box-orient': 'vertical', overflow: 'hidden' }, select: _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({}, "& .".concat(classNamePrefix, "MuiInputBase-root"), { padding: 0 }), "& .".concat(classNamePrefix, "MuiInputBase-input"), { padding: theme.spacing(1, 3, 1, 1) }), "& .".concat(classNamePrefix, "MuiSelect-icon"), { fontSize: 20, marginRight: theme.spacing(0.5), marginTop: theme.spacing(0.25) }), "& .".concat(classNamePrefix, "MuiSelect-select"), { '&:focus': { backgroundColor: 'transparent' } }), '&:hover', {}), "border", '1px solid'), "borderRadius", 4), selectContainer: _defineProperty2(_defineProperty2(_defineProperty2({}, theme.breakpoints.down('sm'), { width: '100%', minWidth: 'unset', flex: 1 }), "width", DEFAULT_GRID_COLUMN_WIDTH), "minWidth", DEFAULT_GRID_COLUMN_WIDTH), selectContainerOpen: {}, disabled: {}, fullWidth: { width: '100%' } }; });
|
|
9036
|
-
var SelectCore = function SelectCore(
|
|
9036
|
+
var SelectCore = function SelectCore(_ref34) { var caption = _ref34.caption, disabled = _ref34.disabled, fullWidth = _ref34.fullWidth, id = _ref34.id, label = _ref34.label, menuAnchorHorizontal = _ref34.menuAnchorHorizontal, selectItems = _ref34.selectItems, multiple = _ref34.multiple, onChange = _ref34.onChange, placeholder = _ref34.placeholder, readOnly = _ref34.readOnly, required = _ref34.required, value = _ref34.value, classes = _ref34.classes, Label = _ref34.LabelComponent, MenuItem = _ref34.MenuItemComponent, Typography = _ref34.TypographyComponent; var _a; var selectId = useShortId(id); var _h20 = h$4(false), _h21 = _slicedToArray2(_h20, 2), isOpen = _h21[0], setIsOpen = _h21[1]; var totalOptions = selectItems.filter(function (item) { return !item.disabled; }).length; var isMultiSelect = multiple && Array.isArray(value); var hasMoreThanOneChild = totalOptions > 1; var MultiSelectIcon; var canSelectAll; if (isMultiSelect && hasMoreThanOneChild) {
|
|
9037
9037
|
if (value.length > 0) {
|
|
9038
9038
|
MultiSelectIcon = default_1$8;
|
|
9039
9039
|
canSelectAll = false;
|
|
@@ -9060,7 +9060,7 @@ else if (Array.isArray(val) && val.length === totalOptions && hasMoreThanOneChil
|
|
|
9060
9060
|
return 'All';
|
|
9061
9061
|
} return renderText; }; var shouldDisable = disabled && !readOnly; return /*#__PURE__*/ wn.createElement("div", { className: C(classes.selectContainer, _defineProperty2(_defineProperty2(_defineProperty2({}, classes.selectContainerOpen, isOpen), classes.readOnlyContainer, readOnly), classes.fullWidth, fullWidth)) }, label && ( /*#__PURE__*/wn.createElement(Label, { variant: "caption", disabled: shouldDisable, htmlFor: selectId, required: required }, label)), readOnly && /*#__PURE__*/ wn.createElement(Typography, null, (_a = getRenderValue(value)) !== null && _a !== void 0 ? _a : 'None selected'), !readOnly && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(MuiSelect, { IconComponent: default_1$9, MenuProps: { anchorOrigin: { horizontal: menuAnchorHorizontal !== null && menuAnchorHorizontal !== void 0 ? menuAnchorHorizontal : 'center', vertical: 'bottom' }, getContentAnchorEl: null, transformOrigin: { horizontal: 'center', vertical: 'top' }, PopoverClasses: { paper: classes.menuPaper } }, className: C(classes.select, _defineProperty2({}, classes.disabled, disabled)), disableUnderline: true, disabled: shouldDisable, displayEmpty: true, fullWidth: true, id: selectId, multiple: multiple, onChange: handleChange, onClose: function onClose() { return setIsOpen(false); }, onOpen: function onOpen() { return setIsOpen(true); }, renderValue: function renderValue(value) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, _renderValue(value)); }, value: value !== null && value !== void 0 ? value : '' }, isMultiSelect && hasMoreThanOneChild && ( /*#__PURE__*/wn.createElement(MenuItem, { Icon: MultiSelectIcon ? /*#__PURE__*/ wn.createElement(MultiSelectIcon, { className: classes.checkIcon, fontSize: "small" }) : /*#__PURE__*/ wn.createElement("div", null), forceSelected: !!MultiSelectIcon, label: canSelectAll ? 'Select all' : 'Unselect', onClick: canSelectAll ? selectAll : deselectAll, value: MULTISELECT_VALUE })), selectItems.map(function (menuItem) { return /*#__PURE__*/ wn.createElement(MenuItem, Object.assign({ Icon: /*#__PURE__*/ wn.createElement(default_1$b, { className: classes.checkIcon, fontSize: "small" }), key: menuItem.value }, menuItem)); })), caption && ( /*#__PURE__*/wn.createElement(Typography, { variant: "caption", disabled: shouldDisable }, caption))))); };
|
|
9062
9062
|
var useStyles$d = makeStyles(function (theme) { return { container: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' }, icon: { display: 'flex', marginRight: theme.spacing(1), visibility: 'hidden' }, iconVisible: { visibility: 'visible' }, text: { display: 'flex', flexDirection: 'column', textWrap: 'wrap' }, menuItem: { display: 'flex', alignItems: 'flex-start', padding: theme.spacing(1), flex: 1 }, premiumButton: { marginRight: theme.spacing(1) } }; });
|
|
9063
|
-
var MenuItemCore = function MenuItemCore(
|
|
9063
|
+
var MenuItemCore = function MenuItemCore(_ref35) { var Icon = _ref35.Icon, disabled = _ref35.disabled, footer = _ref35.footer, forceSelected = _ref35.forceSelected, label = _ref35.label, onClick = _ref35.onClick, selected = _ref35.selected, subtext = _ref35.subtext, Typography = _ref35.TypographyComponent; var classes = useStyles$d(); return /*#__PURE__*/ wn.createElement("div", { className: classes.container }, /*#__PURE__*/ wn.createElement(MenuItem$2, { button: !!onClick || undefined, className: classes.menuItem, "data-value": label, disableRipple: true, disabled: disabled, onClick: onClick }, Icon && /*#__PURE__*/ wn.createElement("div", { className: C(classes.icon, _defineProperty2({}, classes.iconVisible, selected || forceSelected)) }, Icon), /*#__PURE__*/ wn.createElement("div", { className: classes.text }, /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, label), /*#__PURE__*/ wn.createElement(Typography, { variant: "caption" }, subtext))), footer); };
|
|
9064
9064
|
var MenuItem = function MenuItem(props) { return /*#__PURE__*/ wn.createElement(MenuItemCore, Object.assign({}, props, { TypographyComponent: Typography })); };
|
|
9065
9065
|
var useStyles$c = makeSelectStyles(function (theme) { return { checkIcon: { color: theme.styleConfig.colors.primary }, menuPaper: { backgroundColor: theme.styleConfig.container.backgroundColor, color: theme.styleConfig.colors.primary }, select: _defineProperty2(_defineProperty2({ color: theme.styleConfig.colors.primary }, "& .".concat(classNamePrefix, "MuiSelect-icon"), { color: theme.styleConfig.colors.primary }), "borderColor", theme.styleConfig.inputs.borderColor), selectContainer: { width: function width(props) { return props === null || props === void 0 ? void 0 : props.width; } } }; });
|
|
9066
9066
|
var Select = function Select(props) { var classes = useStyles$c(props); return /*#__PURE__*/ wn.createElement(SelectCore, Object.assign({}, props, { LabelComponent: Label, MenuItemComponent: MenuItem, TypographyComponent: Typography, classes: classes })); };
|
|
@@ -9068,7 +9068,7 @@ var useStyles$b = makeStyles(function (theme) { return { settingsContainer: { bo
|
|
|
9068
9068
|
var DEFAULT_STATE = { editing: false, setEditing: noop };
|
|
9069
9069
|
var SettingsContext = /*#__PURE__*/ F$4(DEFAULT_STATE);
|
|
9070
9070
|
var useSettingsContainer = function useSettingsContainer() { return q$5(SettingsContext); };
|
|
9071
|
-
var SettingsContainer = function SettingsContainer(
|
|
9071
|
+
var SettingsContainer = function SettingsContainer(_ref36) { var _ref36$canEdit = _ref36.canEdit, canEdit = _ref36$canEdit === void 0 ? true : _ref36$canEdit, disableSave = _ref36.disableSave, children = _ref36.children, hasCTA = _ref36.hasCTA, onCancel = _ref36.onCancel, onSave = _ref36.onSave, title = _ref36.title, customCTA = _ref36.customCTA, creating = _ref36.creating, externalEditing = _ref36.editing, externalSetEditing = _ref36.setEditing, modalDescription = _ref36.modalDescription, useBlockNavigation = _ref36.useBlockNavigation; var classes = useStyles$b(); var _h22 = h$4(creating !== null && creating !== void 0 ? creating : false), _h23 = _slicedToArray2(_h22, 2), internalEditing = _h23[0], internalSetEditing = _h23[1]; var _h24 = h$4(false), _h25 = _slicedToArray2(_h24, 2), isSaving = _h25[0], setIsSaving = _h25[1]; var _useToast3 = useToast(), openToast = _useToast3.openToast, closeToast = _useToast3.closeToast; var shouldUseExternalEditing = externalEditing !== undefined && !!externalSetEditing; var editing = shouldUseExternalEditing ? externalEditing : internalEditing; var setEditing = shouldUseExternalEditing ? externalSetEditing : internalSetEditing; var _useBlockNavigation = useBlockNavigation(editing && !isSaving), allowNavigation = _useBlockNavigation.allowNavigation, blocked = _useBlockNavigation.blocked, cancelNavigation = _useBlockNavigation.cancelNavigation; var edit = function edit() { setEditing(true); }; var cancel = function cancel() { onCancel === null || onCancel === void 0 ? void 0 : onCancel(); closeToast(); setEditing(false); }; var save = function save() { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee6() { var message; return _regeneratorRuntime().wrap(function _callee6$(_context6) { while (1)
|
|
9072
9072
|
switch (_context6.prev = _context6.next) {
|
|
9073
9073
|
case 0:
|
|
9074
9074
|
setIsSaving(true);
|
|
@@ -9095,20 +9095,20 @@ var SettingsContainer = function SettingsContainer(_ref35) { var _ref35$canEdit
|
|
|
9095
9095
|
} }, _callee6, null, [[1, 7, 11, 14]]); })); }; var modalState = useModalState(save); if (!modalDescription) {
|
|
9096
9096
|
modalDescription = 'Double check before saving your changes.';
|
|
9097
9097
|
} return /*#__PURE__*/ wn.createElement(SettingsContext.Provider, { value: { editing: editing, setEditing: setEditing } }, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, modalState, { confirmButtonText: "Save changes", description: modalDescription, title: "Save changes?", warning: true })), /*#__PURE__*/ wn.createElement(Modal, { isOpen: blocked, close: cancelNavigation, confirm: function confirm() { allowNavigation(); return Promise.resolve(); }, confirmButtonText: "Navigate without saving", cancelButtonText: "Keep editing", description: 'Your changes are unsaved – are you sure you want to navigate away?', title: "Save changes?", warning: true }), /*#__PURE__*/ wn.createElement("div", { className: classes.settingsContainer }, /*#__PURE__*/ wn.createElement("div", { className: classes.titleContainer }, /*#__PURE__*/ wn.createElement(Typography, { variant: "h3" }, title), /*#__PURE__*/ wn.createElement("div", { className: classes.actions }, hasCTA && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, editing ? ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Button, { compact: true, onClick: cancel, variant: "ghost" }, "Cancel"), /*#__PURE__*/ wn.createElement(Button, { compact: true, disabled: disableSave, onClick: modalState.open }, "Save"))) : ( /*#__PURE__*/wn.createElement(wn.Fragment, null, customCTA ? customCTA : canEdit && ( /*#__PURE__*/wn.createElement(Button, { compact: true, onClick: edit, variant: "ghost" }, "Edit")))))))), /*#__PURE__*/ wn.createElement("div", { className: classes.content }, children))); };
|
|
9098
|
-
var SettingsList = function SettingsList(
|
|
9099
|
-
var SettingsListItem = function SettingsListItem(
|
|
9098
|
+
var SettingsList = function SettingsList(_ref37) { var children = _ref37.children; return /*#__PURE__*/ wn.createElement("dl", { style: { margin: 0 } }, children); };
|
|
9099
|
+
var SettingsListItem = function SettingsListItem(_ref38) { var children = _ref38.children, title = _ref38.title; return /*#__PURE__*/ wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Typography, { variant: "body2", color: "secondary", component: "dt" }, title), /*#__PURE__*/ wn.createElement("dd", { style: { margin: '0 0 8px' } }, children)); };
|
|
9100
9100
|
var makeInfoIconStyles = makeStylesFactory(function () { return { infoIconContainer: { width: 'fit-content' }, infoIcon: {} }; });
|
|
9101
|
-
var InfoIconCore = function InfoIconCore(
|
|
9101
|
+
var InfoIconCore = function InfoIconCore(_ref39) { var tooltipText = _ref39.tooltipText, classes = _ref39.classes, Tooltip = _ref39.TooltipComponent; return /*#__PURE__*/ wn.createElement("div", { className: classes.infoIconContainer }, /*#__PURE__*/ wn.createElement(Tooltip, { text: tooltipText }, /*#__PURE__*/ wn.createElement(InfoOutlined, { className: classes.infoIcon }))); };
|
|
9102
9102
|
var makeTooltipStyles = makeStylesFactory(function (theme) { return { targetWrapper: { display: 'flex', width: 'fit-content' }, tooltip: _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({}, "& .".concat(classNamePrefix, "MuiTooltip-tooltip"), { maxWidth: 240, padding: theme.spacing(1), borderRadius: 4 }), "& .".concat(classNamePrefix, "MuiTooltip-tooltipPlacementRight"), { margin: theme.spacing(0, 1) }), "& .".concat(classNamePrefix, "MuiTooltip-tooltipPlacementLeft"), { margin: theme.spacing(0, 1) }), "zIndex", 2000) }; });
|
|
9103
|
-
var TooltipCore = function TooltipCore(
|
|
9103
|
+
var TooltipCore = function TooltipCore(_ref40) { var text = _ref40.text, children = _ref40.children, disabled = _ref40.disabled, _ref40$placement = _ref40.placement, placement = _ref40$placement === void 0 ? 'right' : _ref40$placement, classes = _ref40.classes, Typography = _ref40.TypographyComponent; if (disabled) {
|
|
9104
9104
|
return children;
|
|
9105
9105
|
} return /*#__PURE__*/ wn.createElement(Tooltip$2, { PopperProps: { className: classes.tooltip }, interactive: true, placement: placement, title: /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, text) }, /*#__PURE__*/ wn.createElement("span", { className: classes.targetWrapper }, children)); };
|
|
9106
9106
|
var useStyles$a = makeTooltipStyles(function (theme) { return { tooltip: _defineProperty2({}, "& .".concat(classNamePrefix, "MuiTooltip-tooltip"), { '& p': { color: theme.styleConfig.buttons.primary.textColor }, backgroundColor: theme.styleConfig.buttons.primary.backgroundColor }) }; });
|
|
9107
9107
|
var Tooltip = function Tooltip(props) { var classes = useStyles$a(); return /*#__PURE__*/ wn.createElement(TooltipCore, Object.assign({}, props, { TypographyComponent: Typography, classes: classes })); };
|
|
9108
9108
|
var useStyles$9 = makeInfoIconStyles(function (theme) { return { infoIconContainer: { color: theme.styleConfig.colors.primary }, infoIcon: { width: 18, height: 18 } }; });
|
|
9109
9109
|
var InfoIcon = function InfoIcon(props) { var classes = useStyles$9(); return /*#__PURE__*/ wn.createElement(InfoIconCore, Object.assign({}, props, { classes: classes, TooltipComponent: Tooltip })); };
|
|
9110
|
-
var SettingsSection = function SettingsSection(
|
|
9111
|
-
var useFormState = function useFormState(
|
|
9110
|
+
var SettingsSection = function SettingsSection(_ref41) { var children = _ref41.children, title = _ref41.title, tooltipText = _ref41.tooltipText; return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 0.5 }, /*#__PURE__*/ wn.createElement(FlexBox, { alignItems: "center", flexDirection: "row", gap: 0.5 }, /*#__PURE__*/ wn.createElement(Typography, { variant: "h4" }, title), tooltipText && /*#__PURE__*/ wn.createElement(InfoIcon, { tooltipText: tooltipText })), children); };
|
|
9111
|
+
var useFormState = function useFormState(_ref42) { var remoteState = _ref42.remoteState; var _h26 = h$4(remoteState), _h27 = _slicedToArray2(_h26, 2), localState = _h27[0], setLocalState = _h27[1]; var resetLocalState = T$2(function () { setLocalState(remoteState); }, [remoteState]); var _h28 = h$4(false), _h29 = _slicedToArray2(_h28, 2), editing = _h29[0], setEditing = _h29[1]; var handleSetEditing = T$2(function (newEditing) { if (newEditing) {
|
|
9112
9112
|
resetLocalState();
|
|
9113
9113
|
} setEditing(newEditing); }, [resetLocalState]); return { localState: localState, setLocalState: setLocalState, editing: editing, handleSetEditing: handleSetEditing }; };
|
|
9114
9114
|
var useStateSliceSetter = function useStateSliceSetter(setState, key) { return T$2(function (value) { setState(function (state) { return Object.assign(Object.assign({}, state), _defineProperty2({}, key, value)); }); }, [key, setState]); };
|
|
@@ -9123,13 +9123,13 @@ else {
|
|
|
9123
9123
|
return { idp: oidcIdpMap[_idpKey], type: type };
|
|
9124
9124
|
} };
|
|
9125
9125
|
var getIdpAndConnectionInfo = function getIdpAndConnectionInfo(connection) { return Object.assign(Object.assign({}, getIdpInfo(connection.identity_provider, connection.connectionType)), { connection: connection }); };
|
|
9126
|
-
var AppDetails = function AppDetails(
|
|
9126
|
+
var AppDetails = function AppDetails(_ref43) { var connectionProp = _ref43.connection; var _getIdpAndConnectionI = getIdpAndConnectionInfo(connectionProp), connection = _getIdpAndConnectionI.connection, idp = _getIdpAndConnectionI.idp, type = _getIdpAndConnectionI.type; return /*#__PURE__*/ wn.createElement(wn.Fragment, null, type === 'saml' && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(SettingsListItem, { title: idp.acsUrlLabel }, /*#__PURE__*/ wn.createElement(CopyableText, null, connection.acs_url)), /*#__PURE__*/ wn.createElement(SettingsListItem, { title: idp.audienceUriLabel }, /*#__PURE__*/ wn.createElement(CopyableText, null, connection.audience_uri)))), type === 'oidc' && ( /*#__PURE__*/wn.createElement(SettingsListItem, { title: idp.redirectUrlLabel }, /*#__PURE__*/ wn.createElement(CopyableText, null, connection.redirect_url))), type === 'saml' && ( /*#__PURE__*/wn.createElement(SettingsListItem, { title: idp.nameIdFormatLabel }, /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, idp.nameIdFormatValue)))); };
|
|
9127
9127
|
var collator = Intl.Collator();
|
|
9128
9128
|
var nameKeys = new Set(['full_name', 'first_name', 'last_name']);
|
|
9129
9129
|
var requiredKeys = new Set([].concat(_toConsumableArray2(nameKeys), ['email']));
|
|
9130
|
-
var attributeMappingItemRenderer = [{ title: 'Key', getValue: function getValue(
|
|
9131
|
-
var attributeMappingKeyExtractor = function attributeMappingKeyExtractor(
|
|
9132
|
-
var AttributeMappingTable = function AttributeMappingTable(
|
|
9130
|
+
var attributeMappingItemRenderer = [{ title: 'Key', getValue: function getValue(_ref44) { var key = _ref44.key; var isRequiredKey = requiredKeys.has(key); var label = key; return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, label, isRequiredKey && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, ' ', /*#__PURE__*/ wn.createElement(Typography, { component: "span", color: "error" }, "*")))); } }, { title: 'Value', getValue: function getValue(_ref45) { var value = _ref45.value; return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, value); } }];
|
|
9131
|
+
var attributeMappingKeyExtractor = function attributeMappingKeyExtractor(_ref46) { var key = _ref46.key; return key; };
|
|
9132
|
+
var AttributeMappingTable = function AttributeMappingTable(_ref47) { var editing = _ref47.editing, localState = _ref47.localState, remoteState = _ref47.remoteState, setLocalState = _ref47.setLocalState; var _ref48 = editing ? localState : remoteState, attributeMapping = _ref48.attributeMapping; var attributeMappingItems = F$3(function () { return Object.entries(attributeMapping).map(function (_ref49) { var _ref50 = _slicedToArray2(_ref49, 2), key = _ref50[0], value = _ref50[1]; return { key: key, value: value }; }).sort(function (a, b) { return collator.compare(a.key, b.key); }); }, [attributeMapping]); var _h30 = h$4([['', '']]), _h31 = _slicedToArray2(_h30, 2), pendingAttributeMapping = _h31[0], setPendingAttributeMapping = _h31[1]; var _h32 = h$4('key'), _h33 = _slicedToArray2(_h32, 2), editMode = _h33[0], setEditMode = _h33[1]; var _h34 = h$4(''), _h35 = _slicedToArray2(_h34, 2), editedAttributeMappingKey = _h35[0], setEditedAttributeMappingKey = _h35[1]; var _h36 = h$4(''), _h37 = _slicedToArray2(_h36, 2), editedAttributeMappingValue = _h37[0], setEditedAttributeMappingValue = _h37[1]; var _h38 = h$4(''), _h39 = _slicedToArray2(_h38, 2), editedAttributeMappingLastNameValue = _h39[0], setEditedAttributeMappingLastNameValue = _h39[1]; var editAttributeMappingModalProps = useModalState(function () { var editedMapping = editMode === 'name' && editedAttributeMappingKey === 'first_name' ? { first_name: editedAttributeMappingValue, last_name: editedAttributeMappingLastNameValue } : _defineProperty2({}, editedAttributeMappingKey, editedAttributeMappingValue); setLocalState(function (state) { var mergedMapping = Object.assign(Object.assign({}, state.attributeMapping), editedMapping); if (editMode === 'name') {
|
|
9133
9133
|
if (editedAttributeMappingKey === 'full_name') {
|
|
9134
9134
|
delete mergedMapping.first_name;
|
|
9135
9135
|
delete mergedMapping.last_name;
|
|
@@ -9150,17 +9150,17 @@ else {
|
|
|
9150
9150
|
setEditedAttributeMappingValue((_c = attributeMapping[key]) !== null && _c !== void 0 ? _c : '');
|
|
9151
9151
|
} editAttributeMappingModalProps.open(); }, [attributeMapping, editAttributeMappingModalProps, hasFullNameKey]); var deleteAttributeMapping = T$2(function (key) { setLocalState(function (state) { var _a = state.attributeMapping, _b = key; _a[_b]; var rest = __rest(_a, [_typeof2(_b) === "symbol" ? _b : _b + ""]); return Object.assign(Object.assign({}, state), { attributeMapping: rest }); }); }, [setLocalState]); var deleteAttributeMappingModalProps = useModalState(function () { if (pendingDeleteAttributeMappingKey) {
|
|
9152
9152
|
deleteAttributeMapping(pendingDeleteAttributeMappingKey);
|
|
9153
|
-
} }); var
|
|
9153
|
+
} }); var _h40 = h$4(), _h41 = _slicedToArray2(_h40, 2), pendingDeleteAttributeMappingKey = _h41[0], setPendingDeleteAttributeMappingKey = _h41[1]; var handleRequestDeleteAttributeMapping = T$2(function (key) { if (key !== 'groups') {
|
|
9154
9154
|
deleteAttributeMapping(key);
|
|
9155
9155
|
}
|
|
9156
9156
|
else {
|
|
9157
9157
|
setPendingDeleteAttributeMappingKey(key);
|
|
9158
9158
|
deleteAttributeMappingModalProps.open();
|
|
9159
|
-
} }, [deleteAttributeMapping, deleteAttributeMappingModalProps]); return /*#__PURE__*/ wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, editAttributeMappingModalProps, { title: "Edit custom mapping", confirmButtonText: "Save" }), /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 1 }, editMode === 'name' ? ( /*#__PURE__*/wn.createElement(Select, { selectItems: [{ label: 'Full Name', value: 'full_name' }, { label: 'First Name, Last Name', value: 'first_last_name' }], fullWidth: true, caption: "You can change the format of the key.", value: editedAttributeMappingKey === 'full_name' ? 'full_name' : 'first_last_name', onChange: function onChange(value) { setEditedAttributeMappingKey(value === 'full_name' ? 'full_name' : 'first_name'); } })) : ( /*#__PURE__*/wn.createElement(Input$1, { label: "Key", fullWidth: true, value: editedAttributeMappingKey, onChange: setEditedAttributeMappingKey })), editMode === 'name' && (editedAttributeMappingKey === 'first_name' || editedAttributeMappingKey === 'last_name') ? ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(FlexBox, { gap: 2 }, /*#__PURE__*/ wn.createElement(Input$1, { label: "First Name", fullWidth: true, value: editedAttributeMappingValue, onChange: setEditedAttributeMappingValue }), /*#__PURE__*/ wn.createElement(Input$1, { label: "Last Name", fullWidth: true, value: editedAttributeMappingLastNameValue, onChange: setEditedAttributeMappingLastNameValue })))) : ( /*#__PURE__*/wn.createElement(Input$1, { label: "Value", fullWidth: true, value: editedAttributeMappingValue, onChange: setEditedAttributeMappingValue })))), /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, deleteAttributeMappingModalProps, { title: "Delete mapping?", confirmButtonText: "Delete", warning: true }), /*#__PURE__*/ wn.createElement(Typography, null, "Deleting the Groups attribute mapping will also disable any Group Role assignments you have added above. They will not be deleted, but you must add a Groups mapping to make edits.")), /*#__PURE__*/ wn.createElement(ListEditor, { items: attributeMappingItems, itemRenderer: attributeMappingItemRenderer, rowKeyExtractor: attributeMappingKeyExtractor, addModalProps: { confirm: function confirm() { setLocalState(function (state) { return Object.assign(Object.assign({}, state), { attributeMapping: Object.assign(Object.assign({}, state.attributeMapping), Object.fromEntries(pendingAttributeMapping.filter(function (
|
|
9159
|
+
} }, [deleteAttributeMapping, deleteAttributeMappingModalProps]); return /*#__PURE__*/ wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, editAttributeMappingModalProps, { title: "Edit custom mapping", confirmButtonText: "Save" }), /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 1 }, editMode === 'name' ? ( /*#__PURE__*/wn.createElement(Select, { selectItems: [{ label: 'Full Name', value: 'full_name' }, { label: 'First Name, Last Name', value: 'first_last_name' }], fullWidth: true, caption: "You can change the format of the key.", value: editedAttributeMappingKey === 'full_name' ? 'full_name' : 'first_last_name', onChange: function onChange(value) { setEditedAttributeMappingKey(value === 'full_name' ? 'full_name' : 'first_name'); } })) : ( /*#__PURE__*/wn.createElement(Input$1, { label: "Key", fullWidth: true, value: editedAttributeMappingKey, onChange: setEditedAttributeMappingKey })), editMode === 'name' && (editedAttributeMappingKey === 'first_name' || editedAttributeMappingKey === 'last_name') ? ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(FlexBox, { gap: 2 }, /*#__PURE__*/ wn.createElement(Input$1, { label: "First Name", fullWidth: true, value: editedAttributeMappingValue, onChange: setEditedAttributeMappingValue }), /*#__PURE__*/ wn.createElement(Input$1, { label: "Last Name", fullWidth: true, value: editedAttributeMappingLastNameValue, onChange: setEditedAttributeMappingLastNameValue })))) : ( /*#__PURE__*/wn.createElement(Input$1, { label: "Value", fullWidth: true, value: editedAttributeMappingValue, onChange: setEditedAttributeMappingValue })))), /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, deleteAttributeMappingModalProps, { title: "Delete mapping?", confirmButtonText: "Delete", warning: true }), /*#__PURE__*/ wn.createElement(Typography, null, "Deleting the Groups attribute mapping will also disable any Group Role assignments you have added above. They will not be deleted, but you must add a Groups mapping to make edits.")), /*#__PURE__*/ wn.createElement(ListEditor, { items: attributeMappingItems, itemRenderer: attributeMappingItemRenderer, rowKeyExtractor: attributeMappingKeyExtractor, addModalProps: { confirm: function confirm() { setLocalState(function (state) { return Object.assign(Object.assign({}, state), { attributeMapping: Object.assign(Object.assign({}, state.attributeMapping), Object.fromEntries(pendingAttributeMapping.filter(function (_ref52) { var _ref53 = _slicedToArray2(_ref52, 2), key = _ref53[0], value = _ref53[1]; return key && value && !state.attributeMapping[key]; }))) }); }); return Promise.resolve(); }, title: 'Add custom mapping', content: ( /*#__PURE__*/wn.createElement(FlexBox, { flexDirection: "column", gap: 1 }, pendingAttributeMapping.map(function (_ref54, i) { var _ref55 = _slicedToArray2(_ref54, 2), key = _ref55[0], value = _ref55[1]; return /*#__PURE__*/ wn.createElement(FlexBox, { gap: 1, key: i }, /*#__PURE__*/ wn.createElement(Input$1, { label: "Key", fullWidth: true, value: key, onChange: function onChange(value) { setPendingAttributeMapping(function (state) { return state.map(function (item, index) { return index === i ? [value, item[1]] : item; }); }); } }), /*#__PURE__*/ wn.createElement(Input$1, { label: "Value", fullWidth: true, value: value, onChange: function onChange(value) { setPendingAttributeMapping(function (state) { return state.map(function (item, index) { return index === i ? [item[0], value] : item; }); }); } })); }), /*#__PURE__*/ wn.createElement(Button, { variant: "text", startIcon: /*#__PURE__*/ wn.createElement(Add$1, null), fullWidth: true, onClick: function onClick() { setPendingAttributeMapping(function (state) { return [].concat(_toConsumableArray2(state), [['', '']]); }); } }, "Add custom mapping"))) }, hideAddButton: !editing, getItemActionProps: editing ? function (item) { return { action: item.key === 'email' && item.value === 'NameID' ? undefined : { text: 'Edit', onClick: function onClick() { handleEditAttributeMapping(item.key); } }, warningAction: item.key === 'email' || nameKeys.has(item.key) && !(hasFirstAndLastNameKeys && hasFullNameKey) ? undefined : { text: 'Delete', onClick: function onClick() { handleRequestDeleteAttributeMapping(item.key); } } }; } : undefined })); };
|
|
9160
9160
|
var makeSamlOption = function makeSamlOption(idpName) { return { idp: samlIdpMap[idpName], idpName: idpName, type: 'saml' }; };
|
|
9161
9161
|
var makeOidcOption = function makeOidcOption(idpName) { return { idp: oidcIdpMap[idpName], idpName: idpName, type: 'oidc' }; };
|
|
9162
9162
|
var idpOptions = { 'saml:google-workspace': makeSamlOption('google-workspace'), 'saml:okta': makeSamlOption('okta'), 'oidc:okta': makeOidcOption('okta'), 'saml:microsoft-entra': makeSamlOption('microsoft-entra'), 'oidc:microsoft-entra': makeOidcOption('microsoft-entra'), 'saml:generic': makeSamlOption('generic'), 'oidc:generic': makeOidcOption('generic') };
|
|
9163
|
-
var idpSelectItems = Object.entries(idpOptions).map(function (
|
|
9163
|
+
var idpSelectItems = Object.entries(idpOptions).map(function (_ref56) { var _ref57 = _slicedToArray2(_ref56, 2), idpKey = _ref57[0], idp = _ref57[1].idp; return { label: idp.displayName, value: idpKey }; });
|
|
9164
9164
|
var samlIdpSelectItems = Object.values(idpOptions).filter(function (item) { return item.type === 'saml'; }).map(function (item) { return { label: item.idp.displayName, value: item.idpName }; });
|
|
9165
9165
|
var oidcIdpSelectItems = Object.values(idpOptions).filter(function (item) { return item.type === 'oidc'; }).map(function (item) { return { label: item.idp.displayName, value: item.idpName }; });
|
|
9166
9166
|
var useBeforeUnloadNavigationBlock = function useBeforeUnloadNavigationBlock(shouldWarn) { p$3(function () { if (shouldWarn) {
|
|
@@ -9195,18 +9195,18 @@ var routerReducer = function routerReducer(state, action) { switch (action.type)
|
|
|
9195
9195
|
case 'cancelNavigation': return Object.assign(Object.assign({}, state), { pendingRoute: undefined });
|
|
9196
9196
|
default: return state;
|
|
9197
9197
|
} };
|
|
9198
|
-
var createRouter = function createRouter() { var initialState = { blockersActive: new Set() }; var StateContext = /*#__PURE__*/ wn.createContext({}); var ControllerContext = /*#__PURE__*/ wn.createContext({ navigate: noop, useBlockNavigation: function useBlockNavigation() { return { blocked: false, allowNavigation: noop, cancelNavigation: noop }; } }); var useRouterState = function useRouterState() { return wn.useContext(StateContext); }; var useRouterController = function useRouterController() { return wn.useContext(ControllerContext); }; var Router = function Router(
|
|
9198
|
+
var createRouter = function createRouter() { var initialState = { blockersActive: new Set() }; var StateContext = /*#__PURE__*/ wn.createContext({}); var ControllerContext = /*#__PURE__*/ wn.createContext({ navigate: noop, useBlockNavigation: function useBlockNavigation() { return { blocked: false, allowNavigation: noop, cancelNavigation: noop }; } }); var useRouterState = function useRouterState() { return wn.useContext(StateContext); }; var useRouterController = function useRouterController() { return wn.useContext(ControllerContext); }; var Router = function Router(_ref58) { var routeMap = _ref58.routeMap; var _useRouterState = useRouterState(), currentRoute = _useRouterState.currentRoute; var ChildComponent = routeMap[currentRoute.screen]; var childComponentProps = currentRoute.params; return ChildComponent ? /*#__PURE__*/ wn.createElement(ChildComponent, Object.assign({}, childComponentProps)) : null; }; var RouterProvider = function RouterProvider(_ref59) { var children = _ref59.children, initialRoute = _ref59.initialRoute; var _wn$useReducer = wn.useReducer(routerReducer, Object.assign(Object.assign({}, initialState), { currentRoute: initialRoute })), _wn$useReducer2 = _slicedToArray2(_wn$useReducer, 2), state = _wn$useReducer2[0], dispatch = _wn$useReducer2[1]; var navigate = T$2(function (destination) { dispatch({ type: 'navigate', payload: destination }); }, []); var routerState = F$3(function () { return { currentRoute: state.currentRoute }; }, [state.currentRoute]); var isNavigationBlocked = !!state.pendingRoute; var useBlockNavigation = T$2(function (enableBlock) { var callback = F$3(function () { return typeof enableBlock === 'function' ? enableBlock : function () { return enableBlock; }; }, [enableBlock]); p$3(function () { var shouldEnableBlock = callback(); if (shouldEnableBlock) {
|
|
9199
9199
|
dispatch({ type: 'addBlocker', payload: { callback: callback } });
|
|
9200
9200
|
return function () { dispatch({ type: 'removeBlocker', payload: { callback: callback } }); };
|
|
9201
9201
|
} }, [callback, enableBlock]); return { blocked: isNavigationBlocked, allowNavigation: function allowNavigation() { dispatch({ type: 'approveNavigation' }); }, cancelNavigation: function cancelNavigation() { dispatch({ type: 'cancelNavigation' }); } }; }, [isNavigationBlocked]); useBeforeUnloadNavigationBlock(state.blockersActive.size > 0); var controller = F$3(function () { return { navigate: navigate, useBlockNavigation: useBlockNavigation }; }, [navigate, useBlockNavigation]); return /*#__PURE__*/ wn.createElement(ControllerContext.Provider, { value: controller }, /*#__PURE__*/ wn.createElement(StateContext.Provider, { value: routerState }, children)); }; return { RouterProvider: RouterProvider, Router: Router, useRouterController: useRouterController, useRouterState: useRouterState }; };
|
|
9202
9202
|
var _createRouter = createRouter(), SsoRouterProvider = _createRouter.RouterProvider, SsoRouter = _createRouter.Router, useSsoRouterController = _createRouter.useRouterController;
|
|
9203
9203
|
var certItemRenderer = [{ title: 'Issuer', getValue: function getValue(item) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, 'issuer' in item ? item.issuer : 'Pending'); } }, { title: 'Created', getValue: function getValue(item) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, 'created_at' in item ? new Date(item.created_at).toLocaleString() : 'Pending'); } }, { title: 'Expires', getValue: function getValue(item) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, 'expires_at' in item ? new Date(item.expires_at).toLocaleString() : 'Pending'); } }];
|
|
9204
9204
|
var certKeyExtractor = function certKeyExtractor(item) { return 'certificate_id' in item ? item.certificate_id : 'new-certificate-id-pending'; };
|
|
9205
|
-
var CertificateTable = function CertificateTable(
|
|
9205
|
+
var CertificateTable = function CertificateTable(_ref51) { var editing = _ref51.editing, localState = _ref51.localState, manualConfiguration = _ref51.manualConfiguration, remoteState = _ref51.remoteState, setLocalState = _ref51.setLocalState; var _a, _b, _c; var certificates = F$3(function () { if (!remoteState) {
|
|
9206
9206
|
return undefined;
|
|
9207
9207
|
} var remoteCertificates = remoteState; if (!editing) {
|
|
9208
9208
|
return remoteCertificates;
|
|
9209
|
-
} return [].concat(_toConsumableArray2(remoteCertificates.filter(function (cert) { var _a; return !((_a = localState.deletedCertificateIds) === null || _a === void 0 ? void 0 : _a.includes(cert.certificate_id)); })), _toConsumableArray2(localState.certificate ? [{ certificate: localState.certificate, isPending: true }] : [])); }, [editing, localState, remoteState]); var viewCertModalProps = useModalState(); var
|
|
9209
|
+
} return [].concat(_toConsumableArray2(remoteCertificates.filter(function (cert) { var _a; return !((_a = localState.deletedCertificateIds) === null || _a === void 0 ? void 0 : _a.includes(cert.certificate_id)); })), _toConsumableArray2(localState.certificate ? [{ certificate: localState.certificate, isPending: true }] : [])); }, [editing, localState, remoteState]); var viewCertModalProps = useModalState(); var _h42 = h$4(), _h43 = _slicedToArray2(_h42, 2), viewCertificateContents = _h43[0], setViewCertificateContents = _h43[1]; var persistPendingCertificate = useStateSliceSetter(setLocalState, 'certificate'); var addCertModalProps = useModalState(function () { persistPendingCertificate(pendingCert); }); var _h44 = h$4(''), _h45 = _slicedToArray2(_h44, 2), pendingCert = _h45[0], setPendingCert = _h45[1]; var remoteCertificateCount = (_a = remoteState === null || remoteState === void 0 ? void 0 : remoteState.length) !== null && _a !== void 0 ? _a : 0; var remoteCertificatePendingDeletionCount = (_c = (_b = localState.deletedCertificateIds) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0; var minimumRequiredCertificates = 1; var maximumAllowedCertificates = 5; var canDeleteCertificates = remoteCertificateCount - remoteCertificatePendingDeletionCount > minimumRequiredCertificates; var canAddCertificate = editing && manualConfiguration && !localState.certificate && remoteCertificateCount - remoteCertificatePendingDeletionCount < maximumAllowedCertificates; return /*#__PURE__*/ wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, viewCertModalProps, { title: "View x509 Certificate", confirmButtonText: "Close", noCancelButton: true }), /*#__PURE__*/ wn.createElement(CopyableText, { whiteSpace: "pre-wrap" }, viewCertificateContents)), /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, addCertModalProps, { title: "Add Certificate" }), /*#__PURE__*/ wn.createElement(Input$1, { label: "x509 Certificate", multiline: true, onChange: function onChange(value) { setPendingCert(value); }, placeholder: "Enter certificate", value: pendingCert })), /*#__PURE__*/ wn.createElement(ListEditor, { items: certificates !== null && certificates !== void 0 ? certificates : [], itemRenderer: certItemRenderer, rowKeyExtractor: certKeyExtractor, onAdd: function onAdd() { setPendingCert(''); addCertModalProps.open(); }, getItemActionProps: function getItemActionProps(item) { return { action: { text: item.isPending ? 'Edit' : 'View', onClick: function onClick() { if (item.isPending) {
|
|
9210
9210
|
setPendingCert(item.certificate);
|
|
9211
9211
|
addCertModalProps.open();
|
|
9212
9212
|
}
|
|
@@ -9219,8 +9219,8 @@ var CertificateTable = function CertificateTable(_ref50) { var editing = _ref50.
|
|
|
9219
9219
|
else if ('certificate_id' in item) {
|
|
9220
9220
|
setLocalState(function (state) { var _a; return Object.assign(Object.assign({}, state), { deletedCertificateIds: [].concat(_toConsumableArray2((_a = state.deletedCertificateIds) !== null && _a !== void 0 ? _a : []), [item.certificate_id]) }); });
|
|
9221
9221
|
} } } : undefined }; }, hideAddButton: !canAddCertificate })); };
|
|
9222
|
-
var DetailsSectionBody = function DetailsSectionBody(
|
|
9223
|
-
var DetailsSection = function DetailsSection(
|
|
9222
|
+
var DetailsSectionBody = function DetailsSectionBody(_ref60) { var taggedConnection = _ref60.connection, localState = _ref60.localState, remoteState = _ref60.remoteState, setLocalState = _ref60.setLocalState; var _a, _b; var _useSettingsContainer = useSettingsContainer(), editing = _useSettingsContainer.editing; var _ref61 = editing ? localState : remoteState, displayName = _ref61.displayName, identityProvider = _ref61.identityProvider; var handleDisplayNameChange = useStateSliceSetter(setLocalState, 'displayName'); var handleIdentityProviderChange = useStateSliceSetter(setLocalState, 'identityProvider'); var handleMetadataUrlChange = useStateSliceSetter(setLocalState, 'metadataUrl'); var handleSsoUrlChange = useStateSliceSetter(setLocalState, 'ssoUrl'); var handleEntityIdChange = useStateSliceSetter(setLocalState, 'entityId'); var handleClientIdChange = useStateSliceSetter(setLocalState, 'clientId'); var handleClientSecretChange = useStateSliceSetter(setLocalState, 'clientSecret'); var handleIssuerChange = useStateSliceSetter(setLocalState, 'issuer'); var handleIssuerDerivedValueChange = useStateSliceSetter(setLocalState, 'issuerDerivedValue'); var handleAuthorizationUrlChange = useStateSliceSetter(setLocalState, 'authorizationUrl'); var handleTokenUrlChange = useStateSliceSetter(setLocalState, 'tokenUrl'); var handleUserInfoUrlChange = useStateSliceSetter(setLocalState, 'userInfoUrl'); var handleJwksUrlChange = useStateSliceSetter(setLocalState, 'jwksUrl'); var _getIdpAndConnectionI2 = getIdpAndConnectionInfo(taggedConnection), connection = _getIdpAndConnectionI2.connection, idp = _getIdpAndConnectionI2.idp, type = _getIdpAndConnectionI2.type; var idpRequiresManualConfig = type === 'saml' && idp.metadataUrlLabel === false; var manualConfiguration = localState.manualConfiguration || idpRequiresManualConfig; var setManualConfiguration = useStateSliceSetter(setLocalState, 'manualConfiguration'); return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, /*#__PURE__*/ wn.createElement(SettingsSection, { title: "Display Name" }, editing ? ( /*#__PURE__*/wn.createElement(Input$1, { value: displayName, onChange: handleDisplayNameChange })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, displayName))), /*#__PURE__*/ wn.createElement(SettingsSection, { title: "IdP" }, editing ? ( /*#__PURE__*/wn.createElement(Select, { width: 360, placeholder: "Select", selectItems: type === 'saml' ? samlIdpSelectItems : oidcIdpSelectItems, value: identityProvider, onChange: handleIdentityProviderChange })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, idp.displayName))), /*#__PURE__*/ wn.createElement(SettingsSection, { title: "App Values", tooltipText: "Copy these App (Service Provider) Values into your IdP." }, /*#__PURE__*/ wn.createElement(SettingsList, null, /*#__PURE__*/ wn.createElement(SettingsListItem, { title: "Connection ID" }, /*#__PURE__*/ wn.createElement(CopyableText, null, connection.connection_id)), /*#__PURE__*/ wn.createElement(AppDetails, { connection: connection }))), /*#__PURE__*/ wn.createElement(SettingsSection, { title: "IdP Values" }, /*#__PURE__*/ wn.createElement(SettingsList, null, type === 'saml' && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, editing && !manualConfiguration ? ( /*#__PURE__*/wn.createElement(SettingsListItem, { title: idp.metadataUrlLabel }, /*#__PURE__*/ wn.createElement(Input$1, { placeholder: "Enter ".concat(idp.metadataUrlLabel), value: localState.metadataUrl || '', onChange: handleMetadataUrlChange }))) : ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(SettingsListItem, { title: idp.idpSsoUrlLabel }, editing ? ( /*#__PURE__*/wn.createElement(Input$1, { placeholder: "Enter ".concat(idp.idpSsoUrlLabel), value: localState.ssoUrl || '', onChange: handleSsoUrlChange })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, connection.idp_sso_url || '–'))), /*#__PURE__*/ wn.createElement(SettingsListItem, { title: idp.idpEntityIdLabel }, editing ? ( /*#__PURE__*/wn.createElement(Input$1, { placeholder: "Enter ".concat(idp.idpEntityIdLabel), value: localState.entityId || '', onChange: handleEntityIdChange })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, connection.idp_entity_id || '–'))))), /*#__PURE__*/ wn.createElement(SettingsListItem, { title: idp.x509CertificateLabel }, /*#__PURE__*/ wn.createElement(CertificateTable, { editing: editing, remoteState: connection.verification_certificates, localState: localState, setLocalState: setLocalState, manualConfiguration: manualConfiguration })), editing && !idpRequiresManualConfig && ( /*#__PURE__*/wn.createElement(Button, { compact: true, variant: "ghost", onClick: function onClick() { setManualConfiguration(!manualConfiguration); } }, manualConfiguration ? "Configure using ".concat(idp.metadataUrlLabel) : 'Configure manually')))), type === 'oidc' && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(SettingsListItem, { title: idp.clientIdLabel }, editing ? ( /*#__PURE__*/wn.createElement(Input$1, { placeholder: "Enter ".concat(idp.clientIdLabel), value: localState.clientId || '', onChange: handleClientIdChange })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, connection.client_id || '–'))), /*#__PURE__*/ wn.createElement(SettingsListItem, { title: idp.clientSecretLabel }, editing ? ( /*#__PURE__*/wn.createElement(Input$1, { placeholder: "Enter ".concat(idp.clientSecretLabel), value: localState.clientSecret || '', onChange: handleClientSecretChange })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, connection.client_secret || '–'))), idp.issuerDerivedLabel ? ( /*#__PURE__*/wn.createElement(SettingsListItem, { title: idp.issuerDerivedLabel }, editing ? ( /*#__PURE__*/wn.createElement(Input$1, { placeholder: "Enter ".concat(idp.issuerDerivedLabel), value: localState.issuerDerivedValue || '', onChange: handleIssuerDerivedValueChange })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, ((_a = idp.extractIssuerFromInput) === null || _a === void 0 ? void 0 : _a.call(idp, connection.issuer)) || '–')))) : ( /*#__PURE__*/wn.createElement(SettingsListItem, { title: idp.issuerLabel }, editing ? ( /*#__PURE__*/wn.createElement(Input$1, { placeholder: "URL", value: localState.issuer || '', onChange: handleIssuerChange })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, connection.issuer || '–')))), editing && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, manualConfiguration && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(SettingsListItem, { title: "Authorization URL" }, /*#__PURE__*/ wn.createElement(Input$1, { placeholder: "Enter Authorization URL", value: localState.authorizationUrl || '', onChange: handleAuthorizationUrlChange })), /*#__PURE__*/ wn.createElement(SettingsListItem, { title: "Token URL" }, /*#__PURE__*/ wn.createElement(Input$1, { placeholder: "Enter Token URL", value: localState.tokenUrl || '', onChange: handleTokenUrlChange })), /*#__PURE__*/ wn.createElement(SettingsListItem, { title: "User info URL" }, /*#__PURE__*/ wn.createElement(Input$1, { placeholder: "Enter User info URL", value: localState.userInfoUrl || '', onChange: handleUserInfoUrlChange })), /*#__PURE__*/ wn.createElement(SettingsListItem, { title: "JWKS URL" }, /*#__PURE__*/ wn.createElement(Input$1, { placeholder: "Enter JWKS URL", value: localState.jwksUrl || '', onChange: handleJwksUrlChange })))), /*#__PURE__*/ wn.createElement(Button, { compact: true, variant: "ghost", onClick: function onClick() { setManualConfiguration(!manualConfiguration); } }, manualConfiguration ? "Configure using ".concat((_b = idp.issuerDerivedLabel) !== null && _b !== void 0 ? _b : idp.issuerLabel) : 'Configure manually'))))))), type === 'saml' && ( /*#__PURE__*/wn.createElement(SettingsSection, { title: idp.attributeMappingLabel }, /*#__PURE__*/ wn.createElement(AttributeMappingTable, { editing: editing, localState: localState, remoteState: remoteState, setLocalState: setLocalState })))); };
|
|
9223
|
+
var DetailsSection = function DetailsSection(_ref62) { var canUpdateConnection = _ref62.canUpdateConnection, connectionProp = _ref62.connection; var _getIdpAndConnectionI3 = getIdpAndConnectionInfo(connectionProp), idp = _getIdpAndConnectionI3.idp, connection = _getIdpAndConnectionI3.connection, type = _getIdpAndConnectionI3.type; var remoteState = F$3(function () { var _a; return { displayName: connection.display_name, identityProvider: connection.identity_provider, attributeMapping: 'attribute_mapping' in connection ? connection.attribute_mapping : {}, manualConfiguration: false, authorizationUrl: 'authorization_url' in connection ? connection.authorization_url : undefined, clientId: 'client_id' in connection ? connection.client_id : undefined, clientSecret: 'client_secret' in connection ? connection.client_secret : undefined, entityId: 'idp_entity_id' in connection ? connection.idp_entity_id : undefined, issuer: 'issuer' in connection ? connection.issuer : undefined, issuerDerivedValue: type === 'oidc' ? (_a = idp.extractIssuerFromInput) === null || _a === void 0 ? void 0 : _a.call(idp, connection.issuer) : undefined, jwksUrl: 'jwks_url' in connection ? connection.jwks_url : undefined, ssoUrl: 'idp_sso_url' in connection ? connection.idp_sso_url : undefined, tokenUrl: 'token_url' in connection ? connection.token_url : undefined, userInfoUrl: 'userinfo_url' in connection ? connection.userinfo_url : undefined }; }, [connection, idp, type]); var _useFormState = useFormState({ remoteState: remoteState }), localState = _useFormState.localState, setLocalState = _useFormState.setLocalState, editing = _useFormState.editing, handleSetEditing = _useFormState.handleSetEditing; var _useMutateSsoConnecti = useMutateSsoConnection(type), mutate = _useMutateSsoConnecti.mutate; var _useDeleteSsoConnecti2 = useDeleteSsoConnectionCert(), deleteCertificate = _useDeleteSsoConnecti2.mutate; var _useMutateSsoConnecti2 = useMutateSsoConnectionByUrl(), mutateByUrl = _useMutateSsoConnecti2.mutate; var handleSave = T$2(function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee7() { var _a, baseOptions, mutatedProperties, idpRequiresManualConfig, isManualConfig, _iterator, _step, _loop, _ret, getIssuer, issuer; return _regeneratorRuntime().wrap(function _callee7$(_context8) { while (1)
|
|
9224
9224
|
switch (_context8.prev = _context8.next) {
|
|
9225
9225
|
case 0:
|
|
9226
9226
|
baseOptions = { connection_id: connection.connection_id };
|
|
@@ -9385,8 +9385,8 @@ var useMutateOrganization = function useMutateOrganization() { var _useSWRConfig
|
|
|
9385
9385
|
case "end": return _context10.stop();
|
|
9386
9386
|
} }, _callee9); })); }, [client.organization, mutateSWR])); };
|
|
9387
9387
|
var SetDefaultConfirmModal = function SetDefaultConfirmModal(_a) { var connectionName = _a.connectionName, defaultConnectionName = _a.defaultConnectionName, modalProps = __rest(_a, ["connectionName", "defaultConnectionName"]); return /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, modalProps, { title: "Set ".concat(connectionName || '', " as default?"), confirmButtonText: "Set as default" }), /*#__PURE__*/ wn.createElement(Typography, null, "This will be the default SSO connection for your entire organization. The default connection ID is used to initiate the SSO authentication flow if the connection ID is missing and you only specify the org ID or slug."), defaultConnectionName && ( /*#__PURE__*/wn.createElement(Typography, { color: "error" }, "This will replace ", defaultConnectionName, " as the default connection for your organization."))); };
|
|
9388
|
-
var useMutateDefaultConnection = function useMutateDefaultConnection() { var _useMutateOrganizatio = useMutateOrganization(), mutate = _useMutateOrganizatio.mutate; var setDefault = function setDefault(
|
|
9389
|
-
var useSetDefaultConnection = function useSetDefaultConnection(
|
|
9388
|
+
var useMutateDefaultConnection = function useMutateDefaultConnection() { var _useMutateOrganizatio = useMutateOrganization(), mutate = _useMutateOrganizatio.mutate; var setDefault = function setDefault(_ref63) { var connectionId = _ref63.connectionId, connectionName = _ref63.connectionName; return mutate({ sso_default_connection_id: connectionId }, { errorMessage: "Failed to set ".concat(connectionName, " as default connection") }); }; return { setDefault: setDefault }; };
|
|
9389
|
+
var useSetDefaultConnection = function useSetDefaultConnection(_ref64) { var defaultConnectionName = _ref64.defaultConnectionName; var _h46 = h$4(), _h47 = _slicedToArray2(_h46, 2), connection = _h47[0], setConnection = _h47[1]; var _h48 = h$4(defaultConnectionName), _h49 = _slicedToArray2(_h48, 2), cachedDefaultConnectionName = _h49[0], setCachedDefaultConnectionName = _h49[1]; var _useToggleState2 = useToggleState(), isOpen = _useToggleState2.isOpen, open = _useToggleState2.open, close = _useToggleState2.close; var handleRequestSetDefault = T$2(function (connection) { setConnection(connection); setCachedDefaultConnectionName(defaultConnectionName); open(); }, [defaultConnectionName, open]); var _useMutateDefaultConn = useMutateDefaultConnection(), setDefault = _useMutateDefaultConn.setDefault; var confirm = function confirm() { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee10() { return _regeneratorRuntime().wrap(function _callee10$(_context11) { while (1)
|
|
9390
9390
|
switch (_context11.prev = _context11.next) {
|
|
9391
9391
|
case 0:
|
|
9392
9392
|
if (!connection) {
|
|
@@ -9401,14 +9401,14 @@ var useSetDefaultConnection = function useSetDefaultConnection(_ref63) { var def
|
|
|
9401
9401
|
} }, _callee10); })); }; return { handleRequestSetDefault: handleRequestSetDefault, modalProps: { connectionName: connection === null || connection === void 0 ? void 0 : connection.displayName, defaultConnectionName: cachedDefaultConnectionName, isOpen: isOpen, close: close, confirm: confirm } }; };
|
|
9402
9402
|
var useStyles$8 = makeStyles(function (theme) { var primary = theme.styleConfig.buttons.primary.backgroundColor; var secondary = theme.styleConfig.colors.secondary; var containerBackground = theme.styleConfig.container.backgroundColor; return { root: { width: 38, height: 24, padding: 8, marginLeft: 4, display: 'flex', alignItems: 'center', boxSizing: 'border-box' }, switchBase: { transition: theme.transitions.create(['opacity', 'background-color']), margin: '0px 3px', '&$checked': _defineProperty2({ margin: '0px -8px' }, "& + .".concat(classNamePrefix, "MuiSwitch-track"), { opacity: 1, backgroundColor: primary }), '&.Mui-disabled': _defineProperty2(_defineProperty2(_defineProperty2({}, "& .".concat(classNamePrefix, "MuiSwitch-thumb"), { color: secondary }), "& + .".concat(classNamePrefix, "MuiSwitch-track"), { border: '2.5px solid', borderColor: secondary, opacity: 1, backgroundColor: containerBackground }), '&$checked', _defineProperty2(_defineProperty2({}, "& + .".concat(classNamePrefix, "MuiSwitch-track"), { opacity: 1, backgroundColor: secondary }), "& .".concat(classNamePrefix, "MuiSwitch-thumb"), { color: containerBackground })), '&$checked $thumb': { color: containerBackground } }, thumb: { height: 6, width: 6, boxShadow: 'none', color: primary }, colorSecondary: { '&:hover': { backgroundColor: alpha(containerBackground, 0) }, '&$checked': { '&:hover': { backgroundColor: alpha(containerBackground, 0) } } }, track: { border: '2.5px solid', borderColor: primary, backgroundColor: containerBackground, borderRadius: 24 / 2, height: 8, opacity: 1 }, checked: {}, disabled: {} }; });
|
|
9403
9403
|
var stopPropagateOnClick = function stopPropagateOnClick(e) { e.stopPropagation(); };
|
|
9404
|
-
var Switch = function Switch(
|
|
9405
|
-
var OrganizationUpdatesSectionBody = function OrganizationUpdatesSectionBody(
|
|
9404
|
+
var Switch = function Switch(_ref65) { var checked = _ref65.checked, label = _ref65.label, onChange = _ref65.onChange, readOnly = _ref65.readOnly; var classes = useStyles$8(); var handleChange = function handleChange(e) { onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked); }; return /*#__PURE__*/ wn.createElement(FormControlLabel$1, { control: /*#__PURE__*/ wn.createElement(MUISwitch, { "aria-label": "".concat(checked ? 'Disable' : 'Enable', " ").concat(label), checked: checked, classes: classes, disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, disabled: readOnly, onChange: handleChange, onClick: stopPropagateOnClick }), disabled: readOnly, label: /*#__PURE__*/ wn.createElement(FlexBox, null, label && ( /*#__PURE__*/wn.createElement(Typography, { variant: 'body2', disabled: readOnly }, label))) }); };
|
|
9405
|
+
var OrganizationUpdatesSectionBody = function OrganizationUpdatesSectionBody(_ref66) { var connection = _ref66.connection, defaultConnectionName = _ref66.defaultConnectionName, orgJitProvisioningPolicy = _ref66.orgJitProvisioningPolicy, localState = _ref66.localState, setLocalState = _ref66.setLocalState, remoteState = _ref66.remoteState; var _useSettingsContainer2 = useSettingsContainer(), editing = _useSettingsContainer2.editing; var _useSetDefaultConnect = useSetDefaultConnection({ defaultConnectionName: defaultConnectionName }), handleRequestSetDefault = _useSetDefaultConnect.handleRequestSetDefault, modalProps = _useSetDefaultConnect.modalProps; var _ref67 = editing ? localState : remoteState, isDefaultConnection = _ref67.isDefaultConnection, jitProvisioningEnabled = _ref67.jitProvisioningEnabled; var _useRbac = useRbac('stytch.organization', 'update.settings.default-sso-connection'), canSetDefaultConnection = _useRbac.data; var _useRbac2 = useRbac('stytch.organization', 'update.settings.sso-jit-provisioning'), canSetSsoJitProvisioning = _useRbac2.data; return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, editing && ( /*#__PURE__*/wn.createElement(SetDefaultConfirmModal, Object.assign({}, modalProps, { confirm: function confirm() { setLocalState(function (state) { return Object.assign(Object.assign({}, state), { isDefaultConnection: true }); }); return Promise.resolve(); } }))), /*#__PURE__*/ wn.createElement(SettingsSection, { title: "Default SSO connection", tooltipText: "The default connection ID is used to initiate the SSO authentication flow if the connection ID is missing and you only specify the org ID or slug. You can only have one default connection. " }, remoteState.isDefaultConnection ? ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, "This connection is already set as the default.")) : ( /*#__PURE__*/wn.createElement(Switch, { readOnly: !editing || !canSetDefaultConnection, label: "Set this connection as the default SSO connection. This will replace your existing default SSO connection.", checked: isDefaultConnection, onChange: function onChange() { if (isDefaultConnection) {
|
|
9406
9406
|
setLocalState(function (state) { return Object.assign(Object.assign({}, state), { isDefaultConnection: false }); });
|
|
9407
9407
|
}
|
|
9408
9408
|
else {
|
|
9409
9409
|
handleRequestSetDefault({ displayName: connection.display_name, id: connection.connection_id });
|
|
9410
9410
|
} } }))), /*#__PURE__*/ wn.createElement(SettingsSection, { title: "JIT provisioning", tooltipText: "If enabled, users who successfully authenticate through this SSO Connection will be automatically granted an account if they do not already exist within your organization." }, /*#__PURE__*/ wn.createElement(Switch, { readOnly: !editing || !(canSetSsoJitProvisioning && orgJitProvisioningPolicy === 'RESTRICTED'), label: "Allow JIT provisioning for users who successfully authenticate through this SSO connection.", checked: jitProvisioningEnabled, onChange: function onChange(value) { setLocalState(function (state) { return Object.assign(Object.assign({}, state), { jitProvisioningEnabled: value }); }); } }))); };
|
|
9411
|
-
var OrganizationUpdatesSection = function OrganizationUpdatesSection(
|
|
9411
|
+
var OrganizationUpdatesSection = function OrganizationUpdatesSection(_ref68) { var connection = _ref68.connection, defaultConnectionName = _ref68.defaultConnectionName, isDefaultConnection = _ref68.isDefaultConnection; var _useRbac3 = useRbac('stytch.organization', 'update.settings.default-sso-connection'), canSetDefaultConnection = _useRbac3.data; var _useRbac4 = useRbac('stytch.organization', 'update.settings.sso-jit-provisioning'), canSetSsoJitProvisioning = _useRbac4.data; var _useOrgInfo = useOrgInfo(), organization = _useOrgInfo.data; var orgJitProvisioningPolicy = organization === null || organization === void 0 ? void 0 : organization.sso_jit_provisioning; var remoteState = F$3(function () { return { isDefaultConnection: isDefaultConnection, jitProvisioningEnabled: !!(orgJitProvisioningPolicy === 'ALL_ALLOWED' || orgJitProvisioningPolicy === 'RESTRICTED' && (organization === null || organization === void 0 ? void 0 : organization.sso_jit_provisioning_allowed_connections.includes(connection.connection_id))) }; }, [connection.connection_id, isDefaultConnection, orgJitProvisioningPolicy, organization === null || organization === void 0 ? void 0 : organization.sso_jit_provisioning_allowed_connections]); var _useFormState2 = useFormState({ remoteState: remoteState }), localState = _useFormState2.localState, setLocalState = _useFormState2.setLocalState, editing = _useFormState2.editing, handleSetEditing = _useFormState2.handleSetEditing; var _useMutateDefaultConn2 = useMutateDefaultConnection(), setDefault = _useMutateDefaultConn2.setDefault; var _useMutateOrganizatio2 = useMutateOrganization(), mutate = _useMutateOrganizatio2.mutate; var handleSave = T$2(function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee11() { var _a, _b, promises, allowedConnections, _allowedConnections; return _regeneratorRuntime().wrap(function _callee11$(_context12) { while (1)
|
|
9412
9412
|
switch (_context12.prev = _context12.next) {
|
|
9413
9413
|
case 0:
|
|
9414
9414
|
if (organization) {
|
|
@@ -9853,7 +9853,7 @@ var AutocompleteTag = function AutocompleteTag(_a) { var children = _a.children,
|
|
|
9853
9853
|
var Input = function Input(props) { return /*#__PURE__*/ wn.createElement(TextField$1, Object.assign({}, props, { variant: "outlined" })); };
|
|
9854
9854
|
var useStyles$7 = makeStyles(function (theme) { return { autocomplete: _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({}, "& .".concat(classNamePrefix, "MuiInputBase-root"), { padding: theme.spacing(1), gap: theme.spacing(0.5) }), "& .".concat(classNamePrefix, "MuiOutlinedInput-input.").concat(classNamePrefix, "MuiAutocomplete-input"), { padding: 0, height: 24, '&::placeholder': { color: theme.styleConfig.inputs.placeholderColor, opacity: 1 } }), "& .".concat(classNamePrefix, "MuiOutlinedInput-notchedOutline"), { border: '1px solid', borderRadius: theme.styleConfig.inputs.borderRadius, borderColor: theme.styleConfig.inputs.borderColor }), "&:hover .".concat(classNamePrefix, "MuiOutlinedInput-notchedOutline, &.Mui-focused .").concat(classNamePrefix, "MuiOutlinedInput-notchedOutline"), { borderWidth: 1, borderColor: theme.styleConfig.inputs.borderColor }), "& .".concat(classNamePrefix, "MuiAutocomplete-endAdornment .").concat(classNamePrefix, "MuiIconButton-root"), { fontSize: 20 }) }; });
|
|
9855
9855
|
var defaultGetOptionLabel = function defaultGetOptionLabel(item) { return item; };
|
|
9856
|
-
var Autocomplete = function Autocomplete(
|
|
9856
|
+
var Autocomplete = function Autocomplete(_ref69) { var caption = _ref69.caption, fullWidth = _ref69.fullWidth, getOptionDescription = _ref69.getOptionDescription, getOptionDisabled = _ref69.getOptionDisabled, _ref69$getOptionLabel = _ref69.getOptionLabel, getOptionLabel = _ref69$getOptionLabel === void 0 ? defaultGetOptionLabel : _ref69$getOptionLabel, id = _ref69.id, label = _ref69.label, _onChange = _ref69.onChange, placeholder = _ref69.placeholder, required = _ref69.required, selectItems = _ref69.selectItems, value = _ref69.value; var selectId = useShortId(id); var _h50 = h$4(false), _h51 = _slicedToArray2(_h50, 2), isOpen = _h51[0], setIsOpen = _h51[1]; var autocompleteClasses = useStyles$7(); var selectClasses = useStyles$c(); return /*#__PURE__*/ wn.createElement("div", { className: C(selectClasses.selectContainer, _defineProperty2({}, selectClasses.fullWidth, fullWidth)) }, label && ( /*#__PURE__*/wn.createElement(Label, { htmlFor: selectId, required: required, variant: "caption", labelColor: "secondary" }, label)), /*#__PURE__*/ wn.createElement(MuiAutocomplete, { popupIcon: /*#__PURE__*/ wn.createElement(default_1$9, null), className: autocompleteClasses.autocomplete, fullWidth: true, id: selectId, multiple: true, onChange: function onChange(_, newValue, reason) { if (_onChange) {
|
|
9857
9857
|
if (reason === 'clear' && getOptionDisabled) {
|
|
9858
9858
|
_onChange(value.filter(function (item) { return getOptionDisabled(item); }));
|
|
9859
9859
|
}
|
|
@@ -9861,6 +9861,27 @@ var Autocomplete = function Autocomplete(_ref68) { var caption = _ref68.caption,
|
|
|
9861
9861
|
_onChange(newValue);
|
|
9862
9862
|
}
|
|
9863
9863
|
} }, onClose: function onClose() { return setIsOpen(false); }, onOpen: function onOpen() { return setIsOpen(true); }, open: isOpen, value: value, options: selectItems, getOptionDisabled: getOptionDisabled, getOptionLabel: getOptionLabel, renderOption: function renderOption(option, state) { var description = getOptionDescription === null || getOptionDescription === void 0 ? void 0 : getOptionDescription(option); return /*#__PURE__*/ wn.createElement(FlexBox, { gap: 0.5, alignItems: "center" }, /*#__PURE__*/ wn.createElement(default_1$b, { fontSize: "small", style: { visibility: state.selected ? 'visible' : 'hidden' }, "aria-visibility": state.selected }), /*#__PURE__*/ wn.createElement("div", null, getOptionLabel(option), description && /*#__PURE__*/ wn.createElement(Typography$2, { variant: "body2" }, description))); }, renderInput: function renderInput(params) { return /*#__PURE__*/ wn.createElement(Input, Object.assign({}, params, { placeholder: placeholder })); }, renderTags: function renderTags(value, getTagProps) { return value.map(function (option, index) { var _a = getTagProps({ index: index }), onDelete = _a.onDelete, tagProps = __rest(_a, ["onDelete"]); return /*#__PURE__*/ wn.createElement(AutocompleteTag, Object.assign({}, tagProps, { onDelete: (getOptionDisabled === null || getOptionDisabled === void 0 ? void 0 : getOptionDisabled(option)) ? undefined : onDelete }), getOptionLabel(option)); }); } }), caption && /*#__PURE__*/ wn.createElement(Typography$2, { variant: "body2" }, caption)); };
|
|
9864
|
+
var ROLE_ID_STYTCH_MEMBER = 'stytch_member';
|
|
9865
|
+
var ROLE_ID_STYTCH_ADMIN = 'stytch_admin';
|
|
9866
|
+
var getRoleDefaultDisplayName = function getRoleDefaultDisplayName(role) { return role.role_id; };
|
|
9867
|
+
var useGetRoleDisplayName = function useGetRoleDisplayName() { var config = useAdminPortalUIConfig(); return T$2(function (role) { var _a; return ((_a = config === null || config === void 0 ? void 0 : config.getRoleDisplayName) === null || _a === void 0 ? void 0 : _a.call(config, role)) || getRoleDefaultDisplayName(role); }, [config]); };
|
|
9868
|
+
var useRoles = function useRoles() { var _a; var b2bInternals = useB2BInternals(); var _h52 = h$4((_a = b2bInternals.bootstrap.getSync().rbacPolicy) === null || _a === void 0 ? void 0 : _a.roles), _h53 = _slicedToArray2(_h52, 2), roles = _h53[0], setRoles = _h53[1]; p$3(function () { b2bInternals.bootstrap.getAsync().then(function (value) { var _a; setRoles((_a = value.rbacPolicy) === null || _a === void 0 ? void 0 : _a.roles); }); }); return roles; };
|
|
9869
|
+
var wellKnownRoleIds = [ROLE_ID_STYTCH_MEMBER, ROLE_ID_STYTCH_ADMIN];
|
|
9870
|
+
var compareWellKnownRoleIds = function compareWellKnownRoleIds(a, b) { if (a === b) {
|
|
9871
|
+
return 0;
|
|
9872
|
+
} for (var _i = 0, _wellKnownRoleIds = wellKnownRoleIds; _i < _wellKnownRoleIds.length; _i++) {
|
|
9873
|
+
var roleId = _wellKnownRoleIds[_i];
|
|
9874
|
+
if (a === roleId) {
|
|
9875
|
+
return -1;
|
|
9876
|
+
}
|
|
9877
|
+
if (b === roleId) {
|
|
9878
|
+
return 1;
|
|
9879
|
+
}
|
|
9880
|
+
} return 0; };
|
|
9881
|
+
var useRolesById = function useRolesById() { var getRoleDisplayName = useGetRoleDisplayName(); var allRoles = useRoles(); return F$3(function () { return allRoles === null || allRoles === void 0 ? void 0 : allRoles.reduce(function (acc, role) { acc[role.role_id] = Object.assign(Object.assign({}, role), { displayName: getRoleDisplayName(role) || getRoleDefaultDisplayName(role) }); return acc; }, {}); }, [allRoles, getRoleDisplayName]); };
|
|
9882
|
+
var useRoleSortFn = function useRoleSortFn() { var rolesById = useRolesById(); return T$2(function (roles) { return roles.map(function (role) { var _a; var matchingPolicyRole = rolesById === null || rolesById === void 0 ? void 0 : rolesById[role.role_id]; return Object.assign(Object.assign(Object.assign({}, matchingPolicyRole), role), { displayName: (_a = matchingPolicyRole === null || matchingPolicyRole === void 0 ? void 0 : matchingPolicyRole.displayName) !== null && _a !== void 0 ? _a : role.role_id }); }).sort(function (a, b) { return compareWellKnownRoleIds(a.role_id, b.role_id) || a.displayName.localeCompare(b.displayName); }); }, [rolesById]); };
|
|
9883
|
+
var TagList = function TagList(_ref70) { var tags = _ref70.tags; return /*#__PURE__*/ wn.createElement("ul", { style: { listStyle: 'none', padding: 0, margin: 0, display: 'flex', flexWrap: 'wrap', gap: 8 } }, tags.map(function (tag) { return /*#__PURE__*/ wn.createElement("li", { key: tag }, /*#__PURE__*/ wn.createElement(Tag, { size: "small" }, tag)); })); };
|
|
9884
|
+
var RolesList = function RolesList(_ref71) { var hideStytchMemberWithOtherRoles = _ref71.hideStytchMemberWithOtherRoles, roles = _ref71.roles; var sortRows = useRoleSortFn(); var roleObjects = F$3(function () { return roles.map(function (role) { return typeof role === 'string' ? { role_id: role } : role; }); }, [roles]); var sortedRoles = F$3(function () { return sortRows(!hideStytchMemberWithOtherRoles || roleObjects.length === 1 ? roleObjects : roleObjects.filter(function (role) { return role.role_id !== ROLE_ID_STYTCH_MEMBER; })).map(function (role) { return role.displayName; }); }, [hideStytchMemberWithOtherRoles, roleObjects, sortRows]); return /*#__PURE__*/ wn.createElement(TagList, { tags: sortedRoles }); };
|
|
9864
9885
|
var ArrowRight = {};
|
|
9865
9886
|
var _interopRequireDefault$7 = interopRequireDefaultExports;
|
|
9866
9887
|
var _interopRequireWildcard$7 = interopRequireWildcardExports;
|
|
@@ -9875,7 +9896,7 @@ var EXPANDED_CONTENT_CLASSNAME = 'expanded-content';
|
|
|
9875
9896
|
var leftAlignExpandedContent = function leftAlignExpandedContent(containerId) { var container = document.getElementById(containerId); var expandedContentDivs = document.querySelectorAll("#".concat(containerId, " .").concat(EXPANDED_CONTENT_CLASSNAME)); expandedContentDivs.forEach(function (expandedContent) { expandedContent.style.marginLeft = (container === null || container === void 0 ? void 0 : container.scrollLeft) + 'px'; }); };
|
|
9876
9897
|
var makeTableStyles = makeStylesFactory(function (theme) { return { tableCell: { padding: theme.spacing(0.5, 1), minWidth: 80 }, tableHeader: {}, tableWithExpandedContent: { '& tr td:nth-child(2), & tr th:nth-child(2)': { paddingLeft: theme.spacing(0) } }, tableWithActions: { width: 'calc(100% - 2px)' }, tableActionsCell: { position: 'sticky', right: 0, width: '1%' }, cellWithExpandedContent: { borderBottom: 'none' }, expandMoreCell: { padding: theme.spacing(0, 0, 0, 1), width: theme.spacing(4.5), minWidth: 'unset' }, openChevron: { transform: 'rotate(90deg)' }, expandedRow: {}, expandedContentCell: { padding: 0 }, expandedContentContainer: { padding: theme.spacing(0.5, 2, 1) }, clickable: { cursor: 'pointer' }, tableRow: {} }; });
|
|
9877
9898
|
var TableCell = function TableCell(_a) { var children = _a.children, className = _a.className, classes = _a.classes, Typography = _a.TypographyComponent, props = __rest(_a, ["children", "className", "classes", "TypographyComponent"]); var value = getTableCellValue(children); return /*#__PURE__*/ wn.createElement(MUITableCell, Object.assign({ className: C(classes.tableCell, className) }, props), typeof value === 'string' ? /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, value) : children); };
|
|
9878
|
-
var TableRow = function TableRow(
|
|
9899
|
+
var TableRow = function TableRow(_ref72) { var id = _ref72.id, ExpandedContent = _ref72.ExpandedContent, item = _ref72.item, itemRenderer = _ref72.itemRenderer, onRowClick = _ref72.onRowClick, tableWidth = _ref72.tableWidth, tableContainerId = _ref72.tableContainerId, getItemActionProps = _ref72.getItemActionProps, classes = _ref72.classes, TableActions = _ref72.TableActionsComponent, Typography = _ref72.TypographyComponent, isOpenProp = _ref72.isOpen, onOpenChange = _ref72.onOpenChange; var isOpenControlled = isOpenProp !== undefined; var _h54 = h$4(false), _h55 = _slicedToArray2(_h54, 2), openState = _h55[0], setOpenState = _h55[1]; var open = isOpenControlled ? isOpenProp : openState; p$3(function () { if (open) {
|
|
9879
9900
|
leftAlignExpandedContent(tableContainerId);
|
|
9880
9901
|
} }, [open, tableContainerId]); var toggleOpen = function toggleOpen(e) { e.stopPropagation(); if (isOpenControlled) {
|
|
9881
9902
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange({ id: id, open: !open });
|
|
@@ -9888,17 +9909,20 @@ else {
|
|
|
9888
9909
|
else if (ExpandedContent) {
|
|
9889
9910
|
toggleOpen(e);
|
|
9890
9911
|
} }; return /*#__PURE__*/ wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(MUITableRow, { className: C(_defineProperty2(_defineProperty2({}, classes.expandedRow, open), classes.clickable, !!onRowClick), classes.tableRow), onClick: handleRowClick, style: { width: 'fit-content' } }, ExpandedContent && ( /*#__PURE__*/wn.createElement(TableCell, { TypographyComponent: Typography, className: C(classes.expandMoreCell, _defineProperty2({}, classes.cellWithExpandedContent, !!ExpandedContent)), classes: classes }, /*#__PURE__*/ wn.createElement(IconButton$1, { "aria-label": "expand row", onClick: toggleOpen, size: "small" }, ExpandedContent && /*#__PURE__*/ wn.createElement(default_1$7, { className: open ? classes.openChevron : undefined })))), itemRenderer.map(function (column) { return /*#__PURE__*/ wn.createElement(TableCell, { TypographyComponent: Typography, className: C(_defineProperty2({}, classes.cellWithExpandedContent, !!ExpandedContent)), classes: classes, key: "row-".concat(id, "-col-").concat(String(column.title)) }, column.getValue(item)); }), getItemActionProps && ( /*#__PURE__*/wn.createElement(TableCell, { TypographyComponent: Typography, className: C(classes.tableCell, classes.tableActionsCell), classes: classes }, /*#__PURE__*/ wn.createElement(TableActions, Object.assign({}, getItemActionProps(item)))))), ExpandedContent && ( /*#__PURE__*/wn.createElement(MUITableRow, null, /*#__PURE__*/ wn.createElement(TableCell, { TypographyComponent: Typography, className: C(classes.expandedRow, classes.expandedContentCell), classes: classes, colSpan: itemRenderer.length + 1 }, /*#__PURE__*/ wn.createElement(Collapse$1, { "in": open, timeout: "auto", unmountOnExit: true }, /*#__PURE__*/ wn.createElement("div", { className: "".concat(EXPANDED_CONTENT_CLASSNAME, " ").concat(classes.expandedContentContainer), style: { width: tableWidth } }, /*#__PURE__*/ wn.createElement(ExpandedContent, { data: item }))))))); };
|
|
9891
|
-
var TableCore = function TableCore(
|
|
9912
|
+
var TableCore = function TableCore(_ref73) { var ExpandedContent = _ref73.ExpandedContent, itemRenderer = _ref73.itemRenderer, items = _ref73.items, rowKeyExtractor = _ref73.rowKeyExtractor, onRowClick = _ref73.onRowClick, getItemActionProps = _ref73.getItemActionProps, classes = _ref73.classes, TableActions = _ref73.TableActionsComponent, Typography = _ref73.TypographyComponent, disableBottomBorder = _ref73.disableBottomBorder, _ref73$titleVariant = _ref73.titleVariant, titleVariant = _ref73$titleVariant === void 0 ? 'body2' : _ref73$titleVariant, onOpenChange = _ref73.onOpenChange, openIds = _ref73.openIds; var containerId = useShortId(TABLE_CONTAINER_ID); var _h56 = h$4(), _h57 = _slicedToArray2(_h56, 2), setTableWidth = _h57[1]; p$3(function () { var _a; var container = document.getElementById(containerId); var originalTableWidth = (_a = document.querySelector("#".concat(containerId, " thead"))) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width; function handleScroll() { if (!originalTableWidth || !container)
|
|
9892
9913
|
return; var tableWidth = container.getBoundingClientRect().width; if (originalTableWidth - container.scrollLeft + 16 >= tableWidth) {
|
|
9893
9914
|
leftAlignExpandedContent(containerId);
|
|
9894
9915
|
} } function handleResize() { var _a; setTableWidth((_a = container === null || container === void 0 ? void 0 : container.getBoundingClientRect().width) !== null && _a !== void 0 ? _a : 0); handleScroll(); } handleResize(); window.addEventListener('resize', handleResize); container === null || container === void 0 ? void 0 : container.addEventListener('scroll', handleScroll); return function () { container === null || container === void 0 ? void 0 : container.removeEventListener('scroll', handleScroll); window.removeEventListener('resize', handleResize); }; }, [containerId]); validateRowKey(items, rowKeyExtractor); return /*#__PURE__*/ wn.createElement(TableContainer$1, { id: containerId }, /*#__PURE__*/ wn.createElement(MUITable, { className: C(_defineProperty2(_defineProperty2({}, classes.tableWithExpandedContent, !!ExpandedContent), classes.tableWithActions, !!getItemActionProps)) }, /*#__PURE__*/ wn.createElement(TableHead$1, null, /*#__PURE__*/ wn.createElement(MUITableRow, null, ExpandedContent && ( /*#__PURE__*/wn.createElement(TableCell, { TypographyComponent: Typography, className: C(classes.expandMoreCell, classes.tableHeader), classes: classes }, /*#__PURE__*/ wn.createElement(wn.Fragment, null))), itemRenderer.map(function (column) { var _a; var renderTitle = (_a = column.renderTitle) !== null && _a !== void 0 ? _a : function () { return column.title; }; return /*#__PURE__*/ wn.createElement(TableCell, { TypographyComponent: Typography, className: classes.tableHeader, classes: classes, key: "col-header-".concat(String(column.title)) }, /*#__PURE__*/ wn.createElement(Typography, { variant: titleVariant, color: titleVariant === 'h4' ? 'primary' : 'secondary' }, renderTitle())); }), getItemActionProps && ( /*#__PURE__*/wn.createElement(TableCell, { TypographyComponent: Typography, className: C(classes.tableCell, classes.tableActionsCell, classes.tableHeader), classes: classes }, /*#__PURE__*/ wn.createElement(Typography, { variant: titleVariant, color: titleVariant === 'h4' ? 'primary' : 'secondary' }, TABLE_ACTIONS_HEADER))))), /*#__PURE__*/ wn.createElement(TableBody$1, null, items.map(function (item) { var id = rowKeyExtractor ? rowKeyExtractor(item) : item.id; var isOpen = openIds === null || openIds === void 0 ? void 0 : openIds.has(id); return /*#__PURE__*/ wn.createElement(TableRow, { ExpandedContent: ExpandedContent, TableActionsComponent: TableActions, TypographyComponent: Typography, classes: classes, getItemActionProps: getItemActionProps, id: id, item: item, itemRenderer: itemRenderer, key: id, onRowClick: onRowClick, tableContainerId: containerId, disableBottomBorder: disableBottomBorder, isOpen: isOpen, onOpenChange: onOpenChange }); })))); };
|
|
9895
|
-
var useStyles$6 = makeTableStyles(function (theme) { return { tableCell: { borderBottomColor: theme.styleConfig.colors.subtle, color: theme.styleConfig.colors.primary }, tableActionsCell: { minWidth: 0, '&$tableHeader': { textAlign: 'center' } }, tableRow: function tableRow(
|
|
9916
|
+
var useStyles$6 = makeTableStyles(function (theme) { return { tableCell: { borderBottomColor: theme.styleConfig.colors.subtle, color: theme.styleConfig.colors.primary }, tableActionsCell: { minWidth: 0, '&$tableHeader': { textAlign: 'center' } }, tableRow: function tableRow(_ref74) { var disableBottomBorder = _ref74.disableBottomBorder; return disableBottomBorder ? { '&:last-child th, &:last-child td': { borderBottom: 0 } } : {}; }, expandMoreCell: { padding: theme.spacing(0.5, 0), width: theme.spacing(2) }, expandedContentContainer: { padding: theme.spacing(1, 2, 1, 2) } }; });
|
|
9896
9917
|
var Table = function Table(props) { var classes = useStyles$6(props); return /*#__PURE__*/ wn.createElement(TableCore, Object.assign({}, props, { TableActionsComponent: TableActions, TypographyComponent: Typography, classes: classes })); };
|
|
9897
|
-
var
|
|
9898
|
-
var
|
|
9899
|
-
var
|
|
9900
|
-
var
|
|
9901
|
-
var
|
|
9918
|
+
var getRoleDefaultDescription = function getRoleDefaultDescription(role) { return role.description; };
|
|
9919
|
+
var useGetRoleDescription = function useGetRoleDescription() { var config = useAdminPortalUIConfig(); return T$2(function (role) { var _a; return ((_a = config === null || config === void 0 ? void 0 : config.getRoleDescription) === null || _a === void 0 ? void 0 : _a.call(config, role)) || getRoleDefaultDescription(role); }, [config]); };
|
|
9920
|
+
var useRoleDisplayInfo = function useRoleDisplayInfo() { var allRoles = useRoles(); var getRoleDisplayName = useGetRoleDisplayName(); var getRoleDescription = useGetRoleDescription(); var roleInfo = F$3(function () { var _a; return (_a = allRoles === null || allRoles === void 0 ? void 0 : allRoles.reduce(function (acc, role) { acc[role.role_id] = { description: getRoleDescription(role), label: getRoleDisplayName(role) }; return acc; }, {})) !== null && _a !== void 0 ? _a : {}; }, [allRoles, getRoleDescription, getRoleDisplayName]); var getRoleIdDisplayName = T$2(function (roleId) { var _a; return (_a = roleInfo[roleId].label) !== null && _a !== void 0 ? _a : roleId; }, [roleInfo]); return { roleInfo: roleInfo, getRoleIdDisplayName: getRoleIdDisplayName }; };
|
|
9921
|
+
var useRoleAutocomplete = function useRoleAutocomplete() { var _ref75 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref75$excludeStytchM = _ref75.excludeStytchMember, excludeStytchMember = _ref75$excludeStytchM === void 0 ? false : _ref75$excludeStytchM; var allRoles = useRoles(); var assignableRoles = F$3(function () { return excludeStytchMember ? allRoles === null || allRoles === void 0 ? void 0 : allRoles.filter(function (role) { return role.role_id !== ROLE_ID_STYTCH_MEMBER; }) : allRoles; }, [allRoles, excludeStytchMember]); var sortRoles = useRoleSortFn(); var roleSelectItems = F$3(function () { return sortRoles(assignableRoles !== null && assignableRoles !== void 0 ? assignableRoles : []).map(function (role) { return role.role_id; }); }, [assignableRoles, sortRoles]); var _useRoleDisplayInfo = useRoleDisplayInfo(), roleInfo = _useRoleDisplayInfo.roleInfo, getRoleIdDisplayName = _useRoleDisplayInfo.getRoleIdDisplayName; return { selectItems: roleSelectItems, getOptionDescription: function getOptionDescription(roleId) { return roleInfo[roleId].description; }, getOptionLabel: getRoleIdDisplayName }; };
|
|
9922
|
+
var RoleAssignmentsSectionBody = function RoleAssignmentsSectionBody(_ref76) { var connection = _ref76.connection, localState = _ref76.localState, setLocalState = _ref76.setLocalState, remoteState = _ref76.remoteState; var _a; var _useSettingsContainer3 = useSettingsContainer(), editing = _useSettingsContainer3.editing; var _ref77 = editing ? localState : remoteState, connectionRoleIds = _ref77.connectionRoleIds, groupedRoles = _ref77.groupedRoles; var hasGroupAttributeMapping = !!((_a = connection.attribute_mapping) === null || _a === void 0 ? void 0 : _a.groups); var roleAutocompleteProps = useRoleAutocomplete(); var handleAddGroupRole = T$2(function () { setLocalState(function (state) { return Object.assign(Object.assign({}, state), { groupedRoles: [].concat(_toConsumableArray2(state.groupedRoles), [{ group: '', roleIds: [] }]) }); }); }, [setLocalState]); var handleConnectionRolesChange = T$2(function (value) { return setLocalState(function (state) { return Object.assign(Object.assign({}, state), { connectionRoleIds: value }); }); }, [setLocalState]); var _getIdpInfo = getIdpInfo(connection.identity_provider, 'saml'), idp = _getIdpInfo.idp; return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, /*#__PURE__*/ wn.createElement(SettingsSection, { title: "Connection Roles", tooltipText: "Connection Roles are automatically assigned to all Members who authenticate via this SSO connection." }, editing ? ( /*#__PURE__*/wn.createElement(Autocomplete, Object.assign({}, roleAutocompleteProps, { value: connectionRoleIds, onChange: handleConnectionRolesChange }))) : connection.saml_connection_implicit_role_assignments.length > 0 ? ( /*#__PURE__*/wn.createElement(RolesList, { roles: connection.saml_connection_implicit_role_assignments })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, "No roles assigned."))), /*#__PURE__*/ wn.createElement(SettingsSection, { title: "Group Roles", tooltipText: "If a Member is part of a group, they will be assigned both the Connection Role and their Group Role." }, hasGroupAttributeMapping ? editing ? ( /*#__PURE__*/wn.createElement(wn.Fragment, null, groupedRoles.map(function (_ref78, i) { var group = _ref78.group, roleIds = _ref78.roleIds; return /*#__PURE__*/ wn.createElement(FlexBox, { key: i, alignItems: "stretch", justifyContent: "space-between" }, /*#__PURE__*/ wn.createElement(Input$1, { label: "Group name", fullWidth: true, value: group, onChange: function onChange(value) { setLocalState(function (state) { return Object.assign(Object.assign({}, state), { groupedRoles: state.groupedRoles.map(function (item, index) { return index === i ? Object.assign(Object.assign({}, item), { group: value }) : item; }) }); }); } }), /*#__PURE__*/ wn.createElement(Autocomplete, Object.assign({}, roleAutocompleteProps, { label: "Group Role", value: roleIds, fullWidth: true, onChange: function onChange(values) { setLocalState(function (state) { return Object.assign(Object.assign({}, state), { groupedRoles: state.groupedRoles.map(function (item, index) { return index === i ? Object.assign(Object.assign({}, item), { roleIds: values }) : item; }) }); }); } }))); }), /*#__PURE__*/ wn.createElement(Button, { variant: "text", startIcon: /*#__PURE__*/ wn.createElement(Add$1, null), onClick: handleAddGroupRole }, "Add group roles"))) : groupedRoles.length > 0 ? ( /*#__PURE__*/wn.createElement(Table, { items: groupedRoles, rowKeyExtractor: roleAssignmentKeyExtractor, itemRenderer: roleAssignmentItemRenderer })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, "No roles assigned.")) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, "Add a \"groups\" key in the ", idp.attributeMappingLabel, " first to assign group roles.")))); };
|
|
9923
|
+
var roleAssignmentKeyExtractor = function roleAssignmentKeyExtractor(_ref79) { var group = _ref79.group; return group; };
|
|
9924
|
+
var roleAssignmentItemRenderer = [{ title: 'Group', getValue: function getValue(_ref80) { var group = _ref80.group; return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2", color: "secondary" }, group); } }, { title: 'Role', getValue: function getValue(_ref81) { var roleIds = _ref81.roleIds; return /*#__PURE__*/ wn.createElement(RolesList, { roles: roleIds }); } }];
|
|
9925
|
+
var RoleAssignmentsSection = function RoleAssignmentsSection(_ref82) { var canUpdateConnection = _ref82.canUpdateConnection, connection = _ref82.connection; var connectionRoleIds = F$3(function () { return connection.saml_connection_implicit_role_assignments.map(function (_ref83) { var role_id = _ref83.role_id; return role_id; }); }, [connection.saml_connection_implicit_role_assignments]); var groupedRoles = F$3(function () { return Object.values(connection.saml_group_implicit_role_assignments.reduce(function (acc, _ref84) { var group = _ref84.group, role_id = _ref84.role_id; if (!acc[group]) {
|
|
9902
9926
|
acc[group] = { group: group, roleIds: [] };
|
|
9903
9927
|
} acc[group].roleIds.push(role_id); return acc; }, {})); }, [connection.saml_group_implicit_role_assignments]); var remoteState = F$3(function () { return { connectionRoleIds: connectionRoleIds, groupedRoles: groupedRoles }; }, [connectionRoleIds, groupedRoles]); var _useFormState3 = useFormState({ remoteState: remoteState }), localState = _useFormState3.localState, setLocalState = _useFormState3.setLocalState, editing = _useFormState3.editing, handleSetEditing = _useFormState3.handleSetEditing; var _useMutateSamlConnect = useMutateSamlConnection(), mutate = _useMutateSamlConnect.mutate; var handleSave = T$2(function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee12() { var baseOptions, mutatedProperties, filteredGroupRoles; return _regeneratorRuntime().wrap(function _callee12$(_context13) { while (1)
|
|
9904
9928
|
switch (_context13.prev = _context13.next) {
|
|
@@ -9908,9 +9932,9 @@ var RoleAssignmentsSection = function RoleAssignmentsSection(_ref81) { var canUp
|
|
|
9908
9932
|
if (!deepEqual(remoteState.connectionRoleIds, localState.connectionRoleIds)) {
|
|
9909
9933
|
mutatedProperties.saml_connection_implicit_role_assignments = localState.connectionRoleIds.map(function (role_id) { return { role_id: role_id }; });
|
|
9910
9934
|
}
|
|
9911
|
-
filteredGroupRoles = localState.groupedRoles.filter(function (
|
|
9935
|
+
filteredGroupRoles = localState.groupedRoles.filter(function (_ref85) { var group = _ref85.group, roleIds = _ref85.roleIds; return group && roleIds.length > 0; });
|
|
9912
9936
|
if (!deepEqual(remoteState.groupedRoles, filteredGroupRoles)) {
|
|
9913
|
-
mutatedProperties.saml_group_implicit_role_assignments = filteredGroupRoles.flatMap(function (
|
|
9937
|
+
mutatedProperties.saml_group_implicit_role_assignments = filteredGroupRoles.flatMap(function (_ref86) { var group = _ref86.group, roleIds = _ref86.roleIds; return roleIds.map(function (role_id) { return { group: group, role_id: role_id }; }); });
|
|
9914
9938
|
}
|
|
9915
9939
|
if (!(Object.keys(mutatedProperties).length > 0)) {
|
|
9916
9940
|
_context13.next = 7;
|
|
@@ -9921,9 +9945,9 @@ var RoleAssignmentsSection = function RoleAssignmentsSection(_ref81) { var canUp
|
|
|
9921
9945
|
case 8:
|
|
9922
9946
|
case "end": return _context13.stop();
|
|
9923
9947
|
} }, _callee12); })); }, [connection.connection_id, localState.connectionRoleIds, localState.groupedRoles, mutate, remoteState.connectionRoleIds, remoteState.groupedRoles]); var _useSsoRouterControll3 = useSsoRouterController(), useBlockNavigation = _useSsoRouterControll3.useBlockNavigation; return /*#__PURE__*/ wn.createElement(SettingsContainer, { title: "Role assignments", hasCTA: canUpdateConnection, onSave: handleSave, useBlockNavigation: useBlockNavigation, editing: editing, setEditing: handleSetEditing }, /*#__PURE__*/ wn.createElement(RoleAssignmentsSectionBody, { connection: connection, localState: localState, remoteState: remoteState, setLocalState: setLocalState })); };
|
|
9924
|
-
var SSOConnectionDetailsScreen = function SSOConnectionDetailsScreen(
|
|
9948
|
+
var SSOConnectionDetailsScreen = function SSOConnectionDetailsScreen(_ref87) { var connectionId = _ref87.connectionId; var _a, _b; var _useSsoRouterControll4 = useSsoRouterController(), navigate = _useSsoRouterControll4.navigate; var _useRbac5 = useRbac('stytch.sso', 'get'), canGetConnection = _useRbac5.data; var _useRbac6 = useRbac('stytch.sso', 'delete'), canDeleteConnection = _useRbac6.data; var _useRbac7 = useRbac('stytch.sso', 'update'), canUpdateConnection = _useRbac7.data; var _useSsoConnections = useSsoConnections({ shouldFetch: !!canGetConnection }), connections = _useSsoConnections.data, isLoading = _useSsoConnections.isLoading; var _useOrgInfo2 = useOrgInfo(), orgInfo = _useOrgInfo2.data; var defaultConnectionId = orgInfo === null || orgInfo === void 0 ? void 0 : orgInfo.sso_default_connection_id; var defaultConnectionName = F$3(function () { var _a; return connections ? (_a = [].concat(_toConsumableArray2(connections.oidc_connections), _toConsumableArray2(connections.saml_connections)).find(function (connection) { return connection.connection_id === defaultConnectionId; })) === null || _a === void 0 ? void 0 : _a.display_name : undefined; }, [connections, defaultConnectionId]); var connection = F$3(function () { var _a, _b; var oidcMatch = (_a = connections === null || connections === void 0 ? void 0 : connections.oidc_connections) === null || _a === void 0 ? void 0 : _a.find(function (_ref88) { var connection_id = _ref88.connection_id; return connection_id === connectionId; }); if (oidcMatch) {
|
|
9925
9949
|
return Object.assign(Object.assign({}, oidcMatch), { connectionType: 'oidc' });
|
|
9926
|
-
} var samlMatch = (_b = connections === null || connections === void 0 ? void 0 : connections.saml_connections) === null || _b === void 0 ? void 0 : _b.find(function (
|
|
9950
|
+
} var samlMatch = (_b = connections === null || connections === void 0 ? void 0 : connections.saml_connections) === null || _b === void 0 ? void 0 : _b.find(function (_ref89) { var connection_id = _ref89.connection_id; return connection_id === connectionId; }); if (samlMatch) {
|
|
9927
9951
|
return Object.assign(Object.assign({}, samlMatch), { connectionType: 'saml' });
|
|
9928
9952
|
} return null; }, [connectionId, connections === null || connections === void 0 ? void 0 : connections.oidc_connections, connections === null || connections === void 0 ? void 0 : connections.saml_connections]); var connectionType = connection === null || connection === void 0 ? void 0 : connection.connectionType; var connectionName = connection === null || connection === void 0 ? void 0 : connection.display_name; var isDefaultConnection = (connection === null || connection === void 0 ? void 0 : connection.connection_id) === defaultConnectionId; var isOnlyConnection = ((_a = connections === null || connections === void 0 ? void 0 : connections.oidc_connections.length) !== null && _a !== void 0 ? _a : 0) + ((_b = connections === null || connections === void 0 ? void 0 : connections.saml_connections.length) !== null && _b !== void 0 ? _b : 0) === 1; var _useDeleteConnection = useDeleteConnection({ onConfirm: function onConfirm() { navigate({ screen: 'connectionsList' }); } }), handleRequestDelete = _useDeleteConnection.handleRequestDelete, modalProps = _useDeleteConnection.modalProps; var handleDeleteClick = T$2(function () { if (connectionId && connectionName) {
|
|
9929
9953
|
handleRequestDelete({ id: connectionId, displayName: connectionName });
|
|
@@ -9933,11 +9957,11 @@ var transformOrigin$1 = { horizontal: 'right', vertical: 'top' };
|
|
|
9933
9957
|
var useActionMenuStyles = makeStyles(function (theme) { return { gutters: _defineProperty2({}, "&.".concat(classNamePrefix, "MuiListItem-gutters"), { padding: theme.spacing(1) }) }; });
|
|
9934
9958
|
var ActionMenuItem = function ActionMenuItem(_a) { var children = _a.children, onClick = _a.onClick, onClose = _a.onClose, color = _a.color, icon = _a.icon, item = _a.item, rest = __rest(_a, ["children", "onClick", "onClose", "color", "icon", "item"]); var classes = useActionMenuStyles(); var handleClick = T$2(function () { onClick(item); onClose === null || onClose === void 0 ? void 0 : onClose(); }, [item, onClick, onClose]); return /*#__PURE__*/ wn.createElement(MenuItem$2, Object.assign({}, rest, { disableRipple: true, onClick: handleClick, classes: classes }), /*#__PURE__*/ wn.createElement(Typography, { variant: "body2", color: color }, /*#__PURE__*/ wn.createElement(FlexBox, { alignItems: "center" }, icon, children))); };
|
|
9935
9959
|
var useStyles$5 = makeStyles(function () { return { icon: { '& svg': { height: 16, width: 16 } } }; });
|
|
9936
|
-
var IconButtonMenu = function IconButtonMenu(
|
|
9960
|
+
var IconButtonMenu = function IconButtonMenu(_ref90) { var actions = _ref90.actions, anchorElProp = _ref90.anchorEl, _ref90$closeOnClick = _ref90.closeOnClick, closeOnClick = _ref90$closeOnClick === void 0 ? true : _ref90$closeOnClick, icon = _ref90.icon, item = _ref90.item, idPrefix = _ref90.idPrefix, _ref90$menuAnchorOrig = _ref90.menuAnchorOrigin, menuAnchorOrigin = _ref90$menuAnchorOrig === void 0 ? anchorOrigin$1 : _ref90$menuAnchorOrig, _ref90$menuTransformO = _ref90.menuTransformOrigin, menuTransformOrigin = _ref90$menuTransformO === void 0 ? transformOrigin$1 : _ref90$menuTransformO, onClose = _ref90.onClose, onOpen = _ref90.onOpen; var _h58 = h$4(), _h59 = _slicedToArray2(_h58, 2), anchorEl = _h59[0], setAnchorEl = _h59[1]; var handleClose = T$2(function () { setAnchorEl(undefined); onClose === null || onClose === void 0 ? void 0 : onClose(); }, [onClose]); var handleOpen = T$2(function (e) { onOpen === null || onOpen === void 0 ? void 0 : onOpen(); setAnchorEl(anchorElProp !== null && anchorElProp !== void 0 ? anchorElProp : e.currentTarget); }, [anchorElProp, onOpen]); var id = useShortId(idPrefix); var children = F$3(function () { return actions.map(function (_ref91) { var key = _ref91.key, label = _ref91.label, onClick = _ref91.onClick, icon = _ref91.icon, isDangerous = _ref91.isDangerous, _ref91$isVisible = _ref91.isVisible, isVisible = _ref91$isVisible === void 0 ? true : _ref91$isVisible; if (!isVisible || typeof isVisible === 'function' && !isVisible(item)) {
|
|
9937
9961
|
return null;
|
|
9938
9962
|
} return /*#__PURE__*/ wn.createElement(ActionMenuItem, { key: key, item: item, onClick: onClick, onClose: closeOnClick ? handleClose : undefined, color: isDangerous ? 'error' : undefined, icon: icon }, label); }); }, [actions, closeOnClick, handleClose, item]); var isOpen = !!anchorEl; var classes = useStyles$5(); return /*#__PURE__*/ wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(IconButton$1, { disableTouchRipple: true, "aria-label": "actions", color: "inherit", onClick: handleOpen, "aria-controls": id, "aria-haspopup": true, size: "small" }, icon), /*#__PURE__*/ wn.createElement(Menu$1, { id: id, open: isOpen, anchorEl: anchorEl, getContentAnchorEl: null, variant: "menu", anchorOrigin: menuAnchorOrigin, transformOrigin: menuTransformOrigin, onClose: handleClose, className: classes.icon }, children)); };
|
|
9939
|
-
var ActionMenu = function ActionMenu(
|
|
9940
|
-
var useActionMenu = function useActionMenu(
|
|
9963
|
+
var ActionMenu = function ActionMenu(_ref92) { var actions = _ref92.actions, item = _ref92.item, idPrefix = _ref92.idPrefix; return /*#__PURE__*/ wn.createElement(IconButtonMenu, { actions: actions, item: item, idPrefix: idPrefix, icon: /*#__PURE__*/ wn.createElement(MoreVert, null) }); };
|
|
9964
|
+
var useActionMenu = function useActionMenu(_ref93) { var actions = _ref93.actions, idPrefix = _ref93.idPrefix, getId = _ref93.getId; var getItemActionProps = T$2(function (item) { var hasVisibleActions = actions.some(function (_ref94) { var _ref94$isVisible = _ref94.isVisible, isVisible = _ref94$isVisible === void 0 ? true : _ref94$isVisible; return typeof isVisible === 'function' ? isVisible(item) : isVisible; }); if (!hasVisibleActions) {
|
|
9941
9965
|
return {};
|
|
9942
9966
|
} return { customAction: ( /*#__PURE__*/wn.createElement("div", { style: { display: 'flex', width: '100%', justifyContent: 'center' } }, /*#__PURE__*/ wn.createElement(ActionMenu, { actions: actions, item: item, idPrefix: "".concat(idPrefix, "-action-menu-").concat(getId(item)) }))) }; }, [actions, getId, idPrefix]); return { getItemActionProps: getItemActionProps }; };
|
|
9943
9967
|
var DEFAULT_TABLE_ROWS_PER_PAGE = 20;
|
|
@@ -9997,7 +10021,7 @@ default_1$6 = Search["default"] = _default$6;
|
|
|
9997
10021
|
var Keys;
|
|
9998
10022
|
(function (Keys) { Keys["Backspace"] = "Backspace"; Keys["Tab"] = "Tab"; Keys["Enter"] = "Enter"; Keys["Space"] = " "; Keys["Shift"] = "Shift"; Keys["Control"] = "Control"; Keys["Alt"] = "Alt"; Keys["Command"] = "Meta"; Keys["Escape"] = "Escape"; Keys["PageUp"] = "PageUp"; Keys["PageDown"] = "PageDown"; Keys["ArrowLeft"] = "ArrowLeft"; Keys["ArrowUp"] = "ArrowUp"; Keys["ArrowRight"] = "ArrowRight"; Keys["ArrowDown"] = "ArrowDown"; Keys["Delete"] = "Delete"; Keys["Fn"] = "Fn"; Keys["End"] = "End"; Keys["Home"] = "Home"; Keys["Clear"] = "Clear"; Keys["Insert"] = "Insert"; Keys["A"] = "a"; Keys["B"] = "b"; Keys["C"] = "c"; Keys["D"] = "d"; Keys["E"] = "e"; Keys["F"] = "f"; Keys["G"] = "g"; Keys["H"] = "h"; Keys["I"] = "i"; Keys["J"] = "j"; Keys["K"] = "k"; Keys["L"] = "l"; Keys["M"] = "m"; Keys["N"] = "n"; Keys["O"] = "o"; Keys["P"] = "p"; Keys["Q"] = "q"; Keys["R"] = "r"; Keys["S"] = "s"; Keys["T"] = "t"; Keys["U"] = "u"; Keys["V"] = "v"; Keys["W"] = "w"; Keys["X"] = "x"; Keys["Y"] = "y"; Keys["Z"] = "z"; Keys["Zero"] = "0"; Keys["One"] = "1"; Keys["Two"] = "2"; Keys["Three"] = "3"; Keys["Four"] = "4"; Keys["Five"] = "5"; Keys["Six"] = "6"; Keys["Seven"] = "7"; Keys["Eight"] = "8"; Keys["Nine"] = "9"; Keys["F1"] = "F1"; Keys["F2"] = "F2"; Keys["F3"] = "F3"; Keys["F4"] = "F4"; Keys["F5"] = "F5"; Keys["F6"] = "F6"; Keys["F7"] = "F7"; Keys["F8"] = "F8"; Keys["F9"] = "F9"; Keys["F10"] = "F10"; Keys["F11"] = "F11"; Keys["F12"] = "F12"; Keys["Hyphen"] = "-"; Keys["ForwardSlash"] = "/"; Keys["BackSlash"] = "\\"; })(Keys || (Keys = {}));
|
|
9999
10023
|
var makeSearchBarStyles = makeStylesFactory(function (theme) { return { searchBar: { position: 'relative', width: '100%' }, icon: { alignItems: 'center', display: 'flex', justifyContent: 'center', position: 'absolute', bottom: 0, marginBottom: theme.spacing(1) }, searchInput: { '& input': { paddingLeft: "".concat(theme.spacing(4), "px !important"), paddingRight: "".concat(theme.spacing(6), "px !important") }, '&:hover': { cursor: 'pointer' } }, searchIcon: { padding: theme.spacing(0.5, 1, 0, 1) }, slashIcon: { border: '1px solid', borderRadius: theme.shape.borderRadius, padding: theme.spacing(0, 1) }, slashIconContainer: { right: theme.spacing(1) } }; });
|
|
10000
|
-
var SearchBarCore = function SearchBarCore(_a) { var classes = _a.classes, Input = _a.InputComponent, inputProps = __rest(_a, ["classes", "InputComponent"]); var
|
|
10024
|
+
var SearchBarCore = function SearchBarCore(_a) { var classes = _a.classes, Input = _a.InputComponent, inputProps = __rest(_a, ["classes", "InputComponent"]); var _h60 = h$4(null), _h61 = _slicedToArray2(_h60, 2), inputRef = _h61[0], setInputRef = _h61[1]; var _h62 = h$4(false), _h63 = _slicedToArray2(_h62, 2), focused = _h63[0], setFocused = _h63[1]; var onFocus = T$2(function () { return setFocused(true); }, []); var onBlur = T$2(function () { return setFocused(false); }, []); p$3(function () { var handleKey = function handleKey(e) { if (inputRef && !focused) {
|
|
10001
10025
|
if (e.metaKey && e.key === Keys.K || e.key === Keys.ForwardSlash) {
|
|
10002
10026
|
e.stopPropagation();
|
|
10003
10027
|
inputRef.focus();
|
|
@@ -10014,27 +10038,27 @@ var tryParseJson = function tryParseJson(value) { try {
|
|
|
10014
10038
|
}
|
|
10015
10039
|
}
|
|
10016
10040
|
catch (e) { } return undefined; };
|
|
10017
|
-
var makeUseStorage = function makeUseStorage(storage) { return function (defaultValue, key) { var publicToken = useB2BInternals().publicToken; var fullKey = getPersistentStorageKey(publicToken, key); var
|
|
10018
|
-
var useLocalStorage = makeUseStorage(localStorage);
|
|
10041
|
+
var makeUseStorage = function makeUseStorage(storage) { return function (defaultValue, key) { var publicToken = useB2BInternals().publicToken; var fullKey = getPersistentStorageKey(publicToken, key); var _h64 = h$4(function () { var storedValue = storage === null || storage === void 0 ? void 0 : storage.getItem(fullKey); return storedValue ? tryParseJson(storedValue) : defaultValue; }), _h65 = _slicedToArray2(_h64, 2), cachedValue = _h65[0], setCachedValue = _h65[1]; var setValue = function setValue(value) { storage === null || storage === void 0 ? void 0 : storage.setItem(fullKey, JSON.stringify(value)); setCachedValue(value); }; return [cachedValue, setValue]; }; };
|
|
10042
|
+
var useLocalStorage = makeUseStorage(typeof window !== 'undefined' ? window.localStorage : undefined);
|
|
10019
10043
|
var itemsPerPageOptions = [10, 15, 25, 50, 100];
|
|
10020
10044
|
var DEFAULT_ITEMS_PER_PAGE = 15;
|
|
10021
|
-
var useItemsPerPage = function useItemsPerPage(
|
|
10045
|
+
var useItemsPerPage = function useItemsPerPage(_ref95) { var viewId = _ref95.viewId, _ref95$defaultItemsPe = _ref95.defaultItemsPerPage, defaultItemsPerPage = _ref95$defaultItemsPe === void 0 ? DEFAULT_ITEMS_PER_PAGE : _ref95$defaultItemsPe; var _useLocalStorage = useLocalStorage(defaultItemsPerPage, "".concat(viewId, "_itemsPerPage")), _useLocalStorage2 = _slicedToArray2(_useLocalStorage, 2), itemsPerPage = _useLocalStorage2[0], setItemsPerPage = _useLocalStorage2[1]; var handleItemsPerPageChange = function handleItemsPerPageChange(e) { var value = parseInt(e.target.value, 10); if (!Number.isNaN(value)) {
|
|
10022
10046
|
setItemsPerPage(value);
|
|
10023
10047
|
} }; return [itemsPerPage, handleItemsPerPageChange]; };
|
|
10024
|
-
var usePagination = function usePagination(
|
|
10048
|
+
var usePagination = function usePagination(_ref96) { var itemsCount = _ref96.itemsCount, itemsPerPage = _ref96.itemsPerPage; var _h66 = h$4(0), _h67 = _slicedToArray2(_h66, 2), currentPage = _h67[0], setCurrentPage = _h67[1]; var pageCount = Math.ceil(itemsCount / itemsPerPage); var lastPageIndex = Math.max(0, pageCount - 1); if (currentPage > lastPageIndex) {
|
|
10025
10049
|
setCurrentPage(lastPageIndex);
|
|
10026
10050
|
} return { currentPage: currentPage, setCurrentPage: setCurrentPage }; };
|
|
10027
|
-
var useDisplayPagination = function useDisplayPagination(
|
|
10028
|
-
var itemRenderer = [{ title: 'Display Name', getValue: function getValue(
|
|
10051
|
+
var useDisplayPagination = function useDisplayPagination(_ref97) { var items = _ref97.items, _ref97$defaultItemsPe = _ref97.defaultItemsPerPage, defaultItemsPerPage = _ref97$defaultItemsPe === void 0 ? 15 : _ref97$defaultItemsPe, viewId = _ref97.viewId; var _useItemsPerPage = useItemsPerPage({ viewId: viewId, defaultItemsPerPage: defaultItemsPerPage }), _useItemsPerPage2 = _slicedToArray2(_useItemsPerPage, 2), itemsPerPage = _useItemsPerPage2[0], handleItemsPerPageChange = _useItemsPerPage2[1]; var _usePagination = usePagination({ itemsCount: items.length, itemsPerPage: itemsPerPage }), currentPage = _usePagination.currentPage, setCurrentPage = _usePagination.setCurrentPage; var metadata = F$3(function () { return { total: items.length, cursor: 'none' }; }, [items.length]); return { items: items, currentPage: currentPage, setCurrentPage: setCurrentPage, loadNext: noop, metadata: metadata, rowsPerPage: itemsPerPage, rowsPerPageOptions: itemsPerPageOptions, onRowsPerPageChange: handleItemsPerPageChange }; };
|
|
10052
|
+
var itemRenderer = [{ title: 'Display Name', getValue: function getValue(_ref98) { var displayName = _ref98.displayName, isDefault = _ref98.isDefault; return isDefault ? ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, displayName, " ", /*#__PURE__*/ wn.createElement(Tag, { size: "small" }, "Default"))) : displayName; } }, { title: 'IdP', getValue: function getValue(_ref99) { var idp = _ref99.idp, connectionType = _ref99.connectionType; return getIdpInfo(idp, connectionType).idp.displayName; } }, { title: 'Status', getValue: function getValue(_ref100) { var status = _ref100.status; switch (status) {
|
|
10029
10053
|
case 'active': return 'Active';
|
|
10030
10054
|
case 'pending': return 'Pending';
|
|
10031
10055
|
default: return status;
|
|
10032
10056
|
} } }];
|
|
10033
|
-
var useSearchFilter = function useSearchFilter(
|
|
10057
|
+
var useSearchFilter = function useSearchFilter(_ref101) { var data = _ref101.data, searchKeys = _ref101.searchKeys; var _h68 = h$4(''), _h69 = _slicedToArray2(_h68, 2), filterText = _h69[0], setFilterText = _h69[1]; var filteredData = F$3(function () { if (!filterText) {
|
|
10034
10058
|
return data;
|
|
10035
10059
|
} var filterTextLower = filterText.toLowerCase(); return data.filter(function (item) { return searchKeys.some(function (key) { return String(item[key]).toLowerCase().includes(filterTextLower); }); }); }, [data, filterText, searchKeys]); return { filteredData: filteredData, filterText: filterText, setFilterText: setFilterText }; };
|
|
10036
10060
|
var useCanProjectCreateSsoConnection = function useCanProjectCreateSsoConnection() { var _useAdminPortalConfig = useAdminPortalConfig(), data = _useAdminPortalConfig.data; return (data === null || data === void 0 ? void 0 : data.sso_config.can_create_oidc_connection) && data.sso_config.can_create_saml_connection; };
|
|
10037
|
-
var useConnections = function useConnections(canGetSso) { var _a; var ssoConnections = useSsoConnections(canGetSso); var orgInfo = useOrgInfo(); var defaultConnectionId = (_a = orgInfo.data) === null || _a === void 0 ? void 0 : _a.sso_default_connection_id; var connections = F$3(function () { return ssoConnections.data ? [].concat(_toConsumableArray2(ssoConnections.data.saml_connections.map(function (c) { return Object.assign({ connectionType: 'saml' }, c); })), _toConsumableArray2(ssoConnections.data.oidc_connections.map(function (c) { return Object.assign({ connectionType: 'oidc' }, c); }))).map(function (connection) { return { displayName: connection.display_name, idp: connection.identity_provider, connectionType: connection.connectionType, status: connection.status, id: connection.connection_id, isDefault: connection.connection_id === defaultConnectionId }; }).sort(function (a, b) { return collator.compare(a.displayName, b.displayName); }) : []; }, [defaultConnectionId, ssoConnections.data]); return { connections: connections, isLoading: ssoConnections.isLoading }; };
|
|
10061
|
+
var useConnections = function useConnections(canGetSso) { var _a; var ssoConnections = useSsoConnections({ shouldFetch: canGetSso }); var orgInfo = useOrgInfo(); var defaultConnectionId = (_a = orgInfo.data) === null || _a === void 0 ? void 0 : _a.sso_default_connection_id; var connections = F$3(function () { return ssoConnections.data ? [].concat(_toConsumableArray2(ssoConnections.data.saml_connections.map(function (c) { return Object.assign({ connectionType: 'saml' }, c); })), _toConsumableArray2(ssoConnections.data.oidc_connections.map(function (c) { return Object.assign({ connectionType: 'oidc' }, c); }))).map(function (connection) { return { displayName: connection.display_name, idp: connection.identity_provider, connectionType: connection.connectionType, status: connection.status, id: connection.connection_id, isDefault: connection.connection_id === defaultConnectionId }; }).sort(function (a, b) { return collator.compare(a.displayName, b.displayName); }) : []; }, [defaultConnectionId, ssoConnections.data]); return { connections: connections, isLoading: ssoConnections.isLoading }; };
|
|
10038
10062
|
var getConnectionId = function getConnectionId(connection) { return connection.id; };
|
|
10039
10063
|
var SSOConnectionsScreen = function SSOConnectionsScreen() { var _useSsoRouterControll5 = useSsoRouterController(), navigate = _useSsoRouterControll5.navigate; var canProjectCreateSsoConnection = useCanProjectCreateSsoConnection(); var _useRbac8 = useRbac('stytch.sso', 'get'), canGetConnection = _useRbac8.data; var _useRbac9 = useRbac('stytch.sso', 'create'), canCreatePermission = _useRbac9.data; var _useRbac10 = useRbac('stytch.sso', 'delete'), canDeleteConnection = _useRbac10.data; var _useRbac11 = useRbac('stytch.sso', 'update'), canUpdateConnection = _useRbac11.data; var _useRbac12 = useRbac('stytch.organization', 'update.settings.default-sso-connection'), canSetDefaultConnection = _useRbac12.data; var canCreateConnection = canCreatePermission && canProjectCreateSsoConnection; var _useConnections = useConnections(!!canGetConnection), connections = _useConnections.connections, isLoading = _useConnections.isLoading; var _useSearchFilter = useSearchFilter({ data: connections, searchKeys: ['displayName'] }), filterText = _useSearchFilter.filterText, setFilterText = _useSearchFilter.setFilterText, filteredData = _useSearchFilter.filteredData; var tableProps = useDisplayPagination({ items: filteredData, viewId: 'adminPortalSsoConnections' }); var defaultConnectionName = F$3(function () { var _a; return (_a = connections.find(function (connection) { return connection.isDefault; })) === null || _a === void 0 ? void 0 : _a.displayName; }, [connections]); var _useSetDefaultConnect2 = useSetDefaultConnection({ defaultConnectionName: defaultConnectionName }), setDefaultModalProps = _useSetDefaultConnect2.modalProps, handleSetDefault = _useSetDefaultConnect2.handleRequestSetDefault; var _useDeleteConnection2 = useDeleteConnection(), deleteModalProps = _useDeleteConnection2.modalProps, handleDelete = _useDeleteConnection2.handleRequestDelete; var handleEdit = T$2(function (connection) { navigate({ screen: 'connectionDetails', params: { connectionId: connection.id } }); }, [navigate]); var handleNewConnectionClick = T$2(function () { navigate({ screen: 'newConnection' }); }, [navigate]); var hasExactlyOneConnection = connections.length === 1; var actions = F$3(function () { return [{ key: 'view', label: 'View connection', icon: /*#__PURE__*/ wn.createElement(VisibilityOutlined$1, null), onClick: handleEdit, isVisible: !canUpdateConnection }, { key: 'edit', label: 'Edit connection', icon: /*#__PURE__*/ wn.createElement(EditOutlined$1, null), onClick: handleEdit, isVisible: !!canUpdateConnection }, { key: 'set-default', label: 'Set as default', icon: /*#__PURE__*/ wn.createElement(Tune, null), onClick: handleSetDefault, isVisible: function isVisible(connection) { return !connection.isDefault && !!canSetDefaultConnection; } }, { key: 'delete', label: 'Delete', icon: /*#__PURE__*/ wn.createElement(DeleteOutlined$1, null), onClick: handleDelete, isDangerous: true, isVisible: function isVisible(connection) { return (!connection.isDefault || hasExactlyOneConnection) && !!canDeleteConnection; } }]; }, [canDeleteConnection, canSetDefaultConnection, canUpdateConnection, handleDelete, handleEdit, handleSetDefault, hasExactlyOneConnection]); var _useActionMenu = useActionMenu({ actions: actions, idPrefix: 'connection', getId: getConnectionId }), getItemActionProps = _useActionMenu.getItemActionProps; return /*#__PURE__*/ wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 3 }, canCreatePermission && !canCreateConnection && ( /*#__PURE__*/wn.createElement(Alert, null, "You\u2019ve reached the maximum number of allowed connections. Delete an existing connection in order to add a new one.")), /*#__PURE__*/ wn.createElement(FlexBox, { alignItems: "center", justifyContent: "space-between" }, /*#__PURE__*/ wn.createElement(Typography, { variant: "h1" }, "SSO Connections"), canCreateConnection && ( /*#__PURE__*/wn.createElement(Button, { variant: "primary", startIcon: /*#__PURE__*/ wn.createElement(Add$1, null), onClick: handleNewConnectionClick }, "New connection"))), /*#__PURE__*/ wn.createElement(SearchBar, { placeholder: "Search", value: filterText, onChange: setFilterText }), /*#__PURE__*/ wn.createElement(PaginatedTable, Object.assign({}, tableProps, { itemRenderer: itemRenderer, isLoading: isLoading, titleVariant: "h4", getItemActionProps: getItemActionProps }))), /*#__PURE__*/ wn.createElement(SetDefaultConfirmModal, Object.assign({}, setDefaultModalProps)), /*#__PURE__*/ wn.createElement(DeleteConfirmModal, Object.assign({}, deleteModalProps))); };
|
|
10040
10064
|
var makeAccordionStyles = makeStylesFactory(function (theme) { return { accordion: _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({}, "&.".concat(classNamePrefix, "Mui-expanded.").concat(classNamePrefix, "Mui-expanded, &.").concat(classNamePrefix, "Mui-expanded + &.").concat(classNamePrefix, "MuiAccordion-root"), { border: '1px solid' }), "&:not(.".concat(classNamePrefix, "Mui-expanded) + *"), { borderWidth: '0px 1px 1px' }), "&.".concat(classNamePrefix, "MuiAccordion-root:before"), { display: 'none' }), "border", 'solid'), "borderWidth", '1px 1px 1px'), accordionDetails: { alignItems: 'flex-start', display: 'flex', flexDirection: 'column', padding: theme.spacing(2) }, accordionExpanded: { '& $accordionSummary': { margin: theme.spacing(1.5, 0) }, minHeight: '0 !important' }, accordionSummary: { alignItems: 'center', display: 'flex', margin: theme.spacing(1.5, 0) } }; });
|
|
@@ -10045,8 +10069,8 @@ var useStyles$2 = makeAccordionStyles(function (theme) { return { accordion: _de
|
|
|
10045
10069
|
var Accordion = function Accordion(props) { var classes = useStyles$2(); return /*#__PURE__*/ wn.createElement(AccordionCore, Object.assign({}, props, { classes: classes })); };
|
|
10046
10070
|
var AccordionSummary = function AccordionSummary(props) { var classes = useStyles$2(); return /*#__PURE__*/ wn.createElement(AccordionSummaryCore, Object.assign({}, props, { classes: classes })); };
|
|
10047
10071
|
var AccordionDetails = function AccordionDetails(props) { var classes = useStyles$2(); return /*#__PURE__*/ wn.createElement(AccordionDetailsCore, Object.assign({}, props, { classes: classes })); };
|
|
10048
|
-
var useManualConfigurationState = function useManualConfigurationState(
|
|
10049
|
-
var SSONewConnectionConfigureScreen = function SSONewConnectionConfigureScreen(
|
|
10072
|
+
var useManualConfigurationState = function useManualConfigurationState(_ref102) { var idp = _ref102.idp, type = _ref102.type; var _h70 = h$4(false), _h71 = _slicedToArray2(_h70, 2), manualConfigurationState = _h71[0], setManualConfigurationState = _h71[1]; var idpRequiresManualConfig = type === 'saml' && idp.metadataUrlLabel === false; var manualConfiguration = manualConfigurationState || idpRequiresManualConfig; return [manualConfiguration, setManualConfigurationState]; };
|
|
10073
|
+
var SSONewConnectionConfigureScreen = function SSONewConnectionConfigureScreen(_ref103) { var connectionProp = _ref103.connection; var _a; var _useSsoRouterControll6 = useSsoRouterController(), navigate = _useSsoRouterControll6.navigate; var info = getIdpAndConnectionInfo(connectionProp); var connection = info.connection, idp = info.idp, type = info.type; var connectionDisplayName = connection.display_name; var _useMutateSsoConnecti3 = useMutateSsoConnection(type), mutate = _useMutateSsoConnecti3.mutate; var _useMutateSsoConnecti4 = useMutateSsoConnectionByUrl(), mutateByUrl = _useMutateSsoConnecti4.mutate; var _useSsoRouterControll7 = useSsoRouterController(), useBlockNavigation = _useSsoRouterControll7.useBlockNavigation; var _h72 = h$4(true), _h73 = _slicedToArray2(_h72, 2), block = _h73[0], setBlock = _h73[1]; var _useBlockNavigation2 = useBlockNavigation(block), allowNavigation = _useBlockNavigation2.allowNavigation, blocked = _useBlockNavigation2.blocked, cancelNavigation = _useBlockNavigation2.cancelNavigation; var _useManualConfigurati = useManualConfigurationState(info), _useManualConfigurati2 = _slicedToArray2(_useManualConfigurati, 2), manualConfiguration = _useManualConfigurati2[0], setManualConfiguration = _useManualConfigurati2[1]; var _h74 = h$4(''), _h75 = _slicedToArray2(_h74, 2), metadataUrl = _h75[0], setMetadataUrl = _h75[1]; var _h76 = h$4(''), _h77 = _slicedToArray2(_h76, 2), ssoUrl = _h77[0], setSsoUrl = _h77[1]; var _h78 = h$4(''), _h79 = _slicedToArray2(_h78, 2), entityId = _h79[0], setEntityId = _h79[1]; var _h80 = h$4(''), _h81 = _slicedToArray2(_h80, 2), x509Certificate = _h81[0], setX509Certificate = _h81[1]; var _h82 = h$4(''), _h83 = _slicedToArray2(_h82, 2), clientId = _h83[0], setClientId = _h83[1]; var _h84 = h$4(''), _h85 = _slicedToArray2(_h84, 2), clientSecret = _h85[0], setClientSecret = _h85[1]; var _h86 = h$4(''), _h87 = _slicedToArray2(_h86, 2), issuer = _h87[0], setIssuer = _h87[1]; var _h88 = h$4(''), _h89 = _slicedToArray2(_h88, 2), issuerDerivedValue = _h89[0], setIssuerDerivedValue = _h89[1]; var _h90 = h$4(''), _h91 = _slicedToArray2(_h90, 2), authorizationUrl = _h91[0], setAuthorizationUrl = _h91[1]; var _h92 = h$4(''), _h93 = _slicedToArray2(_h92, 2), tokenUrl = _h93[0], setTokenUrl = _h93[1]; var _h94 = h$4(''), _h95 = _slicedToArray2(_h94, 2), userInfoUrl = _h95[0], setUserInfoUrl = _h95[1]; var _h96 = h$4(''), _h97 = _slicedToArray2(_h96, 2), jwksUrl = _h97[0], setJwksUrl = _h97[1]; var _h98 = h$4({ attributeMapping: { email: 'NameID', first_name: 'firstName', last_name: 'lastName', groups: '' } }), _h99 = _slicedToArray2(_h98, 2), attributeMappingState = _h99[0], setAttributeMappingState = _h99[1]; var attributeMapping = F$3(function () { return Object.fromEntries(Object.entries(attributeMappingState.attributeMapping).filter(function (_ref104) { var _ref105 = _slicedToArray2(_ref104, 2), value = _ref105[1]; return value; })); }, [attributeMappingState.attributeMapping]); var _useToast5 = useToast(), openToast = _useToast5.openToast; var handleSubmit = T$2(function (e) { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee15() { var options, message; return _regeneratorRuntime().wrap(function _callee15$(_context16) { while (1)
|
|
10050
10074
|
switch (_context16.prev = _context16.next) {
|
|
10051
10075
|
case 0:
|
|
10052
10076
|
e.preventDefault();
|
|
@@ -10114,7 +10138,7 @@ var SSONewConnectionConfigureScreen = function SSONewConnectionConfigureScreen(_
|
|
|
10114
10138
|
case 30:
|
|
10115
10139
|
case "end": return _context16.stop();
|
|
10116
10140
|
} }, _callee15, null, [[3, 26]]); })); }, [connection, type, navigate, manualConfiguration, mutate, ssoUrl, entityId, x509Certificate, attributeMapping, metadataUrl, mutateByUrl, clientId, clientSecret, idp, issuerDerivedValue, issuer, authorizationUrl, tokenUrl, userInfoUrl, jwksUrl, openToast]); var idpValueInputs = type === 'saml' ? { ssoUrl: ( /*#__PURE__*/wn.createElement(Input$1, { label: idp.idpSsoUrlLabel, labelVariant: "body1", placeholder: "Enter ".concat(idp.idpSsoUrlLabel), value: ssoUrl, onChange: setSsoUrl })), entityId: ( /*#__PURE__*/wn.createElement(Input$1, { label: idp.idpEntityIdLabel, labelVariant: "body1", placeholder: "Enter ".concat(idp.idpEntityIdLabel), value: entityId, onChange: setEntityId })), certificate: ( /*#__PURE__*/wn.createElement(Input$1, { label: idp.x509CertificateLabel, labelVariant: "body1", placeholder: "Enter ".concat(idp.x509CertificateLabel), value: x509Certificate, onChange: setX509Certificate })) } : undefined; var stepMap = { copyToIdp: ( /*#__PURE__*/wn.createElement(Accordion, null, /*#__PURE__*/ wn.createElement(AccordionSummary, null, /*#__PURE__*/ wn.createElement(Typography, null, "Copy the following App values to your IdP.")), /*#__PURE__*/ wn.createElement(AccordionDetails, null, /*#__PURE__*/ wn.createElement(SettingsList, null, /*#__PURE__*/ wn.createElement(AppDetails, { connection: connection }))))), copyFromIdp: ( /*#__PURE__*/wn.createElement(Accordion, null, /*#__PURE__*/ wn.createElement(AccordionSummary, null, /*#__PURE__*/ wn.createElement(Typography, null, "Enter the following IdP values.")), /*#__PURE__*/ wn.createElement(AccordionDetails, null, /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, type === 'saml' && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, manualConfiguration && idpValueInputs ? idp.idpValueOrder.map(function (key) { return /*#__PURE__*/ wn.createElement(wn.Fragment, { key: key }, idpValueInputs[key]); }) : ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement("label", null, /*#__PURE__*/ wn.createElement(Typography, null, "Enter the ", idp.metadataUrlLabel, " to configure your connection automatically."), /*#__PURE__*/ wn.createElement(Input$1, { placeholder: "Enter ".concat(idp.metadataUrlLabel), caption: "If you don\u2019t know your ".concat(idp.metadataUrlLabel, ", you can configure your connection manually."), value: metadataUrl, onChange: setMetadataUrl })))), !!idp.metadataUrlLabel && ( /*#__PURE__*/wn.createElement(Button, { compact: true, variant: "ghost", onClick: function onClick() { setManualConfiguration(!manualConfiguration); } }, manualConfiguration ? "Configure using ".concat(idp.metadataUrlLabel) : 'Configure manually')))), type === 'oidc' && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Input$1, { label: idp.clientIdLabel, labelVariant: "body1", placeholder: "Enter ".concat(idp.clientIdLabel), value: clientId, onChange: setClientId }), /*#__PURE__*/ wn.createElement(Input$1, { label: idp.clientSecretLabel, labelVariant: "body1", placeholder: "Enter ".concat(idp.clientSecretLabel), value: clientSecret, onChange: setClientSecret }), idp.transformInputToIssuer ? ( /*#__PURE__*/wn.createElement(Input$1, { label: idp.issuerDerivedLabel, labelVariant: "body1", placeholder: "Enter ".concat(idp.issuerDerivedLabel), value: issuerDerivedValue, onChange: setIssuerDerivedValue })) : ( /*#__PURE__*/wn.createElement(Input$1, { label: idp.issuerLabel, labelVariant: "body1", placeholder: "Enter ".concat(idp.issuerLabel), value: issuer, onChange: setIssuer })), manualConfiguration && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Input$1, { label: "Authorization URL", labelVariant: "body1", placeholder: "Enter Authorization URL", value: authorizationUrl, onChange: setAuthorizationUrl }), /*#__PURE__*/ wn.createElement(Input$1, { label: "Token URL", labelVariant: "body1", placeholder: "Enter Token URL", value: tokenUrl, onChange: setTokenUrl }), /*#__PURE__*/ wn.createElement(Input$1, { label: "User Info URL", labelVariant: "body1", placeholder: "Enter User Info", value: userInfoUrl, onChange: setUserInfoUrl }), /*#__PURE__*/ wn.createElement(Input$1, { label: "JWKS URL", labelVariant: "body1", placeholder: "Enter JWKS URL", value: jwksUrl, onChange: setJwksUrl }))), /*#__PURE__*/ wn.createElement(Button, { compact: true, variant: "ghost", onClick: function onClick() { setManualConfiguration(!manualConfiguration); } }, manualConfiguration ? "Configure using ".concat((_a = idp.issuerDerivedLabel) !== null && _a !== void 0 ? _a : idp.issuerLabel) : 'Configure manually'))))))), attributeMapping: type === 'saml' && ( /*#__PURE__*/wn.createElement(Accordion, null, /*#__PURE__*/ wn.createElement(AccordionSummary, null, /*#__PURE__*/ wn.createElement(Typography, null, "Set your ", idp.attributeMappingLabel, ".")), /*#__PURE__*/ wn.createElement(AccordionDetails, null, /*#__PURE__*/ wn.createElement(Typography, null, "The following values are automatically filled based on your IdP. Make changes or add custom mappings."), /*#__PURE__*/ wn.createElement(AttributeMappingTable, { editing: true, localState: attributeMappingState, setLocalState: setAttributeMappingState, remoteState: attributeMappingState })))) }; var steps = idp.setupOrder.map(function (step) { return /*#__PURE__*/ wn.createElement(wn.Fragment, { key: step }, stepMap[step]); }); return /*#__PURE__*/ wn.createElement("form", { onSubmit: handleSubmit }, /*#__PURE__*/ wn.createElement(Modal, { isOpen: block && blocked, close: cancelNavigation, confirm: function confirm() { allowNavigation(); return Promise.resolve(); }, title: "Save ".concat(connectionDisplayName, "?"), confirmButtonText: "Save and complete later", description: 'Your SSO connection is not fully configured. It will remain pending until you complete all necessary configuration steps. You can save your progress and complete later or cancel to finish configuration.' }), /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 3 }, /*#__PURE__*/ wn.createElement(Button, { variant: "ghost", compact: true, onClick: function onClick() { navigate({ screen: 'connectionsList' }); }, startIcon: /*#__PURE__*/ wn.createElement(ChevronLeft$1, null) }, "Back to all SSO connections"), /*#__PURE__*/ wn.createElement(Typography, { variant: "h2" }, "Configure ", connectionDisplayName), /*#__PURE__*/ wn.createElement("div", null, steps), /*#__PURE__*/ wn.createElement(FlexBox, { justifyContent: "flex-end" }, /*#__PURE__*/ wn.createElement(Button, { type: "submit" }, "Create")))); };
|
|
10117
|
-
var SSONewConnectionScreen = function SSONewConnectionScreen() { var _useSsoRouterControll8 = useSsoRouterController(), navigate = _useSsoRouterControll8.navigate; var
|
|
10141
|
+
var SSONewConnectionScreen = function SSONewConnectionScreen() { var _useSsoRouterControll8 = useSsoRouterController(), navigate = _useSsoRouterControll8.navigate; var _h100 = h$4(''), _h101 = _slicedToArray2(_h100, 2), displayName = _h101[0], setDisplayName = _h101[1]; var _h102 = h$4(), _h103 = _slicedToArray2(_h102, 2), idp = _h103[0], setIdp = _h103[1]; var canCreate = displayName && idp; var client = useStytchClient(); var _useSWRConfig4 = useSWRConfig(), mutate = _useSWRConfig4.mutate; var revalidateConnectionList = useRevalidateConnectionList(); var handleSubmit = T$2(function (e) { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee17() { var _idpOptions$idp, idpName, type, response; return _regeneratorRuntime().wrap(function _callee17$(_context18) { while (1)
|
|
10118
10142
|
switch (_context18.prev = _context18.next) {
|
|
10119
10143
|
case 0:
|
|
10120
10144
|
e.preventDefault();
|
|
@@ -10173,9 +10197,9 @@ var isEmptyObject = function isEmptyObject(value) { for (var prop in value) {
|
|
|
10173
10197
|
return false;
|
|
10174
10198
|
}
|
|
10175
10199
|
} return true; };
|
|
10176
|
-
var useMutateOrgSettingsDetails = function useMutateOrgSettingsDetails() { var _useMutateOrganizatio3 = useMutateOrganization(), mutate = _useMutateOrganizatio3.mutate; var setOrgDetails = function setOrgDetails(
|
|
10177
|
-
var OrgSettingsDetailsBody = function OrgSettingsDetailsBody(
|
|
10178
|
-
var OrgSettingsDetailsSection = function OrgSettingsDetailsSection(
|
|
10200
|
+
var useMutateOrgSettingsDetails = function useMutateOrgSettingsDetails() { var _useMutateOrganizatio3 = useMutateOrganization(), mutate = _useMutateOrganizatio3.mutate; var setOrgDetails = function setOrgDetails(_ref106) { var organizationName = _ref106.organizationName, organizationSlug = _ref106.organizationSlug; return mutate(Object.assign(Object.assign({}, organizationName && { organization_name: organizationName }), organizationSlug && { organization_slug: organizationSlug }), { errorMessage: 'Failed to update organization details.' }); }; return { setOrgDetails: setOrgDetails }; };
|
|
10201
|
+
var OrgSettingsDetailsBody = function OrgSettingsDetailsBody(_ref107) { var canSetName = _ref107.canSetName, canSetSlug = _ref107.canSetSlug, remoteState = _ref107.remoteState, localState = _ref107.localState, setLocalState = _ref107.setLocalState; var handleNameChange = useStateSliceSetter(setLocalState, 'organizationName'); var handleSlugChange = useStateSliceSetter(setLocalState, 'organizationSlug'); var _useSettingsContainer4 = useSettingsContainer(), editing = _useSettingsContainer4.editing; return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, /*#__PURE__*/ wn.createElement(SettingsList, null, /*#__PURE__*/ wn.createElement(SettingsListItem, { title: "Name" }, editing && canSetName ? ( /*#__PURE__*/wn.createElement(Input$1, { placeholder: "Enter Name", value: localState.organizationName, onChange: handleNameChange })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, remoteState.organizationName))), /*#__PURE__*/ wn.createElement(SettingsListItem, { title: "Slug" }, editing && canSetSlug ? ( /*#__PURE__*/wn.createElement(Input$1, { placeholder: "Enter Slug", value: localState.organizationSlug, onChange: handleSlugChange })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, remoteState.organizationSlug))))); };
|
|
10202
|
+
var OrgSettingsDetailsSection = function OrgSettingsDetailsSection(_ref108) { var orgInfo = _ref108.orgInfo; var _useRbac14 = useRbac('stytch.organization', 'update.info.name'), canSetName = _useRbac14.data; var _useRbac15 = useRbac('stytch.organization', 'update.info.slug'), canSetSlug = _useRbac15.data; var remoteState = F$3(function () { return { organizationName: orgInfo.organization_name, organizationSlug: orgInfo.organization_slug }; }, [orgInfo]); var _useFormState4 = useFormState({ remoteState: remoteState }), localState = _useFormState4.localState, setLocalState = _useFormState4.setLocalState, editing = _useFormState4.editing, handleSetEditing = _useFormState4.handleSetEditing; var _useOrgSettingsRouter = useOrgSettingsRouterController(), useBlockNavigation = _useOrgSettingsRouter.useBlockNavigation; var _useMutateOrgSettings = useMutateOrgSettingsDetails(), setOrgDetails = _useMutateOrgSettings.setOrgDetails; var findMutatedProperties = T$2(function () { var mutatedProperties = {}; if (remoteState.organizationName !== localState.organizationName && localState.organizationName.length > 0) {
|
|
10179
10203
|
mutatedProperties.organizationName = localState.organizationName;
|
|
10180
10204
|
} if (remoteState.organizationSlug !== localState.organizationSlug && localState.organizationSlug.length > 0) {
|
|
10181
10205
|
mutatedProperties.organizationSlug = localState.organizationSlug;
|
|
@@ -10194,7 +10218,7 @@ var OrgSettingsDetailsSection = function OrgSettingsDetailsSection(_ref107) { va
|
|
|
10194
10218
|
case "end": return _context19.stop();
|
|
10195
10219
|
} }, _callee18); })); }, [setOrgDetails, findMutatedProperties]); var disableSave = isEmptyObject(findMutatedProperties()); return /*#__PURE__*/ wn.createElement(SettingsContainer, { title: "Details", hasCTA: canSetName || canSetSlug, onSave: handleSave, useBlockNavigation: useBlockNavigation, editing: editing, setEditing: handleSetEditing, disableSave: disableSave }, /*#__PURE__*/ wn.createElement(OrgSettingsDetailsBody, { canSetName: canSetName, canSetSlug: canSetSlug, localState: localState, remoteState: remoteState, setLocalState: setLocalState })); };
|
|
10196
10220
|
var makeCheckboxStyles = makeStylesFactory(function (theme) { return { checkbox: _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({}, "&:hover, &.".concat(classNamePrefix, "Mui-checked:hover"), { backgroundColor: 'transparent' }), "&.".concat(classNamePrefix, "MuiCheckbox-root"), { padding: 0 }), "marginRight", theme.spacing(0.5)), "marginTop", theme.spacing(0.5)), checkboxContainer: { display: 'flex', alignItems: 'flex-start', marginLeft: theme.spacing(-0.25), width: 'fit-content' } }; });
|
|
10197
|
-
var CheckboxCore = function CheckboxCore(
|
|
10221
|
+
var CheckboxCore = function CheckboxCore(_ref109) { var autoFocus = _ref109.autoFocus, checked = _ref109.checked, disabled = _ref109.disabled, indeterminate = _ref109.indeterminate, label = _ref109.label, onClick = _ref109.onClick, value = _ref109.value, classes = _ref109.classes; var handleChange = function handleChange(e) { onClick === null || onClick === void 0 ? void 0 : onClick(e.target.checked, e.target.name); }; return /*#__PURE__*/ wn.createElement(FormControlLabel$1, { className: classes.checkboxContainer, control: /*#__PURE__*/ wn.createElement(MUICheckbox, { autoFocus: autoFocus, checked: checked, className: classes.checkbox, color: "primary", disableRipple: true, indeterminate: indeterminate, name: value, onChange: handleChange, size: "small" }), disabled: disabled, label: label && ( /*#__PURE__*/wn.createElement("div", { style: { paddingTop: '4px' } }, /*#__PURE__*/ wn.createElement(Typography, { variant: 'body2', disabled: disabled }, label))) }); };
|
|
10198
10222
|
var useStyles$1 = makeCheckboxStyles(function (theme) { return { checkbox: _defineProperty2({}, "&.".concat(classNamePrefix, "MuiCheckbox-root"), { padding: 0, color: theme.styleConfig.colors.primary, '&.Mui-disabled': { color: theme.styleConfig.colors.secondary } }), checkboxContainer: { display: 'flex', alignItems: 'center' } }; });
|
|
10199
10223
|
var Checkbox = function Checkbox(props) { var classes = useStyles$1(); return /*#__PURE__*/ wn.createElement(CheckboxCore, Object.assign({}, props, { classes: classes })); };
|
|
10200
10224
|
var PaddingLeft = He.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-left: 34px;\n"])));
|
|
@@ -10211,7 +10235,7 @@ var arraysHaveSameContents = function arraysHaveSameContents(arr1, arr2) { if (A
|
|
|
10211
10235
|
var allowedAuthMethodsLabelMap = { magic_link: 'Email Magic Links', sso: 'Single Sign-On', google_oauth: 'Google OAuth', microsoft_oauth: 'Microsoft OAuth', password: 'Password' };
|
|
10212
10236
|
var allowedMfaMethodsLabelMap = { sms_otp: 'SMS OTP', totp: 'TOTP' };
|
|
10213
10237
|
var useMutateAuthSettings$1 = function useMutateAuthSettings$1() { var _useMutateOrganizatio4 = useMutateOrganization(), mutate = _useMutateOrganizatio4.mutate; var setOrgAuthSettings = function setOrgAuthSettings(mutatedProperties) { return mutate(mutatedProperties, { errorMessage: 'Failed to update authorization details.' }); }; return { setOrgAuthSettings: setOrgAuthSettings }; };
|
|
10214
|
-
var OrgSettingsAuthenticationSettingsBody = function OrgSettingsAuthenticationSettingsBody(
|
|
10238
|
+
var OrgSettingsAuthenticationSettingsBody = function OrgSettingsAuthenticationSettingsBody(_ref110) { var orgConfigAuthMethods = _ref110.orgConfigAuthMethods, orgConfigMfaMethods = _ref110.orgConfigMfaMethods, canSetAllowedAuthMethods = _ref110.canSetAllowedAuthMethods, canSetMfaPolicy = _ref110.canSetMfaPolicy, canSetAllowedMfaMethods = _ref110.canSetAllowedMfaMethods, mfaPolicyConfig = _ref110.mfaPolicyConfig, localState = _ref110.localState, setLocalState = _ref110.setLocalState; var _useSettingsContainer5 = useSettingsContainer(), editing = _useSettingsContainer5.editing; var handlePrimaryAuthChange = function handlePrimaryAuthChange(value) { setLocalState(function (prevState) { return Object.assign(Object.assign({}, prevState), { isPrimaryAuthAllAllowed: value }); }); }; var handleMfaPolicyChange = function handleMfaPolicyChange(value) { setLocalState(function (prevState) { return Object.assign(Object.assign({}, prevState), { isMfaPolicyRequiredForAll: value }); }); }; var handleSecondaryAuthChange = function handleSecondaryAuthChange(value) { setLocalState(function (prevState) { return Object.assign(Object.assign({}, prevState), { isSecondaryAuthAllAllowed: value }); }); }; var isAuthMethodChecked = function isAuthMethodChecked(authMethod) { var _a; return (_a = localState.allowedAuthMethods) === null || _a === void 0 ? void 0 : _a.includes(authMethod); }; var isMfaMethodChecked = function isMfaMethodChecked(mfaMethod) { var _a; return (_a = localState.allowedMfaMethods) === null || _a === void 0 ? void 0 : _a.includes(mfaMethod); }; var handleAllowedAuthMethodClick = function handleAllowedAuthMethodClick(authMethod) { if (localState.allowedAuthMethods.includes(authMethod)) {
|
|
10215
10239
|
setLocalState(function (prevState) { return Object.assign(Object.assign({}, prevState), { allowedAuthMethods: prevState.allowedAuthMethods.filter(function (method) { return method !== authMethod; }) }); });
|
|
10216
10240
|
}
|
|
10217
10241
|
else {
|
|
@@ -10224,7 +10248,7 @@ else {
|
|
|
10224
10248
|
} }; return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, /*#__PURE__*/ wn.createElement(SettingsSection, { title: "Primary authentication" }, editing && !localState.isPrimaryAuthAllAllowed && !!localState.allowedAuthMethods && localState.allowedAuthMethods.length === 0 && ( /*#__PURE__*/wn.createElement(Alert, null, 'Please select at least one primary authentication method.')), /*#__PURE__*/ wn.createElement(Switch, { readOnly: !editing || !canSetAllowedAuthMethods, label: 'Allow all primary auth methods', checked: localState.isPrimaryAuthAllAllowed, onChange: handlePrimaryAuthChange }), !localState.isPrimaryAuthAllAllowed && ( /*#__PURE__*/wn.createElement(PaddingLeft, null, /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "row", flexWrap: "wrap" }, orgConfigAuthMethods.map(function (authMethod) { var label = allowedAuthMethodsLabelMap[authMethod]; return /*#__PURE__*/ wn.createElement(Checkbox, { key: authMethod, label: label, disabled: !editing, checked: isAuthMethodChecked(authMethod), onClick: function onClick() { return handleAllowedAuthMethodClick(authMethod); } }); }))))), mfaPolicyConfig && ( /*#__PURE__*/wn.createElement(SettingsSection, { title: "Secondary authentication" }, editing && !localState.isSecondaryAuthAllAllowed && !!localState.allowedMfaMethods && localState.allowedMfaMethods.length === 0 && ( /*#__PURE__*/wn.createElement(Alert, null, 'Please select at least one secondary authentication method.')), /*#__PURE__*/ wn.createElement(Typography, { variant: 'body2' }, 'All members logging in will be required to set up one of the allowed secondary auth methods.'), /*#__PURE__*/ wn.createElement(Switch, { readOnly: !editing || !canSetMfaPolicy, label: 'Require MFA for all users', checked: localState.isMfaPolicyRequiredForAll, onChange: handleMfaPolicyChange }), /*#__PURE__*/ wn.createElement(Switch, { readOnly: !editing || !canSetAllowedMfaMethods, label: 'Allow all secondary auth methods', checked: localState.isSecondaryAuthAllAllowed, onChange: handleSecondaryAuthChange }), !localState.isSecondaryAuthAllAllowed && ( /*#__PURE__*/wn.createElement(PaddingLeft, null, /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "row", flexWrap: "wrap" }, orgConfigMfaMethods.map(function (authMethod) { var label = allowedMfaMethodsLabelMap[authMethod]; return /*#__PURE__*/ wn.createElement(Checkbox, { key: authMethod, label: label, disabled: !editing || !canSetAllowedMfaMethods, checked: isMfaMethodChecked(authMethod), onClick: function onClick() { return handleAllowedMfaMethodClick(authMethod); } }); }))))))); };
|
|
10225
10249
|
var configAuthMethodMap = { emailMagicLinks: 'magic_link', sso: 'sso', password: 'password', oauthGoogle: 'google_oauth', oauthMicrosoft: 'microsoft_oauth' };
|
|
10226
10250
|
var configMfaMethodMap = { smsOtp: 'sms_otp', totp: 'totp' };
|
|
10227
|
-
var OrgSettingsAuthenticationSettingsSection = function OrgSettingsAuthenticationSettingsSection(
|
|
10251
|
+
var OrgSettingsAuthenticationSettingsSection = function OrgSettingsAuthenticationSettingsSection(_ref111) { var orgInfo = _ref111.orgInfo; var _useRbac16 = useRbac('stytch.organization', 'update.settings.allowed-auth-methods'), canSetAllowedAuthMethods = _useRbac16.data; var _useRbac17 = useRbac('stytch.organization', 'update.settings.mfa-policy'), canSetMfaPolicy = _useRbac17.data; var _useRbac18 = useRbac('stytch.organization', 'update.settings.allowed-mfa-methods'), canSetAllowedMfaMethods = _useRbac18.data; var _useMutateAuthSetting = useMutateAuthSettings$1(), setOrgAuthSettings = _useMutateAuthSetting.setOrgAuthSettings; var _useAdminPortalConfig3 = useAdminPortalConfig(), adminPortalConfig = _useAdminPortalConfig3.data; var mfaPolicyConfig = adminPortalConfig === null || adminPortalConfig === void 0 ? void 0 : adminPortalConfig.organization_config.mfa_controls_enabled; var orgUIConfig = useAdminPortalOrgUIConfig(); var _F = F$3(function () { var _a, _b; var authMethods = (_a = orgUIConfig === null || orgUIConfig === void 0 ? void 0 : orgUIConfig.allowedAuthMethods) !== null && _a !== void 0 ? _a : Object.keys(configAuthMethodMap); var mfaMethods = (_b = orgUIConfig === null || orgUIConfig === void 0 ? void 0 : orgUIConfig.allowedMfaAuthMethods) !== null && _b !== void 0 ? _b : Object.keys(configMfaMethodMap); var mappedAuthMethods = authMethods.map(function (method) { return configAuthMethodMap[method]; }).filter(isTruthy); var mappedMfaMethods = mfaMethods.map(function (method) { return configMfaMethodMap[method]; }).filter(isTruthy); return { orgConfigAuthMethods: mappedAuthMethods, orgConfigMfaMethods: mappedMfaMethods }; }, [orgUIConfig === null || orgUIConfig === void 0 ? void 0 : orgUIConfig.allowedAuthMethods, orgUIConfig === null || orgUIConfig === void 0 ? void 0 : orgUIConfig.allowedMfaAuthMethods]), orgConfigAuthMethods = _F.orgConfigAuthMethods, orgConfigMfaMethods = _F.orgConfigMfaMethods; var remoteState = F$3(function () { return { authMethods: orgInfo.auth_methods, allowedAuthMethods: orgInfo.allowed_auth_methods, mfaPolicy: orgInfo.mfa_policy, mfaMethods: orgInfo.mfa_methods, allowedMfaMethods: orgInfo.allowed_mfa_methods, isPrimaryAuthAllAllowed: orgInfo.auth_methods === 'ALL_ALLOWED', isSecondaryAuthAllAllowed: orgInfo.mfa_methods === 'ALL_ALLOWED', isMfaPolicyRequiredForAll: orgInfo.mfa_policy === 'REQUIRED_FOR_ALL' }; }, [orgInfo.allowed_auth_methods, orgInfo.allowed_mfa_methods, orgInfo.auth_methods, orgInfo.mfa_methods, orgInfo.mfa_policy]); var _useFormState5 = useFormState({ remoteState: remoteState }), localState = _useFormState5.localState, setLocalState = _useFormState5.setLocalState, editing = _useFormState5.editing, handleSetEditing = _useFormState5.handleSetEditing; var _useOrgSettingsRouter2 = useOrgSettingsRouterController(), useBlockNavigation = _useOrgSettingsRouter2.useBlockNavigation; var handleSave = T$2(function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee19() { var mutatedProperties; return _regeneratorRuntime().wrap(function _callee19$(_context20) { while (1)
|
|
10228
10252
|
switch (_context20.prev = _context20.next) {
|
|
10229
10253
|
case 0:
|
|
10230
10254
|
mutatedProperties = {};
|
|
@@ -10251,20 +10275,63 @@ var OrgSettingsAuthenticationSettingsSection = function OrgSettingsAuthenticatio
|
|
|
10251
10275
|
return setOrgAuthSettings(mutatedProperties);
|
|
10252
10276
|
case 9:
|
|
10253
10277
|
case "end": return _context20.stop();
|
|
10254
|
-
} }, _callee19); })); }, [localState, remoteState, setOrgAuthSettings]); var handleCancel = T$2(function () { setLocalState(remoteState); }, [remoteState, setLocalState]); var disableSave = F$3(function () { var isDeepEqual = arraysHaveSameContents(localState.allowedAuthMethods, remoteState.allowedAuthMethods) && arraysHaveSameContents(localState.allowedMfaMethods, remoteState.allowedMfaMethods) && localState.isPrimaryAuthAllAllowed === remoteState.isPrimaryAuthAllAllowed && localState.isMfaPolicyRequiredForAll === remoteState.isMfaPolicyRequiredForAll && localState.isSecondaryAuthAllAllowed === remoteState.isSecondaryAuthAllAllowed; var allowPrimaryAuth = !localState.isPrimaryAuthAllAllowed && !!localState.allowedAuthMethods && localState.allowedAuthMethods.length === 0; var allowSecondaryAuth = !localState.isSecondaryAuthAllAllowed && localState.allowedMfaMethods && localState.allowedMfaMethods.length === 0; return isDeepEqual || allowPrimaryAuth || allowSecondaryAuth; }, [remoteState, localState]); return /*#__PURE__*/ wn.createElement(SettingsContainer, { title: "Authentication
|
|
10255
|
-
var
|
|
10256
|
-
var
|
|
10278
|
+
} }, _callee19); })); }, [localState, remoteState, setOrgAuthSettings]); var handleCancel = T$2(function () { setLocalState(remoteState); }, [remoteState, setLocalState]); var disableSave = F$3(function () { var isDeepEqual = arraysHaveSameContents(localState.allowedAuthMethods, remoteState.allowedAuthMethods) && arraysHaveSameContents(localState.allowedMfaMethods, remoteState.allowedMfaMethods) && localState.isPrimaryAuthAllAllowed === remoteState.isPrimaryAuthAllAllowed && localState.isMfaPolicyRequiredForAll === remoteState.isMfaPolicyRequiredForAll && localState.isSecondaryAuthAllAllowed === remoteState.isSecondaryAuthAllAllowed; var allowPrimaryAuth = !localState.isPrimaryAuthAllAllowed && !!localState.allowedAuthMethods && localState.allowedAuthMethods.length === 0; var allowSecondaryAuth = !localState.isSecondaryAuthAllAllowed && localState.allowedMfaMethods && localState.allowedMfaMethods.length === 0; return isDeepEqual || allowPrimaryAuth || allowSecondaryAuth; }, [remoteState, localState]); return /*#__PURE__*/ wn.createElement(SettingsContainer, { title: "Authentication settings", hasCTA: canSetAllowedAuthMethods || canSetMfaPolicy || canSetAllowedMfaMethods, onSave: handleSave, useBlockNavigation: useBlockNavigation, editing: editing, setEditing: handleSetEditing, disableSave: disableSave, onCancel: handleCancel }, /*#__PURE__*/ wn.createElement(OrgSettingsAuthenticationSettingsBody, { canSetAllowedAuthMethods: canSetAllowedAuthMethods, canSetMfaPolicy: canSetMfaPolicy, canSetAllowedMfaMethods: canSetAllowedMfaMethods, localState: localState, setLocalState: setLocalState, remoteState: remoteState, orgConfigAuthMethods: orgConfigAuthMethods, orgConfigMfaMethods: orgConfigMfaMethods, mfaPolicyConfig: mfaPolicyConfig })); };
|
|
10279
|
+
var scimGetConnectionKey = function scimGetConnectionKey(orgId, connectionId) { return orgId && connectionId ? ['scim.getConnection', orgId, connectionId] : null; };
|
|
10280
|
+
var useScimConnection = function useScimConnection(_ref112) { var shouldFetch = _ref112.shouldFetch; var _a; var client = useStytchClient(); var org = client.organization.getSync(); var orgId = org === null || org === void 0 ? void 0 : org.organization_id; var connectionId = (_a = org === null || org === void 0 ? void 0 : org.scim_active_connection[0]) === null || _a === void 0 ? void 0 : _a.connection_id; return useSWR(shouldFetch ? scimGetConnectionKey(orgId, connectionId) : null, function () { return client.scim.getConnection(connectionId); }); };
|
|
10281
|
+
var MAX_LIMIT_CONNECTION_GROUPS = 1000;
|
|
10282
|
+
var scimGetConnectionGroupsKey = function scimGetConnectionGroupsKey(orgId) { return ['scim.getConnectionGroups', orgId]; };
|
|
10283
|
+
var useScimConnectionGroups = function useScimConnectionGroups(_ref113) { var shouldFetch = _ref113.shouldFetch; var client = useStytchClient(); var org = client.organization.getSync(); var orgId = org === null || org === void 0 ? void 0 : org.organization_id; return useSWR(shouldFetch ? scimGetConnectionGroupsKey(orgId) : null, function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee20() { var response; return _regeneratorRuntime().wrap(function _callee20$(_context21) { while (1)
|
|
10284
|
+
switch (_context21.prev = _context21.next) {
|
|
10285
|
+
case 0:
|
|
10286
|
+
_context21.next = 2;
|
|
10287
|
+
return client.scim.getConnectionGroups({ limit: MAX_LIMIT_CONNECTION_GROUPS });
|
|
10288
|
+
case 2: response = _context21.sent;
|
|
10289
|
+
case 3:
|
|
10290
|
+
if (!response.next_cursor) {
|
|
10291
|
+
_context21.next = 8;
|
|
10292
|
+
break;
|
|
10293
|
+
}
|
|
10294
|
+
_context21.next = 6;
|
|
10295
|
+
return client.scim.getConnectionGroups({ limit: MAX_LIMIT_CONNECTION_GROUPS, cursor: response.next_cursor }).then(function (newResponse) { response = Object.assign(Object.assign({}, response), { scim_groups: [].concat(_toConsumableArray2(response.scim_groups), _toConsumableArray2(newResponse.scim_groups)), next_cursor: newResponse.next_cursor }); });
|
|
10296
|
+
case 6:
|
|
10297
|
+
_context21.next = 3;
|
|
10298
|
+
break;
|
|
10299
|
+
case 8: return _context21.abrupt("return", response);
|
|
10300
|
+
case 9:
|
|
10301
|
+
case "end": return _context21.stop();
|
|
10302
|
+
} }, _callee20); })); }); };
|
|
10303
|
+
var useMutateScimConnectionRoleAssignments = function useMutateScimConnectionRoleAssignments() { var _a; var _useSWRConfig5 = useSWRConfig(), mutateSWR = _useSWRConfig5.mutate; var client = useStytchClient(); var org = client.organization.getSync(); var orgId = org === null || org === void 0 ? void 0 : org.organization_id; var connectionId = (_a = org === null || org === void 0 ? void 0 : org.scim_active_connection[0]) === null || _a === void 0 ? void 0 : _a.connection_id; return useMutateWithToast(T$2(function (properties) { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee22() { return _regeneratorRuntime().wrap(function _callee22$(_context23) { while (1)
|
|
10304
|
+
switch (_context23.prev = _context23.next) {
|
|
10305
|
+
case 0:
|
|
10306
|
+
_context23.next = 2;
|
|
10307
|
+
return mutateSWR(scimGetConnectionKey(orgId, connectionId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee21() { var resp; return _regeneratorRuntime().wrap(function _callee21$(_context22) { while (1)
|
|
10308
|
+
switch (_context22.prev = _context22.next) {
|
|
10309
|
+
case 0:
|
|
10310
|
+
_context22.next = 2;
|
|
10311
|
+
return client.scim.updateConnection({ connection_id: properties.connection_id, scim_group_implicit_role_assignments: properties.scim_group_implicit_role_assignments });
|
|
10312
|
+
case 2:
|
|
10313
|
+
resp = _context22.sent;
|
|
10314
|
+
return _context22.abrupt("return", resp.connection);
|
|
10315
|
+
case 4:
|
|
10316
|
+
case "end": return _context22.stop();
|
|
10317
|
+
} }, _callee21); })); }, { rollbackOnError: true, populateCache: true, revalidate: false });
|
|
10318
|
+
case 2:
|
|
10319
|
+
case "end": return _context23.stop();
|
|
10320
|
+
} }, _callee22); })); }, [client.scim, connectionId, mutateSWR, orgId])); };
|
|
10321
|
+
var roleAssignmentsItemRenderers = function roleAssignmentsItemRenderers(idMap, rolesById) { return [{ title: 'Role', getValue: function getValue(role) { var _a, _b; return /*#__PURE__*/ wn.createElement(Tag, null, (_b = (_a = rolesById === null || rolesById === void 0 ? void 0 : rolesById[role.role_id]) === null || _a === void 0 ? void 0 : _a.displayName) !== null && _b !== void 0 ? _b : role.role_id); } }, { title: 'Number of Sources Assigned', getValue: function getValue(role) { var _a, _b; return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, String((_b = (_a = idMap[role.role_id]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0)); } }]; };
|
|
10257
10322
|
var roleAssigmnentsKeyExtractor = function roleAssigmnentsKeyExtractor(role) { return role.role_id; };
|
|
10258
|
-
var roleItemRendererer = [{ title: 'Source', getValue: function getValue(value) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, value.source); } }, { title: 'Display Name', getValue: function getValue(value) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, value.displayName); } }, { title: 'Groups', getValue: function getValue(value) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, value.source === 'SSO' ? value.groups : ''); } }];
|
|
10323
|
+
var roleItemRendererer = [{ title: 'Source', getValue: function getValue(value) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, value.source); } }, { title: 'Display Name', getValue: function getValue(value) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, value.displayName); } }, { title: 'Groups', getValue: function getValue(value) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, value.source === 'SSO' ? value.groups : value.source === 'SCIM' ? value.groupName : ''); } }];
|
|
10259
10324
|
var roleKeyExtractor = function roleKeyExtractor(role) { return role.displayName; };
|
|
10260
|
-
var useMutateRoleAssignments = function useMutateRoleAssignments() { var _useMutateOrganizatio5 = useMutateOrganization(), mutate = _useMutateOrganizatio5.mutate; var setOrgEmailAssignments = function setOrgEmailAssignments(
|
|
10325
|
+
var useMutateRoleAssignments = function useMutateRoleAssignments() { var _useMutateOrganizatio5 = useMutateOrganization(), mutate = _useMutateOrganizatio5.mutate; var setOrgEmailAssignments = function setOrgEmailAssignments(_ref114) { var idMap = _ref114.idMap; var rbacEmails = []; Object.entries(idMap).forEach(function (_ref115) { var _ref116 = _slicedToArray2(_ref115, 2), roleId = _ref116[0], values = _ref116[1]; values.forEach(function (value) { if (value.source === 'Email') {
|
|
10261
10326
|
rbacEmails.push({ role_id: roleId, domain: value.displayName });
|
|
10262
10327
|
} }); }); return mutate({ rbac_email_implicit_role_assignments: rbacEmails }, { errorMessage: 'Failed to update email role assignments.' }); }; return { setOrgEmailAssignments: setOrgEmailAssignments }; };
|
|
10263
|
-
var RoleTable = function RoleTable(
|
|
10264
|
-
var filterRoleAssignmentsBy = function filterRoleAssignmentsBy(arr,
|
|
10265
|
-
var uniqueValuesSplitOnSpaces = function uniqueValuesSplitOnSpaces(
|
|
10266
|
-
var OrgSettingsRoleAssignmentsBody = function OrgSettingsRoleAssignmentsBody(
|
|
10328
|
+
var RoleTable = function RoleTable(_ref117) { var localState = _ref117.localState, remoteState = _ref117.remoteState, editing = _ref117.editing, setLocalState = _ref117.setLocalState, role = _ref117.role, isSsoEnabled = _ref117.isSsoEnabled, isScimEnabled = _ref117.isScimEnabled; var _a; var roleId = role.role_id; var items = (_a = (editing ? localState : remoteState).idMap[roleId]) !== null && _a !== void 0 ? _a : []; return /*#__PURE__*/ wn.createElement(TableContainer$1, { component: Paper$1, variant: 'outlined' }, /*#__PURE__*/ wn.createElement(Table, { itemRenderer: roleItemRendererer, items: items, rowKeyExtractor: roleKeyExtractor, disableBottomBorder: true, titleVariant: "caption", getItemActionProps: editing ? function (roleAssignment) { return { warningAction: roleAssignment.source === 'Email' || roleAssignment.source === 'SSO' && isSsoEnabled || roleAssignment.source === 'SCIM' && isScimEnabled ? { text: 'Delete', onClick: function onClick() { setLocalState(function (state) { var assignments = state.idMap[roleId].filter(function (item) { return item !== roleAssignment; }); return Object.assign(Object.assign({}, state), { idMap: Object.assign(Object.assign({}, state.idMap), _defineProperty2({}, roleId, assignments)) }); }); } } : undefined }; } : undefined })); };
|
|
10329
|
+
var filterRoleAssignmentsBy = function filterRoleAssignmentsBy(arr, _ref118) { var source = _ref118.source; return arr.slice().filter(function (val) { return val.source === source; }); };
|
|
10330
|
+
var uniqueValuesSplitOnSpaces = function uniqueValuesSplitOnSpaces(_ref119) { var input = _ref119.input; return new Set(input.split(' ').map(function (val) { return val.trim(); }).filter(function (val) { return val.length > 0; })); };
|
|
10331
|
+
var OrgSettingsRoleAssignmentsBody = function OrgSettingsRoleAssignmentsBody(_ref120) { var editing = _ref120.editing, ssoSamlConnections = _ref120.ssoSamlConnections, roles = _ref120.roles, localState = _ref120.localState, remoteState = _ref120.remoteState, setLocalState = _ref120.setLocalState, isSsoEnabled = _ref120.isSsoEnabled, isScimEnabled = _ref120.isScimEnabled, scimGroupAssignments = _ref120.scimGroupAssignments, allScimGroupIdToGroupName = _ref120.allScimGroupIdToGroupName, scimConnection = _ref120.scimConnection; var idMap = (editing ? localState : remoteState).idMap; var rolesWithAssignments = roles.filter(function (role) { return idMap[role.role_id].length > 0; }); var rolesById = useRolesById(); var itemRenderers = roleAssignmentsItemRenderers(idMap, rolesById); var _h104 = h$4(null), _h105 = _slicedToArray2(_h104, 2), selectedRole = _h105[0], setSelectedRole = _h105[1]; var _h106 = h$4(null), _h107 = _slicedToArray2(_h106, 2), selectedSource = _h107[0], setSelectedSource = _h107[1]; var _h108 = h$4(''), _h109 = _slicedToArray2(_h108, 2), emailDomain = _h109[0], setEmailDomain = _h109[1]; var _h110 = h$4([{ id: '', groups: '' }]), _h111 = _slicedToArray2(_h110, 2), ssoRoleAssignments = _h111[0], setSsoRoleAssignments = _h111[1]; var _h112 = h$4([]), _h113 = _slicedToArray2(_h112, 2), scimGroupIds = _h113[0], setScimGroupIds = _h113[1]; var _h114 = h$4(new Set()), _h115 = _slicedToArray2(_h114, 2), roleOpenIds = _h115[0], setRoleOpenIds = _h115[1]; var idToHasGroupAttributeMapping = ssoSamlConnections.reduce(function (acc, val) { acc[val.connection_id] = !!val.attribute_mapping.groups; return acc; }, {}); var sourceItems = new Set(['Email']); if (isSsoEnabled && ssoSamlConnections.length > 0) {
|
|
10267
10332
|
sourceItems.add('SSO');
|
|
10333
|
+
} if (isScimEnabled && scimGroupAssignments.length > 0) {
|
|
10334
|
+
sourceItems.add('SCIM');
|
|
10268
10335
|
} var sourceSelectItems = Array.from(sourceItems).map(function (source) { return { label: source, value: source }; }); var addRoleAssignmentModalProps = useModalState(function () { if (!selectedSource)
|
|
10269
10336
|
return; var roleId = selectedRole; setRoleOpenIds(function (prev) { return new Set(_toConsumableArray2(prev).concat(roleId)); }); setLocalState(function (state) { var remoteRoleAssignments = _toConsumableArray2(state.idMap[roleId]); var mergedRoleAssignments = _toConsumableArray2(remoteRoleAssignments); var filteredRoleAssignments = filterRoleAssignmentsBy(remoteRoleAssignments, { source: selectedSource }); if (selectedSource === 'Email') {
|
|
10270
10337
|
var domains = new Set();
|
|
@@ -10290,50 +10357,47 @@ else if (selectedSource === 'SSO') {
|
|
|
10290
10357
|
idToGroups[ssoConnection.id].add(group);
|
|
10291
10358
|
} });
|
|
10292
10359
|
} });
|
|
10360
|
+
}
|
|
10361
|
+
else if (selectedSource === 'SCIM') {
|
|
10362
|
+
var currentGroupIds = new Set();
|
|
10363
|
+
filteredRoleAssignments.forEach(function (roleAssignment) { currentGroupIds.add(roleAssignment.groupId); });
|
|
10364
|
+
scimGroupIds.forEach(function (id) { var _a; if (!currentGroupIds.has(id)) {
|
|
10365
|
+
mergedRoleAssignments.push({ source: selectedSource, displayName: (_a = scimConnection === null || scimConnection === void 0 ? void 0 : scimConnection.display_name) !== null && _a !== void 0 ? _a : '', groupId: id, groupName: allScimGroupIdToGroupName[id] });
|
|
10366
|
+
} });
|
|
10293
10367
|
} if (mergedRoleAssignments.length !== remoteRoleAssignments.length) {
|
|
10294
10368
|
return Object.assign(Object.assign({}, state), { idMap: Object.assign(Object.assign({}, state.idMap), _defineProperty2({}, roleId, mergedRoleAssignments)) });
|
|
10295
|
-
} return state; }); }); var showInputContent = !!selectedRole && !!selectedSource; var disableConfirm = !showInputContent || selectedSource === 'Email' && emailDomain.length === 0 || selectedSource === 'SSO' && ssoRoleAssignments.every(function (connection) { return !connection.id; }); var
|
|
10369
|
+
} return state; }); }); var showInputContent = !!selectedRole && !!selectedSource; var disableConfirm = !showInputContent || selectedSource === 'Email' && emailDomain.length === 0 || selectedSource === 'SSO' && ssoRoleAssignments.every(function (connection) { return !connection.id; }); var roleAutocompleteProps = useRoleAutocomplete(); var roleSelectItems = roleAutocompleteProps.selectItems.map(function (roleId) { return { label: roleAutocompleteProps.getOptionLabel(roleId), value: roleId, subtext: roleAutocompleteProps.getOptionDescription(roleId) }; }); var selectedSsoRoleAssignmentIds = ssoRoleAssignments.map(function (connection) { return connection.id; }); var ssoGroupSelectItems = function ssoGroupSelectItems(currentId) { return ssoSamlConnections.filter(function (_ref121) { var id = _ref121.connection_id; return !selectedSsoRoleAssignmentIds.includes(id) || id === currentId; }).map(function (_ref122) { var id = _ref122.connection_id, displayName = _ref122.display_name; return { label: displayName, value: id }; }); }; var scimGroupSelectItems = F$3(function () { return Object.keys(allScimGroupIdToGroupName); }, [allScimGroupIdToGroupName]); var sourceToInputContentMap = { Email: ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(SettingsSection, { title: "Email Domain" }, /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, "Separate domains by a single space to assign to multiple email domains."), /*#__PURE__*/ wn.createElement(Input$1, { label: "Domain", fullWidth: true, value: emailDomain, onChange: setEmailDomain })))), SSO: ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(SettingsSection, { title: "SSO" }, /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, "Enter a Group name to assign a Role at the Group level, or leave blank to assign at the SSO connection level. Separate groups by a single space to assign to multiple groups."), ssoRoleAssignments.map(function (_ref123, index) { var id = _ref123.id, groups = _ref123.groups; var isValidConnection = !!id; var connectionHasGroupMapping = !!idToHasGroupAttributeMapping[id]; var isValidConnectionWithGroupMapping = isValidConnection && connectionHasGroupMapping; var disableGroupInput = !isValidConnectionWithGroupMapping; var groupInputPlaceholder = isValidConnection && !connectionHasGroupMapping ? 'Add a "groups" key first' : 'Enter or leave blank'; var groupInputCaption = isValidConnection && !connectionHasGroupMapping ? 'Add a "groups" key in the SSO Attribute Mapping first to assign group roles.' : undefined; return /*#__PURE__*/ wn.createElement(FlexBox, { key: index, flexDirection: "row", gap: 2, alignItems: "flex-start" }, /*#__PURE__*/ wn.createElement(Select, { label: "Connection Display Name", width: 250, placeholder: "Select", selectItems: selectedRole ? ssoGroupSelectItems(id) : [], value: id, onChange: function onChange(val) { setSsoRoleAssignments(function (connections) { return connections.map(function (connection, currentIndex) { if (currentIndex === index) {
|
|
10296
10370
|
return Object.assign(Object.assign({}, connection), { id: val });
|
|
10297
10371
|
} return connection; }); }); } }), /*#__PURE__*/ wn.createElement(Input$1, { label: "Group name", value: groups, disabled: disableGroupInput, placeholder: groupInputPlaceholder, caption: groupInputCaption, onChange: function onChange(val) { setSsoRoleAssignments(function (connections) { return connections.map(function (connection, currentIndex) { var _a; if (currentIndex === index) {
|
|
10298
10372
|
return Object.assign(Object.assign({}, connection), { groups: val, id: id, hasGroupAttributeMapping: !!((_a = ssoSamlConnections.find(function (ssoSamlConnection) { return ssoSamlConnection.connection_id === val; })) === null || _a === void 0 ? void 0 : _a.attribute_mapping.groups) });
|
|
10299
|
-
} return connection; }); }); } })); }), /*#__PURE__*/ wn.createElement(Button, { variant: "text", startIcon: /*#__PURE__*/ wn.createElement(default_1$c, null), compact: true, disabled: ssoRoleAssignments.length >= ssoSamlConnections.length, onClick: function onClick() { setSsoRoleAssignments(function (connections) { return [].concat(_toConsumableArray2(connections), [{ id: '', groups: '' }]); }); } }, "Add SSO Role assignment")))) }; return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 1 }, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, addRoleAssignmentModalProps, { title: "Add Role assignment", confirmButtonText: "Save", disableConfirm: disableConfirm, close: function close() { addRoleAssignmentModalProps.close(); setSelectedRole(null); setSelectedSource(null); setEmailDomain(''); setSsoRoleAssignments([{ id: '', groups: '' }]); } }), /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, /*#__PURE__*/ wn.createElement(Select, { label: "Select Role", selectItems: roleSelectItems, value: selectedRole, onChange: function onChange(val) { setSelectedRole(val); }, placeholder: "Select Role" }), /*#__PURE__*/ wn.createElement(Select, { label: "Select Source", selectItems: sourceSelectItems, value: selectedSource, placeholder: "Select Source", onChange: function onChange(val) { setSelectedSource(val); } }), showInputContent && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Divider$1, null), sourceToInputContentMap[selectedSource])))), editing && ( /*#__PURE__*/wn.createElement(FlexBox, { justifyContent: "flex-end" }, /*#__PURE__*/ wn.createElement(Button, { variant: "text", startIcon: /*#__PURE__*/ wn.createElement(default_1$c, null), compact: true, onClick: addRoleAssignmentModalProps.open }, "Add Role assignment"))), rolesWithAssignments.length > 0 ? ( /*#__PURE__*/wn.createElement(Table, { titleVariant: "caption", itemRenderer: itemRenderers, items: rolesWithAssignments, rowKeyExtractor: roleAssigmnentsKeyExtractor, openIds: roleOpenIds, onOpenChange: function onOpenChange(
|
|
10373
|
+
} return connection; }); }); } })); }), /*#__PURE__*/ wn.createElement(Button, { variant: "text", startIcon: /*#__PURE__*/ wn.createElement(default_1$c, null), compact: true, disabled: ssoRoleAssignments.length >= ssoSamlConnections.length, onClick: function onClick() { setSsoRoleAssignments(function (connections) { return [].concat(_toConsumableArray2(connections), [{ id: '', groups: '' }]); }); } }, "Add SSO Role assignment")))), SCIM: ( /*#__PURE__*/wn.createElement(SettingsSection, { title: "SCIM Groups" }, /*#__PURE__*/ wn.createElement(Autocomplete, { label: "SCIM Group", selectItems: scimGroupSelectItems, value: scimGroupIds, getOptionLabel: function getOptionLabel(value) { return allScimGroupIdToGroupName[value]; }, onChange: function onChange(value) { setScimGroupIds(function () { return value; }); } }))) }; return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 1 }, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, addRoleAssignmentModalProps, { title: "Add Role assignment", confirmButtonText: "Save", disableConfirm: disableConfirm, close: function close() { addRoleAssignmentModalProps.close(); setSelectedRole(null); setSelectedSource(null); setEmailDomain(''); setSsoRoleAssignments([{ id: '', groups: '' }]); } }), /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, /*#__PURE__*/ wn.createElement(Select, { label: "Select Role", selectItems: roleSelectItems, value: selectedRole, onChange: function onChange(val) { setSelectedRole(val); }, placeholder: "Select Role" }), /*#__PURE__*/ wn.createElement(Select, { label: "Select Source", selectItems: sourceSelectItems, value: selectedSource, placeholder: "Select Source", onChange: function onChange(val) { setSelectedSource(val); } }), showInputContent && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Divider$1, null), sourceToInputContentMap[selectedSource])))), editing && ( /*#__PURE__*/wn.createElement(FlexBox, { justifyContent: "flex-end" }, /*#__PURE__*/ wn.createElement(Button, { variant: "text", startIcon: /*#__PURE__*/ wn.createElement(default_1$c, null), compact: true, onClick: addRoleAssignmentModalProps.open }, "Add Role assignment"))), rolesWithAssignments.length > 0 ? ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Typography, { variant: "body2", color: "secondary" }, "Configure automatic granting and revoking of roles based on the member's email domain, SCIM Group membership, or SSO Connection."), /*#__PURE__*/ wn.createElement(Table, { titleVariant: "caption", itemRenderer: itemRenderers, items: rolesWithAssignments, rowKeyExtractor: roleAssigmnentsKeyExtractor, openIds: roleOpenIds, onOpenChange: function onOpenChange(_ref124) { var id = _ref124.id, open = _ref124.open; setRoleOpenIds(function (prev) { var newRoleOpenIds = new Set(prev); if (open) {
|
|
10300
10374
|
newRoleOpenIds.add(id);
|
|
10301
10375
|
}
|
|
10302
10376
|
else {
|
|
10303
10377
|
newRoleOpenIds["delete"](id);
|
|
10304
|
-
} return newRoleOpenIds; }); }, ExpandedContent: function ExpandedContent(
|
|
10305
|
-
var OrgSettingsRoleAssignmentsSection = function OrgSettingsRoleAssignmentsSection(
|
|
10306
|
-
return -1;
|
|
10307
|
-
} if (b.role_id === 'stytch_admin') {
|
|
10308
|
-
return 1;
|
|
10309
|
-
} if (a.role_id === 'stytch_member') {
|
|
10310
|
-
return -1;
|
|
10311
|
-
} if (b.role_id === 'stytch_member') {
|
|
10312
|
-
return 1;
|
|
10313
|
-
} return a.role_id.localeCompare(b.role_id); })) !== null && _a !== void 0 ? _a : []; }, [roles]); var rbacEmails = orgInfo.rbac_email_implicit_role_assignments; var connections = ssoConnections === null || ssoConnections === void 0 ? void 0 : ssoConnections.saml_connections; var _useMutateRoleAssignm = useMutateRoleAssignments(), setOrgEmailAssignments = _useMutateRoleAssignm.setOrgEmailAssignments; var _useMutateSsoConnecti5 = useMutateSsoConnection('saml'), mutate = _useMutateSsoConnecti5.mutate; var idMap = F$3(function () { var idToRoleAssignments = {}; sortedRoles.forEach(function (role) { idToRoleAssignments[role.role_id] = []; }); connections === null || connections === void 0 ? void 0 : connections.forEach(function (ssoSamlConnection) { var connectionRoleAssignments = ssoSamlConnection.saml_connection_implicit_role_assignments; var groupRoleAssignments = ssoSamlConnection.saml_group_implicit_role_assignments; connectionRoleAssignments.forEach(function (implicitRole) { var role = implicitRole.role_id; if (!idToRoleAssignments[role]) {
|
|
10378
|
+
} return newRoleOpenIds; }); }, ExpandedContent: function ExpandedContent(_ref125) { var role = _ref125.data; return /*#__PURE__*/ wn.createElement(RoleTable, { role: role, editing: editing, setLocalState: setLocalState, localState: localState, remoteState: remoteState, isSsoEnabled: isSsoEnabled, isScimEnabled: isScimEnabled }); } }))) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, "No role assignments."))); };
|
|
10379
|
+
var OrgSettingsRoleAssignmentsSection = function OrgSettingsRoleAssignmentsSection(_ref126) { var orgInfo = _ref126.orgInfo; var _a, _b, _c, _d; var _useAdminPortalConfig4 = useAdminPortalConfig(), adminPortalConfig = _useAdminPortalConfig4.data; var _useRbac19 = useRbac('stytch.organization', 'update.settings.implicit-roles'), canSetRoles = _useRbac19.data; var _useRbac20 = useRbac('stytch.sso', 'get'), canGetSsoConnections = _useRbac20.data; var _useRbac21 = useRbac('stytch.scim', 'get'), canGetScimConnections = _useRbac21.data; var isSsoEnabled = (_a = adminPortalConfig === null || adminPortalConfig === void 0 ? void 0 : adminPortalConfig.sso_config.sso_enabled) !== null && _a !== void 0 ? _a : false; var isScimEnabled = (_b = adminPortalConfig === null || adminPortalConfig === void 0 ? void 0 : adminPortalConfig.scim_config.scim_enabled) !== null && _b !== void 0 ? _b : false; var _useSsoConnections2 = useSsoConnections({ shouldFetch: isSsoEnabled && !!canSetRoles }), ssoConnections = _useSsoConnections2.data, isLoadingSso = _useSsoConnections2.isLoading; var _useScimConnection = useScimConnection({ shouldFetch: isScimEnabled && !!canGetSsoConnections && !!canSetRoles }), scimConnection = _useScimConnection.data, isLoadingScim = _useScimConnection.isLoading; var _useScimConnectionGro = useScimConnectionGroups({ shouldFetch: isScimEnabled && !!canGetScimConnections && !!canSetRoles }), scimConnectionGroups = _useScimConnectionGro.data, isLoadingScimGroups = _useScimConnectionGro.isLoading; var roles = useRoles(); var sortRoles = useRoleSortFn(); var sortedRoles = F$3(function () { return sortRoles(roles !== null && roles !== void 0 ? roles : []); }, [roles, sortRoles]); var rbacEmails = orgInfo.rbac_email_implicit_role_assignments; var connections = ssoConnections === null || ssoConnections === void 0 ? void 0 : ssoConnections.saml_connections; var scimGroupAssignments = (_c = scimConnection === null || scimConnection === void 0 ? void 0 : scimConnection.connection.scim_group_implicit_role_assignments) !== null && _c !== void 0 ? _c : []; var allScimGroups = (_d = scimConnectionGroups === null || scimConnectionGroups === void 0 ? void 0 : scimConnectionGroups.scim_groups) !== null && _d !== void 0 ? _d : []; var allScimGroupIdToGroupName = allScimGroups.reduce(function (acc, val) { acc[val.group_id] = val.group_name; return acc; }, {}); var _useMutateRoleAssignm = useMutateRoleAssignments(), setOrgEmailAssignments = _useMutateRoleAssignm.setOrgEmailAssignments; var _useMutateSsoConnecti5 = useMutateSsoConnection('saml'), mutateSsoConnection = _useMutateSsoConnecti5.mutate; var _useMutateScimConnect = useMutateScimConnectionRoleAssignments(), mutateScimConnection = _useMutateScimConnect.mutate; var idMap = F$3(function () { var idToRoleAssignments = {}; sortedRoles.forEach(function (role) { idToRoleAssignments[role.role_id] = []; }); connections === null || connections === void 0 ? void 0 : connections.forEach(function (ssoSamlConnection) { var connectionRoleAssignments = ssoSamlConnection.saml_connection_implicit_role_assignments; var groupRoleAssignments = ssoSamlConnection.saml_group_implicit_role_assignments; connectionRoleAssignments.forEach(function (implicitRole) { var role = implicitRole.role_id; if (!idToRoleAssignments[role]) {
|
|
10314
10380
|
idToRoleAssignments[role] = [];
|
|
10315
10381
|
} idToRoleAssignments[role].push({ source: 'SSO', displayName: ssoSamlConnection.display_name, id: ssoSamlConnection.connection_id, groups: '' }); }); groupRoleAssignments.forEach(function (implicitRole) { var role = implicitRole.role_id; if (!idToRoleAssignments[role]) {
|
|
10316
10382
|
idToRoleAssignments[role] = [];
|
|
10317
10383
|
} idToRoleAssignments[role].push({ source: 'SSO', displayName: ssoSamlConnection.display_name, id: ssoSamlConnection.connection_id, groups: implicitRole.group }); }); }); rbacEmails === null || rbacEmails === void 0 ? void 0 : rbacEmails.forEach(function (rbacEmail) { var role = rbacEmail.role_id; if (!idToRoleAssignments[role]) {
|
|
10318
10384
|
idToRoleAssignments[role] = [];
|
|
10319
|
-
} idToRoleAssignments[role].push({ source: 'Email', displayName: rbacEmail.domain }); });
|
|
10320
|
-
|
|
10385
|
+
} idToRoleAssignments[role].push({ source: 'Email', displayName: rbacEmail.domain }); }); scimConnection === null || scimConnection === void 0 ? void 0 : scimConnection.connection.scim_group_implicit_role_assignments.forEach(function (implicitRole) { var role = implicitRole.role_id; if (!idToRoleAssignments[role]) {
|
|
10386
|
+
idToRoleAssignments[role] = [];
|
|
10387
|
+
} idToRoleAssignments[role].push({ source: 'SCIM', displayName: scimConnection.connection.display_name, groupId: implicitRole.group_id, groupName: allScimGroupIdToGroupName[implicitRole.group_id] }); }); return idToRoleAssignments; }, [allScimGroupIdToGroupName, connections, rbacEmails, scimConnection === null || scimConnection === void 0 ? void 0 : scimConnection.connection.display_name, scimConnection === null || scimConnection === void 0 ? void 0 : scimConnection.connection.scim_group_implicit_role_assignments, sortedRoles]); var remoteState = { idMap: idMap }; var _useFormState6 = useFormState({ remoteState: remoteState }), localState = _useFormState6.localState, setLocalState = _useFormState6.setLocalState, editing = _useFormState6.editing, handleSetEditing = _useFormState6.handleSetEditing; var _useOrgSettingsRouter3 = useOrgSettingsRouterController(), useBlockNavigation = _useOrgSettingsRouter3.useBlockNavigation; var disableSave = false; var handleSave = function handleSave() { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee24() { var _e, mutatedConnections, copyConnections, currentScimRoleAssignments, updatedScimRoleAssignments; return _regeneratorRuntime().wrap(function _callee24$(_context25) { while (1)
|
|
10388
|
+
switch (_context25.prev = _context25.next) {
|
|
10321
10389
|
case 0:
|
|
10322
10390
|
if (!canSetRoles) {
|
|
10323
|
-
|
|
10391
|
+
_context25.next = 14;
|
|
10324
10392
|
break;
|
|
10325
10393
|
}
|
|
10326
|
-
|
|
10394
|
+
_context25.next = 3;
|
|
10327
10395
|
return setOrgEmailAssignments(localState);
|
|
10328
10396
|
case 3:
|
|
10329
|
-
if (!canUpdateSso) {
|
|
10330
|
-
_context22.next = 10;
|
|
10331
|
-
break;
|
|
10332
|
-
}
|
|
10333
10397
|
mutatedConnections = {};
|
|
10334
10398
|
copyConnections = {};
|
|
10335
10399
|
connections === null || connections === void 0 ? void 0 : connections.forEach(function (val) { var shallow = Object.assign({}, { connection_id: val.connection_id, saml_connection_implicit_role_assignments: val.saml_connection_implicit_role_assignments, saml_group_implicit_role_assignments: val.saml_group_implicit_role_assignments }); copyConnections[val.connection_id] = Object.assign({}, shallow); shallow.saml_connection_implicit_role_assignments = []; shallow.saml_group_implicit_role_assignments = []; mutatedConnections[val.connection_id] = shallow; });
|
|
10336
|
-
Object.entries(localState.idMap).forEach(function (
|
|
10400
|
+
Object.entries(localState.idMap).forEach(function (_ref127) { var _ref128 = _slicedToArray2(_ref127, 2), roleId = _ref128[0], roleAssignments = _ref128[1]; roleAssignments.forEach(function (roleAssignment) { if (roleAssignment.source === 'SSO') {
|
|
10337
10401
|
var connectionId = roleAssignment.id;
|
|
10338
10402
|
if (roleAssignment.groups) {
|
|
10339
10403
|
mutatedConnections[connectionId].saml_group_implicit_role_assignments.push({ role_id: roleId, group: roleAssignment.groups });
|
|
@@ -10342,39 +10406,50 @@ var OrgSettingsRoleAssignmentsSection = function OrgSettingsRoleAssignmentsSecti
|
|
|
10342
10406
|
mutatedConnections[connectionId].saml_connection_implicit_role_assignments.push({ role_id: roleId });
|
|
10343
10407
|
}
|
|
10344
10408
|
} }); });
|
|
10345
|
-
|
|
10346
|
-
return Promise.all(Object.entries(mutatedConnections).map(function (
|
|
10347
|
-
switch (
|
|
10409
|
+
_context25.next = 9;
|
|
10410
|
+
return Promise.all(Object.entries(mutatedConnections).map(function (_ref129) { var _ref130 = _slicedToArray2(_ref129, 2), connectionId = _ref130[0], mutatedConnection = _ref130[1]; return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee23() { var originalConnection; return _regeneratorRuntime().wrap(function _callee23$(_context24) { while (1)
|
|
10411
|
+
switch (_context24.prev = _context24.next) {
|
|
10348
10412
|
case 0:
|
|
10349
10413
|
originalConnection = copyConnections[connectionId];
|
|
10350
10414
|
if (!(!arraysHaveSameContents(mutatedConnection.saml_connection_implicit_role_assignments.map(function (val) { return val.role_id; }), originalConnection.saml_connection_implicit_role_assignments.map(function (val) { return val.role_id; })) || !arraysHaveSameContents(mutatedConnection.saml_group_implicit_role_assignments.map(function (val) { return _defineProperty2({}, val.role_id, val.group); }), originalConnection.saml_group_implicit_role_assignments.map(function (val) { return _defineProperty2({}, val.role_id, val.group); })))) {
|
|
10351
|
-
|
|
10415
|
+
_context24.next = 4;
|
|
10352
10416
|
break;
|
|
10353
10417
|
}
|
|
10354
|
-
|
|
10355
|
-
return
|
|
10418
|
+
_context24.next = 4;
|
|
10419
|
+
return mutateSsoConnection(Object.assign({}, mutatedConnection));
|
|
10356
10420
|
case 4:
|
|
10357
|
-
case "end": return
|
|
10358
|
-
} },
|
|
10359
|
-
case
|
|
10360
|
-
|
|
10361
|
-
|
|
10421
|
+
case "end": return _context24.stop();
|
|
10422
|
+
} }, _callee23); })); }));
|
|
10423
|
+
case 9:
|
|
10424
|
+
currentScimRoleAssignments = (_e = scimConnection === null || scimConnection === void 0 ? void 0 : scimConnection.connection.scim_group_implicit_role_assignments) !== null && _e !== void 0 ? _e : [];
|
|
10425
|
+
updatedScimRoleAssignments = Object.entries(localState.idMap).reduce(function (acc, _ref133) { var _ref134 = _slicedToArray2(_ref133, 2), roleId = _ref134[0], roleAssignments = _ref134[1]; roleAssignments.forEach(function (roleAssignment) { if (roleAssignment.source === 'SCIM') {
|
|
10426
|
+
acc.push({ role_id: roleId, group_id: roleAssignment.groupId });
|
|
10427
|
+
} }); return acc; }, []);
|
|
10428
|
+
if (!(scimConnection && !arraysHaveSameContents(currentScimRoleAssignments, updatedScimRoleAssignments))) {
|
|
10429
|
+
_context25.next = 14;
|
|
10430
|
+
break;
|
|
10431
|
+
}
|
|
10432
|
+
_context25.next = 14;
|
|
10433
|
+
return mutateScimConnection(Object.assign(Object.assign({}, scimConnection.connection), { scim_group_implicit_role_assignments: updatedScimRoleAssignments }));
|
|
10434
|
+
case 14:
|
|
10435
|
+
case "end": return _context25.stop();
|
|
10436
|
+
} }, _callee24); })); }; if (isLoadingSso || isLoadingScim || isLoadingScimGroups) {
|
|
10362
10437
|
return /*#__PURE__*/ wn.createElement(PageLoadingIndicator, null);
|
|
10363
|
-
} return /*#__PURE__*/ wn.createElement(SettingsContainer, { title: "Role assignments", hasCTA: canSetRoles, onSave: handleSave, useBlockNavigation: useBlockNavigation, editing: editing, setEditing: handleSetEditing, disableSave: disableSave }, /*#__PURE__*/ wn.createElement(OrgSettingsRoleAssignmentsBody, { editing: editing, remoteState: remoteState, localState: localState, setLocalState: setLocalState, ssoSamlConnections: connections !== null && connections !== void 0 ? connections : [], roles: sortedRoles,
|
|
10364
|
-
var RadioCore = function RadioCore(
|
|
10438
|
+
} return /*#__PURE__*/ wn.createElement(SettingsContainer, { title: "Automatic Role assignments", hasCTA: canSetRoles, onSave: handleSave, useBlockNavigation: useBlockNavigation, editing: editing, setEditing: handleSetEditing, disableSave: disableSave }, /*#__PURE__*/ wn.createElement(OrgSettingsRoleAssignmentsBody, { editing: editing, remoteState: remoteState, localState: localState, setLocalState: setLocalState, ssoSamlConnections: connections !== null && connections !== void 0 ? connections : [], roles: sortedRoles, isSsoEnabled: isSsoEnabled, isScimEnabled: isScimEnabled, scimGroupAssignments: scimGroupAssignments, allScimGroupIdToGroupName: allScimGroupIdToGroupName, scimConnection: scimConnection === null || scimConnection === void 0 ? void 0 : scimConnection.connection })); };
|
|
10439
|
+
var RadioCore = function RadioCore(_ref135) { var autoFocus = _ref135.autoFocus, checked = _ref135.checked, disabled = _ref135.disabled, label = _ref135.label, onClick = _ref135.onClick, value = _ref135.value, classes = _ref135.classes; var handleChange = function handleChange(e) { onClick === null || onClick === void 0 ? void 0 : onClick(e.target.value); }; return /*#__PURE__*/ wn.createElement(FormControlLabel$1, { control: /*#__PURE__*/ wn.createElement(MUIRadio, { autoFocus: autoFocus, checked: checked, classes: classes, disableRipple: true, onChange: handleChange, color: "primary", size: "small", value: value }), disabled: disabled, label: /*#__PURE__*/ wn.createElement(FlexBox, null, label && ( /*#__PURE__*/wn.createElement(Typography, { variant: 'body2', disabled: disabled }, label))) }); };
|
|
10365
10440
|
var makeRowStyles = makeStyles(function () { return { rowItemContainer: { maxWidth: DEFAULT_GRID_COLUMN_WIDTH }, rowItemFullWidth: { maxWidth: DEFAULT_MAX_ITEM_WIDTH } }; });
|
|
10366
|
-
var RowItemCore = function RowItemCore(
|
|
10441
|
+
var RowItemCore = function RowItemCore(_ref136) { var children = _ref136.children, fullWidth = _ref136.fullWidth; var classes = makeRowStyles(); return /*#__PURE__*/ wn.createElement("div", { className: C(classes.rowItemContainer, _defineProperty2({}, classes.rowItemFullWidth, fullWidth)) }, children); };
|
|
10367
10442
|
var makeRadioGroupStyles = makeStylesFactory(function (theme) { return { radioGroup: { display: 'flex', flexDirection: 'column', gap: theme.spacing(0.5) } }; });
|
|
10368
|
-
var RadioGroupCore = function RadioGroupCore(
|
|
10443
|
+
var RadioGroupCore = function RadioGroupCore(_ref137) { var id = _ref137.id, items = _ref137.items, onChange = _ref137.onChange, readOnly = _ref137.readOnly, value = _ref137.value, classes = _ref137.classes; var radioGroupId = useShortId(id); var onClick = function onClick(value) { onChange === null || onChange === void 0 ? void 0 : onChange(value); }; return /*#__PURE__*/ wn.createElement(RowItemCore, { fullWidth: true }, /*#__PURE__*/ wn.createElement(FormGroup$1, { className: classes.radioGroup, id: radioGroupId }, items.map(function (item) { return /*#__PURE__*/ wn.createElement(RadioCore, Object.assign({}, item, { classes: Object.assign(Object.assign({}, classes), { checkbox: '', root: '', checkboxContainer: '' }), checked: item.value === value, disabled: item.disabled || readOnly, key: item.value, onClick: onClick, label: item.label })); }))); };
|
|
10369
10444
|
var useStyles = makeRadioGroupStyles(function (theme) { return { radioGroup: { display: 'flex', flexDirection: 'row', gap: theme.spacing(0.5) } }; });
|
|
10370
10445
|
var RadioGroup = function RadioGroup(props) { var classes = useStyles(props); return /*#__PURE__*/ wn.createElement(RadioGroupCore, Object.assign({ classes: classes }, props)); };
|
|
10371
10446
|
var useMutateAuthSettings = function useMutateAuthSettings() { var _useMutateOrganizatio6 = useMutateOrganization(), mutate = _useMutateOrganizatio6.mutate; var setOrgAuthSettings = function setOrgAuthSettings(mutatedProperties) { return mutate(mutatedProperties, { errorMessage: 'Failed to update email domain details.' }); }; return { setOrgAuthSettings: setOrgAuthSettings }; };
|
|
10372
10447
|
var emailAllowedDomainsRenderer = [{ title: 'Domain', getValue: function getValue(email) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, email); } }];
|
|
10373
10448
|
var emailInvitesLabelMap = { ALL_ALLOWED: 'Anybody', RESTRICTED: 'Users from allowed email domains' };
|
|
10374
|
-
var EmailDomainsTable = function EmailDomainsTable(
|
|
10375
|
-
var OrgSettingsEmailDomainsBody = function OrgSettingsEmailDomainsBody(
|
|
10376
|
-
var OrgSettingsEmailDomainsSection = function OrgSettingsEmailDomainsSection(
|
|
10377
|
-
switch (
|
|
10449
|
+
var EmailDomainsTable = function EmailDomainsTable(_ref138) { var localState = _ref138.localState, remoteState = _ref138.remoteState, setLocalState = _ref138.setLocalState, canSetAllowedDomains = _ref138.canSetAllowedDomains, editing = _ref138.editing; var emailAllowedDomains = editing ? localState.emailAllowedDomains : remoteState.emailAllowedDomains; var _h116 = h$4(''), _h117 = _slicedToArray2(_h116, 2), email = _h117[0], setEmail = _h117[1]; var addEmailModalProps = useModalState(function () { setLocalState(function (state) { return Object.assign(Object.assign({}, state), { emailAllowedDomains: _toConsumableArray2(new Set([].concat(_toConsumableArray2(localState.emailAllowedDomains), [email]))) }); }); setEmail(''); }); return /*#__PURE__*/ wn.createElement(SettingsSection, { title: "Allowed email domains" }, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, addEmailModalProps, { title: "Add allowed email domain", confirmButtonText: "Save" }), /*#__PURE__*/ wn.createElement(Input$1, { label: "Domain", onChange: setEmail, placeholder: "Enter domain", value: email })), /*#__PURE__*/ wn.createElement(ListEditor, { items: emailAllowedDomains !== null && emailAllowedDomains !== void 0 ? emailAllowedDomains : [], itemRenderer: emailAllowedDomainsRenderer, onAdd: function onAdd() { addEmailModalProps.open(); }, getItemActionProps: editing && canSetAllowedDomains ? function (item) { return { warningAction: { text: 'Delete', onClick: function onClick() { setEmail(''); setLocalState(function (prevState) { return Object.assign(Object.assign({}, prevState), { emailAllowedDomains: localState.emailAllowedDomains.filter(function (domain) { return domain !== item; }) }); }); } } }; } : undefined, hideAddButton: !canSetAllowedDomains || !editing, addButtonText: "Add Domain" })); };
|
|
10450
|
+
var OrgSettingsEmailDomainsBody = function OrgSettingsEmailDomainsBody(_ref139) { var canSetEmailInvites = _ref139.canSetEmailInvites, canSetEmailJitProvisioning = _ref139.canSetEmailJitProvisioning, canSetAllowedDomains = _ref139.canSetAllowedDomains, localState = _ref139.localState, remoteState = _ref139.remoteState, setLocalState = _ref139.setLocalState; var _useSettingsContainer6 = useSettingsContainer(), editing = _useSettingsContainer6.editing; var handleJitProvisioningChange = useStateSliceSetter(setLocalState, 'isEmailJitProvisioningAllowed'); var handleEmailInvitesChange = useStateSliceSetter(setLocalState, 'emailInvites'); return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, /*#__PURE__*/ wn.createElement(SettingsSection, { title: "Email Invites" }, /*#__PURE__*/ wn.createElement(Switch, { readOnly: !editing || !canSetEmailInvites, label: 'Allow members to be invited to join your organization by email', checked: localState.emailInvites !== 'NOT_ALLOWED', onChange: function onChange(value) { return handleEmailInvitesChange(value ? 'ALL_ALLOWED' : 'NOT_ALLOWED'); } }), localState.emailInvites !== 'NOT_ALLOWED' && ( /*#__PURE__*/wn.createElement(PaddingLeft, null, /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "row", flexWrap: "wrap" }, /*#__PURE__*/ wn.createElement(RadioGroup, { onChange: handleEmailInvitesChange, value: localState.emailInvites, items: Object.entries(emailInvitesLabelMap).map(function (_ref140) { var _ref141 = _slicedToArray2(_ref140, 2), value = _ref141[0], label = _ref141[1]; return { value: value, label: label, disabled: !editing || !canSetEmailInvites }; }) }))))), /*#__PURE__*/ wn.createElement(SettingsSection, { title: "JIT Provisioning", tooltipText: "If enabled, users who successfully authenticate via allowed email domains will be automatically granted an account if they do not already exist within your organization." }, /*#__PURE__*/ wn.createElement(Switch, { readOnly: !editing || !canSetEmailJitProvisioning, label: 'Allow JIT provisioning for users from allowed email domains', checked: localState.isEmailJitProvisioningAllowed, onChange: handleJitProvisioningChange })), /*#__PURE__*/ wn.createElement(EmailDomainsTable, { localState: localState, remoteState: remoteState, setLocalState: setLocalState, canSetAllowedDomains: canSetAllowedDomains, editing: editing, manualConfiguration: false })); };
|
|
10451
|
+
var OrgSettingsEmailDomainsSection = function OrgSettingsEmailDomainsSection(_ref142) { var orgInfo = _ref142.orgInfo; var _useRbac22 = useRbac('stytch.organization', 'update.settings.email-jit-provisioning'), canSetEmailJitProvisioning = _useRbac22.data; var _useRbac23 = useRbac('stytch.organization', 'update.settings.email-invites'), canSetEmailInvites = _useRbac23.data; var _useRbac24 = useRbac('stytch.organization', 'update.settings.allowed-domains'), canSetAllowedDomains = _useRbac24.data; var remoteState = F$3(function () { return { emailInvites: orgInfo.email_invites, emailAllowedDomains: orgInfo.email_allowed_domains, isEmailJitProvisioningAllowed: orgInfo.email_jit_provisioning !== 'NOT_ALLOWED' }; }, [orgInfo]); var _useFormState7 = useFormState({ remoteState: remoteState }), localState = _useFormState7.localState, setLocalState = _useFormState7.setLocalState, editing = _useFormState7.editing, handleSetEditing = _useFormState7.handleSetEditing; var _useMutateAuthSetting2 = useMutateAuthSettings(), setOrgAuthSettings = _useMutateAuthSetting2.setOrgAuthSettings; var _useOrgSettingsRouter4 = useOrgSettingsRouterController(), useBlockNavigation = _useOrgSettingsRouter4.useBlockNavigation; var handleSave = T$2(function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee25() { var mutatedProperties; return _regeneratorRuntime().wrap(function _callee25$(_context26) { while (1)
|
|
10452
|
+
switch (_context26.prev = _context26.next) {
|
|
10378
10453
|
case 0:
|
|
10379
10454
|
mutatedProperties = {};
|
|
10380
10455
|
if (localState.isEmailJitProvisioningAllowed !== remoteState.isEmailJitProvisioningAllowed) {
|
|
@@ -10387,14 +10462,14 @@ var OrgSettingsEmailDomainsSection = function OrgSettingsEmailDomainsSection(_re
|
|
|
10387
10462
|
mutatedProperties.email_allowed_domains = localState.emailAllowedDomains;
|
|
10388
10463
|
}
|
|
10389
10464
|
if (!(Object.keys(mutatedProperties).length > 0)) {
|
|
10390
|
-
|
|
10465
|
+
_context26.next = 7;
|
|
10391
10466
|
break;
|
|
10392
10467
|
}
|
|
10393
|
-
|
|
10468
|
+
_context26.next = 7;
|
|
10394
10469
|
return setOrgAuthSettings(mutatedProperties);
|
|
10395
10470
|
case 7:
|
|
10396
|
-
case "end": return
|
|
10397
|
-
} },
|
|
10471
|
+
case "end": return _context26.stop();
|
|
10472
|
+
} }, _callee25); })); }, [localState.emailAllowedDomains, localState.emailInvites, localState.isEmailJitProvisioningAllowed, remoteState.emailAllowedDomains, remoteState.emailInvites, remoteState.isEmailJitProvisioningAllowed, setOrgAuthSettings]); var disableSave = F$3(function () { return arraysHaveSameContents(localState.emailAllowedDomains, remoteState.emailAllowedDomains) && localState.emailInvites === remoteState.emailInvites && localState.isEmailJitProvisioningAllowed === remoteState.isEmailJitProvisioningAllowed; }, [localState.emailAllowedDomains, localState.emailInvites, localState.isEmailJitProvisioningAllowed, remoteState.emailAllowedDomains, remoteState.emailInvites, remoteState.isEmailJitProvisioningAllowed]); return /*#__PURE__*/ wn.createElement(SettingsContainer, { title: "Email domain settings", hasCTA: canSetEmailJitProvisioning || canSetEmailInvites || canSetAllowedDomains, onSave: handleSave, useBlockNavigation: useBlockNavigation, editing: editing, setEditing: handleSetEditing, disableSave: disableSave }, /*#__PURE__*/ wn.createElement(OrgSettingsEmailDomainsBody, { canSetEmailJitProvisioning: canSetEmailJitProvisioning, canSetEmailInvites: canSetEmailInvites, canSetAllowedDomains: canSetAllowedDomains, localState: localState, remoteState: remoteState, setLocalState: setLocalState })); };
|
|
10398
10473
|
var OrgSettingsScreen = function OrgSettingsScreen() { var _useOrgInfo3 = useOrgInfo(), isLoading = _useOrgInfo3.isLoading, error = _useOrgInfo3.error, orgInfo = _useOrgInfo3.data; if (isLoading) {
|
|
10399
10474
|
return /*#__PURE__*/ wn.createElement(PageLoadingIndicator, null);
|
|
10400
10475
|
} if (error) {
|
|
@@ -10429,22 +10504,20 @@ default_1$5 = ChevronLeft["default"] = _default$5;
|
|
|
10429
10504
|
var NO_VALUE = '–';
|
|
10430
10505
|
var decorateCurrentMemberName = function decorateCurrentMemberName(name) { return "".concat(name || NO_VALUE, " (You)"); };
|
|
10431
10506
|
var memberGetKey = function memberGetKey(memberId) { return memberId ? ['members.search.id', memberId] : null; };
|
|
10432
|
-
var
|
|
10433
|
-
|
|
10434
|
-
var fetchMembers = function fetchMembers(client) { return function (_ref138) { var cursor = _ref138.cursor, limit = _ref138.limit, email = _ref138.email, roles = _ref138.roles, statuses = _ref138.statuses; return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee23() { var operands, response; return _regeneratorRuntime().wrap(function _callee23$(_context24) { while (1)
|
|
10435
|
-
switch (_context24.prev = _context24.next) {
|
|
10507
|
+
var fetchMembers = function fetchMembers(client) { return function (_ref143) { var cursor = _ref143.cursor, limit = _ref143.limit, email = _ref143.email, roles = _ref143.roles, statuses = _ref143.statuses; return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee26() { var operands, response; return _regeneratorRuntime().wrap(function _callee26$(_context27) { while (1)
|
|
10508
|
+
switch (_context27.prev = _context27.next) {
|
|
10436
10509
|
case 0:
|
|
10437
10510
|
operands = [email && { filter_name: 'member_email_fuzzy', filter_value: email }, roles && { filter_name: 'member_roles', filter_value: roles }, statuses && { filter_name: 'statuses', filter_value: statuses }].filter(isTruthy);
|
|
10438
|
-
|
|
10511
|
+
_context27.next = 3;
|
|
10439
10512
|
return client.organization.members.search({ cursor: cursor, limit: limit, query: operands.length > 0 ? { operator: 'AND', operands: operands } : undefined });
|
|
10440
10513
|
case 3:
|
|
10441
|
-
response =
|
|
10442
|
-
return
|
|
10514
|
+
response = _context27.sent;
|
|
10515
|
+
return _context27.abrupt("return", Object.assign(Object.assign({}, response), { isFetchMemberResponse: true }));
|
|
10443
10516
|
case 5:
|
|
10444
|
-
case "end": return
|
|
10445
|
-
} },
|
|
10517
|
+
case "end": return _context27.stop();
|
|
10518
|
+
} }, _callee26); })); }; };
|
|
10446
10519
|
var isFetchMembersResponse = function isFetchMembersResponse(data) { return _typeof2(data) === 'object' && data !== null && 'isFetchMemberResponse' in data && data.isFetchMemberResponse; };
|
|
10447
|
-
var useUpdateCachedMember = function useUpdateCachedMember() { var
|
|
10520
|
+
var useUpdateCachedMember = function useUpdateCachedMember() { var _useSWRConfig6 = useSWRConfig(), mutate = _useSWRConfig6.mutate, cache = _useSWRConfig6.cache; var updateCachedMember = T$2(function (memberId, setMember) { var _a; var _iterator2 = _createForOfIteratorHelper(cache.keys()), _step2; try {
|
|
10448
10521
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
10449
10522
|
var _key6 = _step2.value;
|
|
10450
10523
|
var data = cache.get(_key6);
|
|
@@ -10465,48 +10538,29 @@ catch (err) {
|
|
|
10465
10538
|
finally {
|
|
10466
10539
|
_iterator2.f();
|
|
10467
10540
|
} }, [cache, mutate]); var setMember = T$2(function (member) { updateCachedMember(member.member_id, function () { return member; }); }, [updateCachedMember]); var markMemberDeleted = T$2(function (memberId) { updateCachedMember(memberId, function (member) { return Object.assign(Object.assign({}, member), { status: 'deleted' }); }); }, [updateCachedMember]); return { setMember: setMember, markMemberDeleted: markMemberDeleted }; };
|
|
10468
|
-
var useMutateMember = function useMutateMember() { var
|
|
10469
|
-
switch (
|
|
10541
|
+
var useMutateMember = function useMutateMember() { var _useSWRConfig7 = useSWRConfig(), mutateSWR = _useSWRConfig7.mutate; var client = useStytchClient(); var _useUpdateCachedMembe = useUpdateCachedMember(), setMember = _useUpdateCachedMembe.setMember; return useMutateWithToast(T$2(function (properties) { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee28() { var result; return _regeneratorRuntime().wrap(function _callee28$(_context29) { while (1)
|
|
10542
|
+
switch (_context29.prev = _context29.next) {
|
|
10470
10543
|
case 0:
|
|
10471
|
-
|
|
10472
|
-
return mutateSWR(memberGetKey(properties.member_id), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function
|
|
10473
|
-
switch (
|
|
10544
|
+
_context29.next = 2;
|
|
10545
|
+
return mutateSWR(memberGetKey(properties.member_id), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee27() { var resp; return _regeneratorRuntime().wrap(function _callee27$(_context28) { while (1)
|
|
10546
|
+
switch (_context28.prev = _context28.next) {
|
|
10474
10547
|
case 0:
|
|
10475
|
-
|
|
10548
|
+
_context28.next = 2;
|
|
10476
10549
|
return client.organization.members.update(properties);
|
|
10477
10550
|
case 2:
|
|
10478
|
-
resp =
|
|
10479
|
-
return
|
|
10551
|
+
resp = _context28.sent;
|
|
10552
|
+
return _context28.abrupt("return", resp.member);
|
|
10480
10553
|
case 4:
|
|
10481
|
-
case "end": return
|
|
10482
|
-
} },
|
|
10554
|
+
case "end": return _context28.stop();
|
|
10555
|
+
} }, _callee27); })); }, { optimisticData: function optimisticData(member) { properties.roles; var rest = __rest(properties, ["roles"]); return Object.assign(Object.assign({}, member), rest); }, rollbackOnError: true, populateCache: true, revalidate: false });
|
|
10483
10556
|
case 2:
|
|
10484
|
-
result =
|
|
10557
|
+
result = _context29.sent;
|
|
10485
10558
|
if (result) {
|
|
10486
10559
|
setMember(result);
|
|
10487
10560
|
}
|
|
10488
10561
|
case 4:
|
|
10489
|
-
case "end": return
|
|
10490
|
-
} },
|
|
10491
|
-
var getRoleDefaultDescription = function getRoleDefaultDescription(role) { return role.description; };
|
|
10492
|
-
var useGetRoleDescription = function useGetRoleDescription() { var config = useAdminPortalUIConfig(); return T$2(function (role) { var _a; return ((_a = config === null || config === void 0 ? void 0 : config.getRoleDescription) === null || _a === void 0 ? void 0 : _a.call(config, role)) || getRoleDefaultDescription(role); }, [config]); };
|
|
10493
|
-
var getRoleDefaultDisplayName = function getRoleDefaultDisplayName(role) { return role.role_id; };
|
|
10494
|
-
var useGetRoleDisplayName = function useGetRoleDisplayName() { var config = useAdminPortalUIConfig(); return T$2(function (role) { var _a; return ((_a = config === null || config === void 0 ? void 0 : config.getRoleDisplayName) === null || _a === void 0 ? void 0 : _a.call(config, role)) || getRoleDefaultDisplayName(role); }, [config]); };
|
|
10495
|
-
var useRoleDisplayInfo = function useRoleDisplayInfo() { var allRoles = useRoles(); var getRoleDisplayName = useGetRoleDisplayName(); var getRoleDescription = useGetRoleDescription(); var roleInfo = F$3(function () { var _a; return (_a = allRoles === null || allRoles === void 0 ? void 0 : allRoles.reduce(function (acc, role) { acc[role.role_id] = { description: getRoleDescription(role), label: getRoleDisplayName(role) }; return acc; }, {})) !== null && _a !== void 0 ? _a : {}; }, [allRoles, getRoleDescription, getRoleDisplayName]); var getRoleIdDisplayName = T$2(function (roleId) { var _a; return (_a = roleInfo[roleId].label) !== null && _a !== void 0 ? _a : roleId; }, [roleInfo]); return { roleInfo: roleInfo, getRoleIdDisplayName: getRoleIdDisplayName }; };
|
|
10496
|
-
var wellKnownRoleIds = [ROLE_ID_STYTCH_MEMBER, ROLE_ID_STYTCH_ADMIN];
|
|
10497
|
-
var compareWellKnownRoleIds = function compareWellKnownRoleIds(a, b) { if (a === b) {
|
|
10498
|
-
return 0;
|
|
10499
|
-
} for (var _i = 0, _wellKnownRoleIds = wellKnownRoleIds; _i < _wellKnownRoleIds.length; _i++) {
|
|
10500
|
-
var roleId = _wellKnownRoleIds[_i];
|
|
10501
|
-
if (a === roleId) {
|
|
10502
|
-
return -1;
|
|
10503
|
-
}
|
|
10504
|
-
if (b === roleId) {
|
|
10505
|
-
return 1;
|
|
10506
|
-
}
|
|
10507
|
-
} return 0; };
|
|
10508
|
-
var useRoleSortFn = function useRoleSortFn() { var getRoleDisplayName = useGetRoleDisplayName(); var allRoles = useRoles(); var rolesById = F$3(function () { return allRoles === null || allRoles === void 0 ? void 0 : allRoles.reduce(function (acc, role) { acc[role.role_id] = Object.assign(Object.assign({}, role), { displayName: getRoleDisplayName(role) || getRoleDefaultDisplayName(role) }); return acc; }, {}); }, [allRoles, getRoleDisplayName]); return T$2(function (roles) { return roles.map(function (role) { var _a; var matchingPolicyRole = rolesById === null || rolesById === void 0 ? void 0 : rolesById[role.role_id]; return Object.assign(Object.assign(Object.assign({}, matchingPolicyRole), role), { displayName: (_a = matchingPolicyRole === null || matchingPolicyRole === void 0 ? void 0 : matchingPolicyRole.displayName) !== null && _a !== void 0 ? _a : role.role_id }); }).sort(function (a, b) { return compareWellKnownRoleIds(a.role_id, b.role_id) || a.displayName.localeCompare(b.displayName); }); }, [rolesById]); };
|
|
10509
|
-
var useRoleAutocomplete = function useRoleAutocomplete() { var _ref139 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref139$excludeStytch = _ref139.excludeStytchMember, excludeStytchMember = _ref139$excludeStytch === void 0 ? false : _ref139$excludeStytch; var allRoles = useRoles(); var assignableRoles = F$3(function () { return excludeStytchMember ? allRoles === null || allRoles === void 0 ? void 0 : allRoles.filter(function (role) { return role.role_id !== ROLE_ID_STYTCH_MEMBER; }) : allRoles; }, [allRoles, excludeStytchMember]); var sortRoles = useRoleSortFn(); var roleSelectItems = F$3(function () { return sortRoles(assignableRoles !== null && assignableRoles !== void 0 ? assignableRoles : []).map(function (role) { return role.role_id; }); }, [assignableRoles, sortRoles]); var _useRoleDisplayInfo = useRoleDisplayInfo(), roleInfo = _useRoleDisplayInfo.roleInfo, getRoleIdDisplayName = _useRoleDisplayInfo.getRoleIdDisplayName; return { selectItems: roleSelectItems, getOptionDescription: function getOptionDescription(roleId) { return roleInfo[roleId].description; }, getOptionLabel: getRoleIdDisplayName }; };
|
|
10562
|
+
case "end": return _context29.stop();
|
|
10563
|
+
} }, _callee28); })); }, [client.organization.members, mutateSWR, setMember])); };
|
|
10510
10564
|
var _createRouter3 = createRouter(), MemberManagementRouterProvider = _createRouter3.RouterProvider, MemberManagementRouter = _createRouter3.Router, useMemberManagementRouterController = _createRouter3.useRouterController;
|
|
10511
10565
|
var getRoleSourceTypeDisplayName = function getRoleSourceTypeDisplayName(sourceType) { switch (sourceType) {
|
|
10512
10566
|
case 'direct_assignment': return 'Manual assignment';
|
|
@@ -10517,13 +10571,13 @@ var getRoleSourceTypeDisplayName = function getRoleSourceTypeDisplayName(sourceT
|
|
|
10517
10571
|
default: return sourceType;
|
|
10518
10572
|
} };
|
|
10519
10573
|
var roleAssignmentsRowKeyExtractor = function roleAssignmentsRowKeyExtractor(item) { return "".concat(item.role_id, "-").concat(item.sourceType); };
|
|
10520
|
-
var AccessSectionBody = function AccessSectionBody(
|
|
10574
|
+
var AccessSectionBody = function AccessSectionBody(_ref131) { var localState = _ref131.localState, setLocalState = _ref131.setLocalState, remoteState = _ref131.remoteState, implicitRoleAssignments = _ref131.implicitRoleAssignments, showRoleAssignment = _ref131.showRoleAssignment; var _useSettingsContainer7 = useSettingsContainer(), editing = _useSettingsContainer7.editing; var _ref132 = editing ? localState : remoteState, isMfaEnrolled = _ref132.isMfaEnrolled, explicitRoleAssignments = _ref132.explicitRoleAssignments, isBreakglass = _ref132.isBreakglass; var handleIsMfaEnrolledChange = useStateSliceSetter(setLocalState, 'isMfaEnrolled'); var setIsBreakglass = useStateSliceSetter(setLocalState, 'isBreakglass'); var _a = useModalState(function () { setIsBreakglass(true); }), openBreakGlassConfirmModal = _a.open, breakGlassConfirmModalProps = __rest(_a, ["open"]); var handleIsBreakglassChange = T$2(function (value) { if (value) {
|
|
10521
10575
|
openBreakGlassConfirmModal();
|
|
10522
10576
|
}
|
|
10523
10577
|
else {
|
|
10524
10578
|
setIsBreakglass(value);
|
|
10525
|
-
} }, [openBreakGlassConfirmModal, setIsBreakglass]); var _useRbac25 = useRbac('stytch.member', 'update.settings.roles'), canUpdateRoles = _useRbac25.data; var _useRbac26 = useRbac('stytch.member', 'update.settings.mfa-enrolled'), canUpdateMfaEnrolled = _useRbac26.data; var _useRbac27 = useRbac('stytch.member', 'update.settings.is-breakglass'), canUpdateBreakglass = _useRbac27.data; var sortRoles = useRoleSortFn(); var _b = useRoleAutocomplete({ excludeStytchMember: true }), roleSelectItems = _b.selectItems, roleAutocompleteProps = __rest(_b, ["selectItems"]); var availableRoleSelectItems = roleSelectItems.filter(function (roleId) { return !explicitRoleAssignments.includes(roleId); }); var _useRoleDisplayInfo2 = useRoleDisplayInfo(), getRoleIdDisplayName = _useRoleDisplayInfo2.getRoleIdDisplayName; var stytchMemberRoleDisplayName = roleAutocompleteProps.getOptionLabel(ROLE_ID_STYTCH_MEMBER); var combinedRoleAssignments = F$3(function () { return [].concat(_toConsumableArray2(sortRoles(implicitRoleAssignments)), _toConsumableArray2(sortRoles(explicitRoleAssignments.map(function (roleId) { return { role_id: roleId, sourceType: 'direct_assignment' }; })))); }, [explicitRoleAssignments, implicitRoleAssignments, sortRoles]); var
|
|
10526
|
-
var AccessSection = function AccessSection(
|
|
10579
|
+
} }, [openBreakGlassConfirmModal, setIsBreakglass]); var _useRbac25 = useRbac('stytch.member', 'update.settings.roles'), canUpdateRoles = _useRbac25.data; var _useRbac26 = useRbac('stytch.member', 'update.settings.mfa-enrolled'), canUpdateMfaEnrolled = _useRbac26.data; var _useRbac27 = useRbac('stytch.member', 'update.settings.is-breakglass'), canUpdateBreakglass = _useRbac27.data; var sortRoles = useRoleSortFn(); var _b = useRoleAutocomplete({ excludeStytchMember: true }), roleSelectItems = _b.selectItems, roleAutocompleteProps = __rest(_b, ["selectItems"]); var availableRoleSelectItems = roleSelectItems.filter(function (roleId) { return !explicitRoleAssignments.includes(roleId); }); var _useRoleDisplayInfo2 = useRoleDisplayInfo(), getRoleIdDisplayName = _useRoleDisplayInfo2.getRoleIdDisplayName; var stytchMemberRoleDisplayName = roleAutocompleteProps.getOptionLabel(ROLE_ID_STYTCH_MEMBER); var combinedRoleAssignments = F$3(function () { return [].concat(_toConsumableArray2(sortRoles(implicitRoleAssignments)), _toConsumableArray2(sortRoles(explicitRoleAssignments.map(function (roleId) { return { role_id: roleId, sourceType: 'direct_assignment' }; })))); }, [explicitRoleAssignments, implicitRoleAssignments, sortRoles]); var _h118 = h$4([]), _h119 = _slicedToArray2(_h118, 2), pendingAssignments = _h119[0], setPendingAssignments = _h119[1]; var _c = useModalState(function () { setLocalState(function (state) { return Object.assign(Object.assign({}, state), { explicitRoleAssignments: Array.from(new Set([].concat(_toConsumableArray2(state.explicitRoleAssignments), _toConsumableArray2(pendingAssignments)))) }); }); }), openRoleAssignmentModal = _c.open, roleAssignmentModalProps = __rest(_c, ["open"]); var roleAssignmentsItemRenderer = F$3(function () { return [{ title: 'Role', getValue: function getValue(assignment) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, getRoleIdDisplayName(assignment.role_id)); } }, { title: 'Source', getValue: function getValue(assignment) { return /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, getRoleSourceTypeDisplayName(assignment.sourceType)); } }]; }, [getRoleIdDisplayName]); var handleAddRoleAssignment = T$2(function () { setPendingAssignments([]); openRoleAssignmentModal(); }, [openRoleAssignmentModal]); var roleAssignmentsItemActionProps = F$3(function () { return function (item) { return item.sourceType === 'direct_assignment' ? { warningAction: { text: 'Revoke', onClick: function onClick() { setLocalState(function (state) { return Object.assign(Object.assign({}, state), { explicitRoleAssignments: state.explicitRoleAssignments.filter(function (roleId) { return roleId !== item.role_id; }) }); }); } } } : {}; }; }, [setLocalState]); return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, editing && ( /*#__PURE__*/wn.createElement(Modal, Object.assign({}, breakGlassConfirmModalProps, { title: "Exempt Member from primary auth requirements?", confirmButtonText: "Allow", warning: true }), /*#__PURE__*/ wn.createElement(Typography, null, "Enabling this toggle will allow the Member to circumvent your organization's authentication requirements if needed (i.e. to update SSO information in the case of a lockout)."))), /*#__PURE__*/ wn.createElement(SettingsSection, { title: "Exempt from primary auth requirements" }, /*#__PURE__*/ wn.createElement(Switch, { readOnly: !editing || !canUpdateBreakglass, checked: isBreakglass, onChange: handleIsBreakglassChange, label: "Allow Member to circumvent your organization's authentication requirements if needed (i.e. to update SSO information in the case of a lockout)" })), /*#__PURE__*/ wn.createElement(SettingsSection, { title: "Enable MFA" }, /*#__PURE__*/ wn.createElement(Switch, { readOnly: !editing || !canUpdateMfaEnrolled, checked: isMfaEnrolled, onChange: handleIsMfaEnrolledChange, label: "Enable MFA for this Member. This will require the Member to set up and use MFA on login regardless of the organization policy. If enabled, this will override an optional MFA organization policy." })), showRoleAssignment && ( /*#__PURE__*/wn.createElement(SettingsSection, { title: "Role assignments" }, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, roleAssignmentModalProps, { title: "Add Role assignment", confirmButtonText: "Add Role" }), /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 0.5 }, /*#__PURE__*/ wn.createElement(Typography, { color: "secondary", variant: "caption" }, "Role"), /*#__PURE__*/ wn.createElement(Autocomplete, Object.assign({}, roleAutocompleteProps, { selectItems: availableRoleSelectItems, value: pendingAssignments, onChange: setPendingAssignments, placeholder: pendingAssignments.length > 0 ? undefined : 'Select Role' })))), /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, "All members are automatically assigned the ", stytchMemberRoleDisplayName, " Role."), /*#__PURE__*/ wn.createElement(ListEditor, { items: combinedRoleAssignments, rowKeyExtractor: roleAssignmentsRowKeyExtractor, itemRenderer: roleAssignmentsItemRenderer, addButtonText: "Add Role assignment", hideAddButton: availableRoleSelectItems.length === 0, readOnly: !(editing && canUpdateRoles), onAdd: handleAddRoleAssignment, getItemActionProps: roleAssignmentsItemActionProps })))); };
|
|
10580
|
+
var AccessSection = function AccessSection(_ref144) { var member = _ref144.member; var _useRbac28 = useRbac('stytch.member', 'update.settings.roles'), canUpdateRoles = _useRbac28.data; var _useRbac29 = useRbac('stytch.member', 'update.settings.mfa-enrolled'), canUpdateMfaEnrolled = _useRbac29.data; var _useRbac30 = useRbac('stytch.member', 'update.settings.is-breakglass'), canUpdateBreakglass = _useRbac30.data; var isMemberDeleted = member.status === 'deleted'; var canEditSection = !isMemberDeleted && (canUpdateRoles || canUpdateMfaEnrolled || canUpdateBreakglass); var showRoleAssignment = !isMemberDeleted; var _F2 = F$3(function () { return member.roles.filter(function (role) { return role.role_id !== ROLE_ID_STYTCH_MEMBER; }).reduce(function (acc, role) { var implicitAssignments = new Set(role.sources.filter(function (source) { return source.type !== 'direct_assignment'; }).map(function (source) { return source.type; })); var _iterator3 = _createForOfIteratorHelper(implicitAssignments), _step3; try {
|
|
10527
10581
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
10528
10582
|
var sourceType = _step3.value;
|
|
10529
10583
|
acc.implicitRoleAssignments.push({ role_id: role.role_id, sourceType: sourceType });
|
|
@@ -10536,8 +10590,8 @@ finally {
|
|
|
10536
10590
|
_iterator3.f();
|
|
10537
10591
|
} var isExplicitAssignment = role.sources.some(function (source) { return source.type === 'direct_assignment'; }); if (isExplicitAssignment) {
|
|
10538
10592
|
acc.explicitRoleAssignments.push(role.role_id);
|
|
10539
|
-
} return acc; }, { explicitRoleAssignments: [], implicitRoleAssignments: [] }); }, [member.roles]), explicitRoleAssignments = _F2.explicitRoleAssignments, implicitRoleAssignments = _F2.implicitRoleAssignments; var remoteState = F$3(function () { return { isMfaEnrolled: member.mfa_enrolled, explicitRoleAssignments: explicitRoleAssignments, isBreakglass: member.is_breakglass }; }, [explicitRoleAssignments, member.is_breakglass, member.mfa_enrolled]); var _useFormState8 = useFormState({ remoteState: remoteState }), localState = _useFormState8.localState, setLocalState = _useFormState8.setLocalState, editing = _useFormState8.editing, handleSetEditing = _useFormState8.handleSetEditing; var _useMutateMember = useMutateMember(), mutate = _useMutateMember.mutate; var handleSave = T$2(function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function
|
|
10540
|
-
switch (
|
|
10593
|
+
} return acc; }, { explicitRoleAssignments: [], implicitRoleAssignments: [] }); }, [member.roles]), explicitRoleAssignments = _F2.explicitRoleAssignments, implicitRoleAssignments = _F2.implicitRoleAssignments; var remoteState = F$3(function () { return { isMfaEnrolled: member.mfa_enrolled, explicitRoleAssignments: explicitRoleAssignments, isBreakglass: member.is_breakglass }; }, [explicitRoleAssignments, member.is_breakglass, member.mfa_enrolled]); var _useFormState8 = useFormState({ remoteState: remoteState }), localState = _useFormState8.localState, setLocalState = _useFormState8.setLocalState, editing = _useFormState8.editing, handleSetEditing = _useFormState8.handleSetEditing; var _useMutateMember = useMutateMember(), mutate = _useMutateMember.mutate; var handleSave = T$2(function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee29() { var memberOptions, shouldUpdate, setOption; return _regeneratorRuntime().wrap(function _callee29$(_context30) { while (1)
|
|
10594
|
+
switch (_context30.prev = _context30.next) {
|
|
10541
10595
|
case 0:
|
|
10542
10596
|
memberOptions = { member_id: member.member_id };
|
|
10543
10597
|
shouldUpdate = false;
|
|
@@ -10552,168 +10606,168 @@ finally {
|
|
|
10552
10606
|
setOption('roles', localState.explicitRoleAssignments);
|
|
10553
10607
|
}
|
|
10554
10608
|
if (!shouldUpdate) {
|
|
10555
|
-
|
|
10609
|
+
_context30.next = 9;
|
|
10556
10610
|
break;
|
|
10557
10611
|
}
|
|
10558
|
-
|
|
10612
|
+
_context30.next = 9;
|
|
10559
10613
|
return mutate(memberOptions);
|
|
10560
10614
|
case 9:
|
|
10561
|
-
case "end": return
|
|
10562
|
-
} },
|
|
10563
|
-
var AuthManagementSection = function AuthManagementSection(
|
|
10564
|
-
switch (
|
|
10615
|
+
case "end": return _context30.stop();
|
|
10616
|
+
} }, _callee29); })); }, [localState.explicitRoleAssignments, localState.isBreakglass, localState.isMfaEnrolled, member.member_id, mutate, remoteState.explicitRoleAssignments, remoteState.isBreakglass, remoteState.isMfaEnrolled]); var _useMemberManagementR = useMemberManagementRouterController(), useBlockNavigation = _useMemberManagementR.useBlockNavigation; return /*#__PURE__*/ wn.createElement(SettingsContainer, { title: "Access requirements & permissions", hasCTA: canEditSection, onSave: handleSave, useBlockNavigation: useBlockNavigation, editing: editing, setEditing: handleSetEditing }, /*#__PURE__*/ wn.createElement(AccessSectionBody, { remoteState: remoteState, localState: localState, setLocalState: setLocalState, implicitRoleAssignments: implicitRoleAssignments, showRoleAssignment: showRoleAssignment })); };
|
|
10617
|
+
var AuthManagementSection = function AuthManagementSection(_ref145) { var member = _ref145.member; var _useRbac31 = useRbac('stytch.member', 'update.info.delete.mfa-phone'), canDeleteMfaPhonePerm = _useRbac31.data; var _useRbac32 = useRbac('stytch.member', 'update.info.delete.mfa-totp'), canDeleteMfaTotpPerm = _useRbac32.data; var _useRbac33 = useRbac('stytch.member', 'update.info.delete.password'), canDeletePassword = _useRbac33.data; var _useRbac34 = useRbac('stytch.member', 'revoke-sessions'), canRevokeSessions = _useRbac34.data; var memberHasMfaPhone = !!member.mfa_phone_number; var memberHasTotp = !!member.totp_registration_id; var canDeleteMfaPhone = canDeleteMfaPhonePerm && memberHasMfaPhone; var canDeleteMfaTotp = canDeleteMfaTotpPerm && memberHasTotp; var canPerformAnyAction = canDeleteMfaPhone || canDeleteMfaTotp || canDeletePassword || canRevokeSessions; var client = useStytchClient(); var _useSWRConfig8 = useSWRConfig(), mutateSWR = _useSWRConfig8.mutate; var _useMutateWithToast = useMutateWithToast(function (memberId) { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee31() { return _regeneratorRuntime().wrap(function _callee31$(_context32) { while (1)
|
|
10618
|
+
switch (_context32.prev = _context32.next) {
|
|
10565
10619
|
case 0:
|
|
10566
|
-
|
|
10567
|
-
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function
|
|
10568
|
-
switch (
|
|
10620
|
+
_context32.next = 2;
|
|
10621
|
+
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee30() { var result; return _regeneratorRuntime().wrap(function _callee30$(_context31) { while (1)
|
|
10622
|
+
switch (_context31.prev = _context31.next) {
|
|
10569
10623
|
case 0:
|
|
10570
|
-
|
|
10624
|
+
_context31.next = 2;
|
|
10571
10625
|
return client.organization.members.deleteMFATOTP(memberId);
|
|
10572
10626
|
case 2:
|
|
10573
|
-
result =
|
|
10574
|
-
return
|
|
10627
|
+
result = _context31.sent;
|
|
10628
|
+
return _context31.abrupt("return", result.member);
|
|
10575
10629
|
case 4:
|
|
10576
|
-
case "end": return
|
|
10577
|
-
} },
|
|
10630
|
+
case "end": return _context31.stop();
|
|
10631
|
+
} }, _callee30); })); }, { populateCache: true, revalidate: false });
|
|
10578
10632
|
case 2:
|
|
10579
|
-
case "end": return
|
|
10580
|
-
} },
|
|
10581
|
-
switch (
|
|
10633
|
+
case "end": return _context32.stop();
|
|
10634
|
+
} }, _callee31); })); }), deleteMfaTotp = _useMutateWithToast.mutate; var _a = useModalState(function () { return deleteMfaTotp(member.member_id); }), openResetMfaTotpModal = _a.open, resetMfaTotpModalProps = __rest(_a, ["open"]); var _useMutateWithToast2 = useMutateWithToast(function (memberId) { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee33() { return _regeneratorRuntime().wrap(function _callee33$(_context34) { while (1)
|
|
10635
|
+
switch (_context34.prev = _context34.next) {
|
|
10582
10636
|
case 0:
|
|
10583
|
-
|
|
10584
|
-
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function
|
|
10585
|
-
switch (
|
|
10637
|
+
_context34.next = 2;
|
|
10638
|
+
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee32() { var result; return _regeneratorRuntime().wrap(function _callee32$(_context33) { while (1)
|
|
10639
|
+
switch (_context33.prev = _context33.next) {
|
|
10586
10640
|
case 0:
|
|
10587
|
-
|
|
10641
|
+
_context33.next = 2;
|
|
10588
10642
|
return client.organization.members.deleteMFAPhoneNumber(memberId);
|
|
10589
10643
|
case 2:
|
|
10590
|
-
result =
|
|
10591
|
-
return
|
|
10644
|
+
result = _context33.sent;
|
|
10645
|
+
return _context33.abrupt("return", result.member);
|
|
10592
10646
|
case 4:
|
|
10593
|
-
case "end": return
|
|
10594
|
-
} },
|
|
10647
|
+
case "end": return _context33.stop();
|
|
10648
|
+
} }, _callee32); })); }, { populateCache: true, revalidate: false });
|
|
10595
10649
|
case 2:
|
|
10596
|
-
case "end": return
|
|
10597
|
-
} },
|
|
10598
|
-
switch (
|
|
10650
|
+
case "end": return _context34.stop();
|
|
10651
|
+
} }, _callee33); })); }), deleteMfaPhoneNumber = _useMutateWithToast2.mutate; var _b = useModalState(function () { return deleteMfaPhoneNumber(member.member_id); }), openResetMfaPhoneNumberModal = _b.open, resetMfaPhoneNumberModalProps = __rest(_b, ["open"]); var _h120 = h$4(false), _h121 = _slicedToArray2(_h120, 2), sendPasswordReset = _h121[0], setSendPasswordReset = _h121[1]; var _useMutateWithToast3 = useMutateWithToast(function (memberId) { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee35() { return _regeneratorRuntime().wrap(function _callee35$(_context36) { while (1)
|
|
10652
|
+
switch (_context36.prev = _context36.next) {
|
|
10599
10653
|
case 0:
|
|
10600
|
-
|
|
10601
|
-
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function
|
|
10602
|
-
switch (
|
|
10654
|
+
_context36.next = 2;
|
|
10655
|
+
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee34() { var result; return _regeneratorRuntime().wrap(function _callee34$(_context35) { while (1)
|
|
10656
|
+
switch (_context35.prev = _context35.next) {
|
|
10603
10657
|
case 0:
|
|
10604
10658
|
if (!member.member_password_id) {
|
|
10605
|
-
|
|
10659
|
+
_context35.next = 6;
|
|
10606
10660
|
break;
|
|
10607
10661
|
}
|
|
10608
|
-
|
|
10662
|
+
_context35.next = 3;
|
|
10609
10663
|
return client.organization.members.deletePassword(member.member_password_id);
|
|
10610
10664
|
case 3:
|
|
10611
|
-
|
|
10612
|
-
|
|
10665
|
+
_context35.t0 = _context35.sent.member;
|
|
10666
|
+
_context35.next = 7;
|
|
10613
10667
|
break;
|
|
10614
|
-
case 6:
|
|
10668
|
+
case 6: _context35.t0 = member;
|
|
10615
10669
|
case 7:
|
|
10616
|
-
result =
|
|
10670
|
+
result = _context35.t0;
|
|
10617
10671
|
if (!sendPasswordReset) {
|
|
10618
|
-
|
|
10672
|
+
_context35.next = 11;
|
|
10619
10673
|
break;
|
|
10620
10674
|
}
|
|
10621
|
-
|
|
10675
|
+
_context35.next = 11;
|
|
10622
10676
|
return client.passwords.resetByEmailStart({ email_address: member.email_address, organization_id: member.organization_id });
|
|
10623
|
-
case 11: return
|
|
10677
|
+
case 11: return _context35.abrupt("return", result);
|
|
10624
10678
|
case 12:
|
|
10625
|
-
case "end": return
|
|
10626
|
-
} },
|
|
10679
|
+
case "end": return _context35.stop();
|
|
10680
|
+
} }, _callee34); })); }, { populateCache: true, revalidate: false });
|
|
10627
10681
|
case 2:
|
|
10628
|
-
case "end": return
|
|
10629
|
-
} },
|
|
10630
|
-
switch (
|
|
10682
|
+
case "end": return _context36.stop();
|
|
10683
|
+
} }, _callee35); })); }), resetPassword = _useMutateWithToast3.mutate; var _c = useModalState(function () { return resetPassword(member.member_id); }), openResetPasswordModal = _c.open, resetPasswordModalProps = __rest(_c, ["open"]); var _useMutateWithToast4 = useMutateWithToast(function (memberId) { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee37() { return _regeneratorRuntime().wrap(function _callee37$(_context38) { while (1)
|
|
10684
|
+
switch (_context38.prev = _context38.next) {
|
|
10631
10685
|
case 0:
|
|
10632
|
-
|
|
10633
|
-
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function
|
|
10634
|
-
switch (
|
|
10686
|
+
_context38.next = 2;
|
|
10687
|
+
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee36() { return _regeneratorRuntime().wrap(function _callee36$(_context37) { while (1)
|
|
10688
|
+
switch (_context37.prev = _context37.next) {
|
|
10635
10689
|
case 0:
|
|
10636
|
-
|
|
10690
|
+
_context37.next = 2;
|
|
10637
10691
|
return client.session.revokeForMember({ member_id: memberId });
|
|
10638
10692
|
case 2:
|
|
10639
|
-
case "end": return
|
|
10640
|
-
} },
|
|
10693
|
+
case "end": return _context37.stop();
|
|
10694
|
+
} }, _callee36); })); });
|
|
10641
10695
|
case 2:
|
|
10642
|
-
case "end": return
|
|
10643
|
-
} },
|
|
10644
|
-
var getActionCopy = function getActionCopy(
|
|
10696
|
+
case "end": return _context38.stop();
|
|
10697
|
+
} }, _callee37); })); }), revokeSessions = _useMutateWithToast4.mutate; var _d = useModalState(function () { return revokeSessions(member.member_id); }), openRevokeSessionsModal = _d.open, revokeSessionsModalProps = __rest(_d, ["open"]); var _useMemberManagementR2 = useMemberManagementRouterController(), useBlockNavigation = _useMemberManagementR2.useBlockNavigation; return canPerformAnyAction ? ( /*#__PURE__*/wn.createElement(SettingsContainer, { title: "Authentication management", useBlockNavigation: useBlockNavigation }, /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, (canDeleteMfaPhone || canDeleteMfaTotp) && ( /*#__PURE__*/wn.createElement(SettingsSection, { title: "MFA" }, /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, "Reset the Member\u2019s MFA enrollment. If necessary, the Member will have to re-enroll in MFA the next time they login."), /*#__PURE__*/ wn.createElement(FlexBox, { gap: 1 }, canDeleteMfaTotp && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, resetMfaTotpModalProps, { title: "Reset Member\u2019s TOTP enrollment", confirmButtonText: "Reset TOTP", warning: true }), /*#__PURE__*/ wn.createElement(Typography, null, "Reset the Member\u2019s TOTP enrollment. If necessary, the Member will have to re-enroll in MFA the next time they login.")), /*#__PURE__*/ wn.createElement(Button, { compact: true, variant: "ghost", onClick: openResetMfaTotpModal }, "Reset TOTP"))), canDeleteMfaPhone && ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, resetMfaPhoneNumberModalProps, { title: "Reset Member\u2019s SMS OTP enrollment", confirmButtonText: "Reset SMS OTP", warning: true }), /*#__PURE__*/ wn.createElement(Typography, null, "Reset the Member\u2019s SMS OTP enrollment. If necessary, the Member will have to re-enroll in MFA the next time they login.")), /*#__PURE__*/ wn.createElement(Button, { compact: true, variant: "ghost", onClick: openResetMfaPhoneNumberModal }, "Reset SMS OTP")))))), canDeletePassword && ( /*#__PURE__*/wn.createElement(SettingsSection, { title: "Password" }, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, resetPasswordModalProps, { title: "Ask Member to reset their password?", confirmButtonText: "Reset password", warning: true }), /*#__PURE__*/ wn.createElement(Typography, null, "Delete the member\u2019s current password and optionally trigger a password reset email by checking the box below."), /*#__PURE__*/ wn.createElement(Typography, null, "The Member will need to set a new password or use a passwordless authentication method (if allowed by your organization auth settings) in order to login again."), /*#__PURE__*/ wn.createElement(Checkbox, { label: "Trigger password reset email", checked: sendPasswordReset, onClick: function onClick(checked) { setSendPasswordReset(checked); } })), /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, "Forcing a password reset will delete the Member\u2019s current password and send a reset password email."), /*#__PURE__*/ wn.createElement(Button, { compact: true, variant: "ghost", onClick: openResetPasswordModal }, "Reset password"))), canRevokeSessions && ( /*#__PURE__*/wn.createElement(SettingsSection, { title: "Sessions" }, /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, revokeSessionsModalProps, { title: "Revoke Member\u2019s active sessions", confirmButtonText: "Revoke all sessions", warning: true }), /*#__PURE__*/ wn.createElement(Typography, null, "The Member will be force logged out and all their active sessions will be revoked.")), /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, "Force logout this Member. All active sessions will be revoked."), /*#__PURE__*/ wn.createElement(Button, { compact: true, variant: "ghost", onClick: openRevokeSessionsModal }, "Revoke all sessions")))))) : null; };
|
|
10698
|
+
var getActionCopy = function getActionCopy(_ref146) { var status = _ref146.status, isEmailVerified = _ref146.isEmailVerified; if (status === 'invited') {
|
|
10645
10699
|
return { action: 'Revoke invite', description: 'The invited Member will be deleted and cannot be restored. You will need to resend an invite to add the Member to your organization.', modalTitle: 'Revoke invite?', modalAction: 'Revoke invite', modalDescription: 'You will need to resend an invite to add the Member to your organization.' };
|
|
10646
10700
|
} if (status === 'deleted') {
|
|
10647
10701
|
var _description = 'Reactivating this Member will allow them to log into your organization under their previous account.';
|
|
10648
10702
|
return { action: 'Reactivate Member', description: _description, modalTitle: 'Reactivate Member?', modalAction: 'Reactivate', modalDescription: _description };
|
|
10649
10703
|
} var description = isEmailVerified ? 'All of the Member’s authentication factors will be deleted and all active sessions will be revoked. You will be able to reactivate the Member and restore their email, but other authentication factors and Role assignments will not be restored.' : 'All of the Member’s authentication factors will be deleted and all active sessions will be revoked. The Member’s email is not verified, so you will not be able to reactivate the Member or restore their email.'; var modalDescription = isEmailVerified ? description : ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(Typography, null, "All of the Member\u2019s authentication factors will be deleted and all active sessions will be revoked."), /*#__PURE__*/ wn.createElement(Typography, { color: "error" }, "The Member\u2019s email is not verified, so you will not be able to reactivate the Member or restore their email."))); return { action: 'Deactivate Member', description: description, modalTitle: 'Deactivate Member?', modalAction: 'Deactivate Member', modalDescription: modalDescription }; };
|
|
10650
|
-
var useMemberActivation = function useMemberActivation(revalidateMemberList) { var _a, _b; var client = useStytchClient(); var
|
|
10651
|
-
switch (
|
|
10704
|
+
var useMemberActivation = function useMemberActivation(revalidateMemberList) { var _a, _b; var client = useStytchClient(); var _useSWRConfig9 = useSWRConfig(), mutateSWR = _useSWRConfig9.mutate; var _useMutateWithToast5 = useMutateWithToast(function (memberId) { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee39() { return _regeneratorRuntime().wrap(function _callee39$(_context40) { while (1)
|
|
10705
|
+
switch (_context40.prev = _context40.next) {
|
|
10652
10706
|
case 0:
|
|
10653
|
-
|
|
10654
|
-
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function
|
|
10655
|
-
switch (
|
|
10707
|
+
_context40.next = 2;
|
|
10708
|
+
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee38() { return _regeneratorRuntime().wrap(function _callee38$(_context39) { while (1)
|
|
10709
|
+
switch (_context39.prev = _context39.next) {
|
|
10656
10710
|
case 0:
|
|
10657
|
-
|
|
10711
|
+
_context39.next = 2;
|
|
10658
10712
|
return client.organization.members["delete"](memberId);
|
|
10659
10713
|
case 2:
|
|
10660
|
-
case "end": return
|
|
10661
|
-
} },
|
|
10662
|
-
case 2: return
|
|
10714
|
+
case "end": return _context39.stop();
|
|
10715
|
+
} }, _callee38); })); });
|
|
10716
|
+
case 2: return _context40.abrupt("return", _context40.sent);
|
|
10663
10717
|
case 3:
|
|
10664
|
-
case "end": return
|
|
10665
|
-
} },
|
|
10666
|
-
switch (
|
|
10718
|
+
case "end": return _context40.stop();
|
|
10719
|
+
} }, _callee39); })); }), deleteMember = _useMutateWithToast5.mutate; var _useMutateWithToast6 = useMutateWithToast(function (memberId) { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee41() { return _regeneratorRuntime().wrap(function _callee41$(_context42) { while (1)
|
|
10720
|
+
switch (_context42.prev = _context42.next) {
|
|
10667
10721
|
case 0:
|
|
10668
|
-
|
|
10669
|
-
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function
|
|
10670
|
-
switch (
|
|
10722
|
+
_context42.next = 2;
|
|
10723
|
+
return mutateSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee40() { var result; return _regeneratorRuntime().wrap(function _callee40$(_context41) { while (1)
|
|
10724
|
+
switch (_context41.prev = _context41.next) {
|
|
10671
10725
|
case 0:
|
|
10672
|
-
|
|
10726
|
+
_context41.next = 2;
|
|
10673
10727
|
return client.organization.members.reactivate(memberId);
|
|
10674
10728
|
case 2:
|
|
10675
|
-
result =
|
|
10676
|
-
return
|
|
10729
|
+
result = _context41.sent;
|
|
10730
|
+
return _context41.abrupt("return", result.member);
|
|
10677
10731
|
case 4:
|
|
10678
|
-
case "end": return
|
|
10679
|
-
} },
|
|
10680
|
-
case 2: return
|
|
10732
|
+
case "end": return _context41.stop();
|
|
10733
|
+
} }, _callee40); })); }, { populateCache: true, revalidate: false });
|
|
10734
|
+
case 2: return _context42.abrupt("return", _context42.sent);
|
|
10681
10735
|
case 3:
|
|
10682
|
-
case "end": return
|
|
10683
|
-
} },
|
|
10684
|
-
switch (
|
|
10736
|
+
case "end": return _context42.stop();
|
|
10737
|
+
} }, _callee41); })); }), reactivateMember = _useMutateWithToast6.mutate; var _useUpdateCachedMembe2 = useUpdateCachedMember(), markMemberDeleted = _useUpdateCachedMembe2.markMemberDeleted, setMember = _useUpdateCachedMembe2.setMember; var _h122 = h$4(), _h123 = _slicedToArray2(_h122, 2), memberPendingAction = _h123[0], setMemberPendingAction = _h123[1]; var _c = useModalState(function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee42() { var member; return _regeneratorRuntime().wrap(function _callee42$(_context43) { while (1)
|
|
10738
|
+
switch (_context43.prev = _context43.next) {
|
|
10685
10739
|
case 0:
|
|
10686
10740
|
if (memberPendingAction) {
|
|
10687
|
-
|
|
10741
|
+
_context43.next = 2;
|
|
10688
10742
|
break;
|
|
10689
10743
|
}
|
|
10690
|
-
return
|
|
10744
|
+
return _context43.abrupt("return");
|
|
10691
10745
|
case 2:
|
|
10692
10746
|
if (!(memberPendingAction.status === 'deleted')) {
|
|
10693
|
-
|
|
10747
|
+
_context43.next = 9;
|
|
10694
10748
|
break;
|
|
10695
10749
|
}
|
|
10696
|
-
|
|
10750
|
+
_context43.next = 5;
|
|
10697
10751
|
return reactivateMember(memberPendingAction.member_id);
|
|
10698
10752
|
case 5:
|
|
10699
|
-
member =
|
|
10753
|
+
member = _context43.sent;
|
|
10700
10754
|
if (member) {
|
|
10701
10755
|
setMember(member);
|
|
10702
10756
|
}
|
|
10703
|
-
|
|
10757
|
+
_context43.next = 12;
|
|
10704
10758
|
break;
|
|
10705
10759
|
case 9:
|
|
10706
|
-
|
|
10760
|
+
_context43.next = 11;
|
|
10707
10761
|
return deleteMember(memberPendingAction.member_id);
|
|
10708
10762
|
case 11: markMemberDeleted(memberPendingAction.member_id);
|
|
10709
10763
|
case 12: revalidateMemberList === null || revalidateMemberList === void 0 ? void 0 : revalidateMemberList();
|
|
10710
10764
|
case 13:
|
|
10711
|
-
case "end": return
|
|
10712
|
-
} },
|
|
10713
|
-
var DangerZoneSection = function DangerZoneSection(
|
|
10714
|
-
var MemberDetailsSectionBody = function MemberDetailsSectionBody(
|
|
10715
|
-
var MemberDetailsSection = function MemberDetailsSection(
|
|
10716
|
-
switch (
|
|
10765
|
+
case "end": return _context43.stop();
|
|
10766
|
+
} }, _callee42); })); }), openConfirmationModal = _c.open, closeConfirmationModal = _c.close, deleteMemberModalProps = __rest(_c, ["open", "close"]); var close = function close() { closeConfirmationModal(); }; var openModal = function openModal(member) { setMemberPendingAction(member); openConfirmationModal(); }; var actionCopy = getActionCopy({ status: (_a = memberPendingAction === null || memberPendingAction === void 0 ? void 0 : memberPendingAction.status) !== null && _a !== void 0 ? _a : 'active', isEmailVerified: (_b = memberPendingAction === null || memberPendingAction === void 0 ? void 0 : memberPendingAction.email_address_verified) !== null && _b !== void 0 ? _b : false }); var modal = /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, deleteMemberModalProps, { close: close, title: actionCopy.modalTitle, confirmButtonText: actionCopy.modalAction, warning: true }), typeof actionCopy.modalDescription === 'string' ? ( /*#__PURE__*/wn.createElement(Typography, null, actionCopy.modalDescription)) : actionCopy.modalDescription); return { openModal: openModal, modal: modal }; };
|
|
10767
|
+
var DangerZoneSection = function DangerZoneSection(_ref147) { var member = _ref147.member; var _useRbac35 = useRbac('stytch.member', 'create'), canCreateMember = _useRbac35.data; var _useRbac36 = useRbac('stytch.member', 'delete'), canDeleteMember = _useRbac36.data; var isMemberDeleted = member.status === 'deleted'; var canMemberBeReactivated = member.email_address_verified; var canPerformAction = isMemberDeleted ? canCreateMember : canDeleteMember; var _useMemberActivation = useMemberActivation(), openModal = _useMemberActivation.openModal, modal = _useMemberActivation.modal; var actionCopy = getActionCopy({ status: member.status, isEmailVerified: member.email_address_verified }); var handleActionClick = T$2(function () { openModal(member); }, [member, openModal]); var _useMemberManagementR3 = useMemberManagementRouterController(), useBlockNavigation = _useMemberManagementR3.useBlockNavigation; return canPerformAction ? ( /*#__PURE__*/wn.createElement(SettingsContainer, { title: "Danger zone", useBlockNavigation: useBlockNavigation }, /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, !isMemberDeleted || canMemberBeReactivated ? ( /*#__PURE__*/wn.createElement(wn.Fragment, null, modal, /*#__PURE__*/ wn.createElement(Typography, { variant: "body2" }, actionCopy.description), /*#__PURE__*/ wn.createElement(Button, { compact: true, variant: "ghost", warning: true, onClick: handleActionClick }, actionCopy.action))) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, "The Member\u2019s email address was not verified. You cannot reactivate an unverified Member."))))) : null; };
|
|
10768
|
+
var MemberDetailsSectionBody = function MemberDetailsSectionBody(_ref148) { var localState = _ref148.localState, setLocalState = _ref148.setLocalState, remoteState = _ref148.remoteState; var _useSettingsContainer8 = useSettingsContainer(), editing = _useSettingsContainer8.editing; var _ref149 = editing ? localState : remoteState, emailAddress = _ref149.emailAddress, name = _ref149.name; var handleNameChange = useStateSliceSetter(setLocalState, 'name'); var handleEmailChange = useStateSliceSetter(setLocalState, 'emailAddress'); var _useRbac37 = useRbac('stytch.member', 'update.info.name'), canUpdateName = _useRbac37.data; var _useRbac38 = useRbac('stytch.member', 'update.info.email'), canUpdateEmail = _useRbac38.data; return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 2 }, /*#__PURE__*/ wn.createElement(SettingsList, null, /*#__PURE__*/ wn.createElement(SettingsListItem, { title: "Name" }, editing && canUpdateName ? ( /*#__PURE__*/wn.createElement(Input$1, { value: name, onChange: handleNameChange })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, name || NO_VALUE))), /*#__PURE__*/ wn.createElement(SettingsListItem, { title: "Email" }, editing && canUpdateEmail ? ( /*#__PURE__*/wn.createElement(Input$1, { value: emailAddress, onChange: handleEmailChange, caption: "Updating will revoke any current sessions, force a password reset, and delete SSO/OAuth registrations." })) : ( /*#__PURE__*/wn.createElement(Typography, { variant: "body2" }, emailAddress || NO_VALUE))))); };
|
|
10769
|
+
var MemberDetailsSection = function MemberDetailsSection(_ref150) { var member = _ref150.member; var _useRbac39 = useRbac('stytch.member', 'update.info.name'), canUpdateName = _useRbac39.data; var _useRbac40 = useRbac('stytch.member', 'update.info.email'), canUpdateEmail = _useRbac40.data; var isMemberDeleted = member.status === 'deleted'; var canEditSection = !isMemberDeleted && (canUpdateName || canUpdateEmail); var remoteState = F$3(function () { return { emailAddress: member.email_address, name: member.name }; }, [member.email_address, member.name]); var _useFormState9 = useFormState({ remoteState: remoteState }), localState = _useFormState9.localState, setLocalState = _useFormState9.setLocalState, editing = _useFormState9.editing, handleSetEditing = _useFormState9.handleSetEditing; var _useMutateMember2 = useMutateMember(), mutate = _useMutateMember2.mutate; var handleSave = T$2(function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee43() { var memberOptions, shouldUpdate, setOption; return _regeneratorRuntime().wrap(function _callee43$(_context44) { while (1)
|
|
10770
|
+
switch (_context44.prev = _context44.next) {
|
|
10717
10771
|
case 0:
|
|
10718
10772
|
memberOptions = { member_id: member.member_id };
|
|
10719
10773
|
shouldUpdate = false;
|
|
@@ -10725,30 +10779,30 @@ var MemberDetailsSection = function MemberDetailsSection(_ref146) { var member =
|
|
|
10725
10779
|
setOption('email_address', localState.emailAddress);
|
|
10726
10780
|
}
|
|
10727
10781
|
if (!shouldUpdate) {
|
|
10728
|
-
|
|
10782
|
+
_context44.next = 8;
|
|
10729
10783
|
break;
|
|
10730
10784
|
}
|
|
10731
|
-
|
|
10785
|
+
_context44.next = 8;
|
|
10732
10786
|
return mutate(memberOptions);
|
|
10733
10787
|
case 8:
|
|
10734
|
-
case "end": return
|
|
10735
|
-
} },
|
|
10788
|
+
case "end": return _context44.stop();
|
|
10789
|
+
} }, _callee43); })); }, [localState.emailAddress, localState.name, member.member_id, mutate, remoteState.emailAddress, remoteState.name]); var _useMemberManagementR4 = useMemberManagementRouterController(), useBlockNavigation = _useMemberManagementR4.useBlockNavigation; return /*#__PURE__*/ wn.createElement(SettingsContainer, { title: "Details", hasCTA: canEditSection, onSave: handleSave, useBlockNavigation: useBlockNavigation, editing: editing, setEditing: handleSetEditing }, /*#__PURE__*/ wn.createElement(MemberDetailsSectionBody, { remoteState: remoteState, localState: localState, setLocalState: setLocalState })); };
|
|
10736
10790
|
var allMemberStatuses = ['active', 'invited', 'pending', 'deleted'];
|
|
10737
10791
|
var allMemberStatusesSet = new Set(allMemberStatuses);
|
|
10738
10792
|
var memberStatusDisplayNames = { active: 'Active', invited: 'Invited', pending: 'Pending', deleted: 'Deactivated' };
|
|
10739
10793
|
var getMemberStatusDisplayName = function getMemberStatusDisplayName(status) { return status in memberStatusDisplayNames ? memberStatusDisplayNames[status] : status; };
|
|
10740
|
-
var useMember = function useMember(memberId) { var client = useStytchClient(); return useSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function
|
|
10741
|
-
switch (
|
|
10794
|
+
var useMember = function useMember(memberId) { var client = useStytchClient(); return useSWR(memberGetKey(memberId), function () { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee44() { var _a, response; return _regeneratorRuntime().wrap(function _callee44$(_context45) { while (1)
|
|
10795
|
+
switch (_context45.prev = _context45.next) {
|
|
10742
10796
|
case 0:
|
|
10743
|
-
|
|
10797
|
+
_context45.next = 2;
|
|
10744
10798
|
return client.organization.members.search({ limit: 1, query: { operator: 'AND', operands: [{ filter_name: 'member_ids', filter_value: [memberId] }, { filter_name: 'statuses', filter_value: allMemberStatuses }] } });
|
|
10745
10799
|
case 2:
|
|
10746
|
-
response =
|
|
10747
|
-
return
|
|
10800
|
+
response = _context45.sent;
|
|
10801
|
+
return _context45.abrupt("return", (_a = response.members.at(0)) !== null && _a !== void 0 ? _a : null);
|
|
10748
10802
|
case 4:
|
|
10749
|
-
case "end": return
|
|
10750
|
-
} },
|
|
10751
|
-
var MemberDetailsScreen = function MemberDetailsScreen(
|
|
10803
|
+
case "end": return _context45.stop();
|
|
10804
|
+
} }, _callee44); })); }); };
|
|
10805
|
+
var MemberDetailsScreen = function MemberDetailsScreen(_ref151) { var memberId = _ref151.memberId; var _a; var _useMemberManagementR5 = useMemberManagementRouterController(), navigate = _useMemberManagementR5.navigate; var _useMember = useMember(memberId), member = _useMember.data, error = _useMember.error, isLoading = _useMember.isLoading; var memberName = (member === null || member === void 0 ? void 0 : member.name) || NO_VALUE; var _useSelf2 = useSelf(), self = _useSelf2.self; var isSelf = (self === null || self === void 0 ? void 0 : self.member_id) === memberId; var memberDisplayName = isSelf ? decorateCurrentMemberName(memberName) : memberName; return /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 3 }, /*#__PURE__*/ wn.createElement(Button, { compact: true, variant: "ghost", onClick: function onClick() { navigate({ screen: 'membersList' }); }, startIcon: /*#__PURE__*/ wn.createElement(default_1$5, null) }, "Back to all Members"), member ? ( /*#__PURE__*/wn.createElement(wn.Fragment, null, /*#__PURE__*/ wn.createElement(FlexBox, { alignItems: "center", justifyContent: "flex-start", gap: 1 }, /*#__PURE__*/ wn.createElement(Typography, { variant: "h2" }, memberDisplayName), member.status !== 'active' && /*#__PURE__*/ wn.createElement(Tag, { size: "small" }, getMemberStatusDisplayName(member.status))), /*#__PURE__*/ wn.createElement(FlexBox, { flexDirection: "column", gap: 3 }, /*#__PURE__*/ wn.createElement(MemberDetailsSection, { member: member }), /*#__PURE__*/ wn.createElement(AccessSection, { member: member }), member.status === 'active' && /*#__PURE__*/ wn.createElement(AuthManagementSection, { member: member }), /*#__PURE__*/ wn.createElement(DangerZoneSection, { member: member })))) : error || member === null ? ( /*#__PURE__*/wn.createElement(Alert, null, (_a = extractErrorMessage(error)) !== null && _a !== void 0 ? _a : 'There was an error loading Member details.')) : isLoading && /*#__PURE__*/ wn.createElement(PageLoadingIndicator, null)); };
|
|
10752
10806
|
var Add = {};
|
|
10753
10807
|
var _interopRequireDefault$4 = interopRequireDefaultExports;
|
|
10754
10808
|
var _interopRequireWildcard$4 = interopRequireWildcardExports;
|
|
@@ -10799,8 +10853,8 @@ catch (err) { } var _createCacheHelper = createCacheHelper(cache, infiniteKey),
|
|
|
10799
10853
|
return;
|
|
10800
10854
|
} if (infiniteKey) {
|
|
10801
10855
|
set({ _l: persistSize ? lastPageSizeRef.current : resolvePageSize() });
|
|
10802
|
-
} }, [infiniteKey, cache]); var shouldRevalidateOnMount = revalidateOnMount && !didMountRef.current; var swr = useSWRNext(infiniteKey, /*#__PURE__*/ function () { var
|
|
10803
|
-
switch (
|
|
10856
|
+
} }, [infiniteKey, cache]); var shouldRevalidateOnMount = revalidateOnMount && !didMountRef.current; var swr = useSWRNext(infiniteKey, /*#__PURE__*/ function () { var _ref152 = _asyncToGenerator(/*#__PURE__*/ _regeneratorRuntime().mark(function _callee46(key) { var forceRevalidateAll, data, pageSize, _createCacheHelper3, _createCacheHelper4, getCache, cacheData, revalidators, previousPageData, _loop2, i; return _regeneratorRuntime().wrap(function _callee46$(_context48) { while (1)
|
|
10857
|
+
switch (_context48.prev = _context48.next) {
|
|
10804
10858
|
case 0:
|
|
10805
10859
|
forceRevalidateAll = get()._i;
|
|
10806
10860
|
data = [];
|
|
@@ -10809,85 +10863,85 @@ catch (err) { } var _createCacheHelper = createCacheHelper(cache, infiniteKey),
|
|
|
10809
10863
|
cacheData = getCache().data;
|
|
10810
10864
|
revalidators = [];
|
|
10811
10865
|
previousPageData = null;
|
|
10812
|
-
_loop2 = /*#__PURE__*/ _regeneratorRuntime().mark(function _loop2(i) { var _serialize$, _serialize$2, pageKey, pageArg, _createCacheHelper5, _createCacheHelper6, getSWRCache, setSWRCache, pageData, shouldFetchPage, revalidate; return _regeneratorRuntime().wrap(function _loop2$(
|
|
10813
|
-
switch (
|
|
10866
|
+
_loop2 = /*#__PURE__*/ _regeneratorRuntime().mark(function _loop2(i) { var _serialize$, _serialize$2, pageKey, pageArg, _createCacheHelper5, _createCacheHelper6, getSWRCache, setSWRCache, pageData, shouldFetchPage, revalidate; return _regeneratorRuntime().wrap(function _loop2$(_context47) { while (1)
|
|
10867
|
+
switch (_context47.prev = _context47.next) {
|
|
10814
10868
|
case 0:
|
|
10815
10869
|
_serialize$ = serialize$1(getKey(i, parallel ? null : previousPageData)), _serialize$2 = _slicedToArray2(_serialize$, 2), pageKey = _serialize$2[0], pageArg = _serialize$2[1];
|
|
10816
10870
|
if (pageKey) {
|
|
10817
|
-
|
|
10871
|
+
_context47.next = 3;
|
|
10818
10872
|
break;
|
|
10819
10873
|
}
|
|
10820
|
-
return
|
|
10874
|
+
return _context47.abrupt("return", 1);
|
|
10821
10875
|
case 3:
|
|
10822
10876
|
_createCacheHelper5 = createCacheHelper(cache, pageKey), _createCacheHelper6 = _slicedToArray2(_createCacheHelper5, 2), getSWRCache = _createCacheHelper6[0], setSWRCache = _createCacheHelper6[1];
|
|
10823
10877
|
pageData = getSWRCache().data;
|
|
10824
10878
|
shouldFetchPage = revalidateAll || forceRevalidateAll || isUndefined(pageData) || revalidateFirstPage && !i && !isUndefined(cacheData) || shouldRevalidateOnMount || cacheData && !isUndefined(cacheData[i]) && !config.compare(cacheData[i], pageData);
|
|
10825
10879
|
if (!(fn && shouldFetchPage)) {
|
|
10826
|
-
|
|
10880
|
+
_context47.next = 16;
|
|
10827
10881
|
break;
|
|
10828
10882
|
}
|
|
10829
|
-
revalidate = /*#__PURE__*/ function () { var
|
|
10830
|
-
switch (
|
|
10883
|
+
revalidate = /*#__PURE__*/ function () { var _ref153 = _asyncToGenerator(/*#__PURE__*/ _regeneratorRuntime().mark(function _callee45() { return _regeneratorRuntime().wrap(function _callee45$(_context46) { while (1)
|
|
10884
|
+
switch (_context46.prev = _context46.next) {
|
|
10831
10885
|
case 0:
|
|
10832
|
-
|
|
10886
|
+
_context46.next = 2;
|
|
10833
10887
|
return fn(pageArg);
|
|
10834
10888
|
case 2:
|
|
10835
|
-
pageData =
|
|
10889
|
+
pageData = _context46.sent;
|
|
10836
10890
|
setSWRCache({ data: pageData, _k: pageArg });
|
|
10837
10891
|
data[i] = pageData;
|
|
10838
10892
|
case 5:
|
|
10839
|
-
case "end": return
|
|
10840
|
-
} },
|
|
10893
|
+
case "end": return _context46.stop();
|
|
10894
|
+
} }, _callee45); })); return function revalidate() { return _ref153.apply(this, arguments); }; }();
|
|
10841
10895
|
if (!parallel) {
|
|
10842
|
-
|
|
10896
|
+
_context47.next = 12;
|
|
10843
10897
|
break;
|
|
10844
10898
|
}
|
|
10845
10899
|
revalidators.push(revalidate);
|
|
10846
|
-
|
|
10900
|
+
_context47.next = 14;
|
|
10847
10901
|
break;
|
|
10848
10902
|
case 12:
|
|
10849
|
-
|
|
10903
|
+
_context47.next = 14;
|
|
10850
10904
|
return revalidate();
|
|
10851
10905
|
case 14:
|
|
10852
|
-
|
|
10906
|
+
_context47.next = 17;
|
|
10853
10907
|
break;
|
|
10854
10908
|
case 16: data[i] = pageData;
|
|
10855
10909
|
case 17: if (!parallel) {
|
|
10856
10910
|
previousPageData = pageData;
|
|
10857
10911
|
}
|
|
10858
10912
|
case 18:
|
|
10859
|
-
case "end": return
|
|
10913
|
+
case "end": return _context47.stop();
|
|
10860
10914
|
} }, _loop2); });
|
|
10861
10915
|
i = 0;
|
|
10862
10916
|
case 9:
|
|
10863
10917
|
if (!(i < pageSize)) {
|
|
10864
|
-
|
|
10918
|
+
_context48.next = 16;
|
|
10865
10919
|
break;
|
|
10866
10920
|
}
|
|
10867
|
-
return
|
|
10921
|
+
return _context48.delegateYield(_loop2(i), "t0", 11);
|
|
10868
10922
|
case 11:
|
|
10869
|
-
if (!
|
|
10870
|
-
|
|
10923
|
+
if (!_context48.t0) {
|
|
10924
|
+
_context48.next = 13;
|
|
10871
10925
|
break;
|
|
10872
10926
|
}
|
|
10873
|
-
return
|
|
10927
|
+
return _context48.abrupt("break", 16);
|
|
10874
10928
|
case 13:
|
|
10875
10929
|
++i;
|
|
10876
|
-
|
|
10930
|
+
_context48.next = 9;
|
|
10877
10931
|
break;
|
|
10878
10932
|
case 16:
|
|
10879
10933
|
if (!parallel) {
|
|
10880
|
-
|
|
10934
|
+
_context48.next = 19;
|
|
10881
10935
|
break;
|
|
10882
10936
|
}
|
|
10883
|
-
|
|
10937
|
+
_context48.next = 19;
|
|
10884
10938
|
return Promise.all(revalidators.map(function (r) { return r(); }));
|
|
10885
10939
|
case 19:
|
|
10886
10940
|
set({ _i: UNDEFINED });
|
|
10887
|
-
return
|
|
10941
|
+
return _context48.abrupt("return", data);
|
|
10888
10942
|
case 21:
|
|
10889
|
-
case "end": return
|
|
10890
|
-
} },
|
|
10943
|
+
case "end": return _context48.stop();
|
|
10944
|
+
} }, _callee46); })); return function (_x) { return _ref152.apply(this, arguments); }; }(), config); var mutate = T$2(function (data, opts) { var options = typeof opts === 'boolean' ? { revalidate: opts } : opts || {}; var shouldRevalidate = options.revalidate !== false; if (!infiniteKey)
|
|
10891
10945
|
return EMPTY_PROMISE; if (shouldRevalidate) {
|
|
10892
10946
|
if (!isUndefined(data)) {
|
|
10893
10947
|
set({ _i: false });
|
|
@@ -10924,55 +10978,54 @@ var _default = (0, _createSvgIcon["default"])(/*#__PURE__*/ React.createElement(
|
|
|
10924
10978
|
default_1 = FilterList["default"] = _default;
|
|
10925
10979
|
var anchorOrigin = { horizontal: 'left', vertical: 'bottom' };
|
|
10926
10980
|
var transformOrigin = { horizontal: 'left', vertical: 'top' };
|
|
10927
|
-
var FilterMenu = function FilterMenu(
|
|
10981
|
+
var FilterMenu = function FilterMenu(_ref154) { var anchorEl = _ref154.anchorEl, items = _ref154.items, onChange = _ref154.onChange, value = _ref154.value; var theme = useTheme(); var iconColor = value.size > 0 ? theme.styleConfig.colors.primary : theme.styleConfig.colors.secondary; var _h124 = h$4(value), _h125 = _slicedToArray2(_h124, 2), pendingValue = _h125[0], setPendingValue = _h125[1]; var actions = F$3(function () { return items.map(function (item) { return { key: item.value, label: item.label, onClick: function onClick() { var newValue = new Set(pendingValue); if (pendingValue.has(item.value)) {
|
|
10928
10982
|
newValue["delete"](item.value);
|
|
10929
10983
|
}
|
|
10930
10984
|
else {
|
|
10931
10985
|
newValue.add(item.value);
|
|
10932
10986
|
} setPendingValue(newValue); }, icon: /*#__PURE__*/ wn.createElement(default_1$b, { style: { visibility: pendingValue.has(item.value) ? undefined : 'hidden' } }) }; }); }, [items, pendingValue]); var handleOpen = T$2(function () { setPendingValue(value); }, [value]); var handleClose = T$2(function () { onChange(pendingValue); }, [onChange, pendingValue]); return /*#__PURE__*/ wn.createElement(IconButtonMenu, { actions: actions, anchorEl: anchorEl, closeOnClick: false, icon: /*#__PURE__*/ wn.createElement(default_1, { htmlColor: iconColor }), item: undefined, idPrefix: "filter_column", menuAnchorOrigin: anchorOrigin, menuTransformOrigin: transformOrigin, onOpen: handleOpen, onClose: handleClose }); };
|
|
10933
|
-
var useDebouncedState = function useDebouncedState(initialValue, delay) { var
|
|
10934
|
-
var useSessionStorage = makeUseStorage(sessionStorage);
|
|
10987
|
+
var useDebouncedState = function useDebouncedState(initialValue, delay) { var _h126 = h$4(initialValue), _h127 = _slicedToArray2(_h126, 2), debouncedValue = _h127[0], setDebouncedValue = _h127[1]; var _h128 = h$4(initialValue), _h129 = _slicedToArray2(_h128, 2), pendingValue = _h129[0], setPendingValue = _h129[1]; var debouncedSetValue = F$3(function () { return debounce$2(setDebouncedValue, delay); }, [delay]); var setValue = T$2(function (newValue) { setPendingValue(newValue); debouncedSetValue(newValue); }, [debouncedSetValue]); return [debouncedValue, setValue, pendingValue]; };
|
|
10988
|
+
var useSessionStorage = makeUseStorage(typeof window !== 'undefined' ? window.sessionStorage : undefined);
|
|
10935
10989
|
var serialize = function serialize(value) { return Array.from(value); };
|
|
10936
|
-
var usePersistentFilter = function usePersistentFilter(
|
|
10990
|
+
var usePersistentFilter = function usePersistentFilter(_ref155) { var viewId = _ref155.viewId, fieldId = _ref155.fieldId, defaultValue = _ref155.defaultValue, permittedValues = _ref155.permittedValues; var deserialize = T$2(function (value) { if (!value) {
|
|
10937
10991
|
return new Set(defaultValue);
|
|
10938
10992
|
} return new Set(value.filter(function (v) { return permittedValues.has(v); })); }, [defaultValue, permittedValues]); var _useSessionStorage = useSessionStorage(serialize(defaultValue), "".concat(viewId, "_filter_").concat(fieldId)), _useSessionStorage2 = _slicedToArray2(_useSessionStorage, 2), serializedValue = _useSessionStorage2[0], setSerializedValue = _useSessionStorage2[1]; var value = F$3(function () { return deserialize(serializedValue); }, [deserialize, serializedValue]); var setValue = T$2(function (newValue) { return setSerializedValue(serialize(newValue)); }, [setSerializedValue]); return [value, setValue]; };
|
|
10939
10993
|
var defaultInviteRoles = [];
|
|
10940
|
-
var useInviteModal = function useInviteModal(revalidateMemberList) { var
|
|
10941
|
-
switch (
|
|
10994
|
+
var useInviteModal = function useInviteModal(revalidateMemberList) { var _h130 = h$4(''), _h131 = _slicedToArray2(_h130, 2), inviteName = _h131[0], setInviteName = _h131[1]; var _h132 = h$4(''), _h133 = _slicedToArray2(_h132, 2), inviteEmail = _h133[0], setInviteEmail = _h133[1]; var _h134 = h$4(defaultInviteRoles), _h135 = _slicedToArray2(_h134, 2), inviteRoles = _h135[0], setInviteRoles = _h135[1]; var client = useStytchClient(); var _a = useModalState(), openInviteModal = _a.open, modalState = __rest(_a, ["open"]); var _useToast6 = useToast(), openToast = _useToast6.openToast; var handleConfirmInviteModal = function handleConfirmInviteModal() { return __awaiter(void 0, void 0, void 0, /*#__PURE__*/ _regeneratorRuntime().mark(function _callee47() { var message; return _regeneratorRuntime().wrap(function _callee47$(_context49) { while (1)
|
|
10995
|
+
switch (_context49.prev = _context49.next) {
|
|
10942
10996
|
case 0:
|
|
10943
|
-
|
|
10944
|
-
|
|
10997
|
+
_context49.prev = 0;
|
|
10998
|
+
_context49.next = 3;
|
|
10945
10999
|
return client.magicLinks.email.invite({ name: inviteName, email_address: inviteEmail.trim(), roles: inviteRoles });
|
|
10946
11000
|
case 3:
|
|
10947
|
-
|
|
11001
|
+
_context49.next = 10;
|
|
10948
11002
|
break;
|
|
10949
11003
|
case 5:
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
message = extractErrorMessage(
|
|
11004
|
+
_context49.prev = 5;
|
|
11005
|
+
_context49.t0 = _context49["catch"](0);
|
|
11006
|
+
message = extractErrorMessage(_context49.t0);
|
|
10953
11007
|
if (message) {
|
|
10954
11008
|
openToast({ text: message, type: 'error' });
|
|
10955
11009
|
}
|
|
10956
|
-
return
|
|
11010
|
+
return _context49.abrupt("return");
|
|
10957
11011
|
case 10:
|
|
10958
11012
|
revalidateMemberList();
|
|
10959
11013
|
modalState.close();
|
|
10960
11014
|
case 12:
|
|
10961
|
-
case "end": return
|
|
10962
|
-
} },
|
|
10963
|
-
var InviteModal = function InviteModal(
|
|
11015
|
+
case "end": return _context49.stop();
|
|
11016
|
+
} }, _callee47, null, [[0, 5]]); })); }; var handleInviteClick = T$2(function () { setInviteName(''); setInviteEmail(''); setInviteRoles(defaultInviteRoles); openInviteModal(); }, [openInviteModal]); return { handleInviteClick: handleInviteClick, inviteModalProps: { modalState: Object.assign(Object.assign({}, modalState), { confirm: handleConfirmInviteModal }), inviteName: inviteName, setInviteName: setInviteName, inviteEmail: inviteEmail, setInviteEmail: setInviteEmail, inviteRoles: inviteRoles, setInviteRoles: setInviteRoles } }; };
|
|
11017
|
+
var InviteModal = function InviteModal(_ref156) { var modalState = _ref156.modalState, inviteEmail = _ref156.inviteEmail, inviteName = _ref156.inviteName, inviteRoles = _ref156.inviteRoles, setInviteEmail = _ref156.setInviteEmail, setInviteName = _ref156.setInviteName, setInviteRoles = _ref156.setInviteRoles; var roleAutocompleteProps = useRoleAutocomplete({ excludeStytchMember: true }); var stytchMemberRoleDisplayName = roleAutocompleteProps.getOptionLabel(ROLE_ID_STYTCH_MEMBER); var formIsValid = inviteEmail.trim().length > 0; return /*#__PURE__*/ wn.createElement(Modal, Object.assign({}, modalState, { keepOpenOnConfirm: true, title: "Invite Member", confirmButtonText: "Invite", disableConfirm: !formIsValid }), /*#__PURE__*/ wn.createElement(Input$1, { label: "Name (optional)", placeholder: "Enter name", value: inviteName, onChange: setInviteName }), /*#__PURE__*/ wn.createElement(Input$1, { label: "Email address", placeholder: "Enter email address", value: inviteEmail, onChange: setInviteEmail, inputProps: passwordManagerDisableAutofillProps }), /*#__PURE__*/ wn.createElement(Autocomplete, Object.assign({}, roleAutocompleteProps, { placeholder: inviteRoles.length > 0 ? undefined : 'Select Role', label: "Role", caption: "All members are automatically assigned the ".concat(stytchMemberRoleDisplayName, " Role. Select additional Roles to assign more permissions."), value: inviteRoles, onChange: setInviteRoles }))); };
|
|
10964
11018
|
var MIN_EMAIL_FUZZY_SEARCH_LENGTH = 3;
|
|
10965
11019
|
var MEMBER_LIST_TABLE_VIEW_ID = 'adminPortalMemberList';
|
|
10966
11020
|
var DEFAULT_STATUSES_FILTER = new Set(['active', 'invited', 'pending']);
|
|
10967
11021
|
var allStatusesFilterItems = allMemberStatuses.map(function (status) { return { label: getMemberStatusDisplayName(status), value: status }; });
|
|
10968
|
-
var useMembers = function useMembers(
|
|
11022
|
+
var useMembers = function useMembers(_ref157) { var limit = _ref157.limit, emailRaw = _ref157.email, roles = _ref157.roles, statuses = _ref157.statuses; var client = useStytchClient(); var orgInfo = useOrgInfo(); var email = emailRaw && emailRaw.length >= MIN_EMAIL_FUZZY_SEARCH_LENGTH ? emailRaw : undefined; return index(function (index, prevData) { var _a; if (prevData && !prevData.results_metadata.next_cursor) {
|
|
10969
11023
|
return null;
|
|
10970
11024
|
} return { orgId: (_a = orgInfo.data) === null || _a === void 0 ? void 0 : _a.organization_id, method: 'members.search', limit: limit, email: email, roles: roles === null || roles === void 0 ? void 0 : roles.slice().sort(), statuses: statuses === null || statuses === void 0 ? void 0 : statuses.slice().sort(), cursor: prevData === null || prevData === void 0 ? void 0 : prevData.results_metadata.next_cursor }; }, fetchMembers(client), { revalidateFirstPage: false }); };
|
|
10971
11025
|
var getMemberId = function getMemberId(item) { return item.member_id; };
|
|
10972
|
-
var
|
|
10973
|
-
var ColumnTitleWithFilter = function ColumnTitleWithFilter(_ref155) { var items = _ref155.items, onChange = _ref155.onChange, value = _ref155.value, title = _ref155.title; var _h133 = h$4(null), _h134 = _slicedToArray2(_h133, 2), container = _h134[0], setContainer = _h134[1]; return /*#__PURE__*/ wn.createElement("div", { ref: setContainer }, /*#__PURE__*/ wn.createElement(FlexBox, { gap: 1, alignItems: "center" }, title, /*#__PURE__*/ wn.createElement(FilterMenu, { anchorEl: container !== null && container !== void 0 ? container : undefined, items: items, value: value, onChange: onChange }))); };
|
|
11026
|
+
var ColumnTitleWithFilter = function ColumnTitleWithFilter(_ref158) { var items = _ref158.items, onChange = _ref158.onChange, value = _ref158.value, title = _ref158.title; var _h136 = h$4(null), _h137 = _slicedToArray2(_h136, 2), container = _h137[0], setContainer = _h137[1]; return /*#__PURE__*/ wn.createElement("div", { ref: setContainer }, /*#__PURE__*/ wn.createElement(FlexBox, { gap: 1, alignItems: "center" }, title, /*#__PURE__*/ wn.createElement(FilterMenu, { anchorEl: container !== null && container !== void 0 ? container : undefined, items: items, value: value, onChange: onChange }))); };
|
|
10974
11027
|
var emptySet = new Set();
|
|
10975
|
-
var MemberListScreen = function MemberListScreen() { var _a, _b; var _useMemberManagementR6 = useMemberManagementRouterController(), navigate = _useMemberManagementR6.navigate; var _useRbac41 = useRbac('stytch.member', 'create'), canCreateMember = _useRbac41.data; var _useRbac42 = useRbac('stytch.member', 'delete'), canDeleteMember = _useRbac42.data; var _useRbac43 = useRbac('stytch.member', 'update.info.delete.mfa-phone'), canDeleteMfaPhone = _useRbac43.data; var _useRbac44 = useRbac('stytch.member', 'update.info.delete.mfa-totp'), canDeleteMfaTotp = _useRbac44.data; var _useRbac45 = useRbac('stytch.member', 'update.info.delete.password'), canDeletePassword = _useRbac45.data; var _useRbac46 = useRbac('stytch.member', 'update.info.mfa-phone'), canUpdateMfaPhone = _useRbac46.data; var _useRbac47 = useRbac('stytch.member', 'update.info.name'), canUpdateName = _useRbac47.data; var _useRbac48 = useRbac('stytch.member', 'update.info.untrusted-metadata'), canUpdateUntrustedMetadata = _useRbac48.data; var _useRbac49 = useRbac('stytch.member', 'update.settings.is-breakglass'), canUpdateIsBreakglass = _useRbac49.data; var _useRbac50 = useRbac('stytch.member', 'update.settings.mfa-enrolled'), canUpdateMfaEnrolled = _useRbac50.data; var _useRbac51 = useRbac('stytch.member', 'update.settings.default-mfa-method'), canUpdateDefaultMfaMethod = _useRbac51.data; var _useRbac52 = useRbac('stytch.member', 'update.settings.roles'), canUpdateRoles = _useRbac52.data; var canUpdateMember = canDeleteMfaPhone || canDeleteMfaTotp || canDeletePassword || canUpdateMfaPhone || canUpdateName || canUpdateUntrustedMetadata || canUpdateIsBreakglass || canUpdateMfaEnrolled || canUpdateDefaultMfaMethod || canUpdateRoles; var canActivateOrDeactivate = canCreateMember || canDeleteMember; var orgInfo = useOrgInfo(); var orgAllowsEmailInvites = orgInfo.data && orgInfo.data.email_invites !== 'NOT_ALLOWED'; var _useSelf3 = useSelf(), self = _useSelf3.self; var currentMemberId = self === null || self === void 0 ? void 0 : self.member_id; var canInviteMember = canCreateMember && orgAllowsEmailInvites; var roleAutocompleteProps = useRoleAutocomplete({ excludeStytchMember: true }); var allRolesSet = F$3(function () { return new Set(roleAutocompleteProps.selectItems); }, [roleAutocompleteProps.selectItems]); var allRolesFilterItems = F$3(function () { return roleAutocompleteProps.selectItems.map(function (roleId) { return { label: roleAutocompleteProps.getOptionLabel(roleId), value: roleId }; }); }, [roleAutocompleteProps]); var _usePersistentFilter = usePersistentFilter({ viewId: MEMBER_LIST_TABLE_VIEW_ID, fieldId: 'role', defaultValue: emptySet, permittedValues: allRolesSet }), _usePersistentFilter2 = _slicedToArray2(_usePersistentFilter, 2), filterRoles = _usePersistentFilter2[0], setFilterRoles = _usePersistentFilter2[1]; var _usePersistentFilter3 = usePersistentFilter({ viewId: MEMBER_LIST_TABLE_VIEW_ID, fieldId: 'status', defaultValue: DEFAULT_STATUSES_FILTER, permittedValues: allMemberStatusesSet }), _usePersistentFilter4 = _slicedToArray2(_usePersistentFilter3, 2), filterStatuses = _usePersistentFilter4[0], setFilterStatuses = _usePersistentFilter4[1]; var itemRenderer = F$3(function () { return [{ id: 'name', title: 'Name', getValue: function getValue(
|
|
11028
|
+
var MemberListScreen = function MemberListScreen() { var _a, _b; var _useMemberManagementR6 = useMemberManagementRouterController(), navigate = _useMemberManagementR6.navigate; var _useRbac41 = useRbac('stytch.member', 'create'), canCreateMember = _useRbac41.data; var _useRbac42 = useRbac('stytch.member', 'delete'), canDeleteMember = _useRbac42.data; var _useRbac43 = useRbac('stytch.member', 'update.info.delete.mfa-phone'), canDeleteMfaPhone = _useRbac43.data; var _useRbac44 = useRbac('stytch.member', 'update.info.delete.mfa-totp'), canDeleteMfaTotp = _useRbac44.data; var _useRbac45 = useRbac('stytch.member', 'update.info.delete.password'), canDeletePassword = _useRbac45.data; var _useRbac46 = useRbac('stytch.member', 'update.info.mfa-phone'), canUpdateMfaPhone = _useRbac46.data; var _useRbac47 = useRbac('stytch.member', 'update.info.name'), canUpdateName = _useRbac47.data; var _useRbac48 = useRbac('stytch.member', 'update.info.untrusted-metadata'), canUpdateUntrustedMetadata = _useRbac48.data; var _useRbac49 = useRbac('stytch.member', 'update.settings.is-breakglass'), canUpdateIsBreakglass = _useRbac49.data; var _useRbac50 = useRbac('stytch.member', 'update.settings.mfa-enrolled'), canUpdateMfaEnrolled = _useRbac50.data; var _useRbac51 = useRbac('stytch.member', 'update.settings.default-mfa-method'), canUpdateDefaultMfaMethod = _useRbac51.data; var _useRbac52 = useRbac('stytch.member', 'update.settings.roles'), canUpdateRoles = _useRbac52.data; var canUpdateMember = canDeleteMfaPhone || canDeleteMfaTotp || canDeletePassword || canUpdateMfaPhone || canUpdateName || canUpdateUntrustedMetadata || canUpdateIsBreakglass || canUpdateMfaEnrolled || canUpdateDefaultMfaMethod || canUpdateRoles; var canActivateOrDeactivate = canCreateMember || canDeleteMember; var orgInfo = useOrgInfo(); var orgAllowsEmailInvites = orgInfo.data && orgInfo.data.email_invites !== 'NOT_ALLOWED'; var _useSelf3 = useSelf(), self = _useSelf3.self; var currentMemberId = self === null || self === void 0 ? void 0 : self.member_id; var canInviteMember = canCreateMember && orgAllowsEmailInvites; var roleAutocompleteProps = useRoleAutocomplete({ excludeStytchMember: true }); var allRolesSet = F$3(function () { return new Set(roleAutocompleteProps.selectItems); }, [roleAutocompleteProps.selectItems]); var allRolesFilterItems = F$3(function () { return roleAutocompleteProps.selectItems.map(function (roleId) { return { label: roleAutocompleteProps.getOptionLabel(roleId), value: roleId }; }); }, [roleAutocompleteProps]); var _usePersistentFilter = usePersistentFilter({ viewId: MEMBER_LIST_TABLE_VIEW_ID, fieldId: 'role', defaultValue: emptySet, permittedValues: allRolesSet }), _usePersistentFilter2 = _slicedToArray2(_usePersistentFilter, 2), filterRoles = _usePersistentFilter2[0], setFilterRoles = _usePersistentFilter2[1]; var _usePersistentFilter3 = usePersistentFilter({ viewId: MEMBER_LIST_TABLE_VIEW_ID, fieldId: 'status', defaultValue: DEFAULT_STATUSES_FILTER, permittedValues: allMemberStatusesSet }), _usePersistentFilter4 = _slicedToArray2(_usePersistentFilter3, 2), filterStatuses = _usePersistentFilter4[0], setFilterStatuses = _usePersistentFilter4[1]; var itemRenderer = F$3(function () { return [{ id: 'name', title: 'Name', getValue: function getValue(_ref159) { var name = _ref159.name, member_id = _ref159.member_id; return member_id === currentMemberId ? decorateCurrentMemberName(name) : name; } }, { id: 'email', title: 'Email', getValue: function getValue(_ref160) { var email_address = _ref160.email_address; return email_address; } }, { id: 'role', title: 'Role', getValue: function getValue(_ref161) { var roles = _ref161.roles; return /*#__PURE__*/ wn.createElement(RolesList, { hideStytchMemberWithOtherRoles: true, roles: roles }); }, renderTitle: function renderTitle() { return /*#__PURE__*/ wn.createElement(ColumnTitleWithFilter, { title: "Role", items: allRolesFilterItems, value: filterRoles, onChange: setFilterRoles }); } }, { id: 'status', title: 'Status', getValue: function getValue(_ref162) { var status = _ref162.status; return getMemberStatusDisplayName(status); }, renderTitle: function renderTitle() { return /*#__PURE__*/ wn.createElement(ColumnTitleWithFilter, { title: "Status", items: allStatusesFilterItems, value: filterStatuses, onChange: setFilterStatuses }); } }]; }, [allRolesFilterItems, currentMemberId, filterRoles, filterStatuses, setFilterRoles, setFilterStatuses]); var _useDebouncedState = useDebouncedState(''), _useDebouncedState2 = _slicedToArray2(_useDebouncedState, 3), filterText = _useDebouncedState2[0], setFilterText = _useDebouncedState2[1], pendingFilterText = _useDebouncedState2[2]; var _useItemsPerPage3 = useItemsPerPage({ viewId: MEMBER_LIST_TABLE_VIEW_ID }), _useItemsPerPage4 = _slicedToArray2(_useItemsPerPage3, 2), itemsPerPage = _useItemsPerPage4[0], handleItemsPerPageChange = _useItemsPerPage4[1]; var _useMembers = useMembers({ limit: itemsPerPage, email: filterText || undefined, roles: filterRoles.size > 0 ? Array.from(filterRoles) : undefined, statuses: filterStatuses.size > 0 ? Array.from(filterStatuses) : undefined }), data = _useMembers.data, error = _useMembers.error, isLoading = _useMembers.isLoading, setSize = _useMembers.setSize, size = _useMembers.size, mutate = _useMembers.mutate; var resultsMetadata = (_a = data === null || data === void 0 ? void 0 : data.at(-1)) === null || _a === void 0 ? void 0 : _a.results_metadata; var _usePagination2 = usePagination({ itemsCount: size, itemsPerPage: 1 }), currentPage = _usePagination2.currentPage, setCurrentPage = _usePagination2.setCurrentPage; var tableProps = { currentPage: currentPage, setCurrentPage: setCurrentPage, rowsPerPage: itemsPerPage, rowsPerPageOptions: itemsPerPageOptions, onRowsPerPageChange: handleItemsPerPageChange, items: F$3(function () { var _a; return (_a = data === null || data === void 0 ? void 0 : data.flatMap(function (page) { return page.members; })) !== null && _a !== void 0 ? _a : []; }, [data]), loadNext: T$2(function () { return setSize(function (size) { return size + 1; }); }, [setSize]), metadata: F$3(function () { var _a, _b; return { cursor: (_a = resultsMetadata === null || resultsMetadata === void 0 ? void 0 : resultsMetadata.next_cursor) !== null && _a !== void 0 ? _a : '__none', total: (_b = resultsMetadata === null || resultsMetadata === void 0 ? void 0 : resultsMetadata.total) !== null && _b !== void 0 ? _b : 0 }; }, [resultsMetadata === null || resultsMetadata === void 0 ? void 0 : resultsMetadata.next_cursor, resultsMetadata === null || resultsMetadata === void 0 ? void 0 : resultsMetadata.total]) }; var _useInviteModal = useInviteModal(mutate), handleInviteClick = _useInviteModal.handleInviteClick, inviteModalProps = _useInviteModal.inviteModalProps; var handleEdit = T$2(function (member) { navigate({ screen: 'memberDetails', params: { memberId: member.member_id } }); }, [navigate]); var _useMemberActivation2 = useMemberActivation(mutate), openModal = _useMemberActivation2.openModal, modal = _useMemberActivation2.modal; var handleActivateDeactivateMember = T$2(function (member) { openModal(member); }, [openModal]); var actions = F$3(function () { var getDeleteAction = function getDeleteAction(member) { switch (member.status) {
|
|
10976
11029
|
case 'invited':
|
|
10977
11030
|
if (canDeleteMember) {
|
|
10978
11031
|
return 'revoke-invite';
|