@burdenoff/microfe-integrations 2026.1107.2 → 2026.1109.1
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/dist/dev/main.d.ts +0 -2
- package/dist/generated/global-operations.d.ts +4 -2
- package/dist/generated/global-types.d.ts +2 -22
- package/dist/generated/wspace-operations.d.ts +995 -705
- package/dist/generated/wspace-operations.js +180 -167
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +4 -24
- package/dist/generated/wspace-types.js +1 -2
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/integrations/ConnectSourceDialog.d.ts +0 -2
- package/dist/integrations/ConnectSourceDialog.js +13 -14
- package/dist/integrations/ConnectSourceDialog.js.map +1 -1
- package/dist/integrations/ConnectionsPanel.d.ts +0 -2
- package/dist/integrations/ConnectionsPanel.js +5 -6
- package/dist/integrations/ConnectionsPanel.js.map +1 -1
- package/dist/integrations/IntegrationsAdminRoot.d.ts +0 -2
- package/dist/integrations/IntegrationsAdminRoot.js +14 -11
- package/dist/integrations/IntegrationsAdminRoot.js.map +1 -1
- package/dist/integrations/IntegrationsAdminRoutes.d.ts +1 -2
- package/dist/integrations/IntegrationsAdminRoutes.js +1 -2
- package/dist/integrations/IntegrationsAdminRoutes.js.map +1 -1
- package/dist/integrations/IntegrationsRoot.d.ts +0 -2
- package/dist/integrations/IntegrationsRoot.js +9 -6
- package/dist/integrations/IntegrationsRoot.js.map +1 -1
- package/dist/integrations/IntegrationsUserRoutes.d.ts +1 -2
- package/dist/integrations/IntegrationsUserRoutes.js +7 -8
- package/dist/integrations/IntegrationsUserRoutes.js.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.d.ts +1 -3
- package/dist/integrations/components/AddConnectionDialog.js +12 -15
- package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
- package/dist/integrations/components/AuthMethodsEditor.d.ts +0 -2
- package/dist/integrations/components/AuthMethodsEditor.js +1 -2
- package/dist/integrations/components/AuthMethodsEditor.js.map +1 -1
- package/dist/integrations/components/ConfirmDialog.d.ts +1 -3
- package/dist/integrations/components/ConfirmDialog.js +1 -2
- package/dist/integrations/components/ConfirmDialog.js.map +1 -1
- package/dist/integrations/components/ConnectionCard.d.ts +0 -2
- package/dist/integrations/components/ConnectionCard.js +9 -10
- package/dist/integrations/components/ConnectionCard.js.map +1 -1
- package/dist/integrations/components/ConnectionModalFrame.d.ts +0 -2
- package/dist/integrations/components/ConnectionModalFrame.js +2 -3
- package/dist/integrations/components/ConnectionModalFrame.js.map +1 -1
- package/dist/integrations/components/ConnectionSharing.d.ts +0 -2
- package/dist/integrations/components/ConnectionSharing.js +7 -8
- package/dist/integrations/components/ConnectionSharing.js.map +1 -1
- package/dist/integrations/components/ConnectionStatusBadge.d.ts +0 -2
- package/dist/integrations/components/ConnectionStatusBadge.js +1 -2
- package/dist/integrations/components/ConnectionStatusBadge.js.map +1 -1
- package/dist/integrations/components/ConnectorSubmissionCard.d.ts +2 -4
- package/dist/integrations/components/ConnectorSubmissionCard.js +8 -9
- package/dist/integrations/components/ConnectorSubmissionCard.js.map +1 -1
- package/dist/integrations/components/ConnectorSubmissionPager.d.ts +1 -2
- package/dist/integrations/components/ConnectorSubmissionPager.js +1 -2
- package/dist/integrations/components/ConnectorSubmissionPager.js.map +1 -1
- package/dist/integrations/components/MailMessageBody.d.ts +1 -3
- package/dist/integrations/components/MailMessageBody.js +4 -5
- package/dist/integrations/components/MailMessageBody.js.map +1 -1
- package/dist/integrations/components/ProviderCard.d.ts +0 -2
- package/dist/integrations/components/ProviderCard.js +8 -9
- package/dist/integrations/components/ProviderCard.js.map +1 -1
- package/dist/integrations/constants/featureFlags.d.ts +0 -1
- package/dist/integrations/constants/featureFlags.js +1 -2
- package/dist/integrations/constants/featureFlags.js.map +1 -1
- package/dist/integrations/constants/permissions.d.ts +0 -1
- package/dist/integrations/constants/permissions.js +1 -2
- package/dist/integrations/constants/permissions.js.map +1 -1
- package/dist/integrations/events/integrations-events.d.ts +0 -1
- package/dist/integrations/events/useIntegrationsEventBus.d.ts +0 -2
- package/dist/integrations/events/useIntegrationsEventBus.js +1 -2
- package/dist/integrations/events/useIntegrationsEventBus.js.map +1 -1
- package/dist/integrations/hooks/useConnections.d.ts +3 -14
- package/dist/integrations/hooks/useConnections.js +74 -75
- package/dist/integrations/hooks/useConnections.js.map +1 -1
- package/dist/integrations/hooks/useConnectorSubmissions.d.ts +2 -10
- package/dist/integrations/hooks/useConnectorSubmissions.js +23 -24
- package/dist/integrations/hooks/useConnectorSubmissions.js.map +1 -1
- package/dist/integrations/hooks/useFormatDate.d.ts +0 -1
- package/dist/integrations/hooks/useFormatDate.js +1 -2
- package/dist/integrations/hooks/useFormatDate.js.map +1 -1
- package/dist/integrations/hooks/useFormatLastUsed.d.ts +0 -1
- package/dist/integrations/hooks/useFormatLastUsed.js +1 -2
- package/dist/integrations/hooks/useFormatLastUsed.js.map +1 -1
- package/dist/integrations/hooks/useLabel.d.ts +0 -2
- package/dist/integrations/hooks/useLabel.js +1 -2
- package/dist/integrations/hooks/useLabel.js.map +1 -1
- package/dist/integrations/hooks/useLogs.d.ts +1 -6
- package/dist/integrations/hooks/useLogs.js +6 -7
- package/dist/integrations/hooks/useLogs.js.map +1 -1
- package/dist/integrations/hooks/useMailbox.d.ts +19 -43
- package/dist/integrations/hooks/useMailbox.js +46 -47
- package/dist/integrations/hooks/useMailbox.js.map +1 -1
- package/dist/integrations/hooks/useProviders.d.ts +3 -14
- package/dist/integrations/hooks/useProviders.js +42 -43
- package/dist/integrations/hooks/useProviders.js.map +1 -1
- package/dist/integrations/hooks/useTr.d.ts +0 -1
- package/dist/integrations/hooks/useTr.js +1 -2
- package/dist/integrations/hooks/useTr.js.map +1 -1
- package/dist/integrations/index.d.ts +0 -1
- package/dist/integrations/index.js +9 -8
- package/dist/integrations/pages/AddConnectionWizard.d.ts +1 -2
- package/dist/integrations/pages/AddConnectionWizard.js +291 -306
- package/dist/integrations/pages/AddConnectionWizard.js.map +1 -1
- package/dist/integrations/pages/ConnectionDetail.d.ts +1 -2
- package/dist/integrations/pages/ConnectionDetail.js +241 -246
- package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
- package/dist/integrations/pages/ConnectionLogs.d.ts +1 -2
- package/dist/integrations/pages/ConnectionLogs.js +154 -155
- package/dist/integrations/pages/ConnectionLogs.js.map +1 -1
- package/dist/integrations/pages/ConnectionsList.d.ts +1 -2
- package/dist/integrations/pages/ConnectionsList.js +40 -41
- package/dist/integrations/pages/ConnectionsList.js.map +1 -1
- package/dist/integrations/pages/ConnectorReviewQueuePage.d.ts +1 -2
- package/dist/integrations/pages/ConnectorReviewQueuePage.js +9 -10
- package/dist/integrations/pages/ConnectorReviewQueuePage.js.map +1 -1
- package/dist/integrations/pages/ConnectorSubmissionsPage.d.ts +1 -2
- package/dist/integrations/pages/ConnectorSubmissionsPage.js +138 -139
- package/dist/integrations/pages/ConnectorSubmissionsPage.js.map +1 -1
- package/dist/integrations/pages/IntegrationsOverview.d.ts +1 -2
- package/dist/integrations/pages/IntegrationsOverview.js +35 -36
- package/dist/integrations/pages/IntegrationsOverview.js.map +1 -1
- package/dist/integrations/pages/IntegrationsSettings.d.ts +1 -2
- package/dist/integrations/pages/IntegrationsSettings.js +7 -8
- package/dist/integrations/pages/IntegrationsSettings.js.map +1 -1
- package/dist/integrations/pages/IntegrationsUserLandingPage.d.ts +1 -2
- package/dist/integrations/pages/IntegrationsUserLandingPage.js +1 -2
- package/dist/integrations/pages/IntegrationsUserLandingPage.js.map +1 -1
- package/dist/integrations/pages/MailboxInbox.d.ts +1 -2
- package/dist/integrations/pages/MailboxInbox.js +135 -140
- package/dist/integrations/pages/MailboxInbox.js.map +1 -1
- package/dist/integrations/pages/ProviderCatalog.d.ts +1 -2
- package/dist/integrations/pages/ProviderCatalog.js +107 -108
- package/dist/integrations/pages/ProviderCatalog.js.map +1 -1
- package/dist/integrations/pages/ProviderDetail.d.ts +1 -2
- package/dist/integrations/pages/ProviderDetail.js +21 -22
- package/dist/integrations/pages/ProviderDetail.js.map +1 -1
- package/dist/integrations/pages/ProviderEditorPage.d.ts +1 -2
- package/dist/integrations/pages/ProviderEditorPage.js +261 -264
- package/dist/integrations/pages/ProviderEditorPage.js.map +1 -1
- package/dist/integrations/providers/IntegrationsProvider.d.ts +0 -2
- package/dist/integrations/providers/IntegrationsProvider.js +109 -96
- package/dist/integrations/providers/IntegrationsProvider.js.map +1 -1
- package/dist/integrations/store/integrationsStore.d.ts +0 -2
- package/dist/integrations/store/integrationsStore.js +1 -2
- package/dist/integrations/store/integrationsStore.js.map +1 -1
- package/dist/integrations/store/mailboxStore.d.ts +0 -2
- package/dist/integrations/store/mailboxStore.js +1 -2
- package/dist/integrations/store/mailboxStore.js.map +1 -1
- package/dist/integrations/translations/en.d.ts +0 -1
- package/dist/integrations/types/index.d.ts +0 -1
- package/dist/integrations/utils/appearance.d.ts +0 -1
- package/dist/integrations/utils/appearance.js +1 -2
- package/dist/integrations/utils/appearance.js.map +1 -1
- package/dist/integrations/utils/cn.d.ts +0 -2
- package/dist/integrations/utils/cn.js +2 -3
- package/dist/integrations/utils/cn.js.map +1 -1
- package/dist/integrations/utils/constants.d.ts +0 -1
- package/dist/integrations/utils/constants.js +1 -2
- package/dist/integrations/utils/constants.js.map +1 -1
- package/dist/integrations/utils/integrationsHelpers.d.ts +0 -2
- package/dist/integrations/utils/integrationsHelpers.js +1 -2
- package/dist/integrations/utils/integrationsHelpers.js.map +1 -1
- package/dist/integrations/utils/mailHtml.d.ts +0 -2
- package/dist/integrations/utils/mailHtml.js +3 -4
- package/dist/integrations/utils/mailHtml.js.map +1 -1
- package/dist/integrations/utils/mappers.d.ts +0 -2
- package/dist/integrations/utils/mappers.js +2 -3
- package/dist/integrations/utils/mappers.js.map +1 -1
- package/dist/integrations/utils/navigation.d.ts +0 -1
- package/dist/integrations/utils/navigation.js +2 -8
- package/dist/integrations/utils/navigation.js.map +1 -1
- package/dist/integrations/utils/paths.d.ts +0 -1
- package/dist/integrations/utils/paths.js +1 -2
- package/dist/integrations/utils/paths.js.map +1 -1
- package/dist/node_modules/clsx/dist/clsx.js +8 -7
- package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
- package/dist/node_modules/dompurify/dist/purify.es.js +20 -36
- package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +229 -167
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/utils/nativeBridge.d.ts +0 -1
- package/dist/utils/nativeBridge.js +1 -2
- package/package.json +63 -49
- package/dist/dev/main.d.ts.map +0 -1
- package/dist/generated/global-operations.d.ts.map +0 -1
- package/dist/generated/global-types.d.ts.map +0 -1
- package/dist/generated/wspace-operations.d.ts.map +0 -1
- package/dist/generated/wspace-types.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/integrations/ConnectSourceDialog.d.ts.map +0 -1
- package/dist/integrations/ConnectionsPanel.d.ts.map +0 -1
- package/dist/integrations/IntegrationsAdminRoot.d.ts.map +0 -1
- package/dist/integrations/IntegrationsAdminRoutes.d.ts.map +0 -1
- package/dist/integrations/IntegrationsRoot.d.ts.map +0 -1
- package/dist/integrations/IntegrationsUserRoutes.d.ts.map +0 -1
- package/dist/integrations/components/AddConnectionDialog.d.ts.map +0 -1
- package/dist/integrations/components/AuthMethodsEditor.d.ts.map +0 -1
- package/dist/integrations/components/ConfirmDialog.d.ts.map +0 -1
- package/dist/integrations/components/ConnectionCard.d.ts.map +0 -1
- package/dist/integrations/components/ConnectionModalFrame.d.ts.map +0 -1
- package/dist/integrations/components/ConnectionSharing.d.ts.map +0 -1
- package/dist/integrations/components/ConnectionStatusBadge.d.ts.map +0 -1
- package/dist/integrations/components/ConnectorSubmissionCard.d.ts.map +0 -1
- package/dist/integrations/components/ConnectorSubmissionPager.d.ts.map +0 -1
- package/dist/integrations/components/MailMessageBody.d.ts.map +0 -1
- package/dist/integrations/components/ProviderCard.d.ts.map +0 -1
- package/dist/integrations/constants/featureFlags.d.ts.map +0 -1
- package/dist/integrations/constants/permissions.d.ts.map +0 -1
- package/dist/integrations/events/integrations-events.d.ts.map +0 -1
- package/dist/integrations/events/useIntegrationsEventBus.d.ts.map +0 -1
- package/dist/integrations/hooks/useConnections.d.ts.map +0 -1
- package/dist/integrations/hooks/useConnectorSubmissions.d.ts.map +0 -1
- package/dist/integrations/hooks/useFormatDate.d.ts.map +0 -1
- package/dist/integrations/hooks/useFormatLastUsed.d.ts.map +0 -1
- package/dist/integrations/hooks/useLabel.d.ts.map +0 -1
- package/dist/integrations/hooks/useLogs.d.ts.map +0 -1
- package/dist/integrations/hooks/useMailbox.d.ts.map +0 -1
- package/dist/integrations/hooks/useProviders.d.ts.map +0 -1
- package/dist/integrations/hooks/useTr.d.ts.map +0 -1
- package/dist/integrations/index.d.ts.map +0 -1
- package/dist/integrations/pages/AddConnectionWizard.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectionDetail.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectionLogs.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectionsList.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectorReviewQueuePage.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectorSubmissionsPage.d.ts.map +0 -1
- package/dist/integrations/pages/IntegrationsOverview.d.ts.map +0 -1
- package/dist/integrations/pages/IntegrationsSettings.d.ts.map +0 -1
- package/dist/integrations/pages/IntegrationsUserLandingPage.d.ts.map +0 -1
- package/dist/integrations/pages/MailboxInbox.d.ts.map +0 -1
- package/dist/integrations/pages/ProviderCatalog.d.ts.map +0 -1
- package/dist/integrations/pages/ProviderDetail.d.ts.map +0 -1
- package/dist/integrations/pages/ProviderEditorPage.d.ts.map +0 -1
- package/dist/integrations/providers/IntegrationsProvider.d.ts.map +0 -1
- package/dist/integrations/store/integrationsStore.d.ts.map +0 -1
- package/dist/integrations/store/mailboxStore.d.ts.map +0 -1
- package/dist/integrations/translations/en.d.ts.map +0 -1
- package/dist/integrations/types/index.d.ts.map +0 -1
- package/dist/integrations/utils/appearance.d.ts.map +0 -1
- package/dist/integrations/utils/cn.d.ts.map +0 -1
- package/dist/integrations/utils/constants.d.ts.map +0 -1
- package/dist/integrations/utils/integrationsHelpers.d.ts.map +0 -1
- package/dist/integrations/utils/mailHtml.d.ts.map +0 -1
- package/dist/integrations/utils/mappers.d.ts.map +0 -1
- package/dist/integrations/utils/navigation.d.ts.map +0 -1
- package/dist/integrations/utils/paths.d.ts.map +0 -1
- package/dist/utils/nativeBridge.d.ts.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ConnectionDialogPresentation, CreatedConnection } from '@burdenoff/fe-libs/connections';
|
|
3
|
-
|
|
4
3
|
export interface AddConnectionDialogProps {
|
|
5
4
|
/** Whether the dialog is open */
|
|
6
5
|
open: boolean;
|
|
@@ -29,5 +28,4 @@ export interface AddConnectionDialogProps {
|
|
|
29
28
|
}
|
|
30
29
|
/** The OAuth callback the gateway serves; providers compare it exactly. */
|
|
31
30
|
export declare function oauthCallbackUrl(apiGatewayUrl: string | null | undefined): string;
|
|
32
|
-
export declare function AddConnectionDialog({ open, onClose, preselectedProviderId, preselectedProviderKey, onConnectionCreated, presentation, pickerTitle, extraConfig, renderSuccessAction, }: AddConnectionDialogProps): import(
|
|
33
|
-
//# sourceMappingURL=AddConnectionDialog.d.ts.map
|
|
31
|
+
export declare function AddConnectionDialog({ open, onClose, preselectedProviderId, preselectedProviderKey, onConnectionCreated, presentation, pickerTitle, extraConfig, renderSuccessAction, }: AddConnectionDialogProps): import('react').JSX.Element;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { INTEGRATION_PERMISSIONS as e } from "../constants/permissions.js";
|
|
2
|
+
import { useIntegrationsEventBus as t } from "../events/useIntegrationsEventBus.js";
|
|
3
|
+
import { useTr as n } from "../hooks/useTr.js";
|
|
4
|
+
import { useIntegrations as r } from "../providers/IntegrationsProvider.js";
|
|
5
5
|
import { useCallback as i } from "react";
|
|
6
6
|
import { useApolloClient as a } from "@apollo/client/react";
|
|
7
7
|
import { usePermissions as o } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
8
8
|
import { jsx as s } from "react/jsx-runtime";
|
|
9
9
|
import { ConnectionDialog as c } from "@burdenoff/fe-libs/connections";
|
|
10
|
-
|
|
10
|
+
// src/integrations/components/AddConnectionDialog.tsx
|
|
11
11
|
function l(e) {
|
|
12
12
|
return e ? `${e}/integrations/oauth/callback` : "/integrations/oauth/callback";
|
|
13
13
|
}
|
|
14
14
|
function u({ open: u, onClose: d, preselectedProviderId: f, preselectedProviderKey: p, onConnectionCreated: m, presentation: h = "dialog", pickerTitle: g, extraConfig: _, renderSuccessAction: v }) {
|
|
15
|
-
let y =
|
|
15
|
+
let y = n(), b = a(), { apiGatewayUrl: x, defaultConnectionVisibility: S } = r(), { hasPermission: C, isLoading: w } = o(), T = t((e) => e.emit), E = w || C(e.CONNECTION_CREATE), D = !w && C(e.VAULT_CREATE), O = i((e) => {
|
|
16
16
|
switch (e.type) {
|
|
17
17
|
case "connection-created":
|
|
18
18
|
T("integrations:connection-created", {
|
|
@@ -26,13 +26,11 @@ function u({ open: u, onClose: d, preselectedProviderId: f, preselectedProviderK
|
|
|
26
26
|
providerKey: e.providerKey
|
|
27
27
|
});
|
|
28
28
|
break;
|
|
29
|
-
case "oauth-failed":
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
break;
|
|
29
|
+
case "oauth-failed": T("integrations:oauth-failed", {
|
|
30
|
+
connectionId: e.connectionId,
|
|
31
|
+
providerKey: e.providerKey,
|
|
32
|
+
error: e.error
|
|
33
|
+
});
|
|
36
34
|
}
|
|
37
35
|
}, [T]), k = i((e) => m?.(e.id), [m]);
|
|
38
36
|
return /* @__PURE__ */ s(c, {
|
|
@@ -58,7 +56,6 @@ function u({ open: u, onClose: d, preselectedProviderId: f, preselectedProviderK
|
|
|
58
56
|
onEvent: O
|
|
59
57
|
});
|
|
60
58
|
}
|
|
61
|
-
|
|
62
|
-
export { u as AddConnectionDialog };
|
|
59
|
+
export { u as AddConnectionDialog, l as oauthCallbackUrl };
|
|
63
60
|
|
|
64
61
|
//# sourceMappingURL=AddConnectionDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddConnectionDialog.js","names":[],"sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"sourcesContent":["/**\n * AddConnectionDialog — \"Add a connection\" for the integrations screens.\n *\n * The dialog is `@burdenoff/fe-libs/connections`' ConnectionDialog, the same\n * one the workflow builder uses for a node's \"New connection\" (BOFF-8174). The\n * two used to be separate implementations and drifted: provider icons\n * (BOFF-8135), Custom OAuth 2.0 credentials and the redirect URL to register\n * (BOFF-8170). This component only supplies what the integrations screens know\n * and the shared dialog cannot: the shell's Apollo client, the gateway's OAuth\n * callback, the translator, this user's permissions, and this module's event\n * bus.\n *\n * Integrations-specific choices:\n * - the picker lists the workspace's installed, enabled providers;\n * - a vault is required, and the dialog offers to create one when allowed;\n * - the host's connection lists refresh after a create.\n */\nimport { useCallback, type ReactNode } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\nimport {\n ConnectionDialog,\n type ConnectionDialogEvent,\n type ConnectionDialogPresentation,\n type CreatedConnection,\n} from '@burdenoff/fe-libs/connections';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\n\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { useIntegrationsEventBus } from '../events/useIntegrationsEventBus';\nimport { useTr } from '../hooks/useTr';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\n\nexport interface AddConnectionDialogProps {\n /** Whether the dialog is open */\n open: boolean;\n /** Callback to close the dialog */\n onClose: () => void;\n /** Pre-selected provider ID (skips provider picker step) */\n preselectedProviderId?: string | null;\n /** Pre-selected provider key, for links that know a provider by key. */\n preselectedProviderKey?: string | null;\n /** Callback when a connection is successfully created */\n onConnectionCreated?: (connectionId: string) => void;\n /**\n * `dialog` (default): a centred dialog from `sm`. `sheet`: a bottom sheet\n * below `md`, centred from `md` — what `ConnectSourceDialog` uses.\n */\n presentation?: ConnectionDialogPresentation;\n /** Heading while the provider picker shows. Defaults to \"Add new credential\". */\n pickerTitle?: string;\n /**\n * Settings stored on the new connection, e.g. the Botlit channel to return\n * to once OAuth completes.\n */\n extraConfig?: Record<string, unknown>;\n /** Replaces the success panel's button, e.g. \"Link to bot channel\". */\n renderSuccessAction?: (connection: CreatedConnection) => ReactNode;\n}\n\n/** The OAuth callback the gateway serves; providers compare it exactly. */\nexport function oauthCallbackUrl(apiGatewayUrl: string | null | undefined): string {\n return apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\n}\n\nexport function AddConnectionDialog({\n open,\n onClose,\n preselectedProviderId,\n preselectedProviderKey,\n onConnectionCreated,\n presentation = 'dialog',\n pickerTitle,\n extraConfig,\n renderSuccessAction,\n}: AddConnectionDialogProps) {\n const tr = useTr();\n const client = useApolloClient();\n const { apiGatewayUrl, defaultConnectionVisibility } = useIntegrations();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const emit = useIntegrationsEventBus((state) => state.emit);\n\n // While permissions load, show the form rather than flashing \"denied\"; the\n // gateway still enforces the grant on create.\n const canCreate = permissionsLoading || hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n // Vaults belong to the security module: creating a connection does not imply\n // being allowed to create one, and offering it would be a button that fails.\n const canCreateVault = !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.VAULT_CREATE);\n\n const handleEvent = useCallback(\n (event: ConnectionDialogEvent) => {\n switch (event.type) {\n case 'connection-created':\n emit('integrations:connection-created', {\n connectionId: event.connectionId,\n providerKey: event.providerKey,\n });\n break;\n case 'oauth-started':\n emit('integrations:oauth-started', {\n connectionId: event.connectionId,\n providerKey: event.providerKey,\n });\n break;\n case 'oauth-failed':\n emit('integrations:oauth-failed', {\n connectionId: event.connectionId,\n providerKey: event.providerKey,\n error: event.error,\n });\n break;\n }\n },\n [emit]\n );\n\n const handleCreated = useCallback(\n (connection: CreatedConnection) => onConnectionCreated?.(connection.id),\n [onConnectionCreated]\n );\n\n return (\n <ConnectionDialog\n open={open}\n onClose={onClose}\n client={client}\n callbackUrl={oauthCallbackUrl(apiGatewayUrl)}\n translate={tr}\n providerId={preselectedProviderId ?? null}\n providerKey={preselectedProviderKey ?? null}\n providerSource=\"installed\"\n requireVault\n canCreate={canCreate}\n canCreateVault={canCreateVault}\n extraConfig={extraConfig}\n showSharingTab={Boolean(defaultConnectionVisibility)}\n defaultVisibility={defaultConnectionVisibility}\n refetchQueriesOnCreate={['GetConnections']}\n presentation={presentation}\n pickerTitle={pickerTitle}\n renderSuccessAction={renderSuccessAction}\n onConnectionCreated={handleCreated}\n onEvent={handleEvent}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AA4DA,
|
|
1
|
+
{"version":3,"file":"AddConnectionDialog.js","names":["oauthCallbackUrl","apiGatewayUrl","AddConnectionDialog","tr","useTr","client","useApolloClient","useIntegrations","permissionsLoading","usePermissions","emit","useIntegrationsEventBus","state","canCreate","hasPermission","INTEGRATION_PERMISSIONS","canCreateVault","handleEvent","useCallback","event","handleCreated","onConnectionCreated","connection","ConnectionDialog","preselectedProviderId","preselectedProviderKey","defaultConnectionVisibility"],"sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"sourcesContent":["/**\n * AddConnectionDialog — \"Add a connection\" for the integrations screens.\n *\n * The dialog is `@burdenoff/fe-libs/connections`' ConnectionDialog, the same\n * one the workflow builder uses for a node's \"New connection\" (BOFF-8174). The\n * two used to be separate implementations and drifted: provider icons\n * (BOFF-8135), Custom OAuth 2.0 credentials and the redirect URL to register\n * (BOFF-8170). This component only supplies what the integrations screens know\n * and the shared dialog cannot: the shell's Apollo client, the gateway's OAuth\n * callback, the translator, this user's permissions, and this module's event\n * bus.\n *\n * Integrations-specific choices:\n * - the picker lists the workspace's installed, enabled providers;\n * - a vault is required, and the dialog offers to create one when allowed;\n * - the host's connection lists refresh after a create.\n */\nimport { useCallback, type ReactNode } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\nimport {\n ConnectionDialog,\n type ConnectionDialogEvent,\n type ConnectionDialogPresentation,\n type CreatedConnection,\n} from '@burdenoff/fe-libs/connections';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\n\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { useIntegrationsEventBus } from '../events/useIntegrationsEventBus';\nimport { useTr } from '../hooks/useTr';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\n\nexport interface AddConnectionDialogProps {\n /** Whether the dialog is open */\n open: boolean;\n /** Callback to close the dialog */\n onClose: () => void;\n /** Pre-selected provider ID (skips provider picker step) */\n preselectedProviderId?: string | null;\n /** Pre-selected provider key, for links that know a provider by key. */\n preselectedProviderKey?: string | null;\n /** Callback when a connection is successfully created */\n onConnectionCreated?: (connectionId: string) => void;\n /**\n * `dialog` (default): a centred dialog from `sm`. `sheet`: a bottom sheet\n * below `md`, centred from `md` — what `ConnectSourceDialog` uses.\n */\n presentation?: ConnectionDialogPresentation;\n /** Heading while the provider picker shows. Defaults to \"Add new credential\". */\n pickerTitle?: string;\n /**\n * Settings stored on the new connection, e.g. the Botlit channel to return\n * to once OAuth completes.\n */\n extraConfig?: Record<string, unknown>;\n /** Replaces the success panel's button, e.g. \"Link to bot channel\". */\n renderSuccessAction?: (connection: CreatedConnection) => ReactNode;\n}\n\n/** The OAuth callback the gateway serves; providers compare it exactly. */\nexport function oauthCallbackUrl(apiGatewayUrl: string | null | undefined): string {\n return apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\n}\n\nexport function AddConnectionDialog({\n open,\n onClose,\n preselectedProviderId,\n preselectedProviderKey,\n onConnectionCreated,\n presentation = 'dialog',\n pickerTitle,\n extraConfig,\n renderSuccessAction,\n}: AddConnectionDialogProps) {\n const tr = useTr();\n const client = useApolloClient();\n const { apiGatewayUrl, defaultConnectionVisibility } = useIntegrations();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const emit = useIntegrationsEventBus((state) => state.emit);\n\n // While permissions load, show the form rather than flashing \"denied\"; the\n // gateway still enforces the grant on create.\n const canCreate = permissionsLoading || hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n // Vaults belong to the security module: creating a connection does not imply\n // being allowed to create one, and offering it would be a button that fails.\n const canCreateVault = !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.VAULT_CREATE);\n\n const handleEvent = useCallback(\n (event: ConnectionDialogEvent) => {\n switch (event.type) {\n case 'connection-created':\n emit('integrations:connection-created', {\n connectionId: event.connectionId,\n providerKey: event.providerKey,\n });\n break;\n case 'oauth-started':\n emit('integrations:oauth-started', {\n connectionId: event.connectionId,\n providerKey: event.providerKey,\n });\n break;\n case 'oauth-failed':\n emit('integrations:oauth-failed', {\n connectionId: event.connectionId,\n providerKey: event.providerKey,\n error: event.error,\n });\n break;\n }\n },\n [emit]\n );\n\n const handleCreated = useCallback(\n (connection: CreatedConnection) => onConnectionCreated?.(connection.id),\n [onConnectionCreated]\n );\n\n return (\n <ConnectionDialog\n open={open}\n onClose={onClose}\n client={client}\n callbackUrl={oauthCallbackUrl(apiGatewayUrl)}\n translate={tr}\n providerId={preselectedProviderId ?? null}\n providerKey={preselectedProviderKey ?? null}\n providerSource=\"installed\"\n requireVault\n canCreate={canCreate}\n canCreateVault={canCreateVault}\n extraConfig={extraConfig}\n showSharingTab={Boolean(defaultConnectionVisibility)}\n defaultVisibility={defaultConnectionVisibility}\n refetchQueriesOnCreate={['GetConnections']}\n presentation={presentation}\n pickerTitle={pickerTitle}\n renderSuccessAction={renderSuccessAction}\n onConnectionCreated={handleCreated}\n onEvent={handleEvent}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AA4DA,SAAgBA,EAAiB,GAAkD;CACjF,OAAOC,IACH,GAAGA,EAAc,gCACjB;AACN;AAEA,SAAgBC,EAAoB,EAClC,SACA,YACA,0BACA,2BACA,wBACA,kBAAe,UACf,gBACA,gBACA,0BAC2B;CAC3B,IAAMC,IAAKC,EAAM,GACXC,IAASC,EAAgB,GACzB,EAAE,kBAAe,mCAAgCC,EAAgB,GACjE,EAAE,kBAAe,WAAWC,MAAuBC,EAAe,GAClEC,IAAOC,GAAyB,MAAUC,EAAM,IAAI,GAIpDC,IAAYL,KAAsBM,EAAcC,EAAwB,iBAAiB,GAGzFC,IAAiB,CAACR,KAAsBM,EAAcC,EAAwB,YAAY,GAE1FE,IAAcC,GACjB,MAAiC;EAChC,QAAQC,EAAM,MAAd;GACE,KAAK;IACH,EAAK,mCAAmC;KACtC,cAAcA,EAAM;KACpB,aAAaA,EAAM;IACrB,CAAC;IACD;GACF,KAAK;IACH,EAAK,8BAA8B;KACjC,cAAcA,EAAM;KACpB,aAAaA,EAAM;IACrB,CAAC;IACD;GACF,KAAK,gBACH,EAAK,6BAA6B;IAChC,cAAcA,EAAM;IACpB,aAAaA,EAAM;IACnB,OAAOA,EAAM;GACf,CAAC;EAEL;CACF,GACA,CAACT,CAAI,CACP,GAEMU,IAAgBF,GACnB,MAAkCG,IAAsBC,EAAW,EAAE,GACtE,CAACD,CAAmB,CACtB;CAEA,OACE,kBAACE,GAAD;EACQ;EACG;EACD;EACR,aAAavB,EAAiBC,CAAa;EAC3C,WAAWE;EACX,YAAYqB,KAAyB;EACrC,aAAaC,KAA0B;EACvC,gBAAe;EACf,cAAA;EACW;EACK;EACH;EACb,gBAAgB,EAAQC;EACxB,mBAAmBA;EACnB,wBAAwB,CAAC,gBAAgB;EAC3B;EACD;EACQ;EACrB,qBAAqBN;EACrB,SAASH;CACV,CAAA;AAEL"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { IntegrationProvider } from '../types';
|
|
3
|
-
|
|
4
3
|
interface AuthMethodsEditorProps {
|
|
5
4
|
provider: IntegrationProvider;
|
|
6
5
|
canManage: boolean;
|
|
7
6
|
}
|
|
8
7
|
export declare const AuthMethodsEditor: FC<AuthMethodsEditorProps>;
|
|
9
8
|
export {};
|
|
10
|
-
//# sourceMappingURL=AuthMethodsEditor.d.ts.map
|
|
@@ -5,7 +5,7 @@ import { AlertCircle as a, Check as o, Loader2 as s, Plus as c, Star as l, Trash
|
|
|
5
5
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
6
6
|
import { Button as m } from "@burdenoff/fe-libs/ui";
|
|
7
7
|
import { SchemaForm as h, parseFormSchema as g } from "@burdenoff/fe-libs/credentials";
|
|
8
|
-
|
|
8
|
+
// src/integrations/components/AuthMethodsEditor.tsx
|
|
9
9
|
var _ = [
|
|
10
10
|
"OAUTH2",
|
|
11
11
|
"OAUTH1",
|
|
@@ -402,7 +402,6 @@ var T = ({ label: e, id: t, required: n, inline: r, children: i }) => /* @__PURE
|
|
|
402
402
|
]
|
|
403
403
|
}), i]
|
|
404
404
|
});
|
|
405
|
-
//#endregion
|
|
406
405
|
export { x as AuthMethodsEditor };
|
|
407
406
|
|
|
408
407
|
//# sourceMappingURL=AuthMethodsEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthMethodsEditor.js","names":[],"sources":["../../../src/integrations/components/AuthMethodsEditor.tsx"],"sourcesContent":["/**\n * AuthMethodsEditor — admin surface for a provider's authentication methods.\n *\n * This is the screen that turns \"add a way to authenticate\" from a code change\n * into a data change. Each method carries its own type, flow and field schema;\n * the connection UI renders whatever is defined here, so no provider or auth\n * type ever needs bespoke React again.\n *\n * The schema editor shows a live preview using the *same* renderer end users\n * get, so an admin can see the form they are describing instead of writing JSON\n * Schema blind and finding out at connect time.\n */\nimport type { FC } from 'react';\nimport { useId, useState } from 'react';\nimport { AlertCircle, Check, Loader2, Plus, Star, Trash2, X } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../hooks/useTr';\nimport { useDeleteAuthMethod, useUpsertAuthMethod } from '../hooks/useProviders';\nimport type { IntegrationAuthMethod, IntegrationProvider } from '../types';\nimport { SchemaForm, parseFormSchema } from '@burdenoff/fe-libs/credentials';\n\nconst AUTH_TYPES = [\n 'OAUTH2',\n 'OAUTH1',\n 'API_KEY',\n 'BASIC_AUTH',\n 'BEARER_TOKEN',\n 'SERVICE_ACCOUNT',\n 'WORKSPACE_APP_TOKEN',\n 'CUSTOM',\n] as const;\n\nconst FLOWS = ['FIELDS', 'OAUTH2', 'MINTED'] as const;\n\ninterface MethodDraft {\n key: string;\n displayName: string;\n description: string;\n authType: string;\n flow: string;\n configSchema: string;\n isDefault: boolean;\n isEnabled: boolean;\n displayOrder: string;\n}\n\nfunction toDraft(method: IntegrationAuthMethod): MethodDraft {\n return {\n key: method.key,\n displayName: method.displayName,\n description: method.description ?? '',\n authType: method.authType.toUpperCase(),\n flow: method.flow.toUpperCase(),\n configSchema: method.configSchema ? JSON.stringify(method.configSchema, null, 2) : '',\n isDefault: method.isDefault,\n isEnabled: method.isEnabled,\n displayOrder: String(method.displayOrder),\n };\n}\n\nconst EMPTY_DRAFT: MethodDraft = {\n key: '',\n displayName: '',\n description: '',\n authType: 'API_KEY',\n flow: 'FIELDS',\n configSchema: '',\n isDefault: false,\n isEnabled: true,\n displayOrder: '0',\n};\n\ninterface AuthMethodsEditorProps {\n provider: IntegrationProvider;\n canManage: boolean;\n}\n\nexport const AuthMethodsEditor: FC<AuthMethodsEditorProps> = ({ provider, canManage }) => {\n const tr = useTr();\n const { upsertAuthMethod, loading: saving } = useUpsertAuthMethod();\n const { deleteAuthMethod, loading: deleting } = useDeleteAuthMethod();\n const [draft, setDraft] = useState<MethodDraft | null>(null);\n const [errorMessage, setErrorMessage] = useState('');\n const idPrefix = useId();\n const fieldId = (name: string) => `${idPrefix}-${name}`;\n\n const methods = provider.authMethods ?? [];\n const busy = saving || deleting;\n\n const previewSchema = draft ? parseFormSchema(safeParse(draft.configSchema)) : null;\n\n const handleSave = async () => {\n if (!draft) return;\n setErrorMessage('');\n\n if (!draft.key.trim() || !draft.displayName.trim()) {\n setErrorMessage(\n tr(\n 'integrations.providerEditor.errors.keyAndNameRequired',\n 'Key and display name are required'\n )\n );\n return;\n }\n\n let configSchema: Record<string, unknown> | null = null;\n if (draft.configSchema.trim()) {\n const parsed = safeParse(draft.configSchema);\n if (!parsed) {\n setErrorMessage(\n tr('integrations.providerEditor.errors.invalidSchema', 'Field schema is not valid JSON')\n );\n return;\n }\n configSchema = parsed;\n }\n\n try {\n await upsertAuthMethod(provider.id, {\n key: draft.key.trim(),\n displayName: draft.displayName.trim(),\n description: draft.description.trim() || undefined,\n authType: draft.authType,\n flow: draft.flow,\n configSchema,\n isDefault: draft.isDefault,\n isEnabled: draft.isEnabled,\n displayOrder: Number(draft.displayOrder) || 0,\n });\n setDraft(null);\n } catch (error) {\n setErrorMessage(\n error instanceof Error\n ? error.message\n : tr('integrations.providerEditor.errors.saveMethodFailed', 'Failed to save method')\n );\n }\n };\n\n const handleDelete = async (key: string) => {\n // Existing connections can depend on this method, and the backend refuses\n // the delete when any still do — but an accidental click should not even\n // get that far.\n const confirmed = window.confirm(\n tr(\n 'integrations.providerEditor.authMethods.deleteConfirm',\n 'Remove the \"{{key}}\" authentication method? Connections still using it will block the removal.',\n { key }\n )\n );\n if (!confirmed) return;\n\n setErrorMessage('');\n try {\n await deleteAuthMethod(provider.id, key);\n } catch (error) {\n setErrorMessage(\n error instanceof Error\n ? error.message\n : tr('integrations.providerEditor.errors.removeMethodFailed', 'Failed to remove method')\n );\n }\n };\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-start justify-between gap-4\">\n <div>\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {tr('integrations.providerEditor.sections.authMethods', 'Authentication Methods')}\n </h3>\n <p className=\"text-xs text-text-secondary mt-1\">\n {tr(\n 'integrations.providerEditor.sections.authMethodsDescription',\n \"Ways users can authenticate against this provider. When more than one is enabled, the connection form shows a dropdown. Fields come from each method's schema.\"\n )}\n </p>\n </div>\n {canManage && !draft && (\n <Button variant=\"outline\" size=\"sm\" onClick={() => setDraft({ ...EMPTY_DRAFT })}>\n <Plus size={14} /> {tr('integrations.providerEditor.authMethods.add', 'Add method')}\n </Button>\n )}\n </div>\n\n {errorMessage && (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg-subtle border border-border-default\">\n <AlertCircle size={16} className=\"text-status-error-text flex-shrink-0\" />\n <span className=\"text-sm text-status-error-text\">{errorMessage}</span>\n </div>\n )}\n\n <div className=\"space-y-2\">\n {methods.length === 0 && (\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'integrations.providerEditor.authMethods.none',\n 'No authentication methods defined yet.'\n )}\n </p>\n )}\n {methods.map((method) => (\n <div\n key={method.key}\n className=\"flex items-center gap-3 p-3 rounded-md border border-border-subtle\"\n >\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-medium text-text-primary truncate\">\n {method.displayName}\n </span>\n {method.isDefault && (\n <span\n title={tr(\n 'integrations.providerEditor.authMethods.defaultMethod',\n 'Default method'\n )}\n className=\"inline-flex items-center gap-1 text-xs text-text-secondary\"\n >\n <Star size={12} />{' '}\n {tr('integrations.providerEditor.authMethods.default', 'default')}\n </span>\n )}\n {!method.isEnabled && (\n <span className=\"text-xs text-text-secondary\">\n {tr('integrations.providerEditor.authMethods.disabled', 'disabled')}\n </span>\n )}\n {!method.isConfigured && (\n <span className=\"text-xs text-status-warning-text\">\n {tr('integrations.providerEditor.authMethods.notConfigured', 'not configured')}\n </span>\n )}\n </div>\n <div className=\"text-xs text-text-secondary mt-0.5\">\n {method.key} · {method.authType} · {method.flow}\n </div>\n </div>\n {canManage && (\n <div className=\"flex items-center gap-1\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => setDraft(toDraft(method))}>\n {tr('integrations.providerEditor.authMethods.edit', 'Edit')}\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n aria-label={tr(\n 'integrations.providerEditor.authMethods.removeAriaLabel',\n 'Remove {{name}}',\n { name: method.displayName }\n )}\n onClick={() => handleDelete(method.key)}\n disabled={busy}\n >\n <Trash2 size={14} />\n </Button>\n </div>\n )}\n </div>\n ))}\n </div>\n\n {draft && (\n <div className=\"rounded-md border border-border-subtle p-4 space-y-3\">\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-3\">\n <Field\n label={tr('integrations.providerEditor.authMethods.key', 'Key')}\n id={fieldId('key')}\n required\n >\n <input\n id={fieldId('key')}\n aria-label={tr('integrations.providerEditor.authMethods.key', 'Key')}\n value={draft.key}\n onChange={(event) => setDraft({ ...draft, key: event.target.value })}\n placeholder={tr(\n 'integrations.providerEditor.authMethods.keyPlaceholder',\n 'service-account'\n )}\n className={INPUT_CLASS}\n />\n </Field>\n <Field\n label={tr('integrations.providerEditor.authMethods.displayName', 'Display name')}\n id={fieldId('displayName')}\n required\n >\n <input\n id={fieldId('displayName')}\n aria-label={tr(\n 'integrations.providerEditor.authMethods.displayName',\n 'Display name'\n )}\n value={draft.displayName}\n onChange={(event) => setDraft({ ...draft, displayName: event.target.value })}\n placeholder={tr(\n 'integrations.providerEditor.authMethods.displayNamePlaceholder',\n 'Service Account'\n )}\n className={INPUT_CLASS}\n />\n </Field>\n <Field\n label={tr('integrations.providerEditor.authMethods.authType', 'Auth type')}\n id={fieldId('authType')}\n >\n <select\n id={fieldId('authType')}\n aria-label={tr('integrations.providerEditor.authMethods.authType', 'Auth type')}\n value={draft.authType}\n onChange={(event) => setDraft({ ...draft, authType: event.target.value })}\n className={`${INPUT_CLASS} scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary`}\n >\n {AUTH_TYPES.map((type) => (\n <option key={type} value={type}>\n {type}\n </option>\n ))}\n </select>\n </Field>\n <Field\n label={tr('integrations.providerEditor.authMethods.flow', 'Flow')}\n id={fieldId('flow')}\n >\n <select\n id={fieldId('flow')}\n aria-label={tr('integrations.providerEditor.authMethods.flow', 'Flow')}\n value={draft.flow}\n onChange={(event) => setDraft({ ...draft, flow: event.target.value })}\n className={`${INPUT_CLASS} scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary`}\n >\n {FLOWS.map((flow) => (\n <option key={flow} value={flow}>\n {flow}\n </option>\n ))}\n </select>\n </Field>\n </div>\n\n <Field\n label={tr('integrations.providerEditor.fields.description', 'Description')}\n id={fieldId('description')}\n >\n <input\n id={fieldId('description')}\n aria-label={tr('integrations.providerEditor.fields.description', 'Description')}\n value={draft.description}\n onChange={(event) => setDraft({ ...draft, description: event.target.value })}\n className={INPUT_CLASS}\n />\n </Field>\n\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <Field\n label={tr(\n 'integrations.providerEditor.authMethods.configSchema',\n 'Field schema (JSON)'\n )}\n id={fieldId('configSchema')}\n >\n <textarea\n id={fieldId('configSchema')}\n aria-label={tr(\n 'integrations.providerEditor.authMethods.configSchema',\n 'Field schema (JSON)'\n )}\n value={draft.configSchema}\n onChange={(event) => setDraft({ ...draft, configSchema: event.target.value })}\n rows={12}\n spellCheck={false}\n placeholder={SCHEMA_PLACEHOLDER}\n className={`${INPUT_CLASS} font-mono text-xs`}\n />\n </Field>\n <div>\n <span className=\"block text-sm font-medium text-text-primary mb-1.5\">\n {tr('integrations.providerEditor.authMethods.livePreview', 'Live preview')}\n </span>\n <div className=\"rounded-md border border-border-subtle p-3 bg-bg-surface min-h-[200px]\">\n {previewSchema ? (\n <SchemaForm\n schema={previewSchema}\n values={{}}\n onChange={() => undefined}\n disabled\n idPrefix={fieldId('preview')}\n translate={tr}\n />\n ) : (\n <p className=\"text-xs text-text-secondary\">\n {draft.configSchema.trim()\n ? tr(\n 'integrations.providerEditor.authMethods.previewInvalid',\n 'Not a valid object schema yet.'\n )\n : tr(\n 'integrations.providerEditor.authMethods.previewEmpty',\n 'Describe fields on the left to preview the form users will see.'\n )}\n </p>\n )}\n </div>\n </div>\n </div>\n\n <div className=\"flex flex-wrap items-center gap-4\">\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n aria-label={tr(\n 'integrations.providerEditor.authMethods.defaultMethod',\n 'Default method'\n )}\n checked={draft.isDefault}\n onChange={(event) => setDraft({ ...draft, isDefault: event.target.checked })}\n />\n {tr('integrations.providerEditor.authMethods.defaultMethod', 'Default method')}\n </label>\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n aria-label={tr('integrations.providerEditor.authMethods.enabled', 'Enabled')}\n checked={draft.isEnabled}\n onChange={(event) => setDraft({ ...draft, isEnabled: event.target.checked })}\n />\n {tr('integrations.providerEditor.authMethods.enabled', 'Enabled')}\n </label>\n <Field\n label={tr('integrations.providerEditor.authMethods.order', 'Order')}\n id={fieldId('displayOrder')}\n inline\n >\n <input\n id={fieldId('displayOrder')}\n aria-label={tr('integrations.providerEditor.authMethods.order', 'Order')}\n type=\"number\"\n value={draft.displayOrder}\n onChange={(event) => setDraft({ ...draft, displayOrder: event.target.value })}\n className={`${INPUT_CLASS} w-20`}\n />\n </Field>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <Button onClick={handleSave} disabled={busy}>\n {busy ? <Loader2 size={14} className=\"animate-spin\" /> : <Check size={14} />}{' '}\n {tr('integrations.providerEditor.authMethods.save', 'Save method')}\n </Button>\n <Button variant=\"outline\" onClick={() => setDraft(null)} disabled={busy}>\n <X size={14} /> {tr('integrations.common.cancel', 'Cancel')}\n </Button>\n </div>\n </div>\n )}\n </div>\n );\n};\n\nconst INPUT_CLASS =\n 'w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50';\n\nconst SCHEMA_PLACEHOLDER = `{\n \"type\": \"object\",\n \"properties\": {\n \"apiKey\": { \"type\": \"string\", \"title\": \"API Key\", \"secret\": true }\n },\n \"required\": [\"apiKey\"]\n}`;\n\nfunction safeParse(raw: string): Record<string, unknown> | null {\n if (!raw.trim()) return null;\n try {\n const parsed: unknown = JSON.parse(raw);\n return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : null;\n } catch {\n return null;\n }\n}\n\nconst Field: FC<{\n label: string;\n id: string;\n required?: boolean;\n inline?: boolean;\n children: React.ReactNode;\n}> = ({ label, id, required, inline, children }) => (\n <div className={inline ? 'flex items-center gap-2' : undefined}>\n <label\n htmlFor={id}\n className={\n inline\n ? 'text-sm font-medium text-text-primary'\n : 'block text-sm font-medium text-text-primary mb-1.5'\n }\n >\n {label} {required && <span className=\"text-status-error-text\">*</span>}\n </label>\n {children}\n </div>\n);\n"],"mappings":";;;;;;;;AAqBA,IAAM,IAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,EAEK,IAAQ;CAAC;CAAU;CAAU;CAAS;AAc5C,SAAS,EAAQ,GAA4C;AAC3D,QAAO;EACL,KAAK,EAAO;EACZ,aAAa,EAAO;EACpB,aAAa,EAAO,eAAe;EACnC,UAAU,EAAO,SAAS,aAAa;EACvC,MAAM,EAAO,KAAK,aAAa;EAC/B,cAAc,EAAO,eAAe,KAAK,UAAU,EAAO,cAAc,MAAM,EAAE,GAAG;EACnF,WAAW,EAAO;EAClB,WAAW,EAAO;EAClB,cAAc,OAAO,EAAO,aAAa;EAC1C;;AAGH,IAAM,IAA2B;CAC/B,KAAK;CACL,aAAa;CACb,aAAa;CACb,UAAU;CACV,MAAM;CACN,cAAc;CACd,WAAW;CACX,WAAW;CACX,cAAc;CACf,EAOY,KAAiD,EAAE,aAAU,mBAAgB;CACxF,IAAM,IAAK,GAAO,EACZ,EAAE,qBAAkB,SAAS,MAAW,GAAqB,E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;SACxE,MAAK;SACL,OAAO,EAAM;SACb,WAAW,MAAU,EAAS;UAAE,GAAG;UAAO,cAAc,EAAM,OAAO;UAAO,CAAC;SAC7E,WAAW,GAAG,EAAY;SAC1B,CAAA;QACI,CAAA;OACJ;;KAEN,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,GAAD;OAAQ,SAAS;OAAY,UAAU;iBAAvC;QACG,IAAO,kBAAC,GAAD;SAAS,MAAM;SAAI,WAAU;SAAiB,CAAA,GAAG,kBAAC,GAAD,EAAO,MAAM,IAAM,CAAA;QAAE;QAC7E,EAAG,gDAAgD,cAAc;QAC3D;UACT,kBAAC,GAAD;OAAQ,SAAQ;OAAU,eAAe,EAAS,KAAK;OAAE,UAAU;iBAAnE;QACE,kBAAC,GAAD,EAAG,MAAM,IAAM,CAAA;;QAAE,EAAG,8BAA8B,SAAS;QACpD;SACL;;KACF;;GAEJ;;GAIJ,IACJ,gLAEI,IAAqB;AAQ3B,SAAS,EAAU,GAA6C;AAC9D,KAAI,CAAC,EAAI,MAAM,CAAE,QAAO;AACxB,KAAI;EACF,IAAM,IAAkB,KAAK,MAAM,EAAI;AACvC,SAAO,OAAO,KAAW,YAAY,KAAmB,CAAC,MAAM,QAAQ,EAAO,GACzE,IACD;SACE;AACN,SAAO;;;AAIX,IAAM,KAMA,EAAE,UAAO,OAAI,aAAU,WAAQ,kBACnC,kBAAC,OAAD;CAAK,WAAW,IAAS,4BAA4B,KAAA;WAArD,CACE,kBAAC,SAAD;EACE,SAAS;EACT,WACE,IACI,0CACA;YALR;GAQG;GAAM;GAAE,KAAY,kBAAC,QAAD;IAAM,WAAU;cAAyB;IAAQ,CAAA;GAChE;KACP,EACG"}
|
|
1
|
+
{"version":3,"file":"AuthMethodsEditor.js","names":["AUTH_TYPES","FLOWS","toDraft","method","EMPTY_DRAFT","AuthMethodsEditor","tr","useTr","saving","useUpsertAuthMethod","deleting","useDeleteAuthMethod","draft","setDraft","useState","errorMessage","setErrorMessage","idPrefix","useId","fieldId","name","methods","provider","busy","previewSchema","parseFormSchema","safeParse","handleSave","configSchema","parsed","upsertAuthMethod","error","handleDelete","deleteAuthMethod","key","canManage","Button","Plus","AlertCircle","Star","Trash2","Field","event","INPUT_CLASS","type","flow","SCHEMA_PLACEHOLDER","SchemaForm","Loader2","Check","X","raw","inline","id","label","required","children"],"sources":["../../../src/integrations/components/AuthMethodsEditor.tsx"],"sourcesContent":["/**\n * AuthMethodsEditor — admin surface for a provider's authentication methods.\n *\n * This is the screen that turns \"add a way to authenticate\" from a code change\n * into a data change. Each method carries its own type, flow and field schema;\n * the connection UI renders whatever is defined here, so no provider or auth\n * type ever needs bespoke React again.\n *\n * The schema editor shows a live preview using the *same* renderer end users\n * get, so an admin can see the form they are describing instead of writing JSON\n * Schema blind and finding out at connect time.\n */\nimport type { FC } from 'react';\nimport { useId, useState } from 'react';\nimport { AlertCircle, Check, Loader2, Plus, Star, Trash2, X } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../hooks/useTr';\nimport { useDeleteAuthMethod, useUpsertAuthMethod } from '../hooks/useProviders';\nimport type { IntegrationAuthMethod, IntegrationProvider } from '../types';\nimport { SchemaForm, parseFormSchema } from '@burdenoff/fe-libs/credentials';\n\nconst AUTH_TYPES = [\n 'OAUTH2',\n 'OAUTH1',\n 'API_KEY',\n 'BASIC_AUTH',\n 'BEARER_TOKEN',\n 'SERVICE_ACCOUNT',\n 'WORKSPACE_APP_TOKEN',\n 'CUSTOM',\n] as const;\n\nconst FLOWS = ['FIELDS', 'OAUTH2', 'MINTED'] as const;\n\ninterface MethodDraft {\n key: string;\n displayName: string;\n description: string;\n authType: string;\n flow: string;\n configSchema: string;\n isDefault: boolean;\n isEnabled: boolean;\n displayOrder: string;\n}\n\nfunction toDraft(method: IntegrationAuthMethod): MethodDraft {\n return {\n key: method.key,\n displayName: method.displayName,\n description: method.description ?? '',\n authType: method.authType.toUpperCase(),\n flow: method.flow.toUpperCase(),\n configSchema: method.configSchema ? JSON.stringify(method.configSchema, null, 2) : '',\n isDefault: method.isDefault,\n isEnabled: method.isEnabled,\n displayOrder: String(method.displayOrder),\n };\n}\n\nconst EMPTY_DRAFT: MethodDraft = {\n key: '',\n displayName: '',\n description: '',\n authType: 'API_KEY',\n flow: 'FIELDS',\n configSchema: '',\n isDefault: false,\n isEnabled: true,\n displayOrder: '0',\n};\n\ninterface AuthMethodsEditorProps {\n provider: IntegrationProvider;\n canManage: boolean;\n}\n\nexport const AuthMethodsEditor: FC<AuthMethodsEditorProps> = ({ provider, canManage }) => {\n const tr = useTr();\n const { upsertAuthMethod, loading: saving } = useUpsertAuthMethod();\n const { deleteAuthMethod, loading: deleting } = useDeleteAuthMethod();\n const [draft, setDraft] = useState<MethodDraft | null>(null);\n const [errorMessage, setErrorMessage] = useState('');\n const idPrefix = useId();\n const fieldId = (name: string) => `${idPrefix}-${name}`;\n\n const methods = provider.authMethods ?? [];\n const busy = saving || deleting;\n\n const previewSchema = draft ? parseFormSchema(safeParse(draft.configSchema)) : null;\n\n const handleSave = async () => {\n if (!draft) return;\n setErrorMessage('');\n\n if (!draft.key.trim() || !draft.displayName.trim()) {\n setErrorMessage(\n tr(\n 'integrations.providerEditor.errors.keyAndNameRequired',\n 'Key and display name are required'\n )\n );\n return;\n }\n\n let configSchema: Record<string, unknown> | null = null;\n if (draft.configSchema.trim()) {\n const parsed = safeParse(draft.configSchema);\n if (!parsed) {\n setErrorMessage(\n tr('integrations.providerEditor.errors.invalidSchema', 'Field schema is not valid JSON')\n );\n return;\n }\n configSchema = parsed;\n }\n\n try {\n await upsertAuthMethod(provider.id, {\n key: draft.key.trim(),\n displayName: draft.displayName.trim(),\n description: draft.description.trim() || undefined,\n authType: draft.authType,\n flow: draft.flow,\n configSchema,\n isDefault: draft.isDefault,\n isEnabled: draft.isEnabled,\n displayOrder: Number(draft.displayOrder) || 0,\n });\n setDraft(null);\n } catch (error) {\n setErrorMessage(\n error instanceof Error\n ? error.message\n : tr('integrations.providerEditor.errors.saveMethodFailed', 'Failed to save method')\n );\n }\n };\n\n const handleDelete = async (key: string) => {\n // Existing connections can depend on this method, and the backend refuses\n // the delete when any still do — but an accidental click should not even\n // get that far.\n const confirmed = window.confirm(\n tr(\n 'integrations.providerEditor.authMethods.deleteConfirm',\n 'Remove the \"{{key}}\" authentication method? Connections still using it will block the removal.',\n { key }\n )\n );\n if (!confirmed) return;\n\n setErrorMessage('');\n try {\n await deleteAuthMethod(provider.id, key);\n } catch (error) {\n setErrorMessage(\n error instanceof Error\n ? error.message\n : tr('integrations.providerEditor.errors.removeMethodFailed', 'Failed to remove method')\n );\n }\n };\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-start justify-between gap-4\">\n <div>\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {tr('integrations.providerEditor.sections.authMethods', 'Authentication Methods')}\n </h3>\n <p className=\"text-xs text-text-secondary mt-1\">\n {tr(\n 'integrations.providerEditor.sections.authMethodsDescription',\n \"Ways users can authenticate against this provider. When more than one is enabled, the connection form shows a dropdown. Fields come from each method's schema.\"\n )}\n </p>\n </div>\n {canManage && !draft && (\n <Button variant=\"outline\" size=\"sm\" onClick={() => setDraft({ ...EMPTY_DRAFT })}>\n <Plus size={14} /> {tr('integrations.providerEditor.authMethods.add', 'Add method')}\n </Button>\n )}\n </div>\n\n {errorMessage && (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg-subtle border border-border-default\">\n <AlertCircle size={16} className=\"text-status-error-text flex-shrink-0\" />\n <span className=\"text-sm text-status-error-text\">{errorMessage}</span>\n </div>\n )}\n\n <div className=\"space-y-2\">\n {methods.length === 0 && (\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'integrations.providerEditor.authMethods.none',\n 'No authentication methods defined yet.'\n )}\n </p>\n )}\n {methods.map((method) => (\n <div\n key={method.key}\n className=\"flex items-center gap-3 p-3 rounded-md border border-border-subtle\"\n >\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-medium text-text-primary truncate\">\n {method.displayName}\n </span>\n {method.isDefault && (\n <span\n title={tr(\n 'integrations.providerEditor.authMethods.defaultMethod',\n 'Default method'\n )}\n className=\"inline-flex items-center gap-1 text-xs text-text-secondary\"\n >\n <Star size={12} />{' '}\n {tr('integrations.providerEditor.authMethods.default', 'default')}\n </span>\n )}\n {!method.isEnabled && (\n <span className=\"text-xs text-text-secondary\">\n {tr('integrations.providerEditor.authMethods.disabled', 'disabled')}\n </span>\n )}\n {!method.isConfigured && (\n <span className=\"text-xs text-status-warning-text\">\n {tr('integrations.providerEditor.authMethods.notConfigured', 'not configured')}\n </span>\n )}\n </div>\n <div className=\"text-xs text-text-secondary mt-0.5\">\n {method.key} · {method.authType} · {method.flow}\n </div>\n </div>\n {canManage && (\n <div className=\"flex items-center gap-1\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => setDraft(toDraft(method))}>\n {tr('integrations.providerEditor.authMethods.edit', 'Edit')}\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n aria-label={tr(\n 'integrations.providerEditor.authMethods.removeAriaLabel',\n 'Remove {{name}}',\n { name: method.displayName }\n )}\n onClick={() => handleDelete(method.key)}\n disabled={busy}\n >\n <Trash2 size={14} />\n </Button>\n </div>\n )}\n </div>\n ))}\n </div>\n\n {draft && (\n <div className=\"rounded-md border border-border-subtle p-4 space-y-3\">\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-3\">\n <Field\n label={tr('integrations.providerEditor.authMethods.key', 'Key')}\n id={fieldId('key')}\n required\n >\n <input\n id={fieldId('key')}\n aria-label={tr('integrations.providerEditor.authMethods.key', 'Key')}\n value={draft.key}\n onChange={(event) => setDraft({ ...draft, key: event.target.value })}\n placeholder={tr(\n 'integrations.providerEditor.authMethods.keyPlaceholder',\n 'service-account'\n )}\n className={INPUT_CLASS}\n />\n </Field>\n <Field\n label={tr('integrations.providerEditor.authMethods.displayName', 'Display name')}\n id={fieldId('displayName')}\n required\n >\n <input\n id={fieldId('displayName')}\n aria-label={tr(\n 'integrations.providerEditor.authMethods.displayName',\n 'Display name'\n )}\n value={draft.displayName}\n onChange={(event) => setDraft({ ...draft, displayName: event.target.value })}\n placeholder={tr(\n 'integrations.providerEditor.authMethods.displayNamePlaceholder',\n 'Service Account'\n )}\n className={INPUT_CLASS}\n />\n </Field>\n <Field\n label={tr('integrations.providerEditor.authMethods.authType', 'Auth type')}\n id={fieldId('authType')}\n >\n <select\n id={fieldId('authType')}\n aria-label={tr('integrations.providerEditor.authMethods.authType', 'Auth type')}\n value={draft.authType}\n onChange={(event) => setDraft({ ...draft, authType: event.target.value })}\n className={`${INPUT_CLASS} scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary`}\n >\n {AUTH_TYPES.map((type) => (\n <option key={type} value={type}>\n {type}\n </option>\n ))}\n </select>\n </Field>\n <Field\n label={tr('integrations.providerEditor.authMethods.flow', 'Flow')}\n id={fieldId('flow')}\n >\n <select\n id={fieldId('flow')}\n aria-label={tr('integrations.providerEditor.authMethods.flow', 'Flow')}\n value={draft.flow}\n onChange={(event) => setDraft({ ...draft, flow: event.target.value })}\n className={`${INPUT_CLASS} scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary`}\n >\n {FLOWS.map((flow) => (\n <option key={flow} value={flow}>\n {flow}\n </option>\n ))}\n </select>\n </Field>\n </div>\n\n <Field\n label={tr('integrations.providerEditor.fields.description', 'Description')}\n id={fieldId('description')}\n >\n <input\n id={fieldId('description')}\n aria-label={tr('integrations.providerEditor.fields.description', 'Description')}\n value={draft.description}\n onChange={(event) => setDraft({ ...draft, description: event.target.value })}\n className={INPUT_CLASS}\n />\n </Field>\n\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <Field\n label={tr(\n 'integrations.providerEditor.authMethods.configSchema',\n 'Field schema (JSON)'\n )}\n id={fieldId('configSchema')}\n >\n <textarea\n id={fieldId('configSchema')}\n aria-label={tr(\n 'integrations.providerEditor.authMethods.configSchema',\n 'Field schema (JSON)'\n )}\n value={draft.configSchema}\n onChange={(event) => setDraft({ ...draft, configSchema: event.target.value })}\n rows={12}\n spellCheck={false}\n placeholder={SCHEMA_PLACEHOLDER}\n className={`${INPUT_CLASS} font-mono text-xs`}\n />\n </Field>\n <div>\n <span className=\"block text-sm font-medium text-text-primary mb-1.5\">\n {tr('integrations.providerEditor.authMethods.livePreview', 'Live preview')}\n </span>\n <div className=\"rounded-md border border-border-subtle p-3 bg-bg-surface min-h-[200px]\">\n {previewSchema ? (\n <SchemaForm\n schema={previewSchema}\n values={{}}\n onChange={() => undefined}\n disabled\n idPrefix={fieldId('preview')}\n translate={tr}\n />\n ) : (\n <p className=\"text-xs text-text-secondary\">\n {draft.configSchema.trim()\n ? tr(\n 'integrations.providerEditor.authMethods.previewInvalid',\n 'Not a valid object schema yet.'\n )\n : tr(\n 'integrations.providerEditor.authMethods.previewEmpty',\n 'Describe fields on the left to preview the form users will see.'\n )}\n </p>\n )}\n </div>\n </div>\n </div>\n\n <div className=\"flex flex-wrap items-center gap-4\">\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n aria-label={tr(\n 'integrations.providerEditor.authMethods.defaultMethod',\n 'Default method'\n )}\n checked={draft.isDefault}\n onChange={(event) => setDraft({ ...draft, isDefault: event.target.checked })}\n />\n {tr('integrations.providerEditor.authMethods.defaultMethod', 'Default method')}\n </label>\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n aria-label={tr('integrations.providerEditor.authMethods.enabled', 'Enabled')}\n checked={draft.isEnabled}\n onChange={(event) => setDraft({ ...draft, isEnabled: event.target.checked })}\n />\n {tr('integrations.providerEditor.authMethods.enabled', 'Enabled')}\n </label>\n <Field\n label={tr('integrations.providerEditor.authMethods.order', 'Order')}\n id={fieldId('displayOrder')}\n inline\n >\n <input\n id={fieldId('displayOrder')}\n aria-label={tr('integrations.providerEditor.authMethods.order', 'Order')}\n type=\"number\"\n value={draft.displayOrder}\n onChange={(event) => setDraft({ ...draft, displayOrder: event.target.value })}\n className={`${INPUT_CLASS} w-20`}\n />\n </Field>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <Button onClick={handleSave} disabled={busy}>\n {busy ? <Loader2 size={14} className=\"animate-spin\" /> : <Check size={14} />}{' '}\n {tr('integrations.providerEditor.authMethods.save', 'Save method')}\n </Button>\n <Button variant=\"outline\" onClick={() => setDraft(null)} disabled={busy}>\n <X size={14} /> {tr('integrations.common.cancel', 'Cancel')}\n </Button>\n </div>\n </div>\n )}\n </div>\n );\n};\n\nconst INPUT_CLASS =\n 'w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50';\n\nconst SCHEMA_PLACEHOLDER = `{\n \"type\": \"object\",\n \"properties\": {\n \"apiKey\": { \"type\": \"string\", \"title\": \"API Key\", \"secret\": true }\n },\n \"required\": [\"apiKey\"]\n}`;\n\nfunction safeParse(raw: string): Record<string, unknown> | null {\n if (!raw.trim()) return null;\n try {\n const parsed: unknown = JSON.parse(raw);\n return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : null;\n } catch {\n return null;\n }\n}\n\nconst Field: FC<{\n label: string;\n id: string;\n required?: boolean;\n inline?: boolean;\n children: React.ReactNode;\n}> = ({ label, id, required, inline, children }) => (\n <div className={inline ? 'flex items-center gap-2' : undefined}>\n <label\n htmlFor={id}\n className={\n inline\n ? 'text-sm font-medium text-text-primary'\n : 'block text-sm font-medium text-text-primary mb-1.5'\n }\n >\n {label} {required && <span className=\"text-status-error-text\">*</span>}\n </label>\n {children}\n </div>\n);\n"],"mappings":";;;;;;;;AAqBA,IAAMA,IAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEMC,IAAQ;CAAC;CAAU;CAAU;AAAQ;AAc3C,S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: string;
|
|
@@ -12,6 +11,5 @@ interface ConfirmDialogProps {
|
|
|
12
11
|
onConfirm: () => void;
|
|
13
12
|
onCancel: () => void;
|
|
14
13
|
}
|
|
15
|
-
export declare function ConfirmDialog({ open, title, description, confirmLabel, cancelLabel, loading, destructive, icon, onConfirm, onCancel, }: ConfirmDialogProps): import(
|
|
14
|
+
export declare function ConfirmDialog({ open, title, description, confirmLabel, cancelLabel, loading, destructive, icon, onConfirm, onCancel, }: ConfirmDialogProps): import('react').JSX.Element;
|
|
16
15
|
export {};
|
|
17
|
-
//# sourceMappingURL=ConfirmDialog.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Loader2 as e } from "lucide-react";
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
import { AlertDialog as r, AlertDialogAction as i, AlertDialogCancel as a, AlertDialogContent as o, AlertDialogDescription as s, AlertDialogFooter as c, AlertDialogHeader as l, AlertDialogTitle as u } from "@burdenoff/fe-libs/ui";
|
|
4
|
-
|
|
4
|
+
// src/integrations/components/ConfirmDialog.tsx
|
|
5
5
|
function d({ open: d, title: f, description: p, confirmLabel: m, cancelLabel: h, loading: g = !1, destructive: _ = !1, icon: v, onConfirm: y, onCancel: b }) {
|
|
6
6
|
return /* @__PURE__ */ t(r, {
|
|
7
7
|
open: d,
|
|
@@ -36,7 +36,6 @@ function d({ open: d, title: f, description: p, confirmLabel: m, cancelLabel: h,
|
|
|
36
36
|
})
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { d as ConfirmDialog };
|
|
41
40
|
|
|
42
41
|
//# sourceMappingURL=ConfirmDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.js","names":[],"sources":["../../../src/integrations/components/ConfirmDialog.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { Loader2 } from 'lucide-react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from '@burdenoff/fe-libs/ui';\n\ninterface ConfirmDialogProps {\n open: boolean;\n title: string;\n description: string;\n confirmLabel: string;\n cancelLabel: string;\n loading?: boolean;\n destructive?: boolean;\n icon?: ReactNode;\n onConfirm: () => void;\n onCancel: () => void;\n}\n\nexport function ConfirmDialog({\n open,\n title,\n description,\n confirmLabel,\n cancelLabel,\n loading = false,\n destructive = false,\n icon,\n onConfirm,\n onCancel,\n}: ConfirmDialogProps) {\n return (\n <AlertDialog\n open={open}\n onOpenChange={(next) => {\n if (!next) {\n onCancel();\n }\n }}\n >\n <AlertDialogContent className=\"max-w-md\">\n <AlertDialogHeader>\n <div className=\"flex items-start gap-3\">\n {icon && <div className=\"mt-0.5 text-primary\">{icon}</div>}\n <div>\n <AlertDialogTitle>{title}</AlertDialogTitle>\n <AlertDialogDescription className=\"mt-1\">{description}</AlertDialogDescription>\n </div>\n </div>\n </AlertDialogHeader>\n\n <AlertDialogFooter>\n <AlertDialogCancel onClick={onCancel}>{cancelLabel}</AlertDialogCancel>\n <AlertDialogAction\n disabled={loading}\n onClick={(event) => {\n // Keep the dialog open while the confirm callback runs; the\n // caller controls `open` and closes it once the action resolves.\n event.preventDefault();\n onConfirm();\n }}\n className={\n destructive\n ? 'inline-flex items-center gap-2 bg-status-error-bg text-action-primary-text disabled:opacity-50'\n : 'inline-flex items-center gap-2 disabled:opacity-50'\n }\n >\n {loading && <Loader2 size={14} className=\"animate-spin\" />}\n {confirmLabel}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n"],"mappings":";;;;AA0BA,
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.js","names":["ConfirmDialog","AlertDialog","next","onCancel","AlertDialogContent","AlertDialogHeader","icon","AlertDialogTitle","title","AlertDialogDescription","description","AlertDialogFooter","AlertDialogCancel","cancelLabel","AlertDialogAction","loading","event","onConfirm","destructive","Loader2","confirmLabel"],"sources":["../../../src/integrations/components/ConfirmDialog.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { Loader2 } from 'lucide-react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from '@burdenoff/fe-libs/ui';\n\ninterface ConfirmDialogProps {\n open: boolean;\n title: string;\n description: string;\n confirmLabel: string;\n cancelLabel: string;\n loading?: boolean;\n destructive?: boolean;\n icon?: ReactNode;\n onConfirm: () => void;\n onCancel: () => void;\n}\n\nexport function ConfirmDialog({\n open,\n title,\n description,\n confirmLabel,\n cancelLabel,\n loading = false,\n destructive = false,\n icon,\n onConfirm,\n onCancel,\n}: ConfirmDialogProps) {\n return (\n <AlertDialog\n open={open}\n onOpenChange={(next) => {\n if (!next) {\n onCancel();\n }\n }}\n >\n <AlertDialogContent className=\"max-w-md\">\n <AlertDialogHeader>\n <div className=\"flex items-start gap-3\">\n {icon && <div className=\"mt-0.5 text-primary\">{icon}</div>}\n <div>\n <AlertDialogTitle>{title}</AlertDialogTitle>\n <AlertDialogDescription className=\"mt-1\">{description}</AlertDialogDescription>\n </div>\n </div>\n </AlertDialogHeader>\n\n <AlertDialogFooter>\n <AlertDialogCancel onClick={onCancel}>{cancelLabel}</AlertDialogCancel>\n <AlertDialogAction\n disabled={loading}\n onClick={(event) => {\n // Keep the dialog open while the confirm callback runs; the\n // caller controls `open` and closes it once the action resolves.\n event.preventDefault();\n onConfirm();\n }}\n className={\n destructive\n ? 'inline-flex items-center gap-2 bg-status-error-bg text-action-primary-text disabled:opacity-50'\n : 'inline-flex items-center gap-2 disabled:opacity-50'\n }\n >\n {loading && <Loader2 size={14} className=\"animate-spin\" />}\n {confirmLabel}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n"],"mappings":";;;;AA0BA,SAAgBA,EAAc,EAC5B,SACA,UACA,gBACA,iBACA,gBACA,aAAU,IACV,iBAAc,IACd,SACA,cACA,eACqB;CACrB,OACE,kBAACC,GAAD;EACQ;EACN,eAAe,MAAS;GACtB,AAAKC,KACHC,EAAS;EAEb;EAEA,UAAA,kBAACC,GAAD;GAAoB,WAAU;GAA9B,UAAA,CACE,kBAACC,GAAD,EAAA,UACE,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACGC,KAAQ,kBAAC,OAAD;KAAK,WAAU;KAAuB,UAAAA;IAAU,CAAA,GACzD,kBAAC,OAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UAAmBC,EAAwB,CAAA,GAC3C,kBAACC,GAAD;KAAwB,WAAU;KAAQ,UAAAC;IAAoC,CAAA,CAC3E,EAAA,CAAA,CACF;GACY,CAAA,EAAA,CAAA,GAEnB,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;IAAmB,SAAST;IAAW,UAAAU;GAA+B,CAAA,GACtE,kBAACC,GAAD;IACE,UAAUC;IACV,UAAU,MAAU;KAIlB,AADAC,EAAM,eAAe,GACrBC,EAAU;IACZ;IACA,WACEC,IACI,mGACA;IAXR,UAAA,CAcGH,KAAW,kBAACI,GAAD;KAAS,MAAM;KAAI,WAAU;IAAgB,CAAA,GACxDC,CACgB;GACF,CAAA,CAAA,EAAA,CAAA,CACD;;CACT,CAAA;AAEjB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { IntegrationConnection } from '../types';
|
|
3
|
-
|
|
4
3
|
interface ConnectionCardProps {
|
|
5
4
|
connection: IntegrationConnection;
|
|
6
5
|
displayMode?: 'grid' | 'list';
|
|
@@ -11,4 +10,3 @@ interface ConnectionCardProps {
|
|
|
11
10
|
*/
|
|
12
11
|
export declare const ConnectionCard: FC<ConnectionCardProps>;
|
|
13
12
|
export {};
|
|
14
|
-
//# sourceMappingURL=ConnectionCard.d.ts.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { cn as e } from "../utils/cn.js";
|
|
2
|
+
import { useTr as t } from "../hooks/useTr.js";
|
|
3
3
|
import { useFormatLastUsed as n } from "../hooks/useFormatLastUsed.js";
|
|
4
4
|
import { ConnectionStatusBadge as r } from "./ConnectionStatusBadge.js";
|
|
5
5
|
import { ChevronRight as i, Lock as a } from "lucide-react";
|
|
6
6
|
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
7
|
import { ProviderIcon as l } from "@burdenoff/fe-libs/connections";
|
|
8
8
|
import { GlassCard as u } from "@burdenoff/fe-libs/ui";
|
|
9
|
-
|
|
10
|
-
var d = ({ connection:
|
|
11
|
-
let n =
|
|
12
|
-
if (
|
|
9
|
+
// src/integrations/components/ConnectionCard.tsx
|
|
10
|
+
var d = ({ connection: e }) => {
|
|
11
|
+
let n = t();
|
|
12
|
+
if (e.visibility !== "RESTRICTED") return null;
|
|
13
13
|
let r = n("integrations.connectionCard.private", "Private: only the people it is shared with");
|
|
14
14
|
return /* @__PURE__ */ c("span", {
|
|
15
15
|
className: "inline-flex shrink-0 items-center text-text-secondary",
|
|
@@ -24,9 +24,9 @@ var d = ({ connection: t }) => {
|
|
|
24
24
|
})]
|
|
25
25
|
});
|
|
26
26
|
}, f = ({ connection: a, displayMode: f = "grid", onClick: p }) => {
|
|
27
|
-
let m =
|
|
27
|
+
let m = t(), h = n();
|
|
28
28
|
return f === "list" ? /* @__PURE__ */ c(u, {
|
|
29
|
-
className:
|
|
29
|
+
className: e("group flex items-center gap-4 p-4 border-border-seam", "cursor-pointer hover:shadow-[var(--shadow-pop)] hover:border-border-strong", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", "animate-in fade-in-0"),
|
|
30
30
|
onClick: () => p?.(a),
|
|
31
31
|
role: "button",
|
|
32
32
|
tabIndex: 0,
|
|
@@ -76,7 +76,7 @@ var d = ({ connection: t }) => {
|
|
|
76
76
|
})
|
|
77
77
|
]
|
|
78
78
|
}) : /* @__PURE__ */ c(u, {
|
|
79
|
-
className:
|
|
79
|
+
className: e("group relative flex flex-col p-5 border-border-seam", "cursor-pointer hover:shadow-[var(--shadow-pop)] hover:border-border-strong", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", "animate-in fade-in-0"),
|
|
80
80
|
onClick: () => p?.(a),
|
|
81
81
|
role: "button",
|
|
82
82
|
tabIndex: 0,
|
|
@@ -123,7 +123,6 @@ var d = ({ connection: t }) => {
|
|
|
123
123
|
]
|
|
124
124
|
});
|
|
125
125
|
};
|
|
126
|
-
//#endregion
|
|
127
126
|
export { f as ConnectionCard };
|
|
128
127
|
|
|
129
128
|
//# sourceMappingURL=ConnectionCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionCard.js","names":[],"sources":["../../../src/integrations/components/ConnectionCard.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { ChevronRight, Lock } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../hooks/useTr';\nimport { useFormatLastUsed } from '../hooks/useFormatLastUsed';\nimport type { IntegrationConnection } from '../types';\nimport { ProviderIcon } from '@burdenoff/fe-libs/connections';\nimport { ConnectionStatusBadge } from './ConnectionStatusBadge';\n\ninterface ConnectionCardProps {\n connection: IntegrationConnection;\n displayMode?: 'grid' | 'list';\n onClick?: (connection: IntegrationConnection) => void;\n}\n\n/**\n * A lock for a connection only the people it is shared with can use (BOFF-9726).\n */\nconst PrivateBadge: FC<{ connection: IntegrationConnection }> = ({ connection }) => {\n const tr = useTr();\n if (connection.visibility !== 'RESTRICTED') return null;\n const label = tr(\n 'integrations.connectionCard.private',\n 'Private: only the people it is shared with'\n );\n return (\n <span\n className=\"inline-flex shrink-0 items-center text-text-secondary\"\n title={label}\n data-testid=\"connection-private-badge\"\n >\n <Lock size={13} aria-hidden=\"true\" />\n <span className=\"sr-only\">{label}</span>\n </span>\n );\n};\n\n/**\n * Card showing connection info (provider icon, connection name, account email, status badge, last used).\n */\nexport const ConnectionCard: FC<ConnectionCardProps> = ({\n connection,\n displayMode = 'grid',\n onClick,\n}) => {\n const tr = useTr();\n const formatLastUsed = useFormatLastUsed();\n\n if (displayMode === 'list') {\n return (\n <GlassCard\n className={cn(\n 'group flex items-center gap-4 p-4 border-border-seam',\n 'cursor-pointer hover:shadow-[var(--shadow-pop)] hover:border-border-strong',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]',\n 'animate-in fade-in-0'\n )}\n onClick={() => onClick?.(connection)}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick?.(connection);\n }\n }}\n >\n <ProviderIcon provider={connection.provider} size={40} />\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold text-text-primary truncate\">{connection.name}</h3>\n <PrivateBadge connection={connection} />\n <ConnectionStatusBadge status={connection.status} />\n </div>\n <div className=\"flex items-center gap-2 mt-0.5\">\n <span className=\"text-sm text-text-secondary\">{connection.provider.name}</span>\n {connection.externalAccountEmail && (\n <>\n <span className=\"text-text-secondary\">·</span>\n <span className=\"text-sm text-text-secondary truncate\">\n {connection.externalAccountEmail}\n </span>\n </>\n )}\n </div>\n </div>\n\n <div className=\"flex items-center gap-3 flex-shrink-0\">\n <span className=\"text-xs text-text-secondary\">\n {tr('integrations.connectionCard.lastUsed', 'Last used {{time}}', {\n time: formatLastUsed(connection.lastUsedAt),\n })}\n </span>\n <ChevronRight\n size={18}\n className=\"text-text-secondary group-hover:text-primary transition-colors\"\n />\n </div>\n </GlassCard>\n );\n }\n\n return (\n <GlassCard\n className={cn(\n 'group relative flex flex-col p-5 border-border-seam',\n 'cursor-pointer hover:shadow-[var(--shadow-pop)] hover:border-border-strong',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]',\n 'animate-in fade-in-0'\n )}\n onClick={() => onClick?.(connection)}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick?.(connection);\n }\n }}\n >\n <div className=\"flex items-start justify-between mb-3\">\n <ProviderIcon provider={connection.provider} size={44} />\n <ConnectionStatusBadge status={connection.status} />\n </div>\n\n <div className=\"mb-0.5 flex items-center gap-1.5\">\n <h3 className=\"font-semibold text-text-primary truncate\">{connection.name}</h3>\n <PrivateBadge connection={connection} />\n </div>\n <p className=\"text-sm text-text-secondary truncate\">{connection.provider.name}</p>\n\n {connection.externalAccountEmail && (\n <p className=\"text-xs text-text-secondary truncate mt-1\">\n {connection.externalAccountName || connection.externalAccountEmail}\n </p>\n )}\n\n {connection.description && (\n <p className=\"text-sm text-text-secondary line-clamp-2 mt-2\">{connection.description}</p>\n )}\n\n <div className=\"flex items-center justify-between mt-auto pt-3 border-t border-border-seam\">\n <span className=\"text-xs text-text-secondary\">\n {tr('integrations.connectionCard.lastUsed', 'Last used {{time}}', {\n time: formatLastUsed(connection.lastUsedAt),\n })}\n </span>\n <ChevronRight\n size={16}\n className=\"text-text-secondary group-hover:text-primary transition-colors\"\n />\n </div>\n </GlassCard>\n );\n};\n"],"mappings":";;;;;;;;;AAmBA,
|
|
1
|
+
{"version":3,"file":"ConnectionCard.js","names":["_Fragment","PrivateBadge","tr","useTr","connection","label","Lock","ConnectionCard","formatLastUsed","useFormatLastUsed","displayMode","GlassCard","cn","onClick","ProviderIcon","ConnectionStatusBadge","Fragment","ChevronRight"],"sources":["../../../src/integrations/components/ConnectionCard.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { ChevronRight, Lock } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../hooks/useTr';\nimport { useFormatLastUsed } from '../hooks/useFormatLastUsed';\nimport type { IntegrationConnection } from '../types';\nimport { ProviderIcon } from '@burdenoff/fe-libs/connections';\nimport { ConnectionStatusBadge } from './ConnectionStatusBadge';\n\ninterface ConnectionCardProps {\n connection: IntegrationConnection;\n displayMode?: 'grid' | 'list';\n onClick?: (connection: IntegrationConnection) => void;\n}\n\n/**\n * A lock for a connection only the people it is shared with can use (BOFF-9726).\n */\nconst PrivateBadge: FC<{ connection: IntegrationConnection }> = ({ connection }) => {\n const tr = useTr();\n if (connection.visibility !== 'RESTRICTED') return null;\n const label = tr(\n 'integrations.connectionCard.private',\n 'Private: only the people it is shared with'\n );\n return (\n <span\n className=\"inline-flex shrink-0 items-center text-text-secondary\"\n title={label}\n data-testid=\"connection-private-badge\"\n >\n <Lock size={13} aria-hidden=\"true\" />\n <span className=\"sr-only\">{label}</span>\n </span>\n );\n};\n\n/**\n * Card showing connection info (provider icon, connection name, account email, status badge, last used).\n */\nexport const ConnectionCard: FC<ConnectionCardProps> = ({\n connection,\n displayMode = 'grid',\n onClick,\n}) => {\n const tr = useTr();\n const formatLastUsed = useFormatLastUsed();\n\n if (displayMode === 'list') {\n return (\n <GlassCard\n className={cn(\n 'group flex items-center gap-4 p-4 border-border-seam',\n 'cursor-pointer hover:shadow-[var(--shadow-pop)] hover:border-border-strong',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]',\n 'animate-in fade-in-0'\n )}\n onClick={() => onClick?.(connection)}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick?.(connection);\n }\n }}\n >\n <ProviderIcon provider={connection.provider} size={40} />\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold text-text-primary truncate\">{connection.name}</h3>\n <PrivateBadge connection={connection} />\n <ConnectionStatusBadge status={connection.status} />\n </div>\n <div className=\"flex items-center gap-2 mt-0.5\">\n <span className=\"text-sm text-text-secondary\">{connection.provider.name}</span>\n {connection.externalAccountEmail && (\n <>\n <span className=\"text-text-secondary\">·</span>\n <span className=\"text-sm text-text-secondary truncate\">\n {connection.externalAccountEmail}\n </span>\n </>\n )}\n </div>\n </div>\n\n <div className=\"flex items-center gap-3 flex-shrink-0\">\n <span className=\"text-xs text-text-secondary\">\n {tr('integrations.connectionCard.lastUsed', 'Last used {{time}}', {\n time: formatLastUsed(connection.lastUsedAt),\n })}\n </span>\n <ChevronRight\n size={18}\n className=\"text-text-secondary group-hover:text-primary transition-colors\"\n />\n </div>\n </GlassCard>\n );\n }\n\n return (\n <GlassCard\n className={cn(\n 'group relative flex flex-col p-5 border-border-seam',\n 'cursor-pointer hover:shadow-[var(--shadow-pop)] hover:border-border-strong',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]',\n 'animate-in fade-in-0'\n )}\n onClick={() => onClick?.(connection)}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick?.(connection);\n }\n }}\n >\n <div className=\"flex items-start justify-between mb-3\">\n <ProviderIcon provider={connection.provider} size={44} />\n <ConnectionStatusBadge status={connection.status} />\n </div>\n\n <div className=\"mb-0.5 flex items-center gap-1.5\">\n <h3 className=\"font-semibold text-text-primary truncate\">{connection.name}</h3>\n <PrivateBadge connection={connection} />\n </div>\n <p className=\"text-sm text-text-secondary truncate\">{connection.provider.name}</p>\n\n {connection.externalAccountEmail && (\n <p className=\"text-xs text-text-secondary truncate mt-1\">\n {connection.externalAccountName || connection.externalAccountEmail}\n </p>\n )}\n\n {connection.description && (\n <p className=\"text-sm text-text-secondary line-clamp-2 mt-2\">{connection.description}</p>\n )}\n\n <div className=\"flex items-center justify-between mt-auto pt-3 border-t border-border-seam\">\n <span className=\"text-xs text-text-secondary\">\n {tr('integrations.connectionCard.lastUsed', 'Last used {{time}}', {\n time: formatLastUsed(connection.lastUsedAt),\n })}\n </span>\n <ChevronRight\n size={16}\n className=\"text-text-secondary group-hover:text-primary transition-colors\"\n />\n </div>\n </GlassCard>\n );\n};\n"],"mappings":";;;;;;;;;AAmBA,IAAMC,KAA2D,EAAE,oBAAiB;CAClF,IAAMC,IAAKC,EAAM;CACjB,IAAIC,EAAW,eAAe,cAAc,OAAO;CACnD,IAAMC,IAAQH,EACZ,uCACA,4CACF;CACA,OACE,kBAAC,QAAD;EACE,WAAU;EACV,OAAOG;EACP,eAAY;EAHd,UAAA,CAKE,kBAACC,GAAD;GAAM,MAAM;GAAI,eAAY;EAAQ,CAAA,GACpC,kBAAC,QAAD;GAAM,WAAU;GAAW,UAAAD;EAAY,CAAA,CACnC;;AAEV,GAKaE,KAA2C,EACtD,eACA,iBAAc,QACd,iBACI;CACJ,IAAML,IAAKC,EAAM,GACXK,IAAiBC,EAAkB;CAyDzC,OAvDIC,MAAgB,SAEhB,kBAACC,GAAD;EACE,WAAWC,EACT,wDACA,8EACA,gGACA,sBACF;EACA,eAAeC,IAAUT,CAAU;EACnC,MAAK;EACL,UAAU;EACV,YAAY,MAAM;GAChB,CAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,eAAe,GACjBS,IAAUT,CAAU;EAExB;EAfF,UAAA;GAiBE,kBAACU,GAAD;IAAc,UAAUV,EAAW;IAAU,MAAM;GAAK,CAAA;GAExD,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,kBAAC,MAAD;OAAI,WAAU;OAA4C,UAAAA,EAAW;MAAS,CAAA;MAC9E,kBAACH,GAAD,EAA0B,cAAa,CAAA;MACvC,kBAACc,GAAD,EAAuB,QAAQX,EAAW,OAAS,CAAA;KAChD;IACL,CAAA,GAAA,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,QAAD;MAAM,WAAU;MAA+B,UAAAA,EAAW,SAA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AG1F,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,QAAD;KAAM,WAAU;KACb,UAAAF,EAAG,wCAAwC,sBAAsB,EAChE,MAAMM,EAAeJ,EAAW,UAAU,EAC5C,CAAC;IACG,CAAA,GACN,kBAACa,GAAD;KACE,MAAM;KACN,WAAU;IACX,CAAA,CACE;;EACI;;AAEf"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
3
2
|
export type ConnectionModalPresentation = 'dialog' | 'sheet';
|
|
4
3
|
/** `form` holds the picker and the credential form; `notice` a short message. */
|
|
5
4
|
export type ConnectionModalSize = 'form' | 'notice';
|
|
@@ -35,4 +34,3 @@ export interface ConnectionModalFrameProps {
|
|
|
35
34
|
* before).
|
|
36
35
|
*/
|
|
37
36
|
export declare function ConnectionModalFrame({ onClose, labelledBy, presentation, size, testId, children, }: ConnectionModalFrameProps): import('react').ReactPortal | null;
|
|
38
|
-
//# sourceMappingURL=ConnectionModalFrame.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { cn as e } from "../utils/cn.js";
|
|
|
2
2
|
import { useEffect as t, useRef as n } from "react";
|
|
3
3
|
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
4
|
import { createPortal as o } from "react-dom";
|
|
5
|
-
|
|
5
|
+
// src/integrations/components/ConnectionModalFrame.tsx
|
|
6
6
|
var s = 1100, c = 1101, l = "border border-border-subtle bg-bg-surface shadow-2xl focus:outline-none", u = {
|
|
7
7
|
dialog: {
|
|
8
8
|
form: "fixed inset-x-4 top-4 bottom-4 mx-auto flex w-auto max-w-3xl flex-col overflow-hidden rounded-xl animate-in fade-in-0 zoom-in-95 duration-200 sm:inset-x-6 sm:top-1/2 sm:bottom-auto sm:max-h-[min(90vh,56rem)] sm:w-full sm:-translate-y-1/2",
|
|
@@ -58,7 +58,6 @@ function p({ onClose: d, labelledBy: p, presentation: m = "dialog", size: h = "f
|
|
|
58
58
|
children: _
|
|
59
59
|
})] }), document.body);
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
export { p as ConnectionModalFrame };
|
|
61
|
+
export { p as ConnectionModalFrame, c as DIALOG_Z, u as FRAME_CLASSES, s as OVERLAY_Z };
|
|
63
62
|
|
|
64
63
|
//# sourceMappingURL=ConnectionModalFrame.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionModalFrame.js","names":[],"sources":["../../../src/integrations/components/ConnectionModalFrame.tsx"],"sourcesContent":["/**\n * ConnectionModalFrame: the backdrop, the dialog box, and the modal behaviour\n * shared by `AddConnectionDialog` and `ConnectSourceDialog`.\n *\n * ★★ PORTALED TO `document.body`, ALWAYS (BOFF-8158, B4). The dialog is\n * `position: fixed`. Rendered inline, any ancestor with a transform or a\n * `translate` becomes its containing block. VibeControls and HealthyBowl host\n * the connections screen inside a Radix dialog whose content carries\n * `translate: -50% -50%`, so this dialog was sized and centred against that\n * 512 px box instead of the viewport, and its z-index was trapped in the host's\n * `z-50` stacking context, below the app header. A portal escapes both, for any\n * host, whatever it wraps us in.\n *\n * ★ A consequence hosts must respect: do NOT render this module's screens inside\n * another modal. A host modal's focus trap and outside-click handling treat a\n * portaled layer as \"outside\" and fight it. Hosts that want connections over\n * the current page render `ConnectSourceDialog`, which IS the modal.\n *\n * Presentations:\n * - `dialog`: the classic add-connection box, a near-full-height card on\n * phones and a centred dialog from `sm`.\n * - `sheet`: a bottom sheet below `md`, a centred dialog from `md`. This is\n * what the assistant's \"Connect a source\" uses, so a phone user keeps the\n * conversation's context above the sheet.\n */\n\nimport { useEffect, useRef, type KeyboardEvent, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { cn } from '../utils/cn';\n\nexport type ConnectionModalPresentation = 'dialog' | 'sheet';\n\n/** `form` holds the picker and the credential form; `notice` a short message. */\nexport type ConnectionModalSize = 'form' | 'notice';\n\n/**\n * Above the app shell's header (`z-index: 100`) and the assistant panel\n * (`z-50`).\n *\n * The dialog used to sit at Tailwind's `z-50`, so the shell header painted over\n * its top edge and swallowed the title and the Method control — the dialog\n * looked \"cut off\" no matter how its height was constrained. A modal must\n * out-rank the chrome it covers, and Tailwind's scale stops well below it.\n */\nexport const OVERLAY_Z = 1100;\nexport const DIALOG_Z = 1101;\n\nconst SURFACE = 'border border-border-subtle bg-bg-surface shadow-2xl focus:outline-none';\n\n/**\n * Exported so tests can pin the layout contract as classes: happy-dom does no\n * layout, so \"bottom sheet below md\" can only be asserted as the classes that\n * produce it.\n */\nexport const FRAME_CLASSES: Record<\n ConnectionModalPresentation,\n Record<ConnectionModalSize, string>\n> = {\n dialog: {\n /* `sm:` centres the dialog with `top-1/2 bottom-auto`, which leaves its\n height unbounded — a tall provider form grew past the viewport and was\n clipped at BOTH ends, taking the title and the primary action with it.\n The max-height puts the overflow back where it belongs: the scrollable\n body below. */\n form: 'fixed inset-x-4 top-4 bottom-4 mx-auto flex w-auto max-w-3xl flex-col overflow-hidden rounded-xl animate-in fade-in-0 zoom-in-95 duration-200 sm:inset-x-6 sm:top-1/2 sm:bottom-auto sm:max-h-[min(90vh,56rem)] sm:w-full sm:-translate-y-1/2',\n notice:\n 'fixed inset-x-4 top-1/2 mx-auto flex max-w-md -translate-y-1/2 flex-col items-center gap-4 rounded-xl p-8 text-center',\n },\n sheet: {\n /* Below `md` the sheet is pinned to the bottom edge and grows with its\n content up to 90dvh (dvh, so a phone's collapsing URL bar cannot push\n the footer off-screen). From `md` it is the same centred dialog as\n `dialog`. */\n form: 'fixed inset-x-0 bottom-0 flex max-h-[90dvh] w-full flex-col overflow-hidden rounded-t-2xl border-b-0 pb-[env(safe-area-inset-bottom)] animate-in fade-in-0 duration-200 md:inset-x-6 md:top-1/2 md:bottom-auto md:mx-auto md:max-h-[min(90vh,56rem)] md:max-w-3xl md:-translate-y-1/2 md:rounded-xl md:border-b md:pb-0 md:zoom-in-95',\n notice:\n 'fixed inset-x-0 bottom-0 flex w-full flex-col items-center gap-4 rounded-t-2xl border-b-0 p-8 pb-[max(2rem,env(safe-area-inset-bottom))] text-center md:inset-x-4 md:top-1/2 md:bottom-auto md:mx-auto md:max-w-md md:-translate-y-1/2 md:rounded-xl md:border-b md:pb-8',\n },\n};\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]';\n\nfunction focusableWithin(container: HTMLElement): HTMLElement[] {\n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => !el.closest('[hidden], [inert], [aria-hidden=\"true\"]')\n );\n}\n\nexport interface ConnectionModalFrameProps {\n onClose: () => void;\n /** Id of the element that names the dialog. */\n labelledBy: string;\n presentation?: ConnectionModalPresentation;\n size?: ConnectionModalSize;\n testId?: string;\n children: ReactNode;\n}\n\n/**\n * Mount it only while the dialog is open: mounting is \"open\" (focus moves in,\n * Escape is armed) and unmounting is \"close\" (focus returns to whatever held it\n * before).\n */\nexport function ConnectionModalFrame({\n onClose,\n labelledBy,\n presentation = 'dialog',\n size = 'form',\n testId,\n children,\n}: ConnectionModalFrameProps) {\n const dialogRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handleKeyDown = (event: globalThis.KeyboardEvent) => {\n if (event.key === 'Escape') onClose();\n };\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [onClose]);\n\n // Focus moves into the dialog on open and back to the opener on close.\n useEffect(() => {\n const dialog = dialogRef.current;\n const opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n if (dialog && !dialog.contains(document.activeElement)) {\n dialog.focus({ preventScroll: true });\n }\n return () => {\n if (opener && opener.isConnected && opener !== document.body) {\n opener.focus({ preventScroll: true });\n }\n };\n }, []);\n\n // Tab and Shift+Tab cycle inside the dialog. Scoped to the dialog's own DOM:\n // a portaled popover (a select's option list) handles its own keys, and\n // pulling focus back out of it would close it mid-choice.\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const dialog = dialogRef.current;\n if (event.key !== 'Tab' || event.defaultPrevented || !dialog) return;\n if (!(event.target instanceof Node) || !dialog.contains(event.target)) return;\n const items = focusableWithin(dialog);\n if (items.length === 0) {\n event.preventDefault();\n dialog.focus({ preventScroll: true });\n return;\n }\n const first = items[0];\n const last = items[items.length - 1];\n const active = document.activeElement;\n if (event.shiftKey && (active === first || active === dialog)) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n };\n\n if (typeof document === 'undefined') return null;\n\n return createPortal(\n <>\n <div\n aria-hidden=\"true\"\n data-testid={testId ? `${testId}-backdrop` : undefined}\n style={{ zIndex: OVERLAY_Z }}\n className=\"fixed inset-0 bg-bg-overlay animate-in fade-in-0 duration-200\"\n onClick={onClose}\n />\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={labelledBy}\n tabIndex={-1}\n data-testid={testId}\n data-presentation={presentation}\n style={{ zIndex: DIALOG_Z }}\n className={cn(SURFACE, FRAME_CLASSES[presentation][size])}\n onKeyDown={handleKeyDown}\n >\n {children}\n </div>\n </>,\n document.body\n );\n}\n"],"mappings":";;;;;AA4CA,IAAa,IAAY,MACZ,IAAW,MAElB,IAAU,2EAOH,IAGT;CACF,QAAQ;EAMN,MAAM;EACN,QACE;EACH;CACD,OAAO;EAKL,MAAM;EACN,QACE;EACH;CACF,EAEK,IACJ;AAEF,SAAS,EAAgB,GAAuC;AAC9D,QAAO,MAAM,KAAK,EAAU,iBAA8B,EAAU,CAAC,CAAC,QACnE,MAAO,CAAC,EAAG,QAAQ,4CAA0C,CAC/D;;AAkBH,SAAgB,EAAqB,EACnC,YACA,eACA,kBAAe,UACf,UAAO,QACP,WACA,eAC4B;CAC5B,IAAM,IAAY,EAAuB,KAAK;AAmD9C,QAjDA,QAAgB;EACd,IAAM,KAAiB,MA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,gBAAgB,EACtB,EAAK,OAAO,IACH,CAAC,EAAM,YAAY,MAAW,MACvC,EAAM,gBAAgB,EACtB,EAAM,OAAO;;EA2BV;EACG,CAAA,CACL,EAAA,CAAA,EACH,SAAS,KACV"}
|
|
1
|
+
{"version":3,"file":"ConnectionModalFrame.js","names":["_Fragment","OVERLAY_Z","DIALOG_Z","SURFACE","FRAME_CLASSES","FOCUSABLE","focusableWithin","container","el","ConnectionModalFrame","dialogRef","useRef","useEffect","handleKeyDown","event","onClose","dialog","opener","createPortal","Fragment","testId","labelledBy","presentation","cn","size","items","first","last","active"],"sources":["../../../src/integrations/components/ConnectionModalFrame.tsx"],"sourcesContent":["/**\n * ConnectionModalFrame: the backdrop, the dialog box, and the modal behaviour\n * shared by `AddConnectionDialog` and `ConnectSourceDialog`.\n *\n * ★★ PORTALED TO `document.body`, ALWAYS (BOFF-8158, B4). The dialog is\n * `position: fixed`. Rendered inline, any ancestor with a transform or a\n * `translate` becomes its containing block. VibeControls and HealthyBowl host\n * the connections screen inside a Radix dialog whose content carries\n * `translate: -50% -50%`, so this dialog was sized and centred against that\n * 512 px box instead of the viewport, and its z-index was trapped in the host's\n * `z-50` stacking context, below the app header. A portal escapes both, for any\n * host, whatever it wraps us in.\n *\n * ★ A consequence hosts must respect: do NOT render this module's screens inside\n * another modal. A host modal's focus trap and outside-click handling treat a\n * portaled layer as \"outside\" and fight it. Hosts that want connections over\n * the current page render `ConnectSourceDialog`, which IS the modal.\n *\n * Presentations:\n * - `dialog`: the classic add-connection box, a near-full-height card on\n * phones and a centred dialog from `sm`.\n * - `sheet`: a bottom sheet below `md`, a centred dialog from `md`. This is\n * what the assistant's \"Connect a source\" uses, so a phone user keeps the\n * conversation's context above the sheet.\n */\n\nimport { useEffect, useRef, type KeyboardEvent, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { cn } from '../utils/cn';\n\nexport type ConnectionModalPresentation = 'dialog' | 'sheet';\n\n/** `form` holds the picker and the credential form; `notice` a short message. */\nexport type ConnectionModalSize = 'form' | 'notice';\n\n/**\n * Above the app shell's header (`z-index: 100`) and the assistant panel\n * (`z-50`).\n *\n * The dialog used to sit at Tailwind's `z-50`, so the shell header painted over\n * its top edge and swallowed the title and the Method control — the dialog\n * looked \"cut off\" no matter how its height was constrained. A modal must\n * out-rank the chrome it covers, and Tailwind's scale stops well below it.\n */\nexport const OVERLAY_Z = 1100;\nexport const DIALOG_Z = 1101;\n\nconst SURFACE = 'border border-border-subtle bg-bg-surface shadow-2xl focus:outline-none';\n\n/**\n * Exported so tests can pin the layout contract as classes: happy-dom does no\n * layout, so \"bottom sheet below md\" can only be asserted as the classes that\n * produce it.\n */\nexport const FRAME_CLASSES: Record<\n ConnectionModalPresentation,\n Record<ConnectionModalSize, string>\n> = {\n dialog: {\n /* `sm:` centres the dialog with `top-1/2 bottom-auto`, which leaves its\n height unbounded — a tall provider form grew past the viewport and was\n clipped at BOTH ends, taking the title and the primary action with it.\n The max-height puts the overflow back where it belongs: the scrollable\n body below. */\n form: 'fixed inset-x-4 top-4 bottom-4 mx-auto flex w-auto max-w-3xl flex-col overflow-hidden rounded-xl animate-in fade-in-0 zoom-in-95 duration-200 sm:inset-x-6 sm:top-1/2 sm:bottom-auto sm:max-h-[min(90vh,56rem)] sm:w-full sm:-translate-y-1/2',\n notice:\n 'fixed inset-x-4 top-1/2 mx-auto flex max-w-md -translate-y-1/2 flex-col items-center gap-4 rounded-xl p-8 text-center',\n },\n sheet: {\n /* Below `md` the sheet is pinned to the bottom edge and grows with its\n content up to 90dvh (dvh, so a phone's collapsing URL bar cannot push\n the footer off-screen). From `md` it is the same centred dialog as\n `dialog`. */\n form: 'fixed inset-x-0 bottom-0 flex max-h-[90dvh] w-full flex-col overflow-hidden rounded-t-2xl border-b-0 pb-[env(safe-area-inset-bottom)] animate-in fade-in-0 duration-200 md:inset-x-6 md:top-1/2 md:bottom-auto md:mx-auto md:max-h-[min(90vh,56rem)] md:max-w-3xl md:-translate-y-1/2 md:rounded-xl md:border-b md:pb-0 md:zoom-in-95',\n notice:\n 'fixed inset-x-0 bottom-0 flex w-full flex-col items-center gap-4 rounded-t-2xl border-b-0 p-8 pb-[max(2rem,env(safe-area-inset-bottom))] text-center md:inset-x-4 md:top-1/2 md:bottom-auto md:mx-auto md:max-w-md md:-translate-y-1/2 md:rounded-xl md:border-b md:pb-8',\n },\n};\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]';\n\nfunction focusableWithin(container: HTMLElement): HTMLElement[] {\n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => !el.closest('[hidden], [inert], [aria-hidden=\"true\"]')\n );\n}\n\nexport interface ConnectionModalFrameProps {\n onClose: () => void;\n /** Id of the element that names the dialog. */\n labelledBy: string;\n presentation?: ConnectionModalPresentation;\n size?: ConnectionModalSize;\n testId?: string;\n children: ReactNode;\n}\n\n/**\n * Mount it only while the dialog is open: mounting is \"open\" (focus moves in,\n * Escape is armed) and unmounting is \"close\" (focus returns to whatever held it\n * before).\n */\nexport function ConnectionModalFrame({\n onClose,\n labelledBy,\n presentation = 'dialog',\n size = 'form',\n testId,\n children,\n}: ConnectionModalFrameProps) {\n const dialogRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handleKeyDown = (event: globalThis.KeyboardEvent) => {\n if (event.key === 'Escape') onClose();\n };\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [onClose]);\n\n // Focus moves into the dialog on open and back to the opener on close.\n useEffect(() => {\n const dialog = dialogRef.current;\n const opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n if (dialog && !dialog.contains(document.activeElement)) {\n dialog.focus({ preventScroll: true });\n }\n return () => {\n if (opener && opener.isConnected && opener !== document.body) {\n opener.focus({ preventScroll: true });\n }\n };\n }, []);\n\n // Tab and Shift+Tab cycle inside the dialog. Scoped to the dialog's own DOM:\n // a portaled popover (a select's option list) handles its own keys, and\n // pulling focus back out of it would close it mid-choice.\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const dialog = dialogRef.current;\n if (event.key !== 'Tab' || event.defaultPrevented || !dialog) return;\n if (!(event.target instanceof Node) || !dialog.contains(event.target)) return;\n const items = focusableWithin(dialog);\n if (items.length === 0) {\n event.preventDefault();\n dialog.focus({ preventScroll: true });\n return;\n }\n const first = items[0];\n const last = items[items.length - 1];\n const active = document.activeElement;\n if (event.shiftKey && (active === first || active === dialog)) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n };\n\n if (typeof document === 'undefined') return null;\n\n return createPortal(\n <>\n <div\n aria-hidden=\"true\"\n data-testid={testId ? `${testId}-backdrop` : undefined}\n style={{ zIndex: OVERLAY_Z }}\n className=\"fixed inset-0 bg-bg-overlay animate-in fade-in-0 duration-200\"\n onClick={onClose}\n />\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={labelledBy}\n tabIndex={-1}\n data-testid={testId}\n data-presentation={presentation}\n style={{ zIndex: DIALOG_Z }}\n className={cn(SURFACE, FRAME_CLASSES[presentation][size])}\n onKeyDown={handleKeyDown}\n >\n {children}\n </div>\n </>,\n document.body\n );\n}\n"],"mappings":";;;;;AA4CA,IAAaC,IAAY,MACZC,IAAW,MAElBC,IAAU,2EAOHC,IAGT;CACF,QAAQ;EAMN,MAAM;EACN,QACE;CACJ;CACA,OAAO;EAKL,MAAM;EACN,QACE;CACJ;AACF,GAEMC,IACJ;AAEF,SAASC,EAAgB,GAAuC;CAC9D,OAAO,MAAM,KAAKC,EAAU,iBAA8BF,CAAS,CAAC,CAAC,CAAC,QACnE,MAAO,CAACG,EAAG,QAAQ,2CAAyC,CAC/D;AACF;AAiBA,SAAgBC,EAAqB,EACnC,YACA,eACA,kBAAe,UACf,U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AAO,MAAM,EAAE,eAAe,GAAK,CAAC;IACpC;GACF;GACA,IAAMU,IAAQD,EAAM,IACdE,IAAOF,EAAMA,EAAM,SAAS,IAC5BG,IAAS,SAAS;GACxB,AAAId,EAAM,aAAac,MAAWF,KAASE,MAAWZ,MACpDF,EAAM,eAAe,GACrBa,EAAK,MAAM,KACF,CAACb,EAAM,YAAYc,MAAWD,MACvCb,EAAM,eAAe,GACrBY,EAAM,MAAM;EAEhB;EAyBO;CACE,CAAA,CACL,EAAA,CAAA,GACF,SAAS,IACX;AACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { IntegrationConnection } from '../types';
|
|
3
|
-
|
|
4
3
|
/** Marks a connection only the people it is shared with can use. */
|
|
5
4
|
export declare const PrivateConnectionBadge: FC<{
|
|
6
5
|
connection: IntegrationConnection;
|
|
@@ -15,4 +14,3 @@ export declare const ConnectionShareDialog: FC<{
|
|
|
15
14
|
onClose: () => void;
|
|
16
15
|
onShared: () => void;
|
|
17
16
|
}>;
|
|
18
|
-
//# sourceMappingURL=ConnectionSharing.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { useIntegrations as t } from "../providers/IntegrationsProvider.js";
|
|
3
3
|
import { Lock as n } from "lucide-react";
|
|
4
4
|
import { useApolloClient as r } from "@apollo/client/react";
|
|
5
5
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
6
|
import { ShareConnectionDialog as o } from "@burdenoff/fe-libs/connections";
|
|
7
|
-
|
|
8
|
-
var s = ({ connection:
|
|
9
|
-
let r =
|
|
10
|
-
return
|
|
7
|
+
// src/integrations/components/ConnectionSharing.tsx
|
|
8
|
+
var s = ({ connection: t }) => {
|
|
9
|
+
let r = e();
|
|
10
|
+
return t.visibility === "RESTRICTED" ? /* @__PURE__ */ a("span", {
|
|
11
11
|
className: "inline-flex items-center gap-1 rounded-full border border-border-subtle px-2 py-0.5 text-xs text-text-secondary",
|
|
12
12
|
"data-testid": "connection-private-badge",
|
|
13
13
|
children: [/* @__PURE__ */ i(n, {
|
|
@@ -16,7 +16,7 @@ var s = ({ connection: e }) => {
|
|
|
16
16
|
}), r("integrations.connectionDetail.private", "Private")]
|
|
17
17
|
}) : null;
|
|
18
18
|
}, c = ({ connection: n, open: a, onClose: s, onShared: c }) => {
|
|
19
|
-
let { workspaceId: l } =
|
|
19
|
+
let { workspaceId: l } = t(), u = r(), d = e();
|
|
20
20
|
return l ? /* @__PURE__ */ i(o, {
|
|
21
21
|
open: a,
|
|
22
22
|
onClose: s,
|
|
@@ -27,7 +27,6 @@ var s = ({ connection: e }) => {
|
|
|
27
27
|
onShared: c
|
|
28
28
|
}) : null;
|
|
29
29
|
};
|
|
30
|
-
//#endregion
|
|
31
30
|
export { c as ConnectionShareDialog, s as PrivateConnectionBadge };
|
|
32
31
|
|
|
33
32
|
//# sourceMappingURL=ConnectionSharing.js.map
|