@burdenoff/microfe-integrations 2026.1023.1 → 2026.1102.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/global-types.d.ts +5717 -1663
- package/dist/generated/global-types.d.ts.map +1 -1
- package/dist/generated/wspace-operations.d.ts +458 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +219 -84
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +77665 -31967
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js +16 -0
- package/dist/generated/wspace-types.js.map +1 -0
- package/dist/integrations/IntegrationsAdminRoutes.d.ts.map +1 -1
- package/dist/integrations/IntegrationsAdminRoutes.js +13 -9
- package/dist/integrations/IntegrationsAdminRoutes.js.map +1 -1
- package/dist/integrations/IntegrationsUserRoutes.d.ts.map +1 -1
- package/dist/integrations/IntegrationsUserRoutes.js +16 -12
- package/dist/integrations/IntegrationsUserRoutes.js.map +1 -1
- 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/components/ConnectorSubmissionCard.d.ts +16 -0
- package/dist/integrations/components/ConnectorSubmissionCard.d.ts.map +1 -0
- package/dist/integrations/components/ConnectorSubmissionCard.js +192 -0
- package/dist/integrations/components/ConnectorSubmissionCard.js.map +1 -0
- package/dist/integrations/components/ConnectorSubmissionPager.d.ts +22 -0
- package/dist/integrations/components/ConnectorSubmissionPager.d.ts.map +1 -0
- package/dist/integrations/components/ConnectorSubmissionPager.js +36 -0
- package/dist/integrations/components/ConnectorSubmissionPager.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/hooks/useConnectorSubmissions.d.ts +47 -0
- package/dist/integrations/hooks/useConnectorSubmissions.d.ts.map +1 -0
- package/dist/integrations/hooks/useConnectorSubmissions.js +80 -0
- package/dist/integrations/hooks/useConnectorSubmissions.js.map +1 -0
- 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/pages/ConnectorReviewQueuePage.d.ts +7 -0
- package/dist/integrations/pages/ConnectorReviewQueuePage.d.ts.map +1 -0
- package/dist/integrations/pages/ConnectorReviewQueuePage.js +201 -0
- package/dist/integrations/pages/ConnectorReviewQueuePage.js.map +1 -0
- package/dist/integrations/pages/ConnectorSubmissionsPage.d.ts +6 -0
- package/dist/integrations/pages/ConnectorSubmissionsPage.d.ts.map +1 -0
- package/dist/integrations/pages/ConnectorSubmissionsPage.js +576 -0
- package/dist/integrations/pages/ConnectorSubmissionsPage.js.map +1 -0
- package/dist/integrations/pages/ProviderCatalog.d.ts.map +1 -1
- package/dist/integrations/pages/ProviderCatalog.js +157 -145
- package/dist/integrations/pages/ProviderCatalog.js.map +1 -1
- package/dist/integrations/pages/ProviderDetail.d.ts.map +1 -1
- package/dist/integrations/pages/ProviderDetail.js +15 -8
- package/dist/integrations/pages/ProviderDetail.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
|
@@ -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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ConnectorSubmission, ConnectorSubmissionStatus } from '../hooks/useConnectorSubmissions';
|
|
3
|
+
|
|
4
|
+
export declare function ConnectorSubmissionStatusBadge({ status }: {
|
|
5
|
+
status: ConnectorSubmissionStatus;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
interface ConnectorSubmissionCardProps {
|
|
8
|
+
submission: ConnectorSubmission;
|
|
9
|
+
/** Show the publisher contact details (reviewer view). */
|
|
10
|
+
showPublisherContact?: boolean;
|
|
11
|
+
actions?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** One connector submission: identity, auth, links, review state. */
|
|
14
|
+
export declare function ConnectorSubmissionCard({ submission, showPublisherContact, actions, }: ConnectorSubmissionCardProps): import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=ConnectorSubmissionCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectorSubmissionCard.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/ConnectorSubmissionCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,EACL,KAAK,mBAAmB,EACxB,yBAAyB,EAC1B,MAAM,kCAAkC,CAAC;AA+B1C,wBAAgB,8BAA8B,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,yBAAyB,CAAA;CAAE,+BAa/F;AAED,UAAU,4BAA4B;IACpC,UAAU,EAAE,mBAAmB,CAAC;IAChC,0DAA0D;IAC1D,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,qEAAqE;AACrE,wBAAgB,uBAAuB,CAAC,EACtC,UAAU,EACV,oBAA4B,EAC5B,OAAO,GACR,EAAE,4BAA4B,+BA4I9B"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { cn as t } from "../utils/cn.js";
|
|
3
|
+
import { ConnectorSubmissionStatus as n } from "../../generated/wspace-types.js";
|
|
4
|
+
import { useFormatDate as r } from "../hooks/useFormatDate.js";
|
|
5
|
+
import "../hooks/useConnectorSubmissions.js";
|
|
6
|
+
import { AlertTriangle as i, Clock as a, ExternalLink as o } from "lucide-react";
|
|
7
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
+
//#region src/integrations/components/ConnectorSubmissionCard.tsx
|
|
9
|
+
var l = {
|
|
10
|
+
[n.PendingReview]: "text-status-info-text bg-status-info-bg-subtle border-border-default",
|
|
11
|
+
[n.Approved]: "text-status-success-text bg-status-success-bg-subtle border-border-default",
|
|
12
|
+
[n.Rejected]: "text-status-error-text bg-status-error-bg-subtle border-border-default",
|
|
13
|
+
[n.Withdrawn]: "text-text-secondary bg-bg-sunken border-border-subtle"
|
|
14
|
+
}, u = {
|
|
15
|
+
[n.PendingReview]: ["integrations.connectorSubmissions.status.pendingReview", "In review"],
|
|
16
|
+
[n.Approved]: ["integrations.connectorSubmissions.status.approved", "Approved"],
|
|
17
|
+
[n.Rejected]: ["integrations.connectorSubmissions.status.rejected", "Rejected"],
|
|
18
|
+
[n.Withdrawn]: ["integrations.connectorSubmissions.status.withdrawn", "Withdrawn"]
|
|
19
|
+
};
|
|
20
|
+
function d({ status: n }) {
|
|
21
|
+
let r = e(), [i, a] = u[n];
|
|
22
|
+
return /* @__PURE__ */ s("span", {
|
|
23
|
+
className: t("inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium", l[n]),
|
|
24
|
+
children: r(i, a)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function f({ submission: l, showPublisherContact: u = !1, actions: f }) {
|
|
28
|
+
let p = e(), m = r(), h = l.status === n.PendingReview;
|
|
29
|
+
return /* @__PURE__ */ c("article", {
|
|
30
|
+
className: "rounded-xl border border-border-seam bg-bg-surface p-5 space-y-3",
|
|
31
|
+
"data-testid": "connector-submission",
|
|
32
|
+
"aria-label": l.name,
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ c("div", {
|
|
35
|
+
className: "flex flex-wrap items-start gap-3",
|
|
36
|
+
children: [/* @__PURE__ */ c("div", {
|
|
37
|
+
className: "min-w-0 flex-1",
|
|
38
|
+
children: [/* @__PURE__ */ c("div", {
|
|
39
|
+
className: "flex flex-wrap items-center gap-2",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ s("h3", {
|
|
42
|
+
className: "text-base font-semibold text-text-primary",
|
|
43
|
+
children: l.name
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ s(d, { status: l.status }),
|
|
46
|
+
l.isReviewOverdue && /* @__PURE__ */ c("span", {
|
|
47
|
+
className: "inline-flex items-center gap-1 rounded-full border border-border-default bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text",
|
|
48
|
+
children: [/* @__PURE__ */ s(i, { size: 12 }), p("integrations.connectorSubmissions.overdue", "Review overdue")]
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
}), /* @__PURE__ */ c("p", {
|
|
52
|
+
className: "mt-0.5 text-xs text-text-secondary font-mono break-all",
|
|
53
|
+
children: [
|
|
54
|
+
l.key,
|
|
55
|
+
" · v",
|
|
56
|
+
l.version,
|
|
57
|
+
" · ",
|
|
58
|
+
l.authType,
|
|
59
|
+
" · ",
|
|
60
|
+
l.category
|
|
61
|
+
]
|
|
62
|
+
})]
|
|
63
|
+
}), f && /* @__PURE__ */ s("div", {
|
|
64
|
+
className: "flex flex-wrap gap-2",
|
|
65
|
+
children: f
|
|
66
|
+
})]
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ s("p", {
|
|
69
|
+
className: "text-sm text-text-secondary whitespace-pre-line",
|
|
70
|
+
children: l.description
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ c("dl", {
|
|
73
|
+
className: "grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-1 text-xs",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ c("div", {
|
|
76
|
+
className: "flex gap-1 min-w-0",
|
|
77
|
+
children: [/* @__PURE__ */ c("dt", {
|
|
78
|
+
className: "text-text-secondary",
|
|
79
|
+
children: [p("integrations.connectorSubmissions.fields.publisher", "Publisher"), ":"]
|
|
80
|
+
}), /* @__PURE__ */ s("dd", {
|
|
81
|
+
className: "text-text-primary truncate",
|
|
82
|
+
children: l.publisherName
|
|
83
|
+
})]
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ c("div", {
|
|
86
|
+
className: "flex gap-1 min-w-0",
|
|
87
|
+
children: [/* @__PURE__ */ c("dt", {
|
|
88
|
+
className: "text-text-secondary",
|
|
89
|
+
children: [p("integrations.connectorSubmissions.fields.baseUrl", "API base URL"), ":"]
|
|
90
|
+
}), /* @__PURE__ */ s("dd", {
|
|
91
|
+
className: "text-text-primary font-mono truncate",
|
|
92
|
+
children: l.baseUrl
|
|
93
|
+
})]
|
|
94
|
+
}),
|
|
95
|
+
l.apiKeyName && /* @__PURE__ */ c("div", {
|
|
96
|
+
className: "flex gap-1 min-w-0",
|
|
97
|
+
children: [/* @__PURE__ */ c("dt", {
|
|
98
|
+
className: "text-text-secondary",
|
|
99
|
+
children: [p("integrations.connectorSubmissions.fields.apiKey", "API key"), ":"]
|
|
100
|
+
}), /* @__PURE__ */ c("dd", {
|
|
101
|
+
className: "text-text-primary font-mono truncate",
|
|
102
|
+
children: [
|
|
103
|
+
l.apiKeyPlacement,
|
|
104
|
+
" ",
|
|
105
|
+
l.apiKeyName,
|
|
106
|
+
l.apiKeyPrefix ? ` (${l.apiKeyPrefix})` : ""
|
|
107
|
+
]
|
|
108
|
+
})]
|
|
109
|
+
}),
|
|
110
|
+
u && /* @__PURE__ */ c("div", {
|
|
111
|
+
className: "flex gap-1 min-w-0",
|
|
112
|
+
children: [/* @__PURE__ */ c("dt", {
|
|
113
|
+
className: "text-text-secondary",
|
|
114
|
+
children: [p("integrations.connectorSubmissions.fields.supportEmail", "Support email"), ":"]
|
|
115
|
+
}), /* @__PURE__ */ s("dd", {
|
|
116
|
+
className: "text-text-primary truncate",
|
|
117
|
+
children: l.supportEmail
|
|
118
|
+
})]
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ c("div", {
|
|
121
|
+
className: "flex gap-1 min-w-0",
|
|
122
|
+
children: [/* @__PURE__ */ c("dt", {
|
|
123
|
+
className: "text-text-secondary",
|
|
124
|
+
children: [p("integrations.connectorSubmissions.fields.submitted", "Submitted"), ":"]
|
|
125
|
+
}), /* @__PURE__ */ s("dd", {
|
|
126
|
+
className: "text-text-primary",
|
|
127
|
+
children: m(l.submittedAt)
|
|
128
|
+
})]
|
|
129
|
+
}),
|
|
130
|
+
h ? /* @__PURE__ */ c("div", {
|
|
131
|
+
className: "flex gap-1 min-w-0",
|
|
132
|
+
children: [/* @__PURE__ */ c("dt", {
|
|
133
|
+
className: "inline-flex items-center gap-1 text-text-secondary",
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ s(a, { size: 12 }),
|
|
136
|
+
p("integrations.connectorSubmissions.fields.reviewDue", "Review due"),
|
|
137
|
+
":"
|
|
138
|
+
]
|
|
139
|
+
}), /* @__PURE__ */ s("dd", {
|
|
140
|
+
className: "text-text-primary",
|
|
141
|
+
children: m(l.reviewDueAt)
|
|
142
|
+
})]
|
|
143
|
+
}) : /* @__PURE__ */ c("div", {
|
|
144
|
+
className: "flex gap-1 min-w-0",
|
|
145
|
+
children: [/* @__PURE__ */ c("dt", {
|
|
146
|
+
className: "text-text-secondary",
|
|
147
|
+
children: [p("integrations.connectorSubmissions.fields.reviewed", "Reviewed"), ":"]
|
|
148
|
+
}), /* @__PURE__ */ s("dd", {
|
|
149
|
+
className: "text-text-primary",
|
|
150
|
+
children: m(l.reviewedAt ?? null)
|
|
151
|
+
})]
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
}),
|
|
155
|
+
/* @__PURE__ */ s("div", {
|
|
156
|
+
className: "flex flex-wrap gap-3 text-xs",
|
|
157
|
+
children: [
|
|
158
|
+
[l.website, p("integrations.connectorSubmissions.links.website", "Website")],
|
|
159
|
+
[l.docsUrl, p("integrations.connectorSubmissions.links.docs", "API docs")],
|
|
160
|
+
[l.privacyPolicyUrl, p("integrations.connectorSubmissions.links.privacy", "Privacy policy")],
|
|
161
|
+
[l.termsUrl, p("integrations.connectorSubmissions.links.terms", "Terms")],
|
|
162
|
+
[l.repositoryUrl, p("integrations.connectorSubmissions.links.repository", "Repository")]
|
|
163
|
+
].filter((e) => !!e[0]).map(([e, t]) => /* @__PURE__ */ c("a", {
|
|
164
|
+
href: e,
|
|
165
|
+
target: "_blank",
|
|
166
|
+
rel: "noopener noreferrer",
|
|
167
|
+
className: "inline-flex items-center gap-1 text-primary hover:underline",
|
|
168
|
+
children: [t, /* @__PURE__ */ s(o, { size: 12 })]
|
|
169
|
+
}, t))
|
|
170
|
+
}),
|
|
171
|
+
l.submitterNotes && u && /* @__PURE__ */ s("p", {
|
|
172
|
+
className: "rounded-lg bg-bg-sunken px-3 py-2 text-xs text-text-secondary whitespace-pre-line",
|
|
173
|
+
children: l.submitterNotes
|
|
174
|
+
}),
|
|
175
|
+
l.reviewNotes && /* @__PURE__ */ c("p", {
|
|
176
|
+
className: t("rounded-lg px-3 py-2 text-sm whitespace-pre-line", l.status === n.Rejected ? "bg-status-error-bg-subtle text-status-error-text" : "bg-bg-sunken text-text-secondary"),
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ c("span", {
|
|
179
|
+
className: "font-medium",
|
|
180
|
+
children: [p("integrations.connectorSubmissions.fields.reviewNotes", "Reviewer notes"), ":"]
|
|
181
|
+
}),
|
|
182
|
+
" ",
|
|
183
|
+
l.reviewNotes
|
|
184
|
+
]
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
export { f as ConnectorSubmissionCard };
|
|
191
|
+
|
|
192
|
+
//# sourceMappingURL=ConnectorSubmissionCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectorSubmissionCard.js","names":[],"sources":["../../../src/integrations/components/ConnectorSubmissionCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { AlertTriangle, Clock, ExternalLink } from 'lucide-react';\n\nimport { cn } from '../utils/cn';\nimport { useTr } from '../hooks/useTr';\nimport { useFormatDate } from '../hooks/useFormatDate';\nimport {\n type ConnectorSubmission,\n ConnectorSubmissionStatus,\n} from '../hooks/useConnectorSubmissions';\n\nconst STATUS_CLASSES: Record<ConnectorSubmissionStatus, string> = {\n [ConnectorSubmissionStatus.PendingReview]:\n 'text-status-info-text bg-status-info-bg-subtle border-border-default',\n [ConnectorSubmissionStatus.Approved]:\n 'text-status-success-text bg-status-success-bg-subtle border-border-default',\n [ConnectorSubmissionStatus.Rejected]:\n 'text-status-error-text bg-status-error-bg-subtle border-border-default',\n [ConnectorSubmissionStatus.Withdrawn]: 'text-text-secondary bg-bg-sunken border-border-subtle',\n};\n\nconst STATUS_LABELS: Record<ConnectorSubmissionStatus, [string, string]> = {\n [ConnectorSubmissionStatus.PendingReview]: [\n 'integrations.connectorSubmissions.status.pendingReview',\n 'In review',\n ],\n [ConnectorSubmissionStatus.Approved]: [\n 'integrations.connectorSubmissions.status.approved',\n 'Approved',\n ],\n [ConnectorSubmissionStatus.Rejected]: [\n 'integrations.connectorSubmissions.status.rejected',\n 'Rejected',\n ],\n [ConnectorSubmissionStatus.Withdrawn]: [\n 'integrations.connectorSubmissions.status.withdrawn',\n 'Withdrawn',\n ],\n};\n\nexport function ConnectorSubmissionStatusBadge({ status }: { status: ConnectorSubmissionStatus }) {\n const tr = useTr();\n const [key, fallback] = STATUS_LABELS[status];\n return (\n <span\n className={cn(\n 'inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium',\n STATUS_CLASSES[status]\n )}\n >\n {tr(key, fallback)}\n </span>\n );\n}\n\ninterface ConnectorSubmissionCardProps {\n submission: ConnectorSubmission;\n /** Show the publisher contact details (reviewer view). */\n showPublisherContact?: boolean;\n actions?: ReactNode;\n}\n\n/** One connector submission: identity, auth, links, review state. */\nexport function ConnectorSubmissionCard({\n submission,\n showPublisherContact = false,\n actions,\n}: ConnectorSubmissionCardProps) {\n const tr = useTr();\n const formatDate = useFormatDate();\n const pending = submission.status === ConnectorSubmissionStatus.PendingReview;\n\n return (\n <article\n className=\"rounded-xl border border-border-seam bg-bg-surface p-5 space-y-3\"\n data-testid=\"connector-submission\"\n aria-label={submission.name}\n >\n <div className=\"flex flex-wrap items-start gap-3\">\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h3 className=\"text-base font-semibold text-text-primary\">{submission.name}</h3>\n <ConnectorSubmissionStatusBadge status={submission.status} />\n {submission.isReviewOverdue && (\n <span className=\"inline-flex items-center gap-1 rounded-full border border-border-default bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text\">\n <AlertTriangle size={12} />\n {tr('integrations.connectorSubmissions.overdue', 'Review overdue')}\n </span>\n )}\n </div>\n <p className=\"mt-0.5 text-xs text-text-secondary font-mono break-all\">\n {submission.key} · v{submission.version} · {submission.authType} · {submission.category}\n </p>\n </div>\n {actions && <div className=\"flex flex-wrap gap-2\">{actions}</div>}\n </div>\n\n <p className=\"text-sm text-text-secondary whitespace-pre-line\">{submission.description}</p>\n\n <dl className=\"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-1 text-xs\">\n <div className=\"flex gap-1 min-w-0\">\n <dt className=\"text-text-secondary\">\n {tr('integrations.connectorSubmissions.fields.publisher', 'Publisher')}:\n </dt>\n <dd className=\"text-text-primary truncate\">{submission.publisherName}</dd>\n </div>\n <div className=\"flex gap-1 min-w-0\">\n <dt className=\"text-text-secondary\">\n {tr('integrations.connectorSubmissions.fields.baseUrl', 'API base URL')}:\n </dt>\n <dd className=\"text-text-primary font-mono truncate\">{submission.baseUrl}</dd>\n </div>\n {submission.apiKeyName && (\n <div className=\"flex gap-1 min-w-0\">\n <dt className=\"text-text-secondary\">\n {tr('integrations.connectorSubmissions.fields.apiKey', 'API key')}:\n </dt>\n <dd className=\"text-text-primary font-mono truncate\">\n {submission.apiKeyPlacement} {submission.apiKeyName}\n {submission.apiKeyPrefix ? ` (${submission.apiKeyPrefix})` : ''}\n </dd>\n </div>\n )}\n {showPublisherContact && (\n <div className=\"flex gap-1 min-w-0\">\n <dt className=\"text-text-secondary\">\n {tr('integrations.connectorSubmissions.fields.supportEmail', 'Support email')}:\n </dt>\n <dd className=\"text-text-primary truncate\">{submission.supportEmail}</dd>\n </div>\n )}\n <div className=\"flex gap-1 min-w-0\">\n <dt className=\"text-text-secondary\">\n {tr('integrations.connectorSubmissions.fields.submitted', 'Submitted')}:\n </dt>\n <dd className=\"text-text-primary\">{formatDate(submission.submittedAt)}</dd>\n </div>\n {pending ? (\n <div className=\"flex gap-1 min-w-0\">\n <dt className=\"inline-flex items-center gap-1 text-text-secondary\">\n <Clock size={12} />\n {tr('integrations.connectorSubmissions.fields.reviewDue', 'Review due')}:\n </dt>\n <dd className=\"text-text-primary\">{formatDate(submission.reviewDueAt)}</dd>\n </div>\n ) : (\n <div className=\"flex gap-1 min-w-0\">\n <dt className=\"text-text-secondary\">\n {tr('integrations.connectorSubmissions.fields.reviewed', 'Reviewed')}:\n </dt>\n <dd className=\"text-text-primary\">{formatDate(submission.reviewedAt ?? null)}</dd>\n </div>\n )}\n </dl>\n\n <div className=\"flex flex-wrap gap-3 text-xs\">\n {[\n [submission.website, tr('integrations.connectorSubmissions.links.website', 'Website')],\n [submission.docsUrl, tr('integrations.connectorSubmissions.links.docs', 'API docs')],\n [\n submission.privacyPolicyUrl,\n tr('integrations.connectorSubmissions.links.privacy', 'Privacy policy'),\n ],\n [submission.termsUrl, tr('integrations.connectorSubmissions.links.terms', 'Terms')],\n [\n submission.repositoryUrl,\n tr('integrations.connectorSubmissions.links.repository', 'Repository'),\n ],\n ]\n .filter((entry): entry is [string, string] => Boolean(entry[0]))\n .map(([href, label]) => (\n <a\n key={label}\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1 text-primary hover:underline\"\n >\n {label}\n <ExternalLink size={12} />\n </a>\n ))}\n </div>\n\n {submission.submitterNotes && showPublisherContact && (\n <p className=\"rounded-lg bg-bg-sunken px-3 py-2 text-xs text-text-secondary whitespace-pre-line\">\n {submission.submitterNotes}\n </p>\n )}\n\n {submission.reviewNotes && (\n <p\n className={cn(\n 'rounded-lg px-3 py-2 text-sm whitespace-pre-line',\n submission.status === ConnectorSubmissionStatus.Rejected\n ? 'bg-status-error-bg-subtle text-status-error-text'\n : 'bg-bg-sunken text-text-secondary'\n )}\n >\n <span className=\"font-medium\">\n {tr('integrations.connectorSubmissions.fields.reviewNotes', 'Reviewer notes')}:\n </span>{' '}\n {submission.reviewNotes}\n </p>\n )}\n </article>\n );\n}\n"],"mappings":";;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EAAW,YAAY;OAAM,CAAA,CACvE;UAEN,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,MAAD;OAAI,WAAU;iBAAd,CACG,EAAG,qDAAqD,WAAW,EAAC,IAClE;UACL,kBAAC,MAAD;OAAI,WAAU;iBAAqB,EAAW,EAAW,cAAc,KAAK;OAAM,CAAA,CAC9E;;KAEL;;GAEL,kBAAC,OAAD;IAAK,WAAU;cACZ;KACC,CAAC,EAAW,SAAS,EAAG,mDAAmD,UAAU,CAAC;KACtF,CAAC,EAAW,SAAS,EAAG,gDAAgD,WAAW,CAAC;KACpF,CACE,EAAW,kBACX,EAAG,mDAAmD,iBAAiB,CACxE;KACD,CAAC,EAAW,UAAU,EAAG,iDAAiD,QAAQ,CAAC;KACnF,CACE,EAAW,eACX,EAAG,sDAAsD,aAAa,CACvE;KACF,CACE,QAAQ,MAAqC,EAAQ,EAAM,GAAI,CAC/D,KAAK,CAAC,GAAM,OACX,kBAAC,KAAD;KAEQ;KACN,QAAO;KACP,KAAI;KACJ,WAAU;eALZ,CAOG,GACD,kBAAC,GAAD,EAAc,MAAM,IAAM,CAAA,CACxB;OARG,EAQH,CACJ;IACA,CAAA;GAEL,EAAW,kBAAkB,KAC5B,kBAAC,KAAD;IAAG,WAAU;cACV,EAAW;IACV,CAAA;GAGL,EAAW,eACV,kBAAC,KAAD;IACE,WAAW,EACT,oDACA,EAAW,WAAW,EAA0B,WAC5C,qDACA,mCACL;cANH;KAQE,kBAAC,QAAD;MAAM,WAAU;gBAAhB,CACG,EAAG,wDAAwD,iBAAiB,EAAC,IACzE;;KAAC;KACP,EAAW;KACV;;GAEE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface ConnectorSubmissionPagerProps {
|
|
2
|
+
/** Offset of the first row on this page. */
|
|
3
|
+
offset: number;
|
|
4
|
+
/** Rows on this page. */
|
|
5
|
+
count: number;
|
|
6
|
+
/** Rows across every page. */
|
|
7
|
+
total: number;
|
|
8
|
+
/** Whether the service holds rows after this page. */
|
|
9
|
+
hasMore: boolean;
|
|
10
|
+
pageSize: number;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onOffsetChange: (offset: number) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Previous/next paging for connector submission lists (BOFF-4417). Renders
|
|
16
|
+
* nothing while everything fits on the first page. Previous stays available
|
|
17
|
+
* when a page empties (for example after the last pending row on it was
|
|
18
|
+
* withdrawn), so the list never strands the reader past its end.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ConnectorSubmissionPager({ offset, count, total, hasMore, pageSize, disabled, onOffsetChange, }: ConnectorSubmissionPagerProps): import("react").JSX.Element | null;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=ConnectorSubmissionPager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectorSubmissionPager.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/ConnectorSubmissionPager.tsx"],"names":[],"mappings":"AAKA,UAAU,6BAA6B;IACrC,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,MAAM,EACN,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAgB,EAChB,cAAc,GACf,EAAE,6BAA6B,sCAwC/B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { ChevronLeft as t, ChevronRight as n } from "lucide-react";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
import { Button as a } from "@burdenoff/fe-libs/ui";
|
|
5
|
+
//#region src/integrations/components/ConnectorSubmissionPager.tsx
|
|
6
|
+
function o({ offset: o, count: s, total: c, hasMore: l, pageSize: u, disabled: d = !1, onOffsetChange: f }) {
|
|
7
|
+
let p = e();
|
|
8
|
+
return o === 0 && !l ? null : /* @__PURE__ */ i("nav", {
|
|
9
|
+
className: "flex flex-wrap items-center justify-between gap-3 text-sm text-text-secondary",
|
|
10
|
+
"aria-label": p("integrations.connectorSubmissions.pager.label", "Submission pages"),
|
|
11
|
+
children: [/* @__PURE__ */ r("span", { children: s > 0 ? p("integrations.connectorSubmissions.pager.range", "Showing {{first}}–{{last}} of {{total}}", {
|
|
12
|
+
first: o + 1,
|
|
13
|
+
last: o + s,
|
|
14
|
+
total: c
|
|
15
|
+
}) : p("integrations.connectorSubmissions.pager.pastEnd", "No rows on this page") }), /* @__PURE__ */ i("div", {
|
|
16
|
+
className: "flex gap-2",
|
|
17
|
+
children: [/* @__PURE__ */ i(a, {
|
|
18
|
+
variant: "ghost",
|
|
19
|
+
size: "sm",
|
|
20
|
+
disabled: d || o === 0,
|
|
21
|
+
onClick: () => f(Math.max(0, o - u)),
|
|
22
|
+
children: [/* @__PURE__ */ r(t, { size: 14 }), p("integrations.connectorSubmissions.pager.previous", "Previous")]
|
|
23
|
+
}), /* @__PURE__ */ i(a, {
|
|
24
|
+
variant: "ghost",
|
|
25
|
+
size: "sm",
|
|
26
|
+
disabled: d || !l,
|
|
27
|
+
onClick: () => f(o + u),
|
|
28
|
+
children: [p("integrations.connectorSubmissions.pager.next", "Next"), /* @__PURE__ */ r(n, { size: 14 })]
|
|
29
|
+
})]
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { o as ConnectorSubmissionPager };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=ConnectorSubmissionPager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectorSubmissionPager.js","names":[],"sources":["../../../src/integrations/components/ConnectorSubmissionPager.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\n\nimport { useTr } from '../hooks/useTr';\n\ninterface ConnectorSubmissionPagerProps {\n /** Offset of the first row on this page. */\n offset: number;\n /** Rows on this page. */\n count: number;\n /** Rows across every page. */\n total: number;\n /** Whether the service holds rows after this page. */\n hasMore: boolean;\n pageSize: number;\n disabled?: boolean;\n onOffsetChange: (offset: number) => void;\n}\n\n/**\n * Previous/next paging for connector submission lists (BOFF-4417). Renders\n * nothing while everything fits on the first page. Previous stays available\n * when a page empties (for example after the last pending row on it was\n * withdrawn), so the list never strands the reader past its end.\n */\nexport function ConnectorSubmissionPager({\n offset,\n count,\n total,\n hasMore,\n pageSize,\n disabled = false,\n onOffsetChange,\n}: ConnectorSubmissionPagerProps) {\n const tr = useTr();\n if (offset === 0 && !hasMore) return null;\n\n return (\n <nav\n className=\"flex flex-wrap items-center justify-between gap-3 text-sm text-text-secondary\"\n aria-label={tr('integrations.connectorSubmissions.pager.label', 'Submission pages')}\n >\n <span>\n {count > 0\n ? tr(\n 'integrations.connectorSubmissions.pager.range',\n 'Showing {{first}}–{{last}} of {{total}}',\n { first: offset + 1, last: offset + count, total }\n )\n : tr('integrations.connectorSubmissions.pager.pastEnd', 'No rows on this page')}\n </span>\n <div className=\"flex gap-2\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled || offset === 0}\n onClick={() => onOffsetChange(Math.max(0, offset - pageSize))}\n >\n <ChevronLeft size={14} />\n {tr('integrations.connectorSubmissions.pager.previous', 'Previous')}\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled || !hasMore}\n onClick={() => onOffsetChange(offset + pageSize)}\n >\n {tr('integrations.connectorSubmissions.pager.next', 'Next')}\n <ChevronRight size={14} />\n </Button>\n </div>\n </nav>\n );\n}\n"],"mappings":";;;;;AAyBA,SAAgB,EAAyB,EACvC,WACA,UACA,UACA,YACA,aACA,cAAW,IACX,qBACgC;CAChC,IAAM,IAAK,GAAO;AAGlB,QAFI,MAAW,KAAK,CAAC,IAAgB,OAGnC,kBAAC,OAAD;EACE,WAAU;EACV,cAAY,EAAG,iDAAiD,mBAAmB;YAFrF,CAIE,kBAAC,QAAD,EAAA,UACG,IAAQ,IACL,EACE,iDACA,2CACA;GAAE,OAAO,IAAS;GAAG,MAAM,IAAS;GAAO;GAAO,CACnD,GACD,EAAG,mDAAmD,uBAAuB,EAC5E,CAAA,EACP,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,GAAD;IACE,SAAQ;IACR,MAAK;IACL,UAAU,KAAY,MAAW;IACjC,eAAe,EAAe,KAAK,IAAI,GAAG,IAAS,EAAS,CAAC;cAJ/D,CAME,kBAAC,GAAD,EAAa,MAAM,IAAM,CAAA,EACxB,EAAG,oDAAoD,WAAW,CAC5D;OACT,kBAAC,GAAD;IACE,SAAQ;IACR,MAAK;IACL,UAAU,KAAY,CAAC;IACvB,eAAe,EAAe,IAAS,EAAS;cAJlD,CAMG,EAAG,gDAAgD,OAAO,EAC3D,kBAAC,GAAD,EAAc,MAAM,IAAM,CAAA,CACnB;MACL;KACF"}
|
|
@@ -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,CAAC;AAI3E,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AA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DAMrB,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 [mut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Z,MAAM,EAAO,EAAE,WAAW,EAAE,OAAO;GAAE;GAAc;GAAQ,EAAE,EAAE,CAAC,EACjE,MAAM,8BAEtB,CAAC,EAAO,CACT;EAEsC;EAAS;;AAGlD,SAAgB,IAAkB;CAChC,IAAM,CAAC,GAAQ,EAAE,gBAAa,EAAkC,EAC9D,gBAAgB,CAAC,gBAAgB,EAClC,CAAC,EACI,IAAW,GAAyB;AAa1C,QAAO;EAAE,cAXY,EACnB,OAAO,MAAyB;GAC9B,IAAM,IAAS,MAAM,EAAO,EAAE,WAAW,EAAE,iBAAc,EAAE,CAAC;AAI5D,UAHI,EAAO,MAAM,0BACf,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
|
+
{"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 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,gBAAgB,SAAS;EACtC;EAGA;EACA;EACA;EACD;;AAGH,SAAgB,EAAc,GAAY;CACxC,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SA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;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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ConnectorSubmissionFieldsFragment } from '../../generated/wspace-operations';
|
|
2
|
+
import { ConnectorSubmissionStatus, SubmitConnectorInput } from '../../generated/wspace-types';
|
|
3
|
+
|
|
4
|
+
export type ConnectorSubmission = ConnectorSubmissionFieldsFragment;
|
|
5
|
+
export type ConnectorSubmissionInput = SubmitConnectorInput;
|
|
6
|
+
export { ConnectorSubmissionStatus };
|
|
7
|
+
/** Rows per page. The service caps a page at 100. */
|
|
8
|
+
export declare const CONNECTOR_SUBMISSION_PAGE_SIZE = 25;
|
|
9
|
+
/** One page of the caller's own submissions, newest first. */
|
|
10
|
+
export declare function useMyConnectorSubmissions(offset?: number): {
|
|
11
|
+
submissions: ConnectorSubmissionFieldsFragment[];
|
|
12
|
+
total: any;
|
|
13
|
+
hasMore: any;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
error: import('@apollo/client').ErrorLike | undefined;
|
|
16
|
+
refetch: (variables?: any) => Promise<{
|
|
17
|
+
data: any;
|
|
18
|
+
error?: import('@apollo/client').ErrorLike;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
/** One page of the review queue (oldest first) and its counters. Super admins only. */
|
|
22
|
+
export declare function useConnectorReviewQueue(status: ConnectorSubmissionStatus | null, offset?: number): {
|
|
23
|
+
submissions: ConnectorSubmissionFieldsFragment[];
|
|
24
|
+
total: any;
|
|
25
|
+
hasMore: any;
|
|
26
|
+
stats: any;
|
|
27
|
+
loading: boolean;
|
|
28
|
+
error: import('@apollo/client').ErrorLike | undefined;
|
|
29
|
+
refetch: (variables?: any) => Promise<{
|
|
30
|
+
data: any;
|
|
31
|
+
error?: import('@apollo/client').ErrorLike;
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
export declare function useSubmitConnector(): {
|
|
35
|
+
submitConnector: (input: SubmitConnectorInput) => Promise<any>;
|
|
36
|
+
loading: boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare function useWithdrawConnectorSubmission(): {
|
|
39
|
+
withdraw: (id: string) => Promise<any>;
|
|
40
|
+
loading: boolean;
|
|
41
|
+
};
|
|
42
|
+
export declare function useReviewConnectorSubmission(): {
|
|
43
|
+
approve: (id: string, notes: string | null) => Promise<any>;
|
|
44
|
+
reject: (id: string, reason: string) => Promise<any>;
|
|
45
|
+
loading: boolean;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=useConnectorSubmissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConnectorSubmissions.d.ts","sourceRoot":"","sources":["../../../src/integrations/hooks/useConnectorSubmissions.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,iCAAiC,EAOvC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,yBAAyB,EAAE,KAAK,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpG,MAAM,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;AACpE,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC,qDAAqD;AACrD,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAOjD,8DAA8D;AAC9D,wBAAgB,yBAAyB,CAAC,MAAM,SAAI;;;;;;;;;;EAkBnD;AAED,uFAAuF;AACvF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI,EAAE,MAAM,SAAI;;;;;;;;;;;EAiB3F;AAED,wBAAgB,kBAAkB;6BAGhB,oBAAoB;;EAOrC;AAED,wBAAgB,8BAA8B;mBAK/B,MAAM;;EAOpB;AAED,wBAAgB,4BAA4B;kBAQ7B,MAAM,SAAS,MAAM,GAAG,IAAI;iBAO5B,MAAM,UAAU,MAAM;;EAOpC"}
|