@burdenoff/microfe-integrations 2026.1023.1 → 2026.1030.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/generated/wspace-operations.d.ts +18 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +6 -0
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +122 -0
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js +8 -0
- package/dist/generated/wspace-types.js.map +1 -0
- package/dist/integrations/components/AddConnectionDialog.d.ts.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.js +11 -9
- package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
- package/dist/integrations/components/ConnectionCard.d.ts.map +1 -1
- package/dist/integrations/components/ConnectionCard.js +71 -48
- package/dist/integrations/components/ConnectionCard.js.map +1 -1
- package/dist/integrations/components/ConnectionSharing.d.ts +18 -0
- package/dist/integrations/components/ConnectionSharing.d.ts.map +1 -0
- package/dist/integrations/components/ConnectionSharing.js +33 -0
- package/dist/integrations/components/ConnectionSharing.js.map +1 -0
- package/dist/integrations/constants/permissions.d.ts +1 -0
- package/dist/integrations/constants/permissions.d.ts.map +1 -1
- package/dist/integrations/constants/permissions.js +1 -0
- package/dist/integrations/constants/permissions.js.map +1 -1
- package/dist/integrations/hooks/useConnections.d.ts +3 -0
- package/dist/integrations/hooks/useConnections.d.ts.map +1 -1
- package/dist/integrations/hooks/useConnections.js.map +1 -1
- package/dist/integrations/pages/ConnectionDetail.d.ts.map +1 -1
- package/dist/integrations/pages/ConnectionDetail.js +283 -261
- package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
- package/dist/integrations/pages/ConnectionsList.d.ts.map +1 -1
- package/dist/integrations/pages/ConnectionsList.js +197 -161
- package/dist/integrations/pages/ConnectionsList.js.map +1 -1
- package/dist/integrations/providers/IntegrationsProvider.d.ts.map +1 -1
- package/dist/integrations/providers/IntegrationsProvider.js +19 -18
- package/dist/integrations/providers/IntegrationsProvider.js.map +1 -1
- package/dist/integrations/types/index.d.ts +18 -0
- package/dist/integrations/types/index.d.ts.map +1 -1
- package/dist/integrations/utils/mappers.d.ts +3 -1
- package/dist/integrations/utils/mappers.d.ts.map +1 -1
- package/dist/integrations/utils/mappers.js +16 -3
- package/dist/integrations/utils/mappers.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddConnectionDialog.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAGL,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAC;AAQxC,MAAM,WAAW,wBAAwB;IACvC,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,wEAAwE;IACxE,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,yDAAyD;IACzD,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD;;;OAGG;IACH,YAAY,CAAC,EAAE,4BAA4B,CAAC;IAC5C,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,uEAAuE;IACvE,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,SAAS,CAAC;CACpE;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAIjF;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,OAAO,EACP,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,YAAuB,EACvB,WAAW,EACX,WAAW,EACX,mBAAmB,GACpB,EAAE,wBAAwB,+
|
|
1
|
+
{"version":3,"file":"AddConnectionDialog.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAGL,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAC;AAQxC,MAAM,WAAW,wBAAwB;IACvC,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,wEAAwE;IACxE,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,yDAAyD;IACzD,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD;;;OAGG;IACH,YAAY,CAAC,EAAE,4BAA4B,CAAC;IAC5C,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,uEAAuE;IACvE,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,SAAS,CAAC;CACpE;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAIjF;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,OAAO,EACP,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,YAAuB,EACvB,WAAW,EACX,WAAW,EACX,mBAAmB,GACpB,EAAE,wBAAwB,+BAsE1B"}
|
|
@@ -12,29 +12,29 @@ 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 = t(), b = a(), { apiGatewayUrl: x } = e(), { hasPermission:
|
|
15
|
+
let y = t(), b = a(), { apiGatewayUrl: x, defaultConnectionVisibility: S } = e(), { hasPermission: C, isLoading: w } = o(), T = r((e) => e.emit), E = w || C(n.CONNECTION_CREATE), D = !w && C(n.VAULT_CREATE), O = i((e) => {
|
|
16
16
|
switch (e.type) {
|
|
17
17
|
case "connection-created":
|
|
18
|
-
|
|
18
|
+
T("integrations:connection-created", {
|
|
19
19
|
connectionId: e.connectionId,
|
|
20
20
|
providerKey: e.providerKey
|
|
21
21
|
});
|
|
22
22
|
break;
|
|
23
23
|
case "oauth-started":
|
|
24
|
-
|
|
24
|
+
T("integrations:oauth-started", {
|
|
25
25
|
connectionId: e.connectionId,
|
|
26
26
|
providerKey: e.providerKey
|
|
27
27
|
});
|
|
28
28
|
break;
|
|
29
29
|
case "oauth-failed":
|
|
30
|
-
|
|
30
|
+
T("integrations:oauth-failed", {
|
|
31
31
|
connectionId: e.connectionId,
|
|
32
32
|
providerKey: e.providerKey,
|
|
33
33
|
error: e.error
|
|
34
34
|
});
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
|
-
}, [
|
|
37
|
+
}, [T]), k = i((e) => m?.(e.id), [m]);
|
|
38
38
|
return /* @__PURE__ */ s(c, {
|
|
39
39
|
open: u,
|
|
40
40
|
onClose: d,
|
|
@@ -45,15 +45,17 @@ function u({ open: u, onClose: d, preselectedProviderId: f, preselectedProviderK
|
|
|
45
45
|
providerKey: p ?? null,
|
|
46
46
|
providerSource: "installed",
|
|
47
47
|
requireVault: !0,
|
|
48
|
-
canCreate:
|
|
49
|
-
canCreateVault:
|
|
48
|
+
canCreate: E,
|
|
49
|
+
canCreateVault: D,
|
|
50
50
|
extraConfig: _,
|
|
51
|
+
showSharingTab: !!S,
|
|
52
|
+
defaultVisibility: S,
|
|
51
53
|
refetchQueriesOnCreate: ["GetConnections"],
|
|
52
54
|
presentation: h,
|
|
53
55
|
pickerTitle: g,
|
|
54
56
|
renderSuccessAction: v,
|
|
55
|
-
onConnectionCreated:
|
|
56
|
-
onEvent:
|
|
57
|
+
onConnectionCreated: k,
|
|
58
|
+
onEvent: O
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
//#endregion
|
|
@@ -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 } = 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 refetchQueriesOnCreate={['GetConnections']}\n presentation={presentation}\n pickerTitle={pickerTitle}\n renderSuccessAction={renderSuccessAction}\n onConnectionCreated={handleCreated}\n onEvent={handleEvent}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AA4DA,SAAgB,EAAiB,GAAkD;AACjF,QAAO,IACH,GAAG,EAAc,gCACjB;;AAGN,SAAgB,EAAoB,EAClC,SACA,YACA,0BACA,2BACA,wBACA,kBAAe,UACf,gBACA,gBACA,0BAC2B;CAC3B,IAAM,IAAK,GAAO,EACZ,IAAS,GAAiB,EAC1B,EAAE,
|
|
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,SAAgB,EAAiB,GAAkD;AACjF,QAAO,IACH,GAAG,EAAc,gCACjB;;AAGN,SAAgB,EAAoB,EAClC,SACA,YACA,0BACA,2BACA,wBACA,kBAAe,UACf,gBACA,gBACA,0BAC2B;CAC3B,IAAM,IAAK,GAAO,EACZ,IAAS,GAAiB,EAC1B,EAAE,kBAAe,mCAAgC,GAAiB,EAClE,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,IAAO,GAAyB,MAAU,EAAM,KAAK,EAIrD,IAAY,KAAsB,EAAc,EAAwB,kBAAkB,EAG1F,IAAiB,CAAC,KAAsB,EAAc,EAAwB,aAAa,EAE3F,IAAc,GACjB,MAAiC;AAChC,UAAQ,EAAM,MAAd;GACE,KAAK;AACH,MAAK,mCAAmC;KACtC,cAAc,EAAM;KACpB,aAAa,EAAM;KACpB,CAAC;AACF;GACF,KAAK;AACH,MAAK,8BAA8B;KACjC,cAAc,EAAM;KACpB,aAAa,EAAM;KACpB,CAAC;AACF;GACF,KAAK;AACH,MAAK,6BAA6B;KAChC,cAAc,EAAM;KACpB,aAAa,EAAM;KACnB,OAAO,EAAM;KACd,CAAC;AACF;;IAGN,CAAC,EAAK,CACP,EAEK,IAAgB,GACnB,MAAkC,IAAsB,EAAW,GAAG,EACvE,CAAC,EAAoB,CACtB;AAED,QACE,kBAAC,GAAD;EACQ;EACG;EACD;EACR,aAAa,EAAiB,EAAc;EAC5C,WAAW;EACX,YAAY,KAAyB;EACrC,aAAa,KAA0B;EACvC,gBAAe;EACf,cAAA;EACW;EACK;EACH;EACb,gBAAgB,EAAQ;EACxB,mBAAmB;EACnB,wBAAwB,CAAC,iBAAiB;EAC5B;EACD;EACQ;EACrB,qBAAqB;EACrB,SAAS;EACT,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionCard.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/ConnectionCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAItD,UAAU,mBAAmB;IAC3B,UAAU,EAAE,qBAAqB,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACvD;
|
|
1
|
+
{"version":3,"file":"ConnectionCard.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/ConnectionCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAItD,UAAU,mBAAmB;IAC3B,UAAU,EAAE,qBAAqB,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACvD;AAwBD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAmHlD,CAAC"}
|
|
@@ -2,97 +2,120 @@ import { useTr as e } from "../hooks/useTr.js";
|
|
|
2
2
|
import { cn as t } from "../utils/cn.js";
|
|
3
3
|
import { useFormatLastUsed as n } from "../hooks/useFormatLastUsed.js";
|
|
4
4
|
import { ConnectionStatusBadge as r } from "./ConnectionStatusBadge.js";
|
|
5
|
-
import { ChevronRight as i } from "lucide-react";
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { ProviderIcon as
|
|
8
|
-
import { GlassCard as
|
|
5
|
+
import { ChevronRight as i, Lock as a } from "lucide-react";
|
|
6
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { ProviderIcon as l } from "@burdenoff/fe-libs/connections";
|
|
8
|
+
import { GlassCard as u } from "@burdenoff/fe-libs/ui";
|
|
9
9
|
//#region src/integrations/components/ConnectionCard.tsx
|
|
10
|
-
var
|
|
11
|
-
let
|
|
12
|
-
|
|
10
|
+
var d = ({ connection: t }) => {
|
|
11
|
+
let n = e();
|
|
12
|
+
if (t.visibility !== "RESTRICTED") return null;
|
|
13
|
+
let r = n("integrations.connectionCard.private", "Private: only the people it is shared with");
|
|
14
|
+
return /* @__PURE__ */ c("span", {
|
|
15
|
+
className: "inline-flex shrink-0 items-center text-text-secondary",
|
|
16
|
+
title: r,
|
|
17
|
+
"data-testid": "connection-private-badge",
|
|
18
|
+
children: [/* @__PURE__ */ s(a, {
|
|
19
|
+
size: 13,
|
|
20
|
+
"aria-hidden": "true"
|
|
21
|
+
}), /* @__PURE__ */ s("span", {
|
|
22
|
+
className: "sr-only",
|
|
23
|
+
children: r
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
}, f = ({ connection: a, displayMode: f = "grid", onClick: p }) => {
|
|
27
|
+
let m = e(), h = n();
|
|
28
|
+
return f === "list" ? /* @__PURE__ */ c(u, {
|
|
13
29
|
className: t("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"),
|
|
14
|
-
onClick: () =>
|
|
30
|
+
onClick: () => p?.(a),
|
|
15
31
|
role: "button",
|
|
16
32
|
tabIndex: 0,
|
|
17
33
|
onKeyDown: (e) => {
|
|
18
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
34
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), p?.(a));
|
|
19
35
|
},
|
|
20
36
|
children: [
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
provider:
|
|
37
|
+
/* @__PURE__ */ s(l, {
|
|
38
|
+
provider: a.provider,
|
|
23
39
|
size: 40
|
|
24
40
|
}),
|
|
25
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ c("div", {
|
|
26
42
|
className: "flex-1 min-w-0",
|
|
27
|
-
children: [/* @__PURE__ */
|
|
43
|
+
children: [/* @__PURE__ */ c("div", {
|
|
28
44
|
className: "flex items-center gap-2",
|
|
29
|
-
children: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ s("h3", {
|
|
47
|
+
className: "font-semibold text-text-primary truncate",
|
|
48
|
+
children: a.name
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ s(d, { connection: a }),
|
|
51
|
+
/* @__PURE__ */ s(r, { status: a.status })
|
|
52
|
+
]
|
|
53
|
+
}), /* @__PURE__ */ c("div", {
|
|
34
54
|
className: "flex items-center gap-2 mt-0.5",
|
|
35
|
-
children: [/* @__PURE__ */
|
|
55
|
+
children: [/* @__PURE__ */ s("span", {
|
|
36
56
|
className: "text-sm text-text-secondary",
|
|
37
|
-
children:
|
|
38
|
-
}),
|
|
57
|
+
children: a.provider.name
|
|
58
|
+
}), a.externalAccountEmail && /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("span", {
|
|
39
59
|
className: "text-text-secondary",
|
|
40
60
|
children: "·"
|
|
41
|
-
}), /* @__PURE__ */
|
|
61
|
+
}), /* @__PURE__ */ s("span", {
|
|
42
62
|
className: "text-sm text-text-secondary truncate",
|
|
43
|
-
children:
|
|
63
|
+
children: a.externalAccountEmail
|
|
44
64
|
})] })]
|
|
45
65
|
})]
|
|
46
66
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ c("div", {
|
|
48
68
|
className: "flex items-center gap-3 flex-shrink-0",
|
|
49
|
-
children: [/* @__PURE__ */
|
|
69
|
+
children: [/* @__PURE__ */ s("span", {
|
|
50
70
|
className: "text-xs text-text-secondary",
|
|
51
|
-
children:
|
|
52
|
-
}), /* @__PURE__ */
|
|
71
|
+
children: m("integrations.connectionCard.lastUsed", "Last used {{time}}", { time: h(a.lastUsedAt) })
|
|
72
|
+
}), /* @__PURE__ */ s(i, {
|
|
53
73
|
size: 18,
|
|
54
74
|
className: "text-text-secondary group-hover:text-primary transition-colors"
|
|
55
75
|
})]
|
|
56
76
|
})
|
|
57
77
|
]
|
|
58
|
-
}) : /* @__PURE__ */
|
|
78
|
+
}) : /* @__PURE__ */ c(u, {
|
|
59
79
|
className: t("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"),
|
|
60
|
-
onClick: () =>
|
|
80
|
+
onClick: () => p?.(a),
|
|
61
81
|
role: "button",
|
|
62
82
|
tabIndex: 0,
|
|
63
83
|
onKeyDown: (e) => {
|
|
64
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
84
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), p?.(a));
|
|
65
85
|
},
|
|
66
86
|
children: [
|
|
67
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ c("div", {
|
|
68
88
|
className: "flex items-start justify-between mb-3",
|
|
69
|
-
children: [/* @__PURE__ */
|
|
70
|
-
provider:
|
|
89
|
+
children: [/* @__PURE__ */ s(l, {
|
|
90
|
+
provider: a.provider,
|
|
71
91
|
size: 44
|
|
72
|
-
}), /* @__PURE__ */
|
|
92
|
+
}), /* @__PURE__ */ s(r, { status: a.status })]
|
|
73
93
|
}),
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
className: "
|
|
76
|
-
children:
|
|
94
|
+
/* @__PURE__ */ c("div", {
|
|
95
|
+
className: "mb-0.5 flex items-center gap-1.5",
|
|
96
|
+
children: [/* @__PURE__ */ s("h3", {
|
|
97
|
+
className: "font-semibold text-text-primary truncate",
|
|
98
|
+
children: a.name
|
|
99
|
+
}), /* @__PURE__ */ s(d, { connection: a })]
|
|
77
100
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ s("p", {
|
|
79
102
|
className: "text-sm text-text-secondary truncate",
|
|
80
|
-
children:
|
|
103
|
+
children: a.provider.name
|
|
81
104
|
}),
|
|
82
|
-
|
|
105
|
+
a.externalAccountEmail && /* @__PURE__ */ s("p", {
|
|
83
106
|
className: "text-xs text-text-secondary truncate mt-1",
|
|
84
|
-
children:
|
|
107
|
+
children: a.externalAccountName || a.externalAccountEmail
|
|
85
108
|
}),
|
|
86
|
-
|
|
109
|
+
a.description && /* @__PURE__ */ s("p", {
|
|
87
110
|
className: "text-sm text-text-secondary line-clamp-2 mt-2",
|
|
88
|
-
children:
|
|
111
|
+
children: a.description
|
|
89
112
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ c("div", {
|
|
91
114
|
className: "flex items-center justify-between mt-auto pt-3 border-t border-border-seam",
|
|
92
|
-
children: [/* @__PURE__ */
|
|
115
|
+
children: [/* @__PURE__ */ s("span", {
|
|
93
116
|
className: "text-xs text-text-secondary",
|
|
94
|
-
children:
|
|
95
|
-
}), /* @__PURE__ */
|
|
117
|
+
children: m("integrations.connectionCard.lastUsed", "Last used {{time}}", { time: h(a.lastUsedAt) })
|
|
118
|
+
}), /* @__PURE__ */ s(i, {
|
|
96
119
|
size: 16,
|
|
97
120
|
className: "text-text-secondary group-hover:text-primary transition-colors"
|
|
98
121
|
})]
|
|
@@ -101,6 +124,6 @@ var u = ({ connection: u, displayMode: d = "grid", onClick: f }) => {
|
|
|
101
124
|
});
|
|
102
125
|
};
|
|
103
126
|
//#endregion
|
|
104
|
-
export {
|
|
127
|
+
export { f as ConnectionCard };
|
|
105
128
|
|
|
106
129
|
//# 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 } 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 * 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 <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 <h3 className=\"font-semibold text-text-primary
|
|
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,IAAM,KAA2D,EAAE,oBAAiB;CAClF,IAAM,IAAK,GAAO;AAClB,KAAI,EAAW,eAAe,aAAc,QAAO;CACnD,IAAM,IAAQ,EACZ,uCACA,6CACD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D;KACE,MAAM;KACN,WAAU;KACV,CAAA,CACE;;GACI;MAKd,kBAAC,GAAD;EACE,WAAW,EACT,uDACA,8EACA,gGACA,uBACD;EACD,eAAe,IAAU,EAAW;EACpC,MAAK;EACL,UAAU;EACV,YAAY,MAAM;AAChB,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,gBAAgB,EAClB,IAAU,EAAW;;YAb3B;GAiBE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAc,UAAU,EAAW;KAAU,MAAM;KAAM,CAAA,EACzD,kBAAC,GAAD,EAAuB,QAAQ,EAAW,QAAU,CAAA,CAChD;;GAEN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,MAAD;KAAI,WAAU;eAA4C,EAAW;KAAU,CAAA,EAC/E,kBAAC,GAAD,EAA0B,eAAc,CAAA,CACpC;;GACN,kBAAC,KAAD;IAAG,WAAU;cAAwC,EAAW,SAAS;IAAS,CAAA;GAEjF,EAAW,wBACV,kBAAC,KAAD;IAAG,WAAU;cACV,EAAW,uBAAuB,EAAW;IAC5C,CAAA;GAGL,EAAW,eACV,kBAAC,KAAD;IAAG,WAAU;cAAiD,EAAW;IAAgB,CAAA;GAG3F,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD;KAAM,WAAU;eACb,EAAG,wCAAwC,sBAAsB,EAChE,MAAM,EAAe,EAAW,WAAW,EAC5C,CAAC;KACG,CAAA,EACP,kBAAC,GAAD;KACE,MAAM;KACN,WAAU;KACV,CAAA,CACE;;GACI"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { IntegrationConnection } from '../types';
|
|
3
|
+
|
|
4
|
+
/** Marks a connection only the people it is shared with can use. */
|
|
5
|
+
export declare const PrivateConnectionBadge: FC<{
|
|
6
|
+
connection: IntegrationConnection;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* The Share dialog for one connection, against the host's Apollo client and
|
|
10
|
+
* workspace. Renders nothing until the workspace is known.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ConnectionShareDialog: FC<{
|
|
13
|
+
connection: IntegrationConnection;
|
|
14
|
+
open: boolean;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
onShared: () => void;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=ConnectionSharing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionSharing.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/ConnectionSharing.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC;IAAE,UAAU,EAAE,qBAAqB,CAAA;CAAE,CAc5E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC;IACrC,UAAU,EAAE,qBAAqB,CAAC;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAgBA,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useIntegrations as e } from "../providers/IntegrationsProvider.js";
|
|
2
|
+
import { useTr as t } from "../hooks/useTr.js";
|
|
3
|
+
import { Lock as n } from "lucide-react";
|
|
4
|
+
import { useApolloClient as r } from "@apollo/client/react";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import { ShareConnectionDialog as o } from "@burdenoff/fe-libs/connections";
|
|
7
|
+
//#region src/integrations/components/ConnectionSharing.tsx
|
|
8
|
+
var s = ({ connection: e }) => {
|
|
9
|
+
let r = t();
|
|
10
|
+
return e.visibility === "RESTRICTED" ? /* @__PURE__ */ a("span", {
|
|
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
|
+
"data-testid": "connection-private-badge",
|
|
13
|
+
children: [/* @__PURE__ */ i(n, {
|
|
14
|
+
size: 12,
|
|
15
|
+
"aria-hidden": "true"
|
|
16
|
+
}), r("integrations.connectionDetail.private", "Private")]
|
|
17
|
+
}) : null;
|
|
18
|
+
}, c = ({ connection: n, open: a, onClose: s, onShared: c }) => {
|
|
19
|
+
let { workspaceId: l } = e(), u = r(), d = t();
|
|
20
|
+
return l ? /* @__PURE__ */ i(o, {
|
|
21
|
+
open: a,
|
|
22
|
+
onClose: s,
|
|
23
|
+
client: u,
|
|
24
|
+
connectionId: n.id,
|
|
25
|
+
workspaceId: l,
|
|
26
|
+
translate: d,
|
|
27
|
+
onShared: c
|
|
28
|
+
}) : null;
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { c as ConnectionShareDialog, s as PrivateConnectionBadge };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=ConnectionSharing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionSharing.js","names":[],"sources":["../../../src/integrations/components/ConnectionSharing.tsx"],"sourcesContent":["/**\n * Connection sharing on the connection detail page (BOFF-9726): the Private\n * badge in the header and the Share dialog behind the Share action.\n */\nimport type { FC } from 'react';\nimport { Lock } from 'lucide-react';\nimport { useApolloClient } from '@apollo/client/react';\nimport { ShareConnectionDialog } from '@burdenoff/fe-libs/connections';\n\nimport { useTr } from '../hooks/useTr';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport type { IntegrationConnection } from '../types';\n\n/** Marks a connection only the people it is shared with can use. */\nexport const PrivateConnectionBadge: FC<{ connection: IntegrationConnection }> = ({\n connection,\n}) => {\n const tr = useTr();\n if (connection.visibility !== 'RESTRICTED') return null;\n return (\n <span\n className=\"inline-flex items-center gap-1 rounded-full border border-border-subtle px-2 py-0.5 text-xs text-text-secondary\"\n data-testid=\"connection-private-badge\"\n >\n <Lock size={12} aria-hidden=\"true\" />\n {tr('integrations.connectionDetail.private', 'Private')}\n </span>\n );\n};\n\n/**\n * The Share dialog for one connection, against the host's Apollo client and\n * workspace. Renders nothing until the workspace is known.\n */\nexport const ConnectionShareDialog: FC<{\n connection: IntegrationConnection;\n open: boolean;\n onClose: () => void;\n onShared: () => void;\n}> = ({ connection, open, onClose, onShared }) => {\n const { workspaceId } = useIntegrations();\n const client = useApolloClient();\n const tr = useTr();\n if (!workspaceId) return null;\n return (\n <ShareConnectionDialog\n open={open}\n onClose={onClose}\n client={client}\n connectionId={connection.id}\n workspaceId={workspaceId}\n translate={tr}\n onShared={onShared}\n />\n );\n};\n"],"mappings":";;;;;;;AAcA,IAAa,KAAqE,EAChF,oBACI;CACJ,IAAM,IAAK,GAAO;AAElB,QADI,EAAW,eAAe,eAE5B,kBAAC,QAAD;EACE,WAAU;EACV,eAAY;YAFd,CAIE,kBAAC,GAAD;GAAM,MAAM;GAAI,eAAY;GAAS,CAAA,EACpC,EAAG,yCAAyC,UAAU,CAClD;MAR0C;GAgBxC,KAKP,EAAE,eAAY,SAAM,YAAS,kBAAe;CAChD,IAAM,EAAE,mBAAgB,GAAiB,EACnC,IAAS,GAAiB,EAC1B,IAAK,GAAO;AAElB,QADK,IAEH,kBAAC,GAAD;EACQ;EACG;EACD;EACR,cAAc,EAAW;EACZ;EACb,WAAW;EACD;EACV,CAAA,GAVqB"}
|
|
@@ -12,6 +12,7 @@ export declare const INTEGRATION_PERMISSIONS: {
|
|
|
12
12
|
readonly CONNECTION_CREATE: "integration-connection:create";
|
|
13
13
|
readonly CONNECTION_UPDATE: "integration-connection:update";
|
|
14
14
|
readonly CONNECTION_DELETE: "integration-connection:delete";
|
|
15
|
+
readonly CONNECTION_SHARE: "integration-connection:share";
|
|
15
16
|
readonly PROVIDER_READ: "integration-provider:read";
|
|
16
17
|
readonly PROVIDER_CREATE: "integration-provider:create";
|
|
17
18
|
readonly PROVIDER_UPDATE: "integration-provider:update";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/integrations/constants/permissions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/integrations/constants/permissions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;CA8B1B,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAC/B,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -8,6 +8,7 @@ var e = {
|
|
|
8
8
|
CONNECTION_CREATE: "integration-connection:create",
|
|
9
9
|
CONNECTION_UPDATE: "integration-connection:update",
|
|
10
10
|
CONNECTION_DELETE: "integration-connection:delete",
|
|
11
|
+
CONNECTION_SHARE: "integration-connection:share",
|
|
11
12
|
PROVIDER_READ: "integration-provider:read",
|
|
12
13
|
PROVIDER_CREATE: "integration-provider:create",
|
|
13
14
|
PROVIDER_UPDATE: "integration-provider:update",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","names":[],"sources":["../../../src/integrations/constants/permissions.ts"],"sourcesContent":["/**\n * Integrations Permission Constants\n *\n * Usage: hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE)\n */\n\nexport const INTEGRATION_PERMISSIONS = {\n // integration (module-level)\n // Note: the backend RBAC seed defines `integration:write` (not `update`) for\n // module-level config changes. Sub-resources use standard CRUD `update`.\n INTEGRATION_READ: 'integration:read',\n INTEGRATION_CREATE: 'integration:create',\n INTEGRATION_WRITE: 'integration:write',\n INTEGRATION_DELETE: 'integration:delete',\n\n // integration-connection\n CONNECTION_READ: 'integration-connection:read',\n CONNECTION_CREATE: 'integration-connection:create',\n CONNECTION_UPDATE: 'integration-connection:update',\n CONNECTION_DELETE: 'integration-connection:delete',\n\n // integration-provider\n PROVIDER_READ: 'integration-provider:read',\n PROVIDER_CREATE: 'integration-provider:create',\n PROVIDER_UPDATE: 'integration-provider:update',\n PROVIDER_DELETE: 'integration-provider:delete',\n\n // integration-log\n LOG_READ: 'integration-log:read',\n\n // vault — owned by the security module, not this one, but a connection\n // cannot be stored without one, so the connection dialog offers to create a\n // vault inline and must know whether this user is allowed to.\n VAULT_CREATE: 'vault:create',\n} as const;\n\nexport type IntegrationPermission =\n (typeof INTEGRATION_PERMISSIONS)[keyof typeof INTEGRATION_PERMISSIONS];\n"],"mappings":";AAMA,IAAa,IAA0B;CAIrC,kBAAkB;CAClB,oBAAoB;CACpB,mBAAmB;CACnB,oBAAoB;CAGpB,iBAAiB;CACjB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;
|
|
1
|
+
{"version":3,"file":"permissions.js","names":[],"sources":["../../../src/integrations/constants/permissions.ts"],"sourcesContent":["/**\n * Integrations Permission Constants\n *\n * Usage: hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE)\n */\n\nexport const INTEGRATION_PERMISSIONS = {\n // integration (module-level)\n // Note: the backend RBAC seed defines `integration:write` (not `update`) for\n // module-level config changes. Sub-resources use standard CRUD `update`.\n INTEGRATION_READ: 'integration:read',\n INTEGRATION_CREATE: 'integration:create',\n INTEGRATION_WRITE: 'integration:write',\n INTEGRATION_DELETE: 'integration:delete',\n\n // integration-connection\n CONNECTION_READ: 'integration-connection:read',\n CONNECTION_CREATE: 'integration-connection:create',\n CONNECTION_UPDATE: 'integration-connection:update',\n CONNECTION_DELETE: 'integration-connection:delete',\n // BOFF-9726: choose who can use a connection (owner, editors, admins)\n CONNECTION_SHARE: 'integration-connection:share',\n\n // integration-provider\n PROVIDER_READ: 'integration-provider:read',\n PROVIDER_CREATE: 'integration-provider:create',\n PROVIDER_UPDATE: 'integration-provider:update',\n PROVIDER_DELETE: 'integration-provider:delete',\n\n // integration-log\n LOG_READ: 'integration-log:read',\n\n // vault — owned by the security module, not this one, but a connection\n // cannot be stored without one, so the connection dialog offers to create a\n // vault inline and must know whether this user is allowed to.\n VAULT_CREATE: 'vault:create',\n} as const;\n\nexport type IntegrationPermission =\n (typeof INTEGRATION_PERMISSIONS)[keyof typeof INTEGRATION_PERMISSIONS];\n"],"mappings":";AAMA,IAAa,IAA0B;CAIrC,kBAAkB;CAClB,oBAAoB;CACpB,mBAAmB;CACnB,oBAAoB;CAGpB,iBAAiB;CACjB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CAEnB,kBAAkB;CAGlB,eAAe;CACf,iBAAiB;CACjB,iBAAiB;CACjB,iBAAiB;CAGjB,UAAU;CAKV,cAAc;CACf"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConnectionAccessFilter } from '../../generated/wspace-types';
|
|
1
2
|
import { IntegrationConnection, ConnectionStatus, OAuthInitiationResult, ConnectionTestResult } from '../types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -28,6 +29,8 @@ interface ConnectionFilterOptions {
|
|
|
28
29
|
status?: ConnectionStatus;
|
|
29
30
|
providerId?: string;
|
|
30
31
|
search?: string;
|
|
32
|
+
/** BOFF-9726: only the caller's own connections, or those shared with them. */
|
|
33
|
+
access?: ConnectionAccessFilter;
|
|
31
34
|
}
|
|
32
35
|
export declare function useConnections(filter?: ConnectionFilterOptions): {
|
|
33
36
|
connections: IntegrationConnection[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConnections.d.ts","sourceRoot":"","sources":["../../../src/integrations/hooks/useConnections.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"useConnections.d.ts","sourceRoot":"","sources":["../../../src/integrations/hooks/useConnections.ts"],"names":[],"mappings":"AAAA;;GAEG;AAoBH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B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U,MAAM;;EAQ9C;AAED,wBAAgB,4BAA4B;8CAMnB,MAAM,YAAY,MAAM,YAAY,MAAM;;EAQlE;AAED,wBAAgB,8BAA8B;gDAMrB,MAAM,SAAS,MAAM;;EAQ7C;AAkBD;;;;;GAKG;AACH,wBAAgB,iCAAiC;mDASxB,MAAM,WAAW,MAAM,EAAE;YAPN,MAAM;gBAAU,gBAAgB;;;EAe3E;AAmBD;;;;GAIG;AACH,wBAAgB,+BAA+B;iDAStB,MAAM,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;YAPtB,MAAM;gBAAU,gBAAgB;;;EAezE;AAED,wBAAgB,eAAe;iCAON,MAAM;;EAW9B;AAED,wBAAgB,mBAAmB;qCAOV,MAAM;;EAW9B;AAED,wBAAgB,iBAAiB;mCAIR,MAAM,KAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;;EAQrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConnections.js","names":[],"sources":["../../../src/integrations/hooks/useConnections.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries and mutations for connections.\n */\n\nimport { useCallback } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation } from '@apollo/client/react';\nimport {\n useGetConnectionsQuery,\n useGetConnectionQuery,\n useGetConnectionsByProviderQuery,\n useCreateConnectionMutation,\n useInitiateOAuthMutation,\n useAuthenticateConnectionMutation,\n useAuthenticateWithApiKeyMutation,\n useAuthenticateWithBasicAuthMutation,\n useAuthenticateWithBearerTokenMutation,\n useRefreshConnectionTokenMutation,\n useRevokeConnectionMutation,\n useTestConnectionMutation,\n useDeleteConnectionMutation,\n} from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { useIntegrationsEventBus } from '../events/useIntegrationsEventBus';\nimport { mapConnection } from '../utils/mappers';\nimport type {\n IntegrationConnection,\n ConnectionStatus,\n OAuthInitiationResult,\n ConnectionTestResult,\n} from '../types';\n\n/**\n * A query we never asked is NOT an empty result.\n *\n * ★★ THE BUG THIS EXISTS TO PREVENT. Apollo returns `loading: false`,\n * `error: undefined`, `data: undefined` for a SKIPPED query — identical, from a\n * caller's point of view, to a query that ran and found nothing. Pages then\n * render their empty state and tell the user, definitively, that they have no\n * connections.\n *\n * Measured in production 2026-09-13: `/integrations/connections` showed\n * \"No connections yet\" while the workspace held **46** connections — 8 ACTIVE\n * (Gmail, GitHub, Google Sheets, Linear, Anthropic), 1 EXPIRED, 37 PENDING_AUTH.\n * The assistant, asked the same question through the API, listed all 46. No\n * request left the browser and no error appeared anywhere.\n *\n * `workspaceId` is falsy whenever the active context has not resolved — and the\n * shell passes `activeContext.workspaceId ?? \"\"`, so \"not yet known\" arrives as\n * an empty string, which is falsy. Any render in that window produces a\n * confident, wrong answer.\n *\n * So `notReady` is returned separately and callers MUST NOT treat it as empty.\n * It is deliberately not folded into `loading`: a caller that shows a spinner is\n * right, and a caller that ignores it still cannot mistake it for \"none\".\n */\n\n// ─── Query Hooks ────────────────────────────────────────────────────────────\n\ninterface ConnectionFilterOptions {\n status?: ConnectionStatus;\n providerId?: string;\n search?: string;\n}\n\nexport function useConnections(filter?: ConnectionFilterOptions) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsQuery({\n variables: { filter, pagination: { limit: 100 } },\n skip: !workspaceId,\n errorPolicy: 'all',\n });\n\n // ★ Keyed on the ABSENCE OF DATA, not on why it is absent. A skipped query, a\n // query still in flight and a query that resolved from an empty cache entry all\n // land here, and none of them is evidence that the workspace has no connections.\n const answered = data?.getConnections !== undefined;\n\n const connections: IntegrationConnection[] = (data?.getConnections?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return {\n connections,\n total: data?.getConnections?.total ?? 0,\n loading,\n // ★ False until the server has actually told us. Callers MUST gate their\n // empty state on this — see the note above.\n answered,\n error,\n refetch,\n };\n}\n\nexport function useConnection(id: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionQuery({\n variables: { id },\n skip: !workspaceId || !id,\n errorPolicy: 'all',\n });\n\n const answered = data?.getConnection !== undefined;\n\n const connection: IntegrationConnection | null = data?.getConnection\n ? mapConnection(data.getConnection as Record<string, unknown>)\n : null;\n\n return { connection, loading, answered, error, refetch };\n}\n\nexport function useConnectionsByProvider(providerId: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsByProviderQuery({\n variables: { providerId, pagination: { limit: 100 } },\n skip: !workspaceId || !providerId,\n errorPolicy: 'all',\n });\n\n const connections: IntegrationConnection[] = (data?.getConnectionsByProvider?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return {\n connections,\n total: data?.getConnectionsByProvider?.total ?? 0,\n loading,\n error,\n refetch,\n };\n}\n\n// ─── Mutation Hooks ─────────────────────────────────────────────────────────\n\nexport function useCreateConnection() {\n const [mutate, { loading }] = useCreateConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const createConnection = useCallback(\n async (input: {\n name: string;\n description?: string;\n providerId: string;\n authMethodKey?: string;\n vaultId?: string;\n credentialSecretId?: string;\n managedSecretName?: string;\n config?: Record<string, unknown>;\n }) => {\n const result = await mutate({ variables: { input } });\n const id = result.data?.createConnection?.id as string | undefined;\n if (id) {\n eventBus.emit('integrations:connection-created', {\n connectionId: id,\n providerKey: input.providerId,\n });\n }\n return id;\n },\n [mutate, eventBus]\n );\n\n return { createConnection, loading };\n}\n\nexport function useDeleteConnection() {\n const [mutate, { loading }] = useDeleteConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const deleteConnection = useCallback(\n async (id: string, deleteVaultSecret = false) => {\n await mutate({ variables: { id, deleteVaultSecret } });\n eventBus.emit('integrations:connection-deleted', { connectionId: id });\n },\n [mutate, eventBus]\n );\n\n return { deleteConnection, loading };\n}\n\nexport function useInitiateOAuth() {\n const [mutate, { loading }] = useInitiateOAuthMutation();\n const eventBus = useIntegrationsEventBus();\n\n const initiateOAuth = useCallback(\n async (\n connectionId: string,\n redirectUri: string,\n providerKey: string,\n scopes?: string[]\n ): Promise<OAuthInitiationResult | null> => {\n eventBus.emit('integrations:oauth-started', { connectionId, providerKey });\n const result = await mutate({ variables: { input: { connectionId, redirectUri, scopes } } });\n if (result.error) {\n eventBus.emit('integrations:oauth-failed', {\n connectionId,\n providerKey,\n error: result.error.message,\n });\n }\n return result.data?.initiateOAuth ?? null;\n },\n [mutate, eventBus]\n );\n\n return { initiateOAuth, loading };\n}\n\n/**\n * Authenticate a connection with values shaped by its auth method's schema.\n *\n * Generic replacement for the per-auth-type hooks below: the caller passes\n * whatever the rendered form collected, so a new auth type needs no new hook,\n * no new mutation document and no new branch at the call site.\n */\nexport function useAuthenticateConnection() {\n const [mutate, { loading }] = useAuthenticateConnectionMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateConnection = useCallback(\n async (\n connectionId: string,\n authMethodKey: string | undefined,\n values: Record<string, unknown>\n ) => {\n const result = await mutate({\n variables: { input: { connectionId, authMethodKey, values } },\n });\n return result.data?.authenticateConnection;\n },\n [mutate]\n );\n\n return { authenticateConnection, loading };\n}\n\nexport function useAuthenticateWithApiKey() {\n const [mutate, { loading }] = useAuthenticateWithApiKeyMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithApiKey = useCallback(\n async (connectionId: string, apiKey: string) => {\n const result = await mutate({ variables: { input: { connectionId, apiKey } } });\n return result.data?.authenticateWithApiKey;\n },\n [mutate]\n );\n\n return { authenticateWithApiKey, loading };\n}\n\nexport function useAuthenticateWithBasicAuth() {\n const [mutate, { loading }] = useAuthenticateWithBasicAuthMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBasicAuth = useCallback(\n async (connectionId: string, username: string, password: string) => {\n const result = await mutate({ variables: { input: { connectionId, username, password } } });\n return result.data?.authenticateWithBasicAuth;\n },\n [mutate]\n );\n\n return { authenticateWithBasicAuth, loading };\n}\n\nexport function useAuthenticateWithBearerToken() {\n const [mutate, { loading }] = useAuthenticateWithBearerTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBearerToken = useCallback(\n async (connectionId: string, token: string) => {\n const result = await mutate({ variables: { input: { connectionId, token } } });\n return result.data?.authenticateWithBearerToken;\n },\n [mutate]\n );\n\n return { authenticateWithBearerToken, loading };\n}\n\n/**\n * GraphQL document for the first-party SERVICE_ACCOUNT auth flow. Defined inline\n * (rather than via codegen) so it does not depend on a fresh `schema:pull` from\n * a gateway that already exposes the new `authenticateWithServiceAccount`\n * mutation. Once the gateway supergraph includes it, this can be migrated to an\n * `src/operations/...` document like the other mutations.\n */\nconst AUTHENTICATE_WITH_SERVICE_ACCOUNT = gql`\n mutation AuthenticateWithServiceAccount($input: ServiceAccountAuthInput!) {\n authenticateWithServiceAccount(input: $input) {\n id\n status\n }\n }\n`;\n\n/**\n * Connect a first-party SERVICE_ACCOUNT provider (e.g. Burdenoff). No user\n * credentials are collected — the platform mints an app-as-user token per\n * execution. Calling this records the user's consent (delegation) for the\n * reserved app and activates the connection.\n */\nexport function useAuthenticateWithServiceAccount() {\n const [mutate, { loading }] = useMutation<\n { authenticateWithServiceAccount: { id: string; status: ConnectionStatus } },\n { input: { connectionId: string; scopes?: string[] } }\n >(AUTHENTICATE_WITH_SERVICE_ACCOUNT, {\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithServiceAccount = useCallback(\n async (connectionId: string, scopes?: string[]) => {\n const result = await mutate({ variables: { input: { connectionId, scopes } } });\n return result.data?.authenticateWithServiceAccount;\n },\n [mutate]\n );\n\n return { authenticateWithServiceAccount, loading };\n}\n\n/**\n * GraphQL document for CUSTOM provider auth (configSchema-driven config, e.g.\n * Google Workspace Admin domain-wide delegation). Defined inline (rather than\n * via codegen) so it does not depend on a fresh `schema:pull` from a gateway\n * that already exposes the new `authenticateWithCustomConfig` mutation. Once\n * the gateway supergraph includes it, this can be migrated to an\n * `src/operations/...` document like the other mutations.\n */\nconst AUTHENTICATE_WITH_CUSTOM_CONFIG = gql`\n mutation AuthenticateWithCustomConfig($input: CustomConfigAuthInput!) {\n authenticateWithCustomConfig(input: $input) {\n id\n status\n }\n }\n`;\n\n/**\n * Connect a CUSTOM provider with a configSchema-shaped config object. The full\n * config is stored inside the encrypted credential payload (secrets never hit\n * plain columns); the connection becomes ACTIVE immediately.\n */\nexport function useAuthenticateWithCustomConfig() {\n const [mutate, { loading }] = useMutation<\n { authenticateWithCustomConfig: { id: string; status: ConnectionStatus } },\n { input: { connectionId: string; config: Record<string, unknown> } }\n >(AUTHENTICATE_WITH_CUSTOM_CONFIG, {\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithCustomConfig = useCallback(\n async (connectionId: string, config: Record<string, unknown>) => {\n const result = await mutate({ variables: { input: { connectionId, config } } });\n return result.data?.authenticateWithCustomConfig;\n },\n [mutate]\n );\n\n return { authenticateWithCustomConfig, loading };\n}\n\nexport function useRefreshToken() {\n const [mutate, { loading }] = useRefreshConnectionTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const refreshToken = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.refreshConnectionToken) {\n eventBus.emit('integrations:token-refreshed', { connectionId });\n }\n return result.data?.refreshConnectionToken;\n },\n [mutate, eventBus]\n );\n\n return { refreshToken, loading };\n}\n\nexport function useRevokeConnection() {\n const [mutate, { loading }] = useRevokeConnectionMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const revokeConnection = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.revokeConnection) {\n eventBus.emit('integrations:token-revoked', { connectionId });\n }\n return result.data?.revokeConnection;\n },\n [mutate, eventBus]\n );\n\n return { revokeConnection, loading };\n}\n\nexport function useTestConnection() {\n const [mutate, { loading }] = useTestConnectionMutation();\n\n const testConnection = useCallback(\n async (connectionId: string): Promise<ConnectionTestResult | null> => {\n const result = await mutate({ variables: { connectionId } });\n return result.data?.testConnection ?? null;\n },\n [mutate]\n );\n\n return { testConnection, loading };\n}\n"],"mappings":";;;;;;;;AAiEA,SAAgB,EAAe,GAAkC;CAC/D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAuB;EAC/D,WAAW;GAAE;GAAQ,YAAY,EAAE,OAAO,KAAK;GAAE;EACjD,MAAM,CAAC;EACP,aAAa;EACd,CAAC,EAKI,IAAW,GAAM,mBAAmB,KAAA;AAM1C,QAAO;EACL,cAL4C,GAAM,gBAAgB,SAAS,EAAE,EAAE,KAC9E,MAAkC,EAAc,EAAK,CACvD;EAIC,OAAO,GAAM,gBAAgB,SAAS;EACtC;EAGA;EACA;EACA;EACD;;AAGH,SAAgB,EAAc,GAAY;CACxC,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAsB;EAC9D,WAAW,EAAE,OAAI;EACjB,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACd,CAAC,EAEI,IAAW,GAAM,kBAAkB,KAAA;AAMzC,QAAO;EAAE,YAJwC,GAAM,gBACnD,EAAc,EAAK,cAAyC,GAC5D;EAEiB;EAAS;EAAU;EAAO;EAAS;;AAG1D,SAAgB,EAAyB,GAAoB;CAC3D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAiC;EACzE,WAAW;GAAE;GAAY,YAAY,EAAE,OAAO,KAAK;GAAE;EACrD,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACd,CAAC;AAMF,QAAO;EACL,cAL4C,GAAM,0BAA0B,SAAS,EAAE,EAAE,KACxF,MAAkC,EAAc,EAAK,CACvD;EAIC,OAAO,GAAM,0BAA0B,SAAS;EAChD;EACA;EACA;EACD;;AAKH,SAAgB,IAAsB;CAC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"file":"useConnections.js","names":[],"sources":["../../../src/integrations/hooks/useConnections.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries and mutations for connections.\n */\n\nimport { useCallback } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation } from '@apollo/client/react';\nimport {\n useGetConnectionsQuery,\n useGetConnectionQuery,\n useGetConnectionsByProviderQuery,\n useCreateConnectionMutation,\n useInitiateOAuthMutation,\n useAuthenticateConnectionMutation,\n useAuthenticateWithApiKeyMutation,\n useAuthenticateWithBasicAuthMutation,\n useAuthenticateWithBearerTokenMutation,\n useRefreshConnectionTokenMutation,\n useRevokeConnectionMutation,\n useTestConnectionMutation,\n useDeleteConnectionMutation,\n} from '../../generated/wspace-operations';\nimport type { ConnectionAccessFilter } from '../../generated/wspace-types';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { useIntegrationsEventBus } from '../events/useIntegrationsEventBus';\nimport { mapConnection } from '../utils/mappers';\nimport type {\n IntegrationConnection,\n ConnectionStatus,\n OAuthInitiationResult,\n ConnectionTestResult,\n} from '../types';\n\n/**\n * A query we never asked is NOT an empty result.\n *\n * ★★ THE BUG THIS EXISTS TO PREVENT. Apollo returns `loading: false`,\n * `error: undefined`, `data: undefined` for a SKIPPED query — identical, from a\n * caller's point of view, to a query that ran and found nothing. Pages then\n * render their empty state and tell the user, definitively, that they have no\n * connections.\n *\n * Measured in production 2026-09-13: `/integrations/connections` showed\n * \"No connections yet\" while the workspace held **46** connections — 8 ACTIVE\n * (Gmail, GitHub, Google Sheets, Linear, Anthropic), 1 EXPIRED, 37 PENDING_AUTH.\n * The assistant, asked the same question through the API, listed all 46. No\n * request left the browser and no error appeared anywhere.\n *\n * `workspaceId` is falsy whenever the active context has not resolved — and the\n * shell passes `activeContext.workspaceId ?? \"\"`, so \"not yet known\" arrives as\n * an empty string, which is falsy. Any render in that window produces a\n * confident, wrong answer.\n *\n * So `notReady` is returned separately and callers MUST NOT treat it as empty.\n * It is deliberately not folded into `loading`: a caller that shows a spinner is\n * right, and a caller that ignores it still cannot mistake it for \"none\".\n */\n\n// ─── Query Hooks ────────────────────────────────────────────────────────────\n\ninterface ConnectionFilterOptions {\n status?: ConnectionStatus;\n providerId?: string;\n search?: string;\n /** BOFF-9726: only the caller's own connections, or those shared with them. */\n access?: ConnectionAccessFilter;\n}\n\nexport function useConnections(filter?: ConnectionFilterOptions) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsQuery({\n variables: { filter, pagination: { limit: 100 } },\n skip: !workspaceId,\n errorPolicy: 'all',\n });\n\n // ★ Keyed on the ABSENCE OF DATA, not on why it is absent. A skipped query, a\n // query still in flight and a query that resolved from an empty cache entry all\n // land here, and none of them is evidence that the workspace has no connections.\n const answered = data?.getConnections !== undefined;\n\n const connections: IntegrationConnection[] = (data?.getConnections?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return {\n connections,\n total: data?.getConnections?.total ?? 0,\n loading,\n // ★ False until the server has actually told us. Callers MUST gate their\n // empty state on this — see the note above.\n answered,\n error,\n refetch,\n };\n}\n\nexport function useConnection(id: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionQuery({\n variables: { id },\n skip: !workspaceId || !id,\n errorPolicy: 'all',\n });\n\n const answered = data?.getConnection !== undefined;\n\n const connection: IntegrationConnection | null = data?.getConnection\n ? mapConnection(data.getConnection as Record<string, unknown>)\n : null;\n\n return { connection, loading, answered, error, refetch };\n}\n\nexport function useConnectionsByProvider(providerId: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsByProviderQuery({\n variables: { providerId, pagination: { limit: 100 } },\n skip: !workspaceId || !providerId,\n errorPolicy: 'all',\n });\n\n const connections: IntegrationConnection[] = (data?.getConnectionsByProvider?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return {\n connections,\n total: data?.getConnectionsByProvider?.total ?? 0,\n loading,\n error,\n refetch,\n };\n}\n\n// ─── Mutation Hooks ─────────────────────────────────────────────────────────\n\nexport function useCreateConnection() {\n const [mutate, { loading }] = useCreateConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const createConnection = useCallback(\n async (input: {\n name: string;\n description?: string;\n providerId: string;\n authMethodKey?: string;\n vaultId?: string;\n credentialSecretId?: string;\n managedSecretName?: string;\n config?: Record<string, unknown>;\n }) => {\n const result = await mutate({ variables: { input } });\n const id = result.data?.createConnection?.id as string | undefined;\n if (id) {\n eventBus.emit('integrations:connection-created', {\n connectionId: id,\n providerKey: input.providerId,\n });\n }\n return id;\n },\n [mutate, eventBus]\n );\n\n return { createConnection, loading };\n}\n\nexport function useDeleteConnection() {\n const [mutate, { loading }] = useDeleteConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const deleteConnection = useCallback(\n async (id: string, deleteVaultSecret = false) => {\n await mutate({ variables: { id, deleteVaultSecret } });\n eventBus.emit('integrations:connection-deleted', { connectionId: id });\n },\n [mutate, eventBus]\n );\n\n return { deleteConnection, loading };\n}\n\nexport function useInitiateOAuth() {\n const [mutate, { loading }] = useInitiateOAuthMutation();\n const eventBus = useIntegrationsEventBus();\n\n const initiateOAuth = useCallback(\n async (\n connectionId: string,\n redirectUri: string,\n providerKey: string,\n scopes?: string[]\n ): Promise<OAuthInitiationResult | null> => {\n eventBus.emit('integrations:oauth-started', { connectionId, providerKey });\n const result = await mutate({ variables: { input: { connectionId, redirectUri, scopes } } });\n if (result.error) {\n eventBus.emit('integrations:oauth-failed', {\n connectionId,\n providerKey,\n error: result.error.message,\n });\n }\n return result.data?.initiateOAuth ?? null;\n },\n [mutate, eventBus]\n );\n\n return { initiateOAuth, loading };\n}\n\n/**\n * Authenticate a connection with values shaped by its auth method's schema.\n *\n * Generic replacement for the per-auth-type hooks below: the caller passes\n * whatever the rendered form collected, so a new auth type needs no new hook,\n * no new mutation document and no new branch at the call site.\n */\nexport function useAuthenticateConnection() {\n const [mutate, { loading }] = useAuthenticateConnectionMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateConnection = useCallback(\n async (\n connectionId: string,\n authMethodKey: string | undefined,\n values: Record<string, unknown>\n ) => {\n const result = await mutate({\n variables: { input: { connectionId, authMethodKey, values } },\n });\n return result.data?.authenticateConnection;\n },\n [mutate]\n );\n\n return { authenticateConnection, loading };\n}\n\nexport function useAuthenticateWithApiKey() {\n const [mutate, { loading }] = useAuthenticateWithApiKeyMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithApiKey = useCallback(\n async (connectionId: string, apiKey: string) => {\n const result = await mutate({ variables: { input: { connectionId, apiKey } } });\n return result.data?.authenticateWithApiKey;\n },\n [mutate]\n );\n\n return { authenticateWithApiKey, loading };\n}\n\nexport function useAuthenticateWithBasicAuth() {\n const [mutate, { loading }] = useAuthenticateWithBasicAuthMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBasicAuth = useCallback(\n async (connectionId: string, username: string, password: string) => {\n const result = await mutate({ variables: { input: { connectionId, username, password } } });\n return result.data?.authenticateWithBasicAuth;\n },\n [mutate]\n );\n\n return { authenticateWithBasicAuth, loading };\n}\n\nexport function useAuthenticateWithBearerToken() {\n const [mutate, { loading }] = useAuthenticateWithBearerTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBearerToken = useCallback(\n async (connectionId: string, token: string) => {\n const result = await mutate({ variables: { input: { connectionId, token } } });\n return result.data?.authenticateWithBearerToken;\n },\n [mutate]\n );\n\n return { authenticateWithBearerToken, loading };\n}\n\n/**\n * GraphQL document for the first-party SERVICE_ACCOUNT auth flow. Defined inline\n * (rather than via codegen) so it does not depend on a fresh `schema:pull` from\n * a gateway that already exposes the new `authenticateWithServiceAccount`\n * mutation. Once the gateway supergraph includes it, this can be migrated to an\n * `src/operations/...` document like the other mutations.\n */\nconst AUTHENTICATE_WITH_SERVICE_ACCOUNT = gql`\n mutation AuthenticateWithServiceAccount($input: ServiceAccountAuthInput!) {\n authenticateWithServiceAccount(input: $input) {\n id\n status\n }\n }\n`;\n\n/**\n * Connect a first-party SERVICE_ACCOUNT provider (e.g. Burdenoff). No user\n * credentials are collected — the platform mints an app-as-user token per\n * execution. Calling this records the user's consent (delegation) for the\n * reserved app and activates the connection.\n */\nexport function useAuthenticateWithServiceAccount() {\n const [mutate, { loading }] = useMutation<\n { authenticateWithServiceAccount: { id: string; status: ConnectionStatus } },\n { input: { connectionId: string; scopes?: string[] } }\n >(AUTHENTICATE_WITH_SERVICE_ACCOUNT, {\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithServiceAccount = useCallback(\n async (connectionId: string, scopes?: string[]) => {\n const result = await mutate({ variables: { input: { connectionId, scopes } } });\n return result.data?.authenticateWithServiceAccount;\n },\n [mutate]\n );\n\n return { authenticateWithServiceAccount, loading };\n}\n\n/**\n * GraphQL document for CUSTOM provider auth (configSchema-driven config, e.g.\n * Google Workspace Admin domain-wide delegation). Defined inline (rather than\n * via codegen) so it does not depend on a fresh `schema:pull` from a gateway\n * that already exposes the new `authenticateWithCustomConfig` mutation. Once\n * the gateway supergraph includes it, this can be migrated to an\n * `src/operations/...` document like the other mutations.\n */\nconst AUTHENTICATE_WITH_CUSTOM_CONFIG = gql`\n mutation AuthenticateWithCustomConfig($input: CustomConfigAuthInput!) {\n authenticateWithCustomConfig(input: $input) {\n id\n status\n }\n }\n`;\n\n/**\n * Connect a CUSTOM provider with a configSchema-shaped config object. The full\n * config is stored inside the encrypted credential payload (secrets never hit\n * plain columns); the connection becomes ACTIVE immediately.\n */\nexport function useAuthenticateWithCustomConfig() {\n const [mutate, { loading }] = useMutation<\n { authenticateWithCustomConfig: { id: string; status: ConnectionStatus } },\n { input: { connectionId: string; config: Record<string, unknown> } }\n >(AUTHENTICATE_WITH_CUSTOM_CONFIG, {\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithCustomConfig = useCallback(\n async (connectionId: string, config: Record<string, unknown>) => {\n const result = await mutate({ variables: { input: { connectionId, config } } });\n return result.data?.authenticateWithCustomConfig;\n },\n [mutate]\n );\n\n return { authenticateWithCustomConfig, loading };\n}\n\nexport function useRefreshToken() {\n const [mutate, { loading }] = useRefreshConnectionTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const refreshToken = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.refreshConnectionToken) {\n eventBus.emit('integrations:token-refreshed', { connectionId });\n }\n return result.data?.refreshConnectionToken;\n },\n [mutate, eventBus]\n );\n\n return { refreshToken, loading };\n}\n\nexport function useRevokeConnection() {\n const [mutate, { loading }] = useRevokeConnectionMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const revokeConnection = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.revokeConnection) {\n eventBus.emit('integrations:token-revoked', { connectionId });\n }\n return result.data?.revokeConnection;\n },\n [mutate, eventBus]\n );\n\n return { revokeConnection, loading };\n}\n\nexport function useTestConnection() {\n const [mutate, { loading }] = useTestConnectionMutation();\n\n const testConnection = useCallback(\n async (connectionId: string): Promise<ConnectionTestResult | null> => {\n const result = await mutate({ variables: { connectionId } });\n return result.data?.testConnection ?? null;\n },\n [mutate]\n );\n\n return { testConnection, loading };\n}\n"],"mappings":";;;;;;;;AAoEA,SAAgB,EAAe,GAAkC;CAC/D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAuB;EAC/D,WAAW;GAAE;GAAQ,YAAY,EAAE,OAAO,KAAK;GAAE;EACjD,MAAM,CAAC;EACP,aAAa;EACd,CAAC,EAKI,IAAW,GAAM,mBAAmB,KAAA;AAM1C,QAAO;EACL,cAL4C,GAAM,gBAAgB,SAAS,EAAE,EAAE,KAC9E,MAAkC,EAAc,EAAK,CACvD;EAIC,OAAO,GAAM,gBAAg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BACf,EAAS,KAAK,gCAAgC,EAAE,iBAAc,CAAC,EAE1D,EAAO,MAAM;KAEtB,CAAC,GAAQ,EAAS,CACnB;EAEsB;EAAS;;AAGlC,SAAgB,IAAsB;CACpC,IAAM,CAAC,GAAQ,EAAE,gBAAa,EAA4B,EACxD,gBAAgB,CAAC,gBAAgB,EAClC,CAAC,EACI,IAAW,GAAyB;AAa1C,QAAO;EAAE,kBAXgB,EACvB,OAAO,MAAyB;GAC9B,IAAM,IAAS,MAAM,EAAO,EAAE,WAAW,EAAE,iBAAc,EAAE,CAAC;AAI5D,UAHI,EAAO,MAAM,oBACf,EAAS,KAAK,8BAA8B,EAAE,iBAAc,CAAC,EAExD,EAAO,MAAM;KAEtB,CAAC,GAAQ,EAAS,CACnB;EAE0B;EAAS;;AAGtC,SAAgB,IAAoB;CAClC,IAAM,CAAC,GAAQ,EAAE,gBAAa,GAA2B;AAUzD,QAAO;EAAE,gBARc,EACrB,OAAO,OACU,MAAM,EAAO,EAAE,WAAW,EAAE,iBAAc,EAAE,CAAC,EAC9C,MAAM,kBAAkB,MAExC,CAAC,EAAO,CACT;EAEwB;EAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionDetail.d.ts","sourceRoot":"","sources":["../../../src/integrations/pages/ConnectionDetail.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConnectionDetail.d.ts","sourceRoot":"","sources":["../../../src/integrations/pages/ConnectionDetail.tsx"],"names":[],"mappings":"AA+DA;;GAEG;AACH,wBAAgB,gBAAgB,gCAsoB/B"}
|