@activecollab/components 2.0.346 → 2.0.348
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/cjs/presentation/shared/WebhookLogsDialog.js +585 -0
- package/dist/cjs/presentation/shared/WebhookLogsDialog.js.map +1 -0
- package/dist/cjs/presentation/shared/headers.js +93 -24
- package/dist/cjs/presentation/shared/headers.js.map +1 -1
- package/dist/cjs/presentation/shared/index.js +15 -0
- package/dist/cjs/presentation/shared/index.js.map +1 -1
- package/dist/esm/presentation/shared/WebhookLogsDialog.d.ts +62 -0
- package/dist/esm/presentation/shared/WebhookLogsDialog.d.ts.map +1 -0
- package/dist/esm/presentation/shared/WebhookLogsDialog.js +537 -0
- package/dist/esm/presentation/shared/WebhookLogsDialog.js.map +1 -0
- package/dist/esm/presentation/shared/headers.d.ts +6 -1
- package/dist/esm/presentation/shared/headers.d.ts.map +1 -1
- package/dist/esm/presentation/shared/headers.js +94 -31
- package/dist/esm/presentation/shared/headers.js.map +1 -1
- package/dist/esm/presentation/shared/index.d.ts +2 -0
- package/dist/esm/presentation/shared/index.d.ts.map +1 -1
- package/dist/esm/presentation/shared/index.js +1 -0
- package/dist/esm/presentation/shared/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WebhookLogsDialog = exports.WEBHOOK_CONNECTIONS = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _Button = require("../../components/Button");
|
|
10
|
+
var _Chip = require("../../components/Chip");
|
|
11
|
+
var _Dialog = require("../../components/Dialog");
|
|
12
|
+
var _Filter = require("../../components/Filter");
|
|
13
|
+
var _IconButton = require("../../components/IconButton");
|
|
14
|
+
var _Icons = require("../../components/Icons");
|
|
15
|
+
var _Typography = require("../../components/Typography");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
18
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
19
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
21
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
22
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
23
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
24
|
+
/**
|
|
25
|
+
* "Webhook Logs" — the VCS webhook delivery log, shown as a wide dialog with a
|
|
26
|
+
* filterable, expandable list. Extracted into `shared/` so it can be opened
|
|
27
|
+
* from more than one surface (the Apps & Integrations Repositories page and the
|
|
28
|
+
* project "..." menu on the Project Repos story).
|
|
29
|
+
*
|
|
30
|
+
* Mirrors the app's webhook log model:
|
|
31
|
+
* `vcs_webhook_logs` → connection_id, event_type, processing_status
|
|
32
|
+
* (received / unhandled / skipped / processed /
|
|
33
|
+
* failed / duplicate), delivery_identifier, payload,
|
|
34
|
+
* created_on
|
|
35
|
+
* `vcs_webhook_outcomes` → one row per outcome, each with a localized summary
|
|
36
|
+
*
|
|
37
|
+
* The status is derived from the outcomes server-side; here we render the
|
|
38
|
+
* stored value and map it to a palette colour. The connection glyph is the
|
|
39
|
+
* provider icon (GitHub / GitLab, Git for anything else).
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Normalized event kind. The processor layer maps each provider's raw event
|
|
44
|
+
* header (GitHub `issues`, GitLab `Issue Hook`, …) onto one provider-agnostic
|
|
45
|
+
* kind, so the same logical event reads — and filters — identically across
|
|
46
|
+
* connections instead of appearing once per provider.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
var WEBHOOK_CONNECTIONS = exports.WEBHOOK_CONNECTIONS = [{
|
|
50
|
+
id: "gh-activecollab",
|
|
51
|
+
name: "ActiveCollab",
|
|
52
|
+
service: "github"
|
|
53
|
+
}, {
|
|
54
|
+
id: "gh-abstergo",
|
|
55
|
+
name: "Abstergo Ltd.",
|
|
56
|
+
service: "github"
|
|
57
|
+
}, {
|
|
58
|
+
id: "gh-binford",
|
|
59
|
+
name: "Binford & Co.",
|
|
60
|
+
service: "github"
|
|
61
|
+
}, {
|
|
62
|
+
id: "gl-platform",
|
|
63
|
+
name: "Platform",
|
|
64
|
+
service: "gitlab"
|
|
65
|
+
}, {
|
|
66
|
+
id: "gl-content",
|
|
67
|
+
name: "Content",
|
|
68
|
+
service: "gitlab"
|
|
69
|
+
}, {
|
|
70
|
+
id: "gl-acme-ce",
|
|
71
|
+
name: "Acme Community",
|
|
72
|
+
service: "gitlab"
|
|
73
|
+
}];
|
|
74
|
+
var EVENT_KIND_LABELS = {
|
|
75
|
+
issue: "Issue",
|
|
76
|
+
push: "Push",
|
|
77
|
+
merge_request: "Merge request",
|
|
78
|
+
repository: "Repository",
|
|
79
|
+
ping: "Ping"
|
|
80
|
+
};
|
|
81
|
+
var STATUS_LABELS = {
|
|
82
|
+
received: "Received",
|
|
83
|
+
unhandled: "Unhandled",
|
|
84
|
+
skipped: "Skipped",
|
|
85
|
+
processed: "Processed",
|
|
86
|
+
failed: "Failed",
|
|
87
|
+
duplicate: "Duplicate"
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Status → palette colour, chosen so the colour matches the meaning:
|
|
92
|
+
* processed → green (success), failed → coral (error),
|
|
93
|
+
* skipped → orange (warning), received → sky-blue (in progress),
|
|
94
|
+
* unhandled → silver (neutral / no handler matched),
|
|
95
|
+
* duplicate → purple (replayed delivery, dropped before processing).
|
|
96
|
+
*/
|
|
97
|
+
var STATUS_COLORS = {
|
|
98
|
+
processed: {
|
|
99
|
+
bg: "var(--color-green-pale)",
|
|
100
|
+
fg: "var(--color-green-pale-darker)"
|
|
101
|
+
},
|
|
102
|
+
failed: {
|
|
103
|
+
bg: "var(--color-coral)",
|
|
104
|
+
fg: "var(--color-coral-darker)"
|
|
105
|
+
},
|
|
106
|
+
skipped: {
|
|
107
|
+
bg: "var(--color-orange)",
|
|
108
|
+
fg: "var(--color-orange-darker)"
|
|
109
|
+
},
|
|
110
|
+
received: {
|
|
111
|
+
bg: "var(--color-blue-sky)",
|
|
112
|
+
fg: "var(--color-blue-sky-darker)"
|
|
113
|
+
},
|
|
114
|
+
unhandled: {
|
|
115
|
+
bg: "var(--color-gray-silver)",
|
|
116
|
+
fg: "var(--color-gray-silver-darker)"
|
|
117
|
+
},
|
|
118
|
+
duplicate: {
|
|
119
|
+
bg: "var(--color-purple)",
|
|
120
|
+
fg: "var(--color-purple-darker)"
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** Provider glyph for a connection: GitHub / GitLab, Git for anything else. */
|
|
125
|
+
var connectionIcon = function connectionIcon(service) {
|
|
126
|
+
if (service === "github") {
|
|
127
|
+
return _Icons.GitHubIcon;
|
|
128
|
+
}
|
|
129
|
+
if (service === "gitlab") {
|
|
130
|
+
return _Icons.GitLabIcon;
|
|
131
|
+
}
|
|
132
|
+
return _Icons.GitIcon;
|
|
133
|
+
};
|
|
134
|
+
var StatusChip = function StatusChip(_ref) {
|
|
135
|
+
var status = _ref.status;
|
|
136
|
+
var _STATUS_COLORS$status = STATUS_COLORS[status],
|
|
137
|
+
bg = _STATUS_COLORS$status.bg,
|
|
138
|
+
fg = _STATUS_COLORS$status.fg;
|
|
139
|
+
return /*#__PURE__*/_react.default.createElement(_Chip.Chip, {
|
|
140
|
+
label: STATUS_LABELS[status],
|
|
141
|
+
backgroundColor: bg,
|
|
142
|
+
color: fg,
|
|
143
|
+
typographyProps: {
|
|
144
|
+
variant: "Caption 1",
|
|
145
|
+
weight: "medium"
|
|
146
|
+
},
|
|
147
|
+
style: {
|
|
148
|
+
borderRadius: 6
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/* --- Mock log data (newest first is enforced by sorting on receivedAt) --- */
|
|
154
|
+
|
|
155
|
+
var PAYLOAD_ISSUE_OPENED = JSON.stringify({
|
|
156
|
+
action: "opened",
|
|
157
|
+
issue: {
|
|
158
|
+
id: 2002934201,
|
|
159
|
+
number: 42,
|
|
160
|
+
title: "Webhook delivery retries are not logged",
|
|
161
|
+
state: "open",
|
|
162
|
+
html_url: "https://github.com/activecollab/feather/issues/42",
|
|
163
|
+
labels: [{
|
|
164
|
+
name: "bug"
|
|
165
|
+
}, {
|
|
166
|
+
name: "vcs"
|
|
167
|
+
}],
|
|
168
|
+
user: {
|
|
169
|
+
login: "octocat",
|
|
170
|
+
id: 583231
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
repository: {
|
|
174
|
+
id: 776611234,
|
|
175
|
+
full_name: "activecollab/feather",
|
|
176
|
+
private: true
|
|
177
|
+
},
|
|
178
|
+
sender: {
|
|
179
|
+
login: "octocat",
|
|
180
|
+
id: 583231
|
|
181
|
+
}
|
|
182
|
+
}, null, 2);
|
|
183
|
+
var PAYLOAD_MERGE_REQUEST = JSON.stringify({
|
|
184
|
+
object_kind: "merge_request",
|
|
185
|
+
event_type: "merge_request",
|
|
186
|
+
user: {
|
|
187
|
+
id: 41,
|
|
188
|
+
name: "Jane Doe",
|
|
189
|
+
username: "jdoe"
|
|
190
|
+
},
|
|
191
|
+
project: {
|
|
192
|
+
id: 1801,
|
|
193
|
+
path_with_namespace: "content/handbook"
|
|
194
|
+
},
|
|
195
|
+
object_attributes: {
|
|
196
|
+
iid: 318,
|
|
197
|
+
title: "Add changelog for 8.2",
|
|
198
|
+
state: "merged",
|
|
199
|
+
action: "merge",
|
|
200
|
+
source_branch: "changelog-8-2",
|
|
201
|
+
target_branch: "main"
|
|
202
|
+
}
|
|
203
|
+
}, null, 2);
|
|
204
|
+
var PAYLOAD_PUSH = JSON.stringify({
|
|
205
|
+
ref: "refs/heads/main",
|
|
206
|
+
before: "9b2c1f0e",
|
|
207
|
+
after: "f4a7d3c1",
|
|
208
|
+
commits: [{
|
|
209
|
+
id: "f4a7d3c1",
|
|
210
|
+
message: "Fix typo in webhook log repository",
|
|
211
|
+
author: {
|
|
212
|
+
name: "Marko",
|
|
213
|
+
email: "marko@example.com"
|
|
214
|
+
}
|
|
215
|
+
}],
|
|
216
|
+
repository: {
|
|
217
|
+
full_name: "activecollab/feather"
|
|
218
|
+
}
|
|
219
|
+
}, null, 2);
|
|
220
|
+
var WEBHOOK_LOGS = [{
|
|
221
|
+
id: "log-7",
|
|
222
|
+
connectionId: "gh-activecollab",
|
|
223
|
+
eventKind: "issue",
|
|
224
|
+
status: "processed",
|
|
225
|
+
deliveryIdentifier: "d3b07384-d9a0-4c9b-8f1e-2a6f1b9c4e21",
|
|
226
|
+
outcomes: ["Created task #1842 from issue #42"],
|
|
227
|
+
payload: PAYLOAD_ISSUE_OPENED,
|
|
228
|
+
receivedOn: "Jun 29, 2026 · 14:32",
|
|
229
|
+
receivedAt: 1751207520
|
|
230
|
+
}, {
|
|
231
|
+
id: "log-6",
|
|
232
|
+
connectionId: "gl-content",
|
|
233
|
+
eventKind: "merge_request",
|
|
234
|
+
status: "skipped",
|
|
235
|
+
deliveryIdentifier: "b1946ac9-2f3a-4c0d-9b7e-1d2c3e4f5a6b",
|
|
236
|
+
outcomes: ["Skipped: merge request has no linked issue"],
|
|
237
|
+
payload: PAYLOAD_MERGE_REQUEST,
|
|
238
|
+
receivedOn: "Jun 29, 2026 · 11:08",
|
|
239
|
+
receivedAt: 1751195280
|
|
240
|
+
}, {
|
|
241
|
+
id: "log-5",
|
|
242
|
+
connectionId: "gh-activecollab",
|
|
243
|
+
eventKind: "issue",
|
|
244
|
+
status: "failed",
|
|
245
|
+
deliveryIdentifier: "9c1185a5-c5e9-4e3f-8a1b-7d6e5f4c3b2a",
|
|
246
|
+
outcomes: ["Failed at task creation: project not found"],
|
|
247
|
+
payload: PAYLOAD_ISSUE_OPENED,
|
|
248
|
+
receivedOn: "Jun 28, 2026 · 18:54",
|
|
249
|
+
receivedAt: 1751136840
|
|
250
|
+
}, {
|
|
251
|
+
id: "log-4",
|
|
252
|
+
connectionId: "gl-content",
|
|
253
|
+
eventKind: "push",
|
|
254
|
+
status: "processed",
|
|
255
|
+
deliveryIdentifier: "f7c3bc1d-8c5a-4b2e-9f0a-1b2c3d4e5f60",
|
|
256
|
+
outcomes: ["Created task #1839 from issue #311", "Created task #1840 from issue #312"],
|
|
257
|
+
payload: PAYLOAD_PUSH,
|
|
258
|
+
receivedOn: "Jun 28, 2026 · 09:21",
|
|
259
|
+
receivedAt: 1751102460
|
|
260
|
+
}, {
|
|
261
|
+
id: "log-3",
|
|
262
|
+
connectionId: "gh-activecollab",
|
|
263
|
+
eventKind: "ping",
|
|
264
|
+
status: "unhandled",
|
|
265
|
+
deliveryIdentifier: "1574bddb-75c3-4b1e-8a9c-0d1e2f3a4b5c",
|
|
266
|
+
outcomes: [],
|
|
267
|
+
payload: JSON.stringify({
|
|
268
|
+
zen: "Keep it logically awesome.",
|
|
269
|
+
hook_id: 552012
|
|
270
|
+
}, null, 2),
|
|
271
|
+
receivedOn: "Jun 27, 2026 · 16:05",
|
|
272
|
+
receivedAt: 1751040300
|
|
273
|
+
}, {
|
|
274
|
+
id: "log-2",
|
|
275
|
+
connectionId: "gl-content",
|
|
276
|
+
eventKind: "issue",
|
|
277
|
+
status: "received",
|
|
278
|
+
deliveryIdentifier: "0716d970-2b9e-4a1d-9c3f-5e6a7b8c9d01",
|
|
279
|
+
outcomes: [],
|
|
280
|
+
receivedOn: "Jun 27, 2026 · 08:47",
|
|
281
|
+
receivedAt: 1751013420
|
|
282
|
+
}, {
|
|
283
|
+
id: "log-1",
|
|
284
|
+
connectionId: "gh-activecollab",
|
|
285
|
+
eventKind: "issue",
|
|
286
|
+
status: "processed",
|
|
287
|
+
deliveryIdentifier: "fa3ebd6742c360b2d9652b7f78d9bd7d",
|
|
288
|
+
outcomes: ["Created task #1804 from issue #29"],
|
|
289
|
+
payload: PAYLOAD_ISSUE_OPENED,
|
|
290
|
+
receivedOn: "Jun 26, 2026 · 13:12",
|
|
291
|
+
receivedAt: 1750943520
|
|
292
|
+
}, {
|
|
293
|
+
id: "log-1-replay",
|
|
294
|
+
connectionId: "gh-activecollab",
|
|
295
|
+
eventKind: "issue",
|
|
296
|
+
status: "duplicate",
|
|
297
|
+
deliveryIdentifier: "fa3ebd6742c360b2d9652b7f78d9bd7d",
|
|
298
|
+
outcomes: [],
|
|
299
|
+
payload: PAYLOAD_ISSUE_OPENED,
|
|
300
|
+
receivedOn: "Jun 26, 2026 · 13:18",
|
|
301
|
+
receivedAt: 1750943880
|
|
302
|
+
}];
|
|
303
|
+
|
|
304
|
+
/* --- Lightweight, Prism-style JSON syntax highlighter -------------------- */
|
|
305
|
+
/* design-system has no `prismjs` dependency (it's an app dependency), so for */
|
|
306
|
+
/* this throwaway mock we tokenize JSON ourselves and colour the tokens with */
|
|
307
|
+
/* the same token classes Prism uses, styled via PayloadPre below. */
|
|
308
|
+
|
|
309
|
+
var escapeHtml = function escapeHtml(value) {
|
|
310
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
311
|
+
};
|
|
312
|
+
var highlightJson = function highlightJson(json) {
|
|
313
|
+
return escapeHtml(json).replace(/("(?:\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(?:true|false)\b|\bnull\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g, function (match) {
|
|
314
|
+
var cls = "tok-number";
|
|
315
|
+
if (/^"/.test(match)) {
|
|
316
|
+
cls = /:$/.test(match) ? "tok-key" : "tok-string";
|
|
317
|
+
} else if (/true|false/.test(match)) {
|
|
318
|
+
cls = "tok-boolean";
|
|
319
|
+
} else if (/null/.test(match)) {
|
|
320
|
+
cls = "tok-null";
|
|
321
|
+
}
|
|
322
|
+
return "<span class=\"".concat(cls, "\">").concat(match, "</span>");
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
var PAYLOAD_COLLAPSED_LINES = 6;
|
|
326
|
+
var PayloadPre = _styledComponents.default.pre.withConfig({
|
|
327
|
+
displayName: "WebhookLogsDialog__PayloadPre",
|
|
328
|
+
componentId: "sc-6ol7f6-0"
|
|
329
|
+
})(["margin:0;padding:12px 14px;border:1px solid var(--color-theme-400);border-radius:6px;background-color:var(--color-theme-200);color:var(--color-theme-800);font-family:\"SFMono-Regular\",Consolas,\"Liberation Mono\",Menlo,monospace;font-size:12px;line-height:18px;overflow-x:auto;white-space:pre;position:relative;", " .tok-key{color:var(--color-coral-lighter);}.tok-string{color:var(--color-green-pale-lighter);}.tok-number{color:var(--color-orange-lighter);}.tok-boolean{color:var(--color-blue-sky-lighter);}.tok-null{color:var(--color-purple-lighter);}"], function (_ref2) {
|
|
330
|
+
var $collapsed = _ref2.$collapsed;
|
|
331
|
+
return $collapsed ? "max-height: ".concat(PAYLOAD_COLLAPSED_LINES * 18 + 24, "px;\n overflow-y: hidden;") : "";
|
|
332
|
+
});
|
|
333
|
+
var PayloadWrap = _styledComponents.default.div.withConfig({
|
|
334
|
+
displayName: "WebhookLogsDialog__PayloadWrap",
|
|
335
|
+
componentId: "sc-6ol7f6-1"
|
|
336
|
+
})([".payload-toggle{display:flex;justify-content:flex-end;min-height:24px;margin-bottom:4px;}"]);
|
|
337
|
+
var PayloadBlock = function PayloadBlock(_ref3) {
|
|
338
|
+
var payload = _ref3.payload;
|
|
339
|
+
var _useState = (0, _react.useState)(true),
|
|
340
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
341
|
+
collapsed = _useState2[0],
|
|
342
|
+
setCollapsed = _useState2[1];
|
|
343
|
+
var lineCount = (0, _react.useMemo)(function () {
|
|
344
|
+
return payload.split("\n").length;
|
|
345
|
+
}, [payload]);
|
|
346
|
+
var html = (0, _react.useMemo)(function () {
|
|
347
|
+
return highlightJson(payload);
|
|
348
|
+
}, [payload]);
|
|
349
|
+
var canToggle = lineCount > PAYLOAD_COLLAPSED_LINES;
|
|
350
|
+
return /*#__PURE__*/_react.default.createElement(PayloadWrap, null, canToggle ? /*#__PURE__*/_react.default.createElement("div", {
|
|
351
|
+
className: "payload-toggle"
|
|
352
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.Button, {
|
|
353
|
+
variant: "text colored",
|
|
354
|
+
size: "small",
|
|
355
|
+
onClick: function onClick() {
|
|
356
|
+
return setCollapsed(function (value) {
|
|
357
|
+
return !value;
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}, collapsed ? "Show More" : "Show Less")) : null, /*#__PURE__*/_react.default.createElement(PayloadPre, {
|
|
361
|
+
$collapsed: collapsed && canToggle,
|
|
362
|
+
dangerouslySetInnerHTML: {
|
|
363
|
+
__html: html
|
|
364
|
+
}
|
|
365
|
+
}));
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
/* --- A single, expandable log row ---------------------------------------- */
|
|
369
|
+
|
|
370
|
+
var LogRowWrap = _styledComponents.default.div.withConfig({
|
|
371
|
+
displayName: "WebhookLogsDialog__LogRowWrap",
|
|
372
|
+
componentId: "sc-6ol7f6-2"
|
|
373
|
+
})(["border-top:1px solid var(--color-theme-300);.lr-summary{box-sizing:border-box;display:flex;align-items:center;gap:12px;width:100%;min-height:56px;padding:8px 8px 8px 12px;background:none;border:0;text-align:left;cursor:pointer;font-family:inherit;&:hover{background-color:var(--color-theme-200);}}.lr-expand{flex-shrink:0;color:var(--color-theme-600);transform:rotate(90deg);transition:transform 150ms ease;}.lr-expand.open{transform:rotate(180deg);}.lr-conn{display:flex;align-items:center;gap:8px;width:180px;min-width:0;flex-shrink:0;}.lr-conn svg{width:20px;height:20px;flex-shrink:0;}.lr-conn .lr-conn-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}.lr-event{flex:1 1 0%;min-width:0;}.lr-status{flex-shrink:0;}.lr-outcomes{width:96px;flex-shrink:0;text-align:right;}.lr-detail{padding:4px 16px 20px 44px;display:flex;flex-direction:column;gap:16px;}.lr-field-label{display:block;margin-bottom:4px;}.lr-id{font-family:\"SFMono-Regular\",Consolas,\"Liberation Mono\",Menlo,monospace;word-break:break-all;}.lr-outcome-list{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:4px;}"]);
|
|
374
|
+
var LogRow = function LogRow(_ref4) {
|
|
375
|
+
var _connection$name;
|
|
376
|
+
var log = _ref4.log,
|
|
377
|
+
connection = _ref4.connection;
|
|
378
|
+
var _useState3 = (0, _react.useState)(false),
|
|
379
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
380
|
+
open = _useState4[0],
|
|
381
|
+
setOpen = _useState4[1];
|
|
382
|
+
var ConnIcon = connectionIcon(connection === null || connection === void 0 ? void 0 : connection.service);
|
|
383
|
+
return /*#__PURE__*/_react.default.createElement(LogRowWrap, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
384
|
+
type: "button",
|
|
385
|
+
className: "lr-summary",
|
|
386
|
+
"aria-expanded": open,
|
|
387
|
+
onClick: function onClick() {
|
|
388
|
+
return setOpen(function (value) {
|
|
389
|
+
return !value;
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}, /*#__PURE__*/_react.default.createElement(_Icons.CollapseExpandSingleIcon, {
|
|
393
|
+
className: open ? "lr-expand open" : "lr-expand"
|
|
394
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
395
|
+
className: "lr-conn"
|
|
396
|
+
}, /*#__PURE__*/_react.default.createElement(ConnIcon, null), /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
397
|
+
className: "lr-conn-name",
|
|
398
|
+
weight: "bold"
|
|
399
|
+
}, (_connection$name = connection === null || connection === void 0 ? void 0 : connection.name) !== null && _connection$name !== void 0 ? _connection$name : "Unknown")), /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
400
|
+
className: "lr-event",
|
|
401
|
+
color: "tertiary"
|
|
402
|
+
}, EVENT_KIND_LABELS[log.eventKind]), /*#__PURE__*/_react.default.createElement("span", {
|
|
403
|
+
className: "lr-status"
|
|
404
|
+
}, /*#__PURE__*/_react.default.createElement(StatusChip, {
|
|
405
|
+
status: log.status
|
|
406
|
+
})), /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
|
|
407
|
+
className: "lr-outcomes",
|
|
408
|
+
color: "tertiary"
|
|
409
|
+
}, log.outcomes.length > 0 ? "".concat(log.outcomes.length, " ").concat(log.outcomes.length === 1 ? "outcome" : "outcomes") : "")), open ? /*#__PURE__*/_react.default.createElement("div", {
|
|
410
|
+
className: "lr-detail"
|
|
411
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
|
|
412
|
+
className: "lr-field-label",
|
|
413
|
+
color: "secondary",
|
|
414
|
+
weight: "bold"
|
|
415
|
+
}, "Webhook identifier"), /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
416
|
+
className: "lr-id",
|
|
417
|
+
color: "tertiary"
|
|
418
|
+
}, log.deliveryIdentifier)), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
|
|
419
|
+
className: "lr-field-label",
|
|
420
|
+
color: "secondary",
|
|
421
|
+
weight: "bold"
|
|
422
|
+
}, "Outcomes"), log.outcomes.length > 0 ? /*#__PURE__*/_react.default.createElement("ul", {
|
|
423
|
+
className: "lr-outcome-list"
|
|
424
|
+
}, log.outcomes.map(function (outcome, index) {
|
|
425
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
426
|
+
key: index
|
|
427
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
428
|
+
color: "tertiary"
|
|
429
|
+
}, outcome));
|
|
430
|
+
})) : /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
431
|
+
color: "tertiary"
|
|
432
|
+
}, "No outcomes were recorded for this webhook.")), log.payload ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
|
|
433
|
+
className: "lr-field-label",
|
|
434
|
+
color: "secondary",
|
|
435
|
+
weight: "bold"
|
|
436
|
+
}, "Payload"), /*#__PURE__*/_react.default.createElement(PayloadBlock, {
|
|
437
|
+
payload: log.payload
|
|
438
|
+
})) : null) : null);
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
/* --- The dialog ---------------------------------------------------------- */
|
|
442
|
+
|
|
443
|
+
/** Wider than the default 540px dialog so the log columns have room. */
|
|
444
|
+
var WebhookLogsDialogStyled = (0, _styledComponents.default)(_Dialog.Dialog).withConfig({
|
|
445
|
+
displayName: "WebhookLogsDialog__WebhookLogsDialogStyled",
|
|
446
|
+
componentId: "sc-6ol7f6-3"
|
|
447
|
+
})(["&&{width:calc(100vw - 64px);max-width:760px;}"]);
|
|
448
|
+
var DialogTitleBar = _styledComponents.default.div.withConfig({
|
|
449
|
+
displayName: "WebhookLogsDialog__DialogTitleBar",
|
|
450
|
+
componentId: "sc-6ol7f6-4"
|
|
451
|
+
})(["display:flex;align-items:center;justify-content:space-between;gap:16px;.title-actions{display:flex;align-items:center;gap:8px;flex-shrink:0;}"]);
|
|
452
|
+
var LogListHeader = _styledComponents.default.div.withConfig({
|
|
453
|
+
displayName: "WebhookLogsDialog__LogListHeader",
|
|
454
|
+
componentId: "sc-6ol7f6-5"
|
|
455
|
+
})(["box-sizing:border-box;display:flex;align-items:center;gap:12px;padding:0 8px 8px 44px;.lh-conn{width:180px;flex-shrink:0;}.lh-event{flex:1 1 0%;min-width:0;}.lh-status{width:96px;flex-shrink:0;}.lh-outcomes{width:96px;flex-shrink:0;text-align:right;}"]);
|
|
456
|
+
var EmptyLogs = _styledComponents.default.div.withConfig({
|
|
457
|
+
displayName: "WebhookLogsDialog__EmptyLogs",
|
|
458
|
+
componentId: "sc-6ol7f6-6"
|
|
459
|
+
})(["padding:40px 0;text-align:center;"]);
|
|
460
|
+
var WebhookLogsDialog = exports.WebhookLogsDialog = function WebhookLogsDialog(_ref5) {
|
|
461
|
+
var open = _ref5.open,
|
|
462
|
+
onClose = _ref5.onClose,
|
|
463
|
+
initialConnectionId = _ref5.initialConnectionId,
|
|
464
|
+
connectionIds = _ref5.connectionIds;
|
|
465
|
+
var _useState5 = (0, _react.useState)(function () {
|
|
466
|
+
if (connectionIds && connectionIds.length > 0) {
|
|
467
|
+
return {
|
|
468
|
+
connection: connectionIds
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
if (initialConnectionId) {
|
|
472
|
+
return {
|
|
473
|
+
connection: [initialConnectionId]
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
return {};
|
|
477
|
+
}),
|
|
478
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
479
|
+
filters = _useState6[0],
|
|
480
|
+
setFilters = _useState6[1];
|
|
481
|
+
var connectionsById = (0, _react.useMemo)(function () {
|
|
482
|
+
var map = {};
|
|
483
|
+
WEBHOOK_CONNECTIONS.forEach(function (connection) {
|
|
484
|
+
map[connection.id] = connection;
|
|
485
|
+
});
|
|
486
|
+
return map;
|
|
487
|
+
}, []);
|
|
488
|
+
var filterData = (0, _react.useMemo)(function () {
|
|
489
|
+
return [{
|
|
490
|
+
id: "connection",
|
|
491
|
+
title: "Connection",
|
|
492
|
+
submenu: WEBHOOK_CONNECTIONS.map(function (connection) {
|
|
493
|
+
return {
|
|
494
|
+
id: connection.id,
|
|
495
|
+
name: connection.name
|
|
496
|
+
};
|
|
497
|
+
})
|
|
498
|
+
}, {
|
|
499
|
+
id: "event_type",
|
|
500
|
+
title: "Event Type",
|
|
501
|
+
submenu: Array.from(new Set(WEBHOOK_LOGS.map(function (log) {
|
|
502
|
+
return log.eventKind;
|
|
503
|
+
}))).map(function (eventKind) {
|
|
504
|
+
return {
|
|
505
|
+
id: eventKind,
|
|
506
|
+
name: EVENT_KIND_LABELS[eventKind]
|
|
507
|
+
};
|
|
508
|
+
})
|
|
509
|
+
}, {
|
|
510
|
+
id: "status",
|
|
511
|
+
title: "Processing Status",
|
|
512
|
+
submenu: Object.keys(STATUS_LABELS).map(function (status) {
|
|
513
|
+
return {
|
|
514
|
+
id: status,
|
|
515
|
+
name: STATUS_LABELS[status]
|
|
516
|
+
};
|
|
517
|
+
})
|
|
518
|
+
}];
|
|
519
|
+
}, []);
|
|
520
|
+
var visibleLogs = (0, _react.useMemo)(function () {
|
|
521
|
+
var _filters$connection, _filters$event_type, _filters$status;
|
|
522
|
+
var byConnection = (_filters$connection = filters.connection) !== null && _filters$connection !== void 0 ? _filters$connection : [];
|
|
523
|
+
var byEvent = (_filters$event_type = filters.event_type) !== null && _filters$event_type !== void 0 ? _filters$event_type : [];
|
|
524
|
+
var byStatus = (_filters$status = filters.status) !== null && _filters$status !== void 0 ? _filters$status : [];
|
|
525
|
+
return WEBHOOK_LOGS.filter(function (log) {
|
|
526
|
+
if (byConnection.length && !byConnection.includes(log.connectionId)) {
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
529
|
+
if (byEvent.length && !byEvent.includes(log.eventKind)) {
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
if (byStatus.length && !byStatus.includes(log.status)) {
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
return true;
|
|
536
|
+
}).sort(function (a, b) {
|
|
537
|
+
return b.receivedAt - a.receivedAt;
|
|
538
|
+
});
|
|
539
|
+
}, [filters]);
|
|
540
|
+
return /*#__PURE__*/_react.default.createElement(WebhookLogsDialogStyled, {
|
|
541
|
+
open: open,
|
|
542
|
+
onClose: onClose,
|
|
543
|
+
enableBackgroundClick: true
|
|
544
|
+
}, /*#__PURE__*/_react.default.createElement(_Dialog.Dialog.Title, {
|
|
545
|
+
disableDefaultHeading: true
|
|
546
|
+
}, /*#__PURE__*/_react.default.createElement(DialogTitleBar, null, /*#__PURE__*/_react.default.createElement(_Typography.Header3, null, "Webhook Logs"), /*#__PURE__*/_react.default.createElement("div", {
|
|
547
|
+
className: "title-actions"
|
|
548
|
+
}, /*#__PURE__*/_react.default.createElement(_Filter.Filter, {
|
|
549
|
+
data: filterData,
|
|
550
|
+
selected: filters,
|
|
551
|
+
label: "Filter",
|
|
552
|
+
clearAllText: "Clear All",
|
|
553
|
+
noResultText: "No results",
|
|
554
|
+
emptyFilterText: "No filters to show",
|
|
555
|
+
onChange: setFilters
|
|
556
|
+
}), /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
|
|
557
|
+
variant: "text gray",
|
|
558
|
+
onClick: onClose
|
|
559
|
+
}, /*#__PURE__*/_react.default.createElement(_Icons.CancelCrossIcon, null))))), /*#__PURE__*/_react.default.createElement(_Dialog.Dialog.ContentDivider, null), /*#__PURE__*/_react.default.createElement(_Dialog.Dialog.Content, null, visibleLogs.length > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(LogListHeader, null, /*#__PURE__*/_react.default.createElement(_Typography.Caption2, {
|
|
560
|
+
className: "lh-conn",
|
|
561
|
+
color: "secondary",
|
|
562
|
+
weight: "bold"
|
|
563
|
+
}, "CONNECTION"), /*#__PURE__*/_react.default.createElement(_Typography.Caption2, {
|
|
564
|
+
className: "lh-event",
|
|
565
|
+
color: "secondary",
|
|
566
|
+
weight: "bold"
|
|
567
|
+
}, "EVENT TYPE"), /*#__PURE__*/_react.default.createElement(_Typography.Caption2, {
|
|
568
|
+
className: "lh-status",
|
|
569
|
+
color: "secondary",
|
|
570
|
+
weight: "bold"
|
|
571
|
+
}, "STATUS"), /*#__PURE__*/_react.default.createElement(_Typography.Caption2, {
|
|
572
|
+
className: "lh-outcomes",
|
|
573
|
+
color: "secondary",
|
|
574
|
+
weight: "bold"
|
|
575
|
+
}, "OUTCOMES")), visibleLogs.map(function (log) {
|
|
576
|
+
return /*#__PURE__*/_react.default.createElement(LogRow, {
|
|
577
|
+
key: log.id,
|
|
578
|
+
log: log,
|
|
579
|
+
connection: connectionsById[log.connectionId]
|
|
580
|
+
});
|
|
581
|
+
})) : /*#__PURE__*/_react.default.createElement(EmptyLogs, null, /*#__PURE__*/_react.default.createElement(_Typography.Body2, {
|
|
582
|
+
color: "tertiary"
|
|
583
|
+
}, "No webhook logs match the selected filters."))));
|
|
584
|
+
};
|
|
585
|
+
//# sourceMappingURL=WebhookLogsDialog.js.map
|