@corsair-dev/ui 0.1.1 → 0.1.3
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/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +265 -156
- package/dist/permissions.d.ts +1 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/plugins/base.d.ts +1 -1
- package/dist/plugins/base.d.ts.map +1 -1
- package/dist/plugins/cal/bookings-create.d.ts +1 -1
- package/dist/plugins/cal/bookings-create.d.ts.map +1 -1
- package/dist/plugins/gmail/messages-send.d.ts +8 -1
- package/dist/plugins/gmail/messages-send.d.ts.map +1 -1
- package/dist/plugins/googlecalendar/events-create.d.ts +1 -1
- package/dist/plugins/googlecalendar/events-create.d.ts.map +1 -1
- package/dist/plugins/linear/issues-create.d.ts +1 -1
- package/dist/plugins/linear/issues-create.d.ts.map +1 -1
- package/dist/plugins/slack/messages-post.d.ts +1 -1
- package/dist/plugins/slack/messages-post.d.ts.map +1 -1
- package/dist/shared.d.ts +2 -2
- package/dist/shared.d.ts.map +1 -1
- package/dist/snippets.d.ts +9 -0
- package/dist/snippets.d.ts.map +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -2
- package/src/index.ts +3 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -79,6 +79,12 @@ function statusBannerHtml(status) {
|
|
|
79
79
|
if (status === "denied") {
|
|
80
80
|
return `<div style="padding:10px 14px;border-radius:6px;background:#7f1d1d;color:#ef4444;font-size:13px;font-weight:600;margin-bottom:16px;text-align:center">This permission has been denied.</div>`;
|
|
81
81
|
}
|
|
82
|
+
if (status === "expired") {
|
|
83
|
+
return `<div style="padding:10px 14px;border-radius:6px;background:#1c1917;color:#a8a29e;font-size:13px;font-weight:600;margin-bottom:16px;text-align:center">This request has expired.</div>`;
|
|
84
|
+
}
|
|
85
|
+
if (status === "failed") {
|
|
86
|
+
return `<div style="padding:10px 14px;border-radius:6px;background:#7f1d1d;color:#fca5a5;font-size:13px;font-weight:600;margin-bottom:16px;text-align:center">This request failed.</div>`;
|
|
87
|
+
}
|
|
82
88
|
return "";
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -125,62 +131,72 @@ function renderBase(permission, onApproval, onDenial) {
|
|
|
125
131
|
</html>`;
|
|
126
132
|
}
|
|
127
133
|
|
|
128
|
-
// src/plugins/
|
|
129
|
-
function
|
|
134
|
+
// src/plugins/cal/bookings-create.ts
|
|
135
|
+
function renderCalBookingsCreate(permission, onApproval, onDenial) {
|
|
130
136
|
const actions = buildActionDescriptors(permission, onApproval, onDenial);
|
|
131
137
|
const status = permission.status ?? "pending";
|
|
132
138
|
const args = parseArgs(permission);
|
|
133
139
|
const ts = formatTimestamp(permission.created_at);
|
|
134
|
-
const
|
|
135
|
-
const text = args.text ?? null;
|
|
136
|
-
const threadTs = args.thread_ts ?? null;
|
|
137
|
-
const replyBroadcast = args.reply_broadcast;
|
|
140
|
+
const startDisplay = args.start ? formatTimestamp(args.start) : "";
|
|
138
141
|
return `<!DOCTYPE html>
|
|
139
142
|
<html lang="en">
|
|
140
143
|
<head>
|
|
141
144
|
<meta charset="UTF-8" />
|
|
142
145
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
143
|
-
<title>Approve
|
|
146
|
+
<title>Approve Cal.com booking</title>
|
|
144
147
|
<style>
|
|
145
148
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
146
|
-
body { background: #
|
|
149
|
+
body { background: #0a0a0a; color: #e5e7eb; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 24px; }
|
|
147
150
|
</style>
|
|
148
151
|
</head>
|
|
149
152
|
<body>
|
|
150
|
-
<div style="width:100%;max-width:
|
|
153
|
+
<div style="width:100%;max-width:500px">
|
|
151
154
|
|
|
152
155
|
<!-- Header -->
|
|
153
156
|
<div style="display:flex;align-items:center;gap:10px;margin-bottom:20px">
|
|
154
|
-
<div style="width:32px;height:32px;border-radius:8px;background:#
|
|
157
|
+
<div style="width:32px;height:32px;border-radius:8px;background:#111827;border:1px solid #374151;display:flex;align-items:center;justify-content:center;font-size:18px">📅</div>
|
|
155
158
|
<div>
|
|
156
|
-
<div style="font-size:15px;font-weight:700;color:#f9fafb">Approve
|
|
157
|
-
<div style="font-size:12px;color:#6b7280">Review before
|
|
159
|
+
<div style="font-size:15px;font-weight:700;color:#f9fafb">Approve Cal.com booking</div>
|
|
160
|
+
<div style="font-size:12px;color:#6b7280">Review the booking details before creating it</div>
|
|
158
161
|
</div>
|
|
159
162
|
<div style="margin-left:auto">
|
|
160
|
-
<span style="background:#
|
|
163
|
+
<span style="background:#111827;border:1px solid #374151;color:#e5e7eb;font-size:11px;font-weight:700;padding:3px 10px;border-radius:999px;text-transform:uppercase">Cal.com</span>
|
|
161
164
|
</div>
|
|
162
165
|
</div>
|
|
163
166
|
|
|
164
167
|
${statusBannerHtml(status)}
|
|
165
168
|
|
|
166
|
-
<!--
|
|
167
|
-
|
|
169
|
+
<!-- Booking card -->
|
|
170
|
+
<div style="background:#111111;border:1px solid #1f1f1f;border-radius:10px;overflow:hidden;margin-bottom:20px">
|
|
168
171
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
<div style="font-size:13px;font-weight:700;color:#f9fafb;margin-bottom:4px">Agent</div>
|
|
175
|
-
<div style="font-size:14px;color:#d1d2d3;line-height:1.6;white-space:pre-wrap;word-break:break-word">${escapeHtml(text)}</div>
|
|
176
|
-
</div>
|
|
172
|
+
<!-- Event type + time -->
|
|
173
|
+
<div style="border-left:4px solid #6366f1;padding:16px 18px;border-bottom:1px solid #1f1f1f">
|
|
174
|
+
<div style="font-size:11px;color:#6b7280;text-transform:uppercase;letter-spacing:0.05em;margin-bottom:4px">Event type ID: ${escapeHtml(String(args.eventTypeId))}</div>
|
|
175
|
+
${startDisplay ? `<div style="font-size:18px;font-weight:700;color:#f9fafb">${escapeHtml(startDisplay)}</div>` : ""}
|
|
176
|
+
${args.lengthInMinutes ? `<div style="font-size:13px;color:#6b7280;margin-top:4px">${escapeHtml(String(args.lengthInMinutes))} minutes</div>` : ""}
|
|
177
177
|
</div>
|
|
178
|
-
</div>` : ""}
|
|
179
178
|
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
<!-- Attendee -->
|
|
180
|
+
<div style="padding:14px 18px;display:flex;flex-direction:column;gap:12px">
|
|
182
181
|
|
|
183
|
-
|
|
182
|
+
<div style="display:flex;align-items:flex-start;gap:10px">
|
|
183
|
+
<span style="font-size:16px;width:20px;flex-shrink:0">👤</span>
|
|
184
|
+
<div style="font-size:13px;color:#d1d5db">
|
|
185
|
+
<div style="font-weight:600">${escapeHtml(args.attendee.name)}</div>
|
|
186
|
+
<div style="color:#6b7280">${escapeHtml(args.attendee.email)}</div>
|
|
187
|
+
<div style="color:#6b7280;font-size:12px">${escapeHtml(args.attendee.timeZone)}</div>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
${args.meetingUrl ? `<div style="display:flex;align-items:flex-start;gap:10px">
|
|
192
|
+
<span style="font-size:16px;width:20px;flex-shrink:0">💻</span>
|
|
193
|
+
<div style="font-size:13px;color:#d1d5db">${escapeHtml(args.meetingUrl)}</div>
|
|
194
|
+
</div>` : ""}
|
|
195
|
+
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
${ts ? `<p style="font-size:11px;color:#475569;margin-bottom:16px">Requested ${escapeHtml(ts)}</p>` : ""}
|
|
184
200
|
|
|
185
201
|
${actionsHtml(status, actions)}
|
|
186
202
|
</div>
|
|
@@ -189,32 +205,99 @@ function renderSlackMessagesPost(permission, onApproval, onDenial) {
|
|
|
189
205
|
}
|
|
190
206
|
|
|
191
207
|
// src/plugins/gmail/messages-send.ts
|
|
208
|
+
function decodeMimeWord(str) {
|
|
209
|
+
return str.replace(
|
|
210
|
+
/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g,
|
|
211
|
+
(_full, _charset, encoding, text) => {
|
|
212
|
+
try {
|
|
213
|
+
if (encoding.toUpperCase() === "B") {
|
|
214
|
+
return Buffer.from(text, "base64").toString("utf-8");
|
|
215
|
+
}
|
|
216
|
+
return text.replace(/_/g, " ").replace(
|
|
217
|
+
/=([0-9A-Fa-f]{2})/g,
|
|
218
|
+
(_m, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
219
|
+
);
|
|
220
|
+
} catch {
|
|
221
|
+
return text;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
function decodeTransferEncoding(body, encoding) {
|
|
227
|
+
const enc = encoding.toLowerCase().trim();
|
|
228
|
+
if (enc === "base64") {
|
|
229
|
+
try {
|
|
230
|
+
return Buffer.from(body.replace(/\s/g, ""), "base64").toString("utf-8");
|
|
231
|
+
} catch {
|
|
232
|
+
return body;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (enc === "quoted-printable") {
|
|
236
|
+
return body.replace(/=\r?\n/g, "").replace(
|
|
237
|
+
/=([0-9A-Fa-f]{2})/g,
|
|
238
|
+
(_m, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
return body;
|
|
242
|
+
}
|
|
243
|
+
function stripHtml(html) {
|
|
244
|
+
return html.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<[^>]+>/g, " ").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/\s+/g, " ").trim();
|
|
245
|
+
}
|
|
246
|
+
function extractFromMultipart(body, boundary) {
|
|
247
|
+
const escaped = boundary.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
248
|
+
const parts = body.split(new RegExp(`--${escaped}(?:--)?`));
|
|
249
|
+
for (const preferred of ["text/plain", "text/html"]) {
|
|
250
|
+
for (const part of parts) {
|
|
251
|
+
const sep = part.search(/\r?\n\r?\n/);
|
|
252
|
+
if (sep === -1) continue;
|
|
253
|
+
const partHeaders = part.slice(0, sep).toLowerCase();
|
|
254
|
+
if (!partHeaders.includes(preferred)) continue;
|
|
255
|
+
const partBody = part.slice(sep).replace(/^\r?\n\r?\n?/, "");
|
|
256
|
+
const encMatch = partHeaders.match(
|
|
257
|
+
/content-transfer-encoding:\s*([^\r\n]+)/
|
|
258
|
+
);
|
|
259
|
+
const text = decodeTransferEncoding(
|
|
260
|
+
partBody,
|
|
261
|
+
encMatch ? (encMatch?.[1] || "").trim() : ""
|
|
262
|
+
);
|
|
263
|
+
return preferred === "text/html" ? stripHtml(text) : text;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return body;
|
|
267
|
+
}
|
|
192
268
|
function parseRawEmail(raw) {
|
|
193
269
|
try {
|
|
194
270
|
const decoded = Buffer.from(raw, "base64url").toString("utf-8");
|
|
195
271
|
const sep = decoded.indexOf("\r\n\r\n") >= 0 ? "\r\n\r\n" : "\n\n";
|
|
196
272
|
const sepIdx = decoded.indexOf(sep);
|
|
197
273
|
const headerSection = sepIdx >= 0 ? decoded.slice(0, sepIdx) : decoded;
|
|
198
|
-
const
|
|
274
|
+
const bodyRaw = sepIdx >= 0 ? decoded.slice(sepIdx + sep.length) : "";
|
|
275
|
+
const unfolded = headerSection.replace(/\r?\n[ \t]+/g, " ");
|
|
199
276
|
const headers = {};
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (current) {
|
|
207
|
-
const colon = current.indexOf(":");
|
|
208
|
-
if (colon > 0) headers[current.slice(0, colon).toLowerCase().trim()] = current.slice(colon + 1).trim();
|
|
209
|
-
}
|
|
210
|
-
current = line;
|
|
277
|
+
for (const line of unfolded.split(/\r?\n/)) {
|
|
278
|
+
const colon = line.indexOf(":");
|
|
279
|
+
if (colon < 1) continue;
|
|
280
|
+
const key = line.slice(0, colon).trim().toLowerCase();
|
|
281
|
+
if (!headers[key]) {
|
|
282
|
+
headers[key] = decodeMimeWord(line.slice(colon + 1).trim());
|
|
211
283
|
}
|
|
212
284
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
285
|
+
const contentType = headers["content-type"] || "";
|
|
286
|
+
let body;
|
|
287
|
+
if (contentType.startsWith("multipart/")) {
|
|
288
|
+
const bm = contentType.match(/boundary="?([^";]+)"?/i);
|
|
289
|
+
if (bm) body = extractFromMultipart(bodyRaw, (bm?.[1] || "").trim());
|
|
290
|
+
} else {
|
|
291
|
+
const enc = headers["content-transfer-encoding"] || "";
|
|
292
|
+
const text = decodeTransferEncoding(bodyRaw, enc);
|
|
293
|
+
body = contentType.includes("text/html") ? stripHtml(text) : text;
|
|
216
294
|
}
|
|
217
|
-
return {
|
|
295
|
+
return {
|
|
296
|
+
to: headers["to"],
|
|
297
|
+
from: headers["from"],
|
|
298
|
+
subject: headers["subject"],
|
|
299
|
+
body: body?.trim() || void 0
|
|
300
|
+
};
|
|
218
301
|
} catch {
|
|
219
302
|
return {};
|
|
220
303
|
}
|
|
@@ -288,85 +371,6 @@ function renderGmailMessagesSend(permission, onApproval, onDenial) {
|
|
|
288
371
|
</html>`;
|
|
289
372
|
}
|
|
290
373
|
|
|
291
|
-
// src/plugins/linear/issues-create.ts
|
|
292
|
-
var priorityLabels = {
|
|
293
|
-
0: "No priority",
|
|
294
|
-
1: "🔥 Urgent",
|
|
295
|
-
2: "⬆️ High",
|
|
296
|
-
3: "➡️ Medium",
|
|
297
|
-
4: "⬇️ Low"
|
|
298
|
-
};
|
|
299
|
-
function chip(label, value) {
|
|
300
|
-
if (!value) return "";
|
|
301
|
-
return `<div style="display:inline-flex;align-items:center;gap:4px;background:#1e293b;border:1px solid #334155;border-radius:6px;padding:4px 10px;font-size:12px;color:#94a3b8">
|
|
302
|
-
<span style="color:#64748b">${escapeHtml(label)}</span>
|
|
303
|
-
<span style="color:#e2e8f0">${escapeHtml(value)}</span>
|
|
304
|
-
</div>`;
|
|
305
|
-
}
|
|
306
|
-
function renderLinearIssuesCreate(permission, onApproval, onDenial) {
|
|
307
|
-
const actions = buildActionDescriptors(permission, onApproval, onDenial);
|
|
308
|
-
const status = permission.status ?? "pending";
|
|
309
|
-
const args = parseArgs(permission);
|
|
310
|
-
const ts = formatTimestamp(permission.created_at);
|
|
311
|
-
const priorityLabel = args.priority != null ? priorityLabels[args.priority] : void 0;
|
|
312
|
-
return `<!DOCTYPE html>
|
|
313
|
-
<html lang="en">
|
|
314
|
-
<head>
|
|
315
|
-
<meta charset="UTF-8" />
|
|
316
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
317
|
-
<title>Approve Linear issue</title>
|
|
318
|
-
<style>
|
|
319
|
-
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
320
|
-
body { background: #0d0e11; color: #e5e7eb; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 24px; }
|
|
321
|
-
</style>
|
|
322
|
-
</head>
|
|
323
|
-
<body>
|
|
324
|
-
<div style="width:100%;max-width:540px">
|
|
325
|
-
|
|
326
|
-
<!-- Header -->
|
|
327
|
-
<div style="display:flex;align-items:center;gap:10px;margin-bottom:20px">
|
|
328
|
-
<div style="width:32px;height:32px;border-radius:8px;background:#5e6ad2;display:flex;align-items:center;justify-content:center;font-size:16px;font-weight:800;color:#fff;letter-spacing:-1px">L</div>
|
|
329
|
-
<div>
|
|
330
|
-
<div style="font-size:15px;font-weight:700;color:#f9fafb">Approve Linear issue</div>
|
|
331
|
-
<div style="font-size:12px;color:#6b7280">Review the issue details before creating it</div>
|
|
332
|
-
</div>
|
|
333
|
-
<div style="margin-left:auto">
|
|
334
|
-
<span style="background:#5e6ad2;color:#fff;font-size:11px;font-weight:700;padding:3px 10px;border-radius:999px;text-transform:uppercase">Linear</span>
|
|
335
|
-
</div>
|
|
336
|
-
</div>
|
|
337
|
-
|
|
338
|
-
${statusBannerHtml(status)}
|
|
339
|
-
|
|
340
|
-
<!-- Issue card -->
|
|
341
|
-
<div style="background:#141518;border:1px solid #1f2127;border-radius:10px;padding:20px;margin-bottom:20px">
|
|
342
|
-
|
|
343
|
-
<!-- Status dot + title -->
|
|
344
|
-
<div style="display:flex;align-items:flex-start;gap:10px;margin-bottom:14px">
|
|
345
|
-
<div style="width:16px;height:16px;border-radius:50%;border:2px solid #5e6ad2;flex-shrink:0;margin-top:3px"></div>
|
|
346
|
-
<h2 style="font-size:17px;font-weight:600;color:#f9fafb;line-height:1.4">${escapeHtml(args.title)}</h2>
|
|
347
|
-
</div>
|
|
348
|
-
|
|
349
|
-
<!-- Description -->
|
|
350
|
-
${args.description ? `<div style="font-size:14px;color:#9ca3af;line-height:1.7;margin-bottom:16px;padding-left:26px;white-space:pre-wrap;word-break:break-word">${escapeHtml(args.description)}</div>` : ""}
|
|
351
|
-
|
|
352
|
-
<!-- Meta chips -->
|
|
353
|
-
<div style="display:flex;flex-wrap:wrap;gap:8px;padding-left:26px">
|
|
354
|
-
${chip("Team", args.teamId)}
|
|
355
|
-
${chip("Assignee", args.assigneeId)}
|
|
356
|
-
${priorityLabel ? `<div style="display:inline-flex;align-items:center;gap:4px;background:#1e293b;border:1px solid #334155;border-radius:6px;padding:4px 10px;font-size:12px;color:#e2e8f0">${priorityLabel}</div>` : ""}
|
|
357
|
-
${chip("Status", args.stateId)}
|
|
358
|
-
${chip("Due", args.dueDate)}
|
|
359
|
-
</div>
|
|
360
|
-
</div>
|
|
361
|
-
|
|
362
|
-
${ts ? `<p style="font-size:11px;color:#475569;margin-bottom:16px">Requested ${escapeHtml(ts)}</p>` : ""}
|
|
363
|
-
|
|
364
|
-
${actionsHtml(status, actions)}
|
|
365
|
-
</div>
|
|
366
|
-
</body>
|
|
367
|
-
</html>`;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
374
|
// src/plugins/googlecalendar/events-create.ts
|
|
371
375
|
function formatEventDateTime(dt) {
|
|
372
376
|
if (!dt) return "";
|
|
@@ -376,7 +380,9 @@ function formatEventDateTime(dt) {
|
|
|
376
380
|
}
|
|
377
381
|
function formatAttendees(attendees) {
|
|
378
382
|
if (!attendees?.length) return "";
|
|
379
|
-
return attendees.map(
|
|
383
|
+
return attendees.map(
|
|
384
|
+
(a) => a.displayName ? `${a.displayName} <${a.email ?? ""}>` : a.email ?? ""
|
|
385
|
+
).join(", ");
|
|
380
386
|
}
|
|
381
387
|
function renderGoogleCalendarEventsCreate(permission, onApproval, onDenial) {
|
|
382
388
|
const actions = buildActionDescriptors(permission, onApproval, onDenial);
|
|
@@ -456,72 +462,141 @@ function renderGoogleCalendarEventsCreate(permission, onApproval, onDenial) {
|
|
|
456
462
|
</html>`;
|
|
457
463
|
}
|
|
458
464
|
|
|
459
|
-
// src/plugins/
|
|
460
|
-
|
|
465
|
+
// src/plugins/linear/issues-create.ts
|
|
466
|
+
var priorityLabels = {
|
|
467
|
+
0: "No priority",
|
|
468
|
+
1: "🔥 Urgent",
|
|
469
|
+
2: "⬆️ High",
|
|
470
|
+
3: "➡️ Medium",
|
|
471
|
+
4: "⬇️ Low"
|
|
472
|
+
};
|
|
473
|
+
function chip(label, value) {
|
|
474
|
+
if (!value) return "";
|
|
475
|
+
return `<div style="display:inline-flex;align-items:center;gap:4px;background:#1e293b;border:1px solid #334155;border-radius:6px;padding:4px 10px;font-size:12px;color:#94a3b8">
|
|
476
|
+
<span style="color:#64748b">${escapeHtml(label)}</span>
|
|
477
|
+
<span style="color:#e2e8f0">${escapeHtml(value)}</span>
|
|
478
|
+
</div>`;
|
|
479
|
+
}
|
|
480
|
+
function renderLinearIssuesCreate(permission, onApproval, onDenial) {
|
|
461
481
|
const actions = buildActionDescriptors(permission, onApproval, onDenial);
|
|
462
482
|
const status = permission.status ?? "pending";
|
|
463
483
|
const args = parseArgs(permission);
|
|
464
484
|
const ts = formatTimestamp(permission.created_at);
|
|
465
|
-
const
|
|
485
|
+
const priorityLabel = args.priority != null ? priorityLabels[args.priority] : void 0;
|
|
466
486
|
return `<!DOCTYPE html>
|
|
467
487
|
<html lang="en">
|
|
468
488
|
<head>
|
|
469
489
|
<meta charset="UTF-8" />
|
|
470
490
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
471
|
-
<title>Approve
|
|
491
|
+
<title>Approve Linear issue</title>
|
|
472
492
|
<style>
|
|
473
493
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
474
|
-
body { background: #
|
|
494
|
+
body { background: #0d0e11; color: #e5e7eb; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 24px; }
|
|
475
495
|
</style>
|
|
476
496
|
</head>
|
|
477
497
|
<body>
|
|
478
|
-
<div style="width:100%;max-width:
|
|
498
|
+
<div style="width:100%;max-width:540px">
|
|
479
499
|
|
|
480
500
|
<!-- Header -->
|
|
481
501
|
<div style="display:flex;align-items:center;gap:10px;margin-bottom:20px">
|
|
482
|
-
<div style="width:32px;height:32px;border-radius:8px;background:#
|
|
502
|
+
<div style="width:32px;height:32px;border-radius:8px;background:#5e6ad2;display:flex;align-items:center;justify-content:center;font-size:16px;font-weight:800;color:#fff;letter-spacing:-1px">L</div>
|
|
483
503
|
<div>
|
|
484
|
-
<div style="font-size:15px;font-weight:700;color:#f9fafb">Approve
|
|
485
|
-
<div style="font-size:12px;color:#6b7280">Review the
|
|
504
|
+
<div style="font-size:15px;font-weight:700;color:#f9fafb">Approve Linear issue</div>
|
|
505
|
+
<div style="font-size:12px;color:#6b7280">Review the issue details before creating it</div>
|
|
486
506
|
</div>
|
|
487
507
|
<div style="margin-left:auto">
|
|
488
|
-
<span style="background:#
|
|
508
|
+
<span style="background:#5e6ad2;color:#fff;font-size:11px;font-weight:700;padding:3px 10px;border-radius:999px;text-transform:uppercase">Linear</span>
|
|
489
509
|
</div>
|
|
490
510
|
</div>
|
|
491
511
|
|
|
492
512
|
${statusBannerHtml(status)}
|
|
493
513
|
|
|
494
|
-
<!--
|
|
495
|
-
<div style="background:#
|
|
514
|
+
<!-- Issue card -->
|
|
515
|
+
<div style="background:#141518;border:1px solid #1f2127;border-radius:10px;padding:20px;margin-bottom:20px">
|
|
496
516
|
|
|
497
|
-
<!--
|
|
498
|
-
<div style="
|
|
499
|
-
<div style="
|
|
500
|
-
|
|
501
|
-
${args.lengthInMinutes ? `<div style="font-size:13px;color:#6b7280;margin-top:4px">${escapeHtml(String(args.lengthInMinutes))} minutes</div>` : ""}
|
|
517
|
+
<!-- Status dot + title -->
|
|
518
|
+
<div style="display:flex;align-items:flex-start;gap:10px;margin-bottom:14px">
|
|
519
|
+
<div style="width:16px;height:16px;border-radius:50%;border:2px solid #5e6ad2;flex-shrink:0;margin-top:3px"></div>
|
|
520
|
+
<h2 style="font-size:17px;font-weight:600;color:#f9fafb;line-height:1.4">${escapeHtml(args.title)}</h2>
|
|
502
521
|
</div>
|
|
503
522
|
|
|
504
|
-
<!--
|
|
505
|
-
|
|
523
|
+
<!-- Description -->
|
|
524
|
+
${args.description ? `<div style="font-size:14px;color:#9ca3af;line-height:1.7;margin-bottom:16px;padding-left:26px;white-space:pre-wrap;word-break:break-word">${escapeHtml(args.description)}</div>` : ""}
|
|
506
525
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
526
|
+
<!-- Meta chips -->
|
|
527
|
+
<div style="display:flex;flex-wrap:wrap;gap:8px;padding-left:26px">
|
|
528
|
+
${chip("Team", args.teamId)}
|
|
529
|
+
${chip("Assignee", args.assigneeId)}
|
|
530
|
+
${priorityLabel ? `<div style="display:inline-flex;align-items:center;gap:4px;background:#1e293b;border:1px solid #334155;border-radius:6px;padding:4px 10px;font-size:12px;color:#e2e8f0">${priorityLabel}</div>` : ""}
|
|
531
|
+
${chip("Status", args.stateId)}
|
|
532
|
+
${chip("Due", args.dueDate)}
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
515
535
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
536
|
+
${ts ? `<p style="font-size:11px;color:#475569;margin-bottom:16px">Requested ${escapeHtml(ts)}</p>` : ""}
|
|
537
|
+
|
|
538
|
+
${actionsHtml(status, actions)}
|
|
539
|
+
</div>
|
|
540
|
+
</body>
|
|
541
|
+
</html>`;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// src/plugins/slack/messages-post.ts
|
|
545
|
+
function renderSlackMessagesPost(permission, onApproval, onDenial) {
|
|
546
|
+
const actions = buildActionDescriptors(permission, onApproval, onDenial);
|
|
547
|
+
const status = permission.status ?? "pending";
|
|
548
|
+
const args = parseArgs(permission);
|
|
549
|
+
const ts = formatTimestamp(permission.created_at);
|
|
550
|
+
const channel = args.channel ? `#${args.channel.replace(/^#/, "")}` : null;
|
|
551
|
+
const text = args.text ?? null;
|
|
552
|
+
const threadTs = args.thread_ts ?? null;
|
|
553
|
+
const replyBroadcast = args.reply_broadcast;
|
|
554
|
+
return `<!DOCTYPE html>
|
|
555
|
+
<html lang="en">
|
|
556
|
+
<head>
|
|
557
|
+
<meta charset="UTF-8" />
|
|
558
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
559
|
+
<title>Approve Slack message</title>
|
|
560
|
+
<style>
|
|
561
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
562
|
+
body { background: #1a1d21; color: #d1d2d3; font-family: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif; min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 24px; }
|
|
563
|
+
</style>
|
|
564
|
+
</head>
|
|
565
|
+
<body>
|
|
566
|
+
<div style="width:100%;max-width:540px">
|
|
520
567
|
|
|
568
|
+
<!-- Header -->
|
|
569
|
+
<div style="display:flex;align-items:center;gap:10px;margin-bottom:20px">
|
|
570
|
+
<div style="width:32px;height:32px;border-radius:8px;background:#4a154b;display:flex;align-items:center;justify-content:center;font-size:18px">💬</div>
|
|
571
|
+
<div>
|
|
572
|
+
<div style="font-size:15px;font-weight:700;color:#f9fafb">Approve Slack message</div>
|
|
573
|
+
<div style="font-size:12px;color:#6b7280">Review before sending</div>
|
|
574
|
+
</div>
|
|
575
|
+
<div style="margin-left:auto">
|
|
576
|
+
<span style="background:#4a154b;color:#fff;font-size:11px;font-weight:700;padding:3px 10px;border-radius:999px;text-transform:uppercase">Slack</span>
|
|
521
577
|
</div>
|
|
522
578
|
</div>
|
|
523
579
|
|
|
524
|
-
${
|
|
580
|
+
${statusBannerHtml(status)}
|
|
581
|
+
|
|
582
|
+
<!-- Channel pill -->
|
|
583
|
+
${channel ? `<div style="display:inline-flex;align-items:center;gap:6px;background:#1e1f22;border:1px solid #2e3035;border-radius:6px;padding:6px 12px;margin-bottom:16px;font-size:13px;color:#d1d2d3;font-weight:600">${escapeHtml(channel)}</div>` : ""}
|
|
584
|
+
|
|
585
|
+
<!-- Message bubble -->
|
|
586
|
+
${text ? `<div style="background:#222529;border:1px solid #2e3035;border-radius:8px;padding:16px;margin-bottom:12px">
|
|
587
|
+
<div style="display:flex;align-items:flex-start;gap:10px">
|
|
588
|
+
<div style="width:36px;height:36px;border-radius:4px;background:#4a154b;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:16px">🤖</div>
|
|
589
|
+
<div>
|
|
590
|
+
<div style="font-size:13px;font-weight:700;color:#f9fafb;margin-bottom:4px">Agent</div>
|
|
591
|
+
<div style="font-size:14px;color:#d1d2d3;line-height:1.6;white-space:pre-wrap;word-break:break-word">${escapeHtml(text)}</div>
|
|
592
|
+
</div>
|
|
593
|
+
</div>
|
|
594
|
+
</div>` : ""}
|
|
595
|
+
|
|
596
|
+
<!-- Thread info -->
|
|
597
|
+
${threadTs ? `<div style="font-size:12px;color:#6b7280;margin-bottom:12px;padding-left:4px">↳ Reply in thread${replyBroadcast ? " · also sending to channel" : ""}</div>` : ""}
|
|
598
|
+
|
|
599
|
+
${ts ? `<p style="font-size:11px;color:#4b5563;margin-bottom:16px">Requested ${escapeHtml(ts)}</p>` : ""}
|
|
525
600
|
|
|
526
601
|
${actionsHtml(status, actions)}
|
|
527
602
|
</div>
|
|
@@ -543,6 +618,40 @@ function corsairPermissions(permission, onApproval, onDenial) {
|
|
|
543
618
|
const renderer = renderers[key] ?? renderBase;
|
|
544
619
|
return renderer(permission, onApproval, onDenial);
|
|
545
620
|
}
|
|
621
|
+
|
|
622
|
+
// src/snippets.ts
|
|
623
|
+
function gmailSendSnippet(rawArgs) {
|
|
624
|
+
const args = rawArgs;
|
|
625
|
+
if (!args || typeof args.raw !== "string") return baseSnippet(rawArgs);
|
|
626
|
+
const email = parseRawEmail(args.raw);
|
|
627
|
+
if (!email.to && !email.subject && !email.body) return baseSnippet(rawArgs);
|
|
628
|
+
const subjectLine = escapeHtml(email.subject ?? "(no subject)");
|
|
629
|
+
const toLine = email.to ? `<div style="font-size:.75rem;color:#64748b;margin-top:3px">To: ${escapeHtml(email.to)}</div>` : "";
|
|
630
|
+
const bodyPreview = email.body ? `<div style="padding:8px 12px;font-size:.8125rem;color:#64748b;white-space:pre-wrap;word-break:break-word;max-height:72px;overflow:hidden;line-height:1.5;border-top:1px solid #e2e8f0">${escapeHtml(email.body)}</div>` : "";
|
|
631
|
+
return `<div style="border:1px solid #e2e8f0;border-radius:8px;overflow:hidden;font-size:.875rem">
|
|
632
|
+
<div style="padding:9px 12px;background:#f8fafc">
|
|
633
|
+
<div style="font-weight:600;color:#1e293b">${subjectLine}</div>
|
|
634
|
+
${toLine}
|
|
635
|
+
</div>
|
|
636
|
+
${bodyPreview}
|
|
637
|
+
</div>`;
|
|
638
|
+
}
|
|
639
|
+
function baseSnippet(rawArgs) {
|
|
640
|
+
let text;
|
|
641
|
+
try {
|
|
642
|
+
text = JSON.stringify(rawArgs, null, 2);
|
|
643
|
+
} catch {
|
|
644
|
+
text = String(rawArgs);
|
|
645
|
+
}
|
|
646
|
+
return `<pre style="background:#f8fafc;border:1px solid #e2e8f0;border-radius:6px;padding:.625rem .75rem;font-size:.75rem;white-space:pre-wrap;word-break:break-all;max-height:120px;overflow-y:auto;margin:0">${escapeHtml(text)}</pre>`;
|
|
647
|
+
}
|
|
648
|
+
function renderArgsSnippet(plugin, endpoint, rawArgs) {
|
|
649
|
+
if (plugin === "gmail" && (endpoint === "messages.send" || endpoint === "drafts.send")) {
|
|
650
|
+
return gmailSendSnippet(rawArgs);
|
|
651
|
+
}
|
|
652
|
+
return baseSnippet(rawArgs);
|
|
653
|
+
}
|
|
546
654
|
export {
|
|
547
|
-
corsairPermissions
|
|
655
|
+
corsairPermissions,
|
|
656
|
+
renderArgsSnippet
|
|
548
657
|
};
|
package/dist/permissions.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PermissionActionCallback, PermissionLike } from './types';
|
|
1
|
+
import type { PermissionActionCallback, PermissionLike } from './types.js';
|
|
2
2
|
export declare function corsairPermissions(permission: PermissionLike, onApproval: PermissionActionCallback, onDenial: PermissionActionCallback): string;
|
|
3
3
|
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAiB3E,wBAAgB,kBAAkB,CACjC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,wBAAwB,GAChC,MAAM,CAIR"}
|
package/dist/plugins/base.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PermissionActionCallback, PermissionLike } from '../types';
|
|
1
|
+
import type { PermissionActionCallback, PermissionLike } from '../types.js';
|
|
2
2
|
export declare function renderBase(permission: PermissionLike, onApproval: PermissionActionCallback, onDenial: PermissionActionCallback): string;
|
|
3
3
|
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/plugins/base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/plugins/base.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5E,wBAAgB,UAAU,CACzB,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,wBAAwB,GAChC,MAAM,CA4CR"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PermissionActionCallback, PermissionLike } from '../../types';
|
|
1
|
+
import type { PermissionActionCallback, PermissionLike } from '../../types.js';
|
|
2
2
|
export declare function renderCalBookingsCreate(permission: PermissionLike, onApproval: PermissionActionCallback, onDenial: PermissionActionCallback): string;
|
|
3
3
|
//# sourceMappingURL=bookings-create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bookings-create.d.ts","sourceRoot":"","sources":["../../../src/plugins/cal/bookings-create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bookings-create.d.ts","sourceRoot":"","sources":["../../../src/plugins/cal/bookings-create.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAI/E,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,wBAAwB,GAChC,MAAM,CA4ER"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
import type { PermissionActionCallback, PermissionLike } from '../../types';
|
|
1
|
+
import type { PermissionActionCallback, PermissionLike } from '../../types.js';
|
|
2
|
+
export type ParsedEmail = {
|
|
3
|
+
to?: string;
|
|
4
|
+
from?: string;
|
|
5
|
+
subject?: string;
|
|
6
|
+
body?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function parseRawEmail(raw: string): ParsedEmail;
|
|
2
9
|
export declare function renderGmailMessagesSend(permission: PermissionLike, onApproval: PermissionActionCallback, onDenial: PermissionActionCallback): string;
|
|
3
10
|
//# sourceMappingURL=messages-send.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages-send.d.ts","sourceRoot":"","sources":["../../../src/plugins/gmail/messages-send.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"messages-send.d.ts","sourceRoot":"","sources":["../../../src/plugins/gmail/messages-send.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAI/E,MAAM,MAAM,WAAW,GAAG;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAiFF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CA0CtD;AAUD,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,wBAAwB,GAChC,MAAM,CAkER"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PermissionActionCallback, PermissionLike } from '../../types';
|
|
1
|
+
import type { PermissionActionCallback, PermissionLike } from '../../types.js';
|
|
2
2
|
export declare function renderGoogleCalendarEventsCreate(permission: PermissionLike, onApproval: PermissionActionCallback, onDenial: PermissionActionCallback): string;
|
|
3
3
|
//# sourceMappingURL=events-create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events-create.d.ts","sourceRoot":"","sources":["../../../src/plugins/googlecalendar/events-create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events-create.d.ts","sourceRoot":"","sources":["../../../src/plugins/googlecalendar/events-create.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAoB/E,wBAAgB,gCAAgC,CAC/C,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,wBAAwB,GAChC,MAAM,CA0FR"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PermissionActionCallback, PermissionLike } from '../../types';
|
|
1
|
+
import type { PermissionActionCallback, PermissionLike } from '../../types.js';
|
|
2
2
|
export declare function renderLinearIssuesCreate(permission: PermissionLike, onApproval: PermissionActionCallback, onDenial: PermissionActionCallback): string;
|
|
3
3
|
//# sourceMappingURL=issues-create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issues-create.d.ts","sourceRoot":"","sources":["../../../src/plugins/linear/issues-create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"issues-create.d.ts","sourceRoot":"","sources":["../../../src/plugins/linear/issues-create.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAoB/E,wBAAgB,wBAAwB,CACvC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,wBAAwB,GAChC,MAAM,CAqER"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PermissionActionCallback, PermissionLike } from '../../types';
|
|
1
|
+
import type { PermissionActionCallback, PermissionLike } from '../../types.js';
|
|
2
2
|
export declare function renderSlackMessagesPost(permission: PermissionLike, onApproval: PermissionActionCallback, onDenial: PermissionActionCallback): string;
|
|
3
3
|
//# sourceMappingURL=messages-post.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages-post.d.ts","sourceRoot":"","sources":["../../../src/plugins/slack/messages-post.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"messages-post.d.ts","sourceRoot":"","sources":["../../../src/plugins/slack/messages-post.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAI/E,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,wBAAwB,GAChC,MAAM,CAkER"}
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PermissionActionCallback, PermissionLike, PermissionStatus } from './types';
|
|
1
|
+
import type { PermissionActionCallback, PermissionLike, PermissionStatus } from './types.js';
|
|
2
2
|
export declare function escapeHtml(s: unknown): string;
|
|
3
3
|
export declare function formatTimestamp(value: Date | string): string;
|
|
4
4
|
export declare function parseArgs(permission: PermissionLike): Record<string, unknown>;
|
|
@@ -10,5 +10,5 @@ export type ActionDescriptors = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare function buildActionDescriptors(permission: PermissionLike, onApproval: PermissionActionCallback, onDenial: PermissionActionCallback): ActionDescriptors;
|
|
12
12
|
export declare function actionsHtml(status: PermissionStatus, actions: ActionDescriptors): string;
|
|
13
|
-
export declare function statusBannerHtml(status: PermissionStatus): string;
|
|
13
|
+
export declare function statusBannerHtml(status: PermissionStatus | 'expired' | 'failed'): string;
|
|
14
14
|
//# sourceMappingURL=shared.d.ts.map
|
package/dist/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,wBAAwB,EACxB,cAAc,EACd,gBAAgB,EAChB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAK7C;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAI5D;AAED,wBAAgB,SAAS,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQ7E;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,KAAK,GAAG,MAAM,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,KAAK,GAAG,MAAM,CAAC;CAC9B,CAAC;AAEF,wBAAgB,sBAAsB,CACrC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,wBAAwB,GAChC,iBAAiB,CASnB;AAED,wBAAgB,WAAW,CAC1B,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,iBAAiB,GACxB,MAAM,CA6CR;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAcxF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a compact, embeddable HTML snippet for displaying permission args
|
|
3
|
+
* inline — e.g. inside a permissions dashboard card. Light-themed.
|
|
4
|
+
*
|
|
5
|
+
* Plugin-specific renderers show rich previews (email layout for Gmail, etc.)
|
|
6
|
+
* and fall back to pretty-printed JSON for unknown plugins.
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderArgsSnippet(plugin: string, endpoint: string, rawArgs: unknown): string;
|
|
9
|
+
//# sourceMappingURL=snippets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snippets.d.ts","sourceRoot":"","sources":["../src/snippets.ts"],"names":[],"mappings":"AAqCA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,GACd,MAAM,CAKR"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIpD,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1E,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,CAAC;AAErD,MAAM,MAAM,0BAA0B,GAAG;IACxC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,CACtC,IAAI,EAAE,cAAc,KAChB,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corsair-dev/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Plain-HTML UI helpers for Corsair permissions and related flows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"corsair": "0.1.
|
|
13
|
+
"corsair": "0.1.63",
|
|
14
|
+
"@corsair-dev/cal": "0.1.0",
|
|
15
|
+
"@corsair-dev/linear": "0.1.0",
|
|
16
|
+
"@corsair-dev/googlecalendar": "0.1.0",
|
|
17
|
+
"@corsair-dev/gmail": "0.1.0",
|
|
18
|
+
"@corsair-dev/slack": "0.1.0"
|
|
14
19
|
},
|
|
15
20
|
"devDependencies": {
|
|
16
21
|
"@types/node": "^22.0.0",
|
package/src/index.ts
CHANGED