@tangle-network/agent-app 0.53.17 → 0.54.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/app-auth/index.js +2 -2
- package/dist/assistant/index.js +10 -10
- package/dist/chat-react/index.js +3 -3
- package/dist/chat-routes/index.js +22 -11
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/sandbox-producer.d.ts +7 -0
- package/dist/chat-routes/wire.d.ts +1 -1
- package/dist/chat-store/index.js +4 -4
- package/dist/{chunk-UII6SBT4.js → chunk-4XBRPVL3.js} +4 -4
- package/dist/{chunk-TSZIYQAZ.js → chunk-6VRVRWYN.js} +2 -2
- package/dist/{chunk-CP36C5LZ.js → chunk-D6UJEOZQ.js} +1 -1
- package/dist/chunk-D6UJEOZQ.js.map +1 -0
- package/dist/{chunk-W3RSC6XB.js → chunk-DVOJNI6T.js} +3 -3
- package/dist/{chunk-M3K2HVQD.js → chunk-FCON65I2.js} +1 -1
- package/dist/{chunk-M3K2HVQD.js.map → chunk-FCON65I2.js.map} +1 -1
- package/dist/{chunk-UJHENCPR.js → chunk-GYDFGEJ2.js} +1 -1
- package/dist/chunk-GYDFGEJ2.js.map +1 -0
- package/dist/{chunk-YB6BZKXY.js → chunk-IJDPERPL.js} +31 -5
- package/dist/chunk-IJDPERPL.js.map +1 -0
- package/dist/{chunk-2S7QRQUS.js → chunk-NJA6X7JI.js} +2 -2
- package/dist/{chunk-JZ64GXYP.js → chunk-OMHGFN5I.js} +2 -2
- package/dist/{chunk-4KFM7VTH.js → chunk-OXDA7G4E.js} +9 -8
- package/dist/chunk-OXDA7G4E.js.map +1 -0
- package/dist/{chunk-ZMMIQOFI.js → chunk-UII4YDYS.js} +2 -2
- package/dist/{chunk-L57CYCXN.js → chunk-WN3UK23P.js} +2 -2
- package/dist/design-canvas-react/index.js +4 -4
- package/dist/interactions/contract.d.ts +4 -3
- package/dist/interactions/index.js +2 -2
- package/dist/platform/index.js +2 -2
- package/dist/public-consultation/index.js +6 -6
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/model.d.ts +1 -1
- package/dist/sandbox/index.d.ts +0 -4
- package/dist/sandbox/index.js +2 -2
- package/dist/sandbox/model.d.ts +9 -12
- package/dist/stream/index.js +2 -2
- package/dist/teams-react/index.d.ts +1 -2
- package/dist/teams-react/index.js +618 -10
- package/dist/teams-react/index.js.map +1 -1
- package/dist/web-react/chat-stream.d.ts +1 -1
- package/dist/web-react/index.d.ts +10 -0
- package/dist/web-react/index.js +13 -13
- package/dist/workspace-react/index.js +51 -5
- package/dist/workspace-react/index.js.map +1 -1
- package/package.json +3 -33
- package/dist/InvitationsPanel-OFCYVSAE.js +0 -9
- package/dist/InvitationsPanel-OFCYVSAE.js.map +0 -1
- package/dist/InviteAcceptPage-BDOO4JSE.js +0 -7
- package/dist/InviteAcceptPage-BDOO4JSE.js.map +0 -1
- package/dist/MembersPanel-3ZK2GCMC.js +0 -9
- package/dist/MembersPanel-3ZK2GCMC.js.map +0 -1
- package/dist/chunk-4KFM7VTH.js.map +0 -1
- package/dist/chunk-5MI2SKQH.js +0 -211
- package/dist/chunk-5MI2SKQH.js.map +0 -1
- package/dist/chunk-AULM4X7U.js +0 -77
- package/dist/chunk-AULM4X7U.js.map +0 -1
- package/dist/chunk-CP36C5LZ.js.map +0 -1
- package/dist/chunk-GRDLGQ6A.js +0 -164
- package/dist/chunk-GRDLGQ6A.js.map +0 -1
- package/dist/chunk-UJHENCPR.js.map +0 -1
- package/dist/chunk-W7P5KV6O.js +0 -192
- package/dist/chunk-W7P5KV6O.js.map +0 -1
- package/dist/chunk-YB6BZKXY.js.map +0 -1
- package/dist/run/index.d.ts +0 -63
- package/dist/run/index.js +0 -30
- package/dist/run/index.js.map +0 -1
- package/dist/tangle/index.d.ts +0 -94
- package/dist/tangle/index.js +0 -33
- package/dist/tangle/index.js.map +0 -1
- package/dist/teams/resend.d.ts +0 -27
- package/dist/teams/resend.js +0 -38
- package/dist/teams/resend.js.map +0 -1
- package/dist/teams-react/lazy.d.ts +0 -14
- package/dist/teams-react/lazy.js +0 -17
- package/dist/teams-react/lazy.js.map +0 -1
- package/dist/web-react/inert.d.ts +0 -39
- package/dist/web-react/session-gateway.d.ts +0 -140
- package/dist/web-react/session-gateway.js +0 -187
- package/dist/web-react/session-gateway.js.map +0 -1
- /package/dist/{chunk-UII6SBT4.js.map → chunk-4XBRPVL3.js.map} +0 -0
- /package/dist/{chunk-TSZIYQAZ.js.map → chunk-6VRVRWYN.js.map} +0 -0
- /package/dist/{chunk-W3RSC6XB.js.map → chunk-DVOJNI6T.js.map} +0 -0
- /package/dist/{chunk-2S7QRQUS.js.map → chunk-NJA6X7JI.js.map} +0 -0
- /package/dist/{chunk-JZ64GXYP.js.map → chunk-OMHGFN5I.js.map} +0 -0
- /package/dist/{chunk-ZMMIQOFI.js.map → chunk-UII4YDYS.js.map} +0 -0
- /package/dist/{chunk-L57CYCXN.js.map → chunk-WN3UK23P.js.map} +0 -0
|
@@ -1,14 +1,622 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "
|
|
11
|
-
|
|
2
|
+
hasWorkspaceRole
|
|
3
|
+
} from "../chunk-6XIAPIW6.js";
|
|
4
|
+
|
|
5
|
+
// src/teams-react/components/MembersPanel.tsx
|
|
6
|
+
import { useState as useState2 } from "react";
|
|
7
|
+
|
|
8
|
+
// src/teams-react/components/RoleSelect.tsx
|
|
9
|
+
import { useEffect, useRef, useState } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var ASSIGNABLE_ROLES = [
|
|
12
|
+
{ value: "viewer", label: "Viewer" },
|
|
13
|
+
{ value: "editor", label: "Editor" },
|
|
14
|
+
{ value: "admin", label: "Admin" }
|
|
15
|
+
];
|
|
16
|
+
function ChevronDownGlyph({ className }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }) });
|
|
18
|
+
}
|
|
19
|
+
function RoleSelect({ value, onChange, ariaLabel, disabled }) {
|
|
20
|
+
const [open, setOpen] = useState(false);
|
|
21
|
+
const ref = useRef(null);
|
|
22
|
+
const current = ASSIGNABLE_ROLES.find((option) => option.value === value);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!open) return;
|
|
25
|
+
function onDocPointer(event) {
|
|
26
|
+
if (ref.current && !ref.current.contains(event.target)) setOpen(false);
|
|
27
|
+
}
|
|
28
|
+
function onKey(event) {
|
|
29
|
+
if (event.key === "Escape") setOpen(false);
|
|
30
|
+
}
|
|
31
|
+
document.addEventListener("pointerdown", onDocPointer);
|
|
32
|
+
document.addEventListener("keydown", onKey);
|
|
33
|
+
return () => {
|
|
34
|
+
document.removeEventListener("pointerdown", onDocPointer);
|
|
35
|
+
document.removeEventListener("keydown", onKey);
|
|
36
|
+
};
|
|
37
|
+
}, [open]);
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: "relative", children: [
|
|
39
|
+
/* @__PURE__ */ jsxs(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
type: "button",
|
|
43
|
+
disabled,
|
|
44
|
+
"aria-haspopup": "listbox",
|
|
45
|
+
"aria-expanded": open,
|
|
46
|
+
"aria-label": ariaLabel,
|
|
47
|
+
onClick: () => setOpen((v) => !v),
|
|
48
|
+
className: "flex items-center justify-between gap-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-input)] px-2 py-1.5 text-xs text-[var(--text-secondary)] hover:border-[var(--brand-primary)] disabled:cursor-default disabled:opacity-40",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx("span", { children: current?.label ?? value }),
|
|
51
|
+
/* @__PURE__ */ jsx(ChevronDownGlyph, { className: "h-3 w-3 text-[var(--text-muted)]" })
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
open ? /* @__PURE__ */ jsx(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
role: "listbox",
|
|
59
|
+
"aria-label": ariaLabel,
|
|
60
|
+
className: "absolute right-0 top-full z-50 mt-1 flex w-32 flex-col rounded border border-[var(--card-edge)] bg-[hsl(var(--popover))] py-1 shadow-[var(--shadow-overlay)]",
|
|
61
|
+
children: ASSIGNABLE_ROLES.map((option) => /* @__PURE__ */ jsx(
|
|
62
|
+
"button",
|
|
63
|
+
{
|
|
64
|
+
type: "button",
|
|
65
|
+
role: "option",
|
|
66
|
+
"aria-selected": option.value === value,
|
|
67
|
+
onClick: () => {
|
|
68
|
+
onChange(option.value);
|
|
69
|
+
setOpen(false);
|
|
70
|
+
},
|
|
71
|
+
className: `px-3 py-1.5 text-left text-xs hover:bg-[color-mix(in_srgb,var(--brand-primary)_10%,transparent)] ${option.value === value ? "text-[var(--brand-primary)]" : "text-[var(--text-primary)]"}`,
|
|
72
|
+
children: option.label
|
|
73
|
+
},
|
|
74
|
+
option.value
|
|
75
|
+
))
|
|
76
|
+
}
|
|
77
|
+
) : null
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/teams-react/components/MembersPanel.tsx
|
|
82
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
83
|
+
function MembersPanel({
|
|
84
|
+
members,
|
|
85
|
+
currentRole,
|
|
86
|
+
onInvite,
|
|
87
|
+
onChangeRole,
|
|
88
|
+
onRemove,
|
|
89
|
+
onNotice,
|
|
90
|
+
showInviteForm = true
|
|
91
|
+
}) {
|
|
92
|
+
const [inviteEmail, setInviteEmail] = useState2("");
|
|
93
|
+
const [inviteRole, setInviteRole] = useState2("editor");
|
|
94
|
+
const [inviting, setInviting] = useState2(false);
|
|
95
|
+
const canManage = hasWorkspaceRole(currentRole, "admin");
|
|
96
|
+
function notify(kind, message) {
|
|
97
|
+
onNotice?.({ kind, message });
|
|
98
|
+
}
|
|
99
|
+
async function submitInvite() {
|
|
100
|
+
const email = inviteEmail.trim();
|
|
101
|
+
if (!email || inviting) return;
|
|
102
|
+
setInviting(true);
|
|
103
|
+
try {
|
|
104
|
+
const result = await onInvite({ email, role: inviteRole });
|
|
105
|
+
if (result && "inviteUrl" in result && result.inviteUrl) {
|
|
106
|
+
notify("success", `Invite link ready for ${email}`);
|
|
107
|
+
} else {
|
|
108
|
+
notify("success", `Invited ${email}`);
|
|
109
|
+
}
|
|
110
|
+
setInviteEmail("");
|
|
111
|
+
} catch (err) {
|
|
112
|
+
notify("error", err instanceof Error ? err.message : "Failed to invite");
|
|
113
|
+
} finally {
|
|
114
|
+
setInviting(false);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function changeRole(memberId, role) {
|
|
118
|
+
try {
|
|
119
|
+
await onChangeRole({ memberId, role });
|
|
120
|
+
notify("success", "Role updated");
|
|
121
|
+
} catch (err) {
|
|
122
|
+
notify("error", err instanceof Error ? err.message : "Failed to update role");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async function remove(memberId) {
|
|
126
|
+
try {
|
|
127
|
+
await onRemove({ memberId });
|
|
128
|
+
notify("success", "Member removed");
|
|
129
|
+
} catch (err) {
|
|
130
|
+
notify("error", err instanceof Error ? err.message : "Failed to remove member");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return /* @__PURE__ */ jsxs2("section", { className: "flex flex-col gap-4", children: [
|
|
134
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between", children: [
|
|
135
|
+
/* @__PURE__ */ jsx2("h4", { className: "text-xs font-semibold text-[var(--text-primary)]", children: "Members" }),
|
|
136
|
+
/* @__PURE__ */ jsxs2("span", { className: "text-xs text-[var(--text-muted)]", children: [
|
|
137
|
+
members.length,
|
|
138
|
+
" total"
|
|
139
|
+
] })
|
|
140
|
+
] }),
|
|
141
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-2", children: [
|
|
142
|
+
members.map((member) => /* @__PURE__ */ jsx2(
|
|
143
|
+
MemberRow,
|
|
144
|
+
{
|
|
145
|
+
member,
|
|
146
|
+
canManage,
|
|
147
|
+
onChangeRole: changeRole,
|
|
148
|
+
onRemove: remove
|
|
149
|
+
},
|
|
150
|
+
member.id
|
|
151
|
+
)),
|
|
152
|
+
members.length === 0 && /* @__PURE__ */ jsx2("p", { className: "text-sm text-[var(--text-muted)]", children: "No team members yet." })
|
|
153
|
+
] }),
|
|
154
|
+
canManage && showInviteForm && /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-1.5 border-t border-[var(--border-default)] pt-3", children: [
|
|
155
|
+
/* @__PURE__ */ jsx2("label", { className: "text-xs font-medium text-[var(--text-muted)]", children: "Invite member" }),
|
|
156
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex gap-2", children: [
|
|
157
|
+
/* @__PURE__ */ jsx2(
|
|
158
|
+
"input",
|
|
159
|
+
{
|
|
160
|
+
type: "email",
|
|
161
|
+
placeholder: "Email address",
|
|
162
|
+
value: inviteEmail,
|
|
163
|
+
"aria-label": "Invite email address",
|
|
164
|
+
onChange: (event) => setInviteEmail(event.target.value),
|
|
165
|
+
onKeyDown: (event) => {
|
|
166
|
+
if (event.key === "Enter") void submitInvite();
|
|
167
|
+
},
|
|
168
|
+
className: "flex-1 rounded border border-[var(--border-default)] bg-[var(--bg-input)] px-3 py-1.5 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)]"
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
/* @__PURE__ */ jsx2(
|
|
172
|
+
RoleSelect,
|
|
173
|
+
{
|
|
174
|
+
value: inviteRole,
|
|
175
|
+
ariaLabel: "Invite role",
|
|
176
|
+
onChange: setInviteRole
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
/* @__PURE__ */ jsx2(
|
|
180
|
+
"button",
|
|
181
|
+
{
|
|
182
|
+
type: "button",
|
|
183
|
+
onClick: () => void submitInvite(),
|
|
184
|
+
disabled: inviting || !inviteEmail.trim(),
|
|
185
|
+
className: "rounded bg-[var(--brand-primary)] px-3 py-1.5 text-sm text-[hsl(var(--primary-foreground))] disabled:opacity-50",
|
|
186
|
+
children: inviting ? "Inviting\u2026" : "Invite"
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] })
|
|
190
|
+
] })
|
|
191
|
+
] });
|
|
192
|
+
}
|
|
193
|
+
function MemberRow({ member, canManage, onChangeRole, onRemove }) {
|
|
194
|
+
const pending = member.acceptedAt == null;
|
|
195
|
+
const label = member.name ?? member.email ?? "Unknown";
|
|
196
|
+
const initial = (member.name?.[0] ?? member.email?.[0] ?? "?").toUpperCase();
|
|
197
|
+
const isOwner = member.role === "owner";
|
|
198
|
+
const editable = canManage && !isOwner && !member.inherited;
|
|
199
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between border-b border-[var(--border-default)] py-2 last:border-0", children: [
|
|
200
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
|
|
201
|
+
/* @__PURE__ */ jsx2("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-[var(--bg-input)] text-xs font-semibold text-[var(--text-secondary)]", children: initial }),
|
|
202
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
203
|
+
/* @__PURE__ */ jsxs2("p", { className: "flex items-center gap-2 text-sm font-medium text-[var(--text-primary)]", children: [
|
|
204
|
+
label,
|
|
205
|
+
pending && /* @__PURE__ */ jsx2("span", { className: "rounded border border-[var(--border-default)] px-1.5 py-0.5 text-xs font-semibold uppercase tracking-[0.05em] text-[var(--text-muted)]", children: "Pending" })
|
|
206
|
+
] }),
|
|
207
|
+
member.name && member.email && /* @__PURE__ */ jsx2("p", { className: "text-xs text-[var(--text-muted)]", children: member.email })
|
|
208
|
+
] })
|
|
209
|
+
] }),
|
|
210
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center gap-2", children: isOwner ? /* @__PURE__ */ jsx2("span", { className: "rounded border border-[var(--border-default)] px-2 py-0.5 text-xs text-[var(--text-secondary)]", children: member.inherited ? "Org Admin" : "Owner" }) : editable ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
211
|
+
/* @__PURE__ */ jsx2(
|
|
212
|
+
RoleSelect,
|
|
213
|
+
{
|
|
214
|
+
value: member.role,
|
|
215
|
+
ariaLabel: `Role for ${label}`,
|
|
216
|
+
onChange: (role) => onChangeRole(member.id, role)
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
/* @__PURE__ */ jsx2(
|
|
220
|
+
"button",
|
|
221
|
+
{
|
|
222
|
+
type: "button",
|
|
223
|
+
"aria-label": `Remove ${label}`,
|
|
224
|
+
onClick: () => onRemove(member.id),
|
|
225
|
+
className: "rounded px-2 py-1 text-xs text-[var(--text-danger)] hover:bg-[var(--border-default)]",
|
|
226
|
+
children: "Remove"
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
] }) : /* @__PURE__ */ jsx2("span", { className: "rounded border border-[var(--border-default)] px-2 py-0.5 text-xs capitalize text-[var(--text-secondary)]", children: member.role }) })
|
|
230
|
+
] });
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// src/teams-react/components/InvitationsPanel.tsx
|
|
234
|
+
import { useState as useState3 } from "react";
|
|
235
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
236
|
+
var BADGE_BASE = "inline-flex items-center rounded border px-2 py-0.5 text-xs font-semibold uppercase tracking-[0.05em]";
|
|
237
|
+
var STATUS_BADGE = {
|
|
238
|
+
accepted: "border-[var(--surface-success-border)] bg-[var(--surface-success-bg)] text-[var(--surface-success-text)]",
|
|
239
|
+
pending: "border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)] text-[var(--surface-warning-text)]",
|
|
240
|
+
revoked: "border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)] text-[var(--surface-danger-text)]",
|
|
241
|
+
expired: "border-[var(--border-default)] text-[var(--text-muted)]"
|
|
242
|
+
};
|
|
243
|
+
var EMAIL_BADGE = {
|
|
244
|
+
sent: "border-[var(--border-default)] text-[var(--text-muted)]",
|
|
245
|
+
not_sent: "border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)] text-[var(--surface-warning-text)]",
|
|
246
|
+
failed: "border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)] text-[var(--surface-danger-text)]"
|
|
247
|
+
};
|
|
248
|
+
function capitalize(text) {
|
|
249
|
+
return text.length === 0 ? text : text[0].toUpperCase() + text.slice(1);
|
|
250
|
+
}
|
|
251
|
+
function InvitationsPanel({
|
|
252
|
+
invitations,
|
|
253
|
+
currentRole,
|
|
254
|
+
onInvite,
|
|
255
|
+
onResend,
|
|
256
|
+
onRevoke,
|
|
257
|
+
onCopy,
|
|
258
|
+
onNotice
|
|
259
|
+
}) {
|
|
260
|
+
const [inviteEmail, setInviteEmail] = useState3("");
|
|
261
|
+
const [inviteRole, setInviteRole] = useState3("editor");
|
|
262
|
+
const [inviting, setInviting] = useState3(false);
|
|
263
|
+
const [busyId, setBusyId] = useState3(null);
|
|
264
|
+
const canManage = hasWorkspaceRole(currentRole, "admin");
|
|
265
|
+
function notify(kind, message) {
|
|
266
|
+
onNotice?.({ kind, message });
|
|
267
|
+
}
|
|
268
|
+
async function submitInvite() {
|
|
269
|
+
const email = inviteEmail.trim();
|
|
270
|
+
if (!email || inviting) return;
|
|
271
|
+
setInviting(true);
|
|
272
|
+
try {
|
|
273
|
+
await onInvite({ email, role: inviteRole });
|
|
274
|
+
notify("success", `Invitation sent to ${email}`);
|
|
275
|
+
setInviteEmail("");
|
|
276
|
+
} catch (err) {
|
|
277
|
+
notify("error", err instanceof Error ? err.message : "Failed to invite");
|
|
278
|
+
} finally {
|
|
279
|
+
setInviting(false);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
async function copyLink(inviteUrl) {
|
|
283
|
+
try {
|
|
284
|
+
if (onCopy) await onCopy({ inviteUrl });
|
|
285
|
+
else await navigator.clipboard.writeText(inviteUrl);
|
|
286
|
+
notify("success", "Invite link copied");
|
|
287
|
+
} catch (err) {
|
|
288
|
+
notify("error", err instanceof Error ? err.message : "Failed to copy link");
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
async function resend(invitationId) {
|
|
292
|
+
setBusyId(invitationId);
|
|
293
|
+
try {
|
|
294
|
+
await onResend({ invitationId });
|
|
295
|
+
notify("success", "Invitation resent");
|
|
296
|
+
} catch (err) {
|
|
297
|
+
notify("error", err instanceof Error ? err.message : "Failed to resend invitation");
|
|
298
|
+
} finally {
|
|
299
|
+
setBusyId(null);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
async function revoke(invitationId) {
|
|
303
|
+
setBusyId(invitationId);
|
|
304
|
+
try {
|
|
305
|
+
await onRevoke({ invitationId });
|
|
306
|
+
notify("success", "Invitation revoked");
|
|
307
|
+
} catch (err) {
|
|
308
|
+
notify("error", err instanceof Error ? err.message : "Failed to revoke invitation");
|
|
309
|
+
} finally {
|
|
310
|
+
setBusyId(null);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return /* @__PURE__ */ jsxs3("section", { className: "flex flex-col gap-4", children: [
|
|
314
|
+
canManage && /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-1.5", children: [
|
|
315
|
+
/* @__PURE__ */ jsx3("label", { className: "text-xs font-medium text-[var(--text-muted)]", children: "Invite by email" }),
|
|
316
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
|
|
317
|
+
/* @__PURE__ */ jsx3(
|
|
318
|
+
"input",
|
|
319
|
+
{
|
|
320
|
+
type: "email",
|
|
321
|
+
placeholder: "colleague@example.com",
|
|
322
|
+
value: inviteEmail,
|
|
323
|
+
"aria-label": "Invite email address",
|
|
324
|
+
onChange: (event) => setInviteEmail(event.target.value),
|
|
325
|
+
onKeyDown: (event) => {
|
|
326
|
+
if (event.key === "Enter") void submitInvite();
|
|
327
|
+
},
|
|
328
|
+
className: "flex-1 rounded border border-[var(--border-default)] bg-[var(--bg-input)] px-3 py-1.5 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-muted)]"
|
|
329
|
+
}
|
|
330
|
+
),
|
|
331
|
+
/* @__PURE__ */ jsx3(
|
|
332
|
+
RoleSelect,
|
|
333
|
+
{
|
|
334
|
+
value: inviteRole,
|
|
335
|
+
ariaLabel: "Invite role",
|
|
336
|
+
onChange: setInviteRole
|
|
337
|
+
}
|
|
338
|
+
),
|
|
339
|
+
/* @__PURE__ */ jsx3(
|
|
340
|
+
"button",
|
|
341
|
+
{
|
|
342
|
+
type: "button",
|
|
343
|
+
onClick: () => void submitInvite(),
|
|
344
|
+
disabled: inviting || !inviteEmail.trim(),
|
|
345
|
+
className: "rounded bg-[var(--brand-primary)] px-3 py-1.5 text-sm text-[hsl(var(--primary-foreground))] disabled:opacity-50",
|
|
346
|
+
children: inviting ? "Inviting\u2026" : "Invite"
|
|
347
|
+
}
|
|
348
|
+
)
|
|
349
|
+
] })
|
|
350
|
+
] }),
|
|
351
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2 border-t border-[var(--border-default)] pt-3", children: [
|
|
352
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
|
|
353
|
+
/* @__PURE__ */ jsx3("h4", { className: "text-xs font-semibold text-[var(--text-primary)]", children: "Invitation history" }),
|
|
354
|
+
/* @__PURE__ */ jsxs3("span", { className: "text-xs text-[var(--text-muted)]", children: [
|
|
355
|
+
invitations.length,
|
|
356
|
+
" total"
|
|
357
|
+
] })
|
|
358
|
+
] }),
|
|
359
|
+
invitations.length === 0 ? /* @__PURE__ */ jsx3("p", { className: "text-sm text-[var(--text-muted)]", children: "No invitations yet." }) : invitations.map((invitation) => /* @__PURE__ */ jsx3(
|
|
360
|
+
InvitationRow,
|
|
361
|
+
{
|
|
362
|
+
invitation,
|
|
363
|
+
canManage,
|
|
364
|
+
busy: busyId === invitation.id,
|
|
365
|
+
onCopy: () => void copyLink(invitation.inviteUrl),
|
|
366
|
+
onResend: () => void resend(invitation.id),
|
|
367
|
+
onRevoke: () => void revoke(invitation.id)
|
|
368
|
+
},
|
|
369
|
+
invitation.id
|
|
370
|
+
))
|
|
371
|
+
] })
|
|
372
|
+
] });
|
|
373
|
+
}
|
|
374
|
+
function InvitationRow({ invitation, canManage, busy, onCopy, onResend, onRevoke }) {
|
|
375
|
+
const isPending = invitation.status === "pending";
|
|
376
|
+
const emailFailed = invitation.emailStatus === "failed";
|
|
377
|
+
const expiry = new Date(invitation.expiresAt).toLocaleDateString("en-US", {
|
|
378
|
+
month: "short",
|
|
379
|
+
day: "numeric",
|
|
380
|
+
year: "numeric"
|
|
381
|
+
});
|
|
382
|
+
return /* @__PURE__ */ jsxs3("div", { className: "rounded-lg border border-[var(--border-default)] bg-[var(--bg-input)] p-3", children: [
|
|
383
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-start justify-between gap-3", children: [
|
|
384
|
+
/* @__PURE__ */ jsxs3("div", { className: "min-w-0", children: [
|
|
385
|
+
/* @__PURE__ */ jsx3("p", { className: "truncate text-sm font-medium text-[var(--text-primary)]", children: invitation.email }),
|
|
386
|
+
/* @__PURE__ */ jsxs3("p", { className: "text-xs text-[var(--text-muted)]", children: [
|
|
387
|
+
capitalize(invitation.permissions),
|
|
388
|
+
" \xB7 expires ",
|
|
389
|
+
expiry
|
|
390
|
+
] }),
|
|
391
|
+
emailFailed && /* @__PURE__ */ jsx3("p", { className: "mt-1 text-xs text-[var(--surface-danger-text)]", children: "Email was not sent \u2014 copy the link to share it." })
|
|
392
|
+
] }),
|
|
393
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
394
|
+
/* @__PURE__ */ jsx3("span", { className: `${BADGE_BASE} ${STATUS_BADGE[invitation.status]}`, children: invitation.status }),
|
|
395
|
+
/* @__PURE__ */ jsx3("span", { className: `${BADGE_BASE} ${EMAIL_BADGE[invitation.emailStatus]}`, children: invitation.emailStatus.replace("_", " ") })
|
|
396
|
+
] })
|
|
397
|
+
] }),
|
|
398
|
+
canManage && isPending && /* @__PURE__ */ jsxs3("div", { className: "mt-3 flex items-center justify-end gap-2", children: [
|
|
399
|
+
/* @__PURE__ */ jsx3(
|
|
400
|
+
"button",
|
|
401
|
+
{
|
|
402
|
+
type: "button",
|
|
403
|
+
onClick: onCopy,
|
|
404
|
+
disabled: busy,
|
|
405
|
+
className: "rounded border border-[var(--border-default)] px-2 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] disabled:opacity-50",
|
|
406
|
+
children: "Copy link"
|
|
407
|
+
}
|
|
408
|
+
),
|
|
409
|
+
/* @__PURE__ */ jsx3(
|
|
410
|
+
"button",
|
|
411
|
+
{
|
|
412
|
+
type: "button",
|
|
413
|
+
onClick: onResend,
|
|
414
|
+
disabled: busy,
|
|
415
|
+
className: "rounded border border-[var(--border-default)] px-2 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] disabled:opacity-50",
|
|
416
|
+
children: busy ? "Working\u2026" : "Resend"
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
/* @__PURE__ */ jsx3(
|
|
420
|
+
"button",
|
|
421
|
+
{
|
|
422
|
+
type: "button",
|
|
423
|
+
onClick: onRevoke,
|
|
424
|
+
disabled: busy,
|
|
425
|
+
className: "rounded px-2 py-1 text-xs text-[var(--text-danger)] hover:bg-[var(--border-default)] disabled:opacity-50",
|
|
426
|
+
children: "Revoke"
|
|
427
|
+
}
|
|
428
|
+
)
|
|
429
|
+
] })
|
|
430
|
+
] });
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// src/teams-react/components/InviteAcceptPage.tsx
|
|
434
|
+
import { useState as useState4 } from "react";
|
|
435
|
+
|
|
436
|
+
// src/teams-react/components/BrandMark.tsx
|
|
437
|
+
import { lazy, Suspense } from "react";
|
|
438
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
439
|
+
function MarkSpacer({ size }) {
|
|
440
|
+
return /* @__PURE__ */ jsx4("span", { "aria-hidden": true, style: { display: "inline-block", width: size, height: size } });
|
|
441
|
+
}
|
|
442
|
+
var LazyKnot = lazy(async () => {
|
|
443
|
+
try {
|
|
444
|
+
const mod = await import("../brand/index.js");
|
|
445
|
+
return { default: mod.TangleKnot };
|
|
446
|
+
} catch {
|
|
447
|
+
return { default: MarkSpacer };
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
function BrandMark({ size, className }) {
|
|
451
|
+
return /* @__PURE__ */ jsx4(Suspense, { fallback: /* @__PURE__ */ jsx4(MarkSpacer, { size }), children: /* @__PURE__ */ jsx4(LazyKnot, { size, className }) });
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// src/teams-react/components/InviteAcceptPage.tsx
|
|
455
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
456
|
+
function InviteAcceptPage({ details, onAccept, onNavigate, onResendVerification }) {
|
|
457
|
+
const [accepting, setAccepting] = useState4(false);
|
|
458
|
+
const [acceptError, setAcceptError] = useState4(null);
|
|
459
|
+
const [accepted, setAccepted] = useState4(false);
|
|
460
|
+
const [resendingVerification, setResendingVerification] = useState4(false);
|
|
461
|
+
const [verificationSent, setVerificationSent] = useState4(false);
|
|
462
|
+
if (details.status === "invalid") {
|
|
463
|
+
return /* @__PURE__ */ jsx5(Shell, { title: "Invalid invitation", body: "This link is invalid or already used. Ask the workspace admin to send a new one.", children: /* @__PURE__ */ jsx5(PrimaryButton, { onClick: () => onNavigate({ kind: "sign-in" }), children: "Go to sign in" }) });
|
|
464
|
+
}
|
|
465
|
+
if (details.status === "already-accepted") {
|
|
466
|
+
return /* @__PURE__ */ jsx5(Shell, { title: "Already accepted", body: "This invitation has already been accepted.", children: /* @__PURE__ */ jsx5(PrimaryButton, { onClick: () => onNavigate({ kind: "open-app" }), children: "Open workspace" }) });
|
|
467
|
+
}
|
|
468
|
+
if (details.status === "expired") {
|
|
469
|
+
return /* @__PURE__ */ jsx5(Shell, { title: "Invitation expired", body: "This invitation has expired. Ask the workspace admin to send a new one.", children: /* @__PURE__ */ jsx5(PrimaryButton, { onClick: () => onNavigate({ kind: "sign-in" }), children: "Go to sign in" }) });
|
|
470
|
+
}
|
|
471
|
+
if (details.status === "revoked") {
|
|
472
|
+
return /* @__PURE__ */ jsx5(Shell, { title: "Invitation revoked", body: "This invitation has been revoked. Ask the workspace admin to send a new one.", children: /* @__PURE__ */ jsx5(PrimaryButton, { onClick: () => onNavigate({ kind: "sign-in" }), children: "Go to sign in" }) });
|
|
473
|
+
}
|
|
474
|
+
const workspaceName = details.workspaceName ?? "a workspace";
|
|
475
|
+
const inviterPrefix = details.inviterName ? `${details.inviterName} invited you` : "You've been invited";
|
|
476
|
+
const roleSuffix = details.role ? ` as ${details.role}` : "";
|
|
477
|
+
if (!details.currentUserEmail) {
|
|
478
|
+
return /* @__PURE__ */ jsxs4(Shell, { title: "You've been invited", children: [
|
|
479
|
+
/* @__PURE__ */ jsxs4("p", { className: "mb-4 text-sm text-[var(--text-secondary)]", children: [
|
|
480
|
+
inviterPrefix,
|
|
481
|
+
" to join ",
|
|
482
|
+
/* @__PURE__ */ jsx5("span", { className: "font-medium text-[var(--text-primary)]", children: workspaceName }),
|
|
483
|
+
roleSuffix,
|
|
484
|
+
"."
|
|
485
|
+
] }),
|
|
486
|
+
details.inviteEmail && /* @__PURE__ */ jsxs4("p", { className: "mb-6 text-sm text-[var(--text-secondary)]", children: [
|
|
487
|
+
"Sign in or create an account with",
|
|
488
|
+
" ",
|
|
489
|
+
/* @__PURE__ */ jsx5("span", { className: "font-medium text-[var(--text-primary)]", children: details.inviteEmail }),
|
|
490
|
+
" to accept."
|
|
491
|
+
] }),
|
|
492
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
493
|
+
/* @__PURE__ */ jsx5(PrimaryButton, { onClick: () => onNavigate({ kind: "sign-in" }), children: "Sign in" }),
|
|
494
|
+
/* @__PURE__ */ jsx5(SecondaryButton, { onClick: () => onNavigate({ kind: "sign-up" }), children: "Create account" })
|
|
495
|
+
] })
|
|
496
|
+
] });
|
|
497
|
+
}
|
|
498
|
+
if (accepted) {
|
|
499
|
+
return /* @__PURE__ */ jsx5(Shell, { title: "Welcome!", children: /* @__PURE__ */ jsxs4("p", { className: "text-sm text-[var(--text-secondary)]", children: [
|
|
500
|
+
"You've joined ",
|
|
501
|
+
/* @__PURE__ */ jsx5("span", { className: "font-medium text-[var(--text-primary)]", children: workspaceName }),
|
|
502
|
+
"."
|
|
503
|
+
] }) });
|
|
504
|
+
}
|
|
505
|
+
const emailMismatch = Boolean(
|
|
506
|
+
details.inviteEmail && details.inviteEmail.toLowerCase() !== details.currentUserEmail.toLowerCase()
|
|
507
|
+
);
|
|
508
|
+
const needsVerification = Boolean(details.needsEmailVerification) && !emailMismatch;
|
|
509
|
+
const expiryLabel = details.expiresAt != null ? new Date(details.expiresAt).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : null;
|
|
510
|
+
async function handleAccept() {
|
|
511
|
+
setAccepting(true);
|
|
512
|
+
setAcceptError(null);
|
|
513
|
+
try {
|
|
514
|
+
const result = await onAccept();
|
|
515
|
+
setAccepted(true);
|
|
516
|
+
if (result && "workspaceId" in result && result.workspaceId) {
|
|
517
|
+
onNavigate({ kind: "open-app", workspaceId: result.workspaceId });
|
|
518
|
+
}
|
|
519
|
+
} catch (err) {
|
|
520
|
+
setAcceptError(err instanceof Error ? err.message : "Failed to accept invitation");
|
|
521
|
+
} finally {
|
|
522
|
+
setAccepting(false);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
async function handleResendVerification() {
|
|
526
|
+
if (!onResendVerification || resendingVerification) return;
|
|
527
|
+
setResendingVerification(true);
|
|
528
|
+
try {
|
|
529
|
+
await onResendVerification();
|
|
530
|
+
setVerificationSent(true);
|
|
531
|
+
} finally {
|
|
532
|
+
setResendingVerification(false);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return /* @__PURE__ */ jsxs4(Shell, { title: "Join workspace", children: [
|
|
536
|
+
/* @__PURE__ */ jsxs4("p", { className: "mb-4 text-sm text-[var(--text-secondary)]", children: [
|
|
537
|
+
inviterPrefix,
|
|
538
|
+
" to join ",
|
|
539
|
+
/* @__PURE__ */ jsx5("span", { className: "font-medium text-[var(--text-primary)]", children: workspaceName }),
|
|
540
|
+
roleSuffix,
|
|
541
|
+
"."
|
|
542
|
+
] }),
|
|
543
|
+
/* @__PURE__ */ jsxs4("p", { className: "mb-4 text-sm text-[var(--text-secondary)]", children: [
|
|
544
|
+
"Signed in as ",
|
|
545
|
+
/* @__PURE__ */ jsx5("span", { className: "font-medium text-[var(--text-primary)]", children: details.currentUserEmail })
|
|
546
|
+
] }),
|
|
547
|
+
expiryLabel && /* @__PURE__ */ jsxs4("p", { className: "mb-4 text-xs text-[var(--text-muted)]", children: [
|
|
548
|
+
"This invitation expires on ",
|
|
549
|
+
expiryLabel,
|
|
550
|
+
"."
|
|
551
|
+
] }),
|
|
552
|
+
emailMismatch && /* @__PURE__ */ jsxs4(
|
|
553
|
+
"div",
|
|
554
|
+
{
|
|
555
|
+
role: "alert",
|
|
556
|
+
className: "mb-4 rounded-md border border-[var(--border-default)] px-4 py-2 text-sm text-[var(--text-warning)]",
|
|
557
|
+
children: [
|
|
558
|
+
"This invitation was sent to ",
|
|
559
|
+
/* @__PURE__ */ jsx5("span", { className: "font-medium", children: details.inviteEmail }),
|
|
560
|
+
". Switch to that account to accept it."
|
|
561
|
+
]
|
|
562
|
+
}
|
|
563
|
+
),
|
|
564
|
+
needsVerification && /* @__PURE__ */ jsx5(
|
|
565
|
+
"div",
|
|
566
|
+
{
|
|
567
|
+
role: "alert",
|
|
568
|
+
className: "mb-4 rounded-md border border-[var(--border-default)] px-4 py-2 text-sm text-[var(--text-warning)]",
|
|
569
|
+
children: verificationSent ? "Verification email sent \u2014 check your inbox, then refresh this page to accept." : "Verify your email address before you can accept this invitation."
|
|
570
|
+
}
|
|
571
|
+
),
|
|
572
|
+
acceptError && /* @__PURE__ */ jsx5("p", { role: "alert", className: "mb-4 text-sm text-[var(--text-danger)]", children: acceptError }),
|
|
573
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
574
|
+
emailMismatch ? /* @__PURE__ */ jsx5(PrimaryButton, { onClick: () => onNavigate({ kind: "switch-account" }), children: "Switch account" }) : needsVerification ? onResendVerification ? /* @__PURE__ */ jsx5(
|
|
575
|
+
PrimaryButton,
|
|
576
|
+
{
|
|
577
|
+
onClick: () => void handleResendVerification(),
|
|
578
|
+
disabled: resendingVerification || verificationSent,
|
|
579
|
+
children: verificationSent ? "Verification sent" : resendingVerification ? "Sending\u2026" : "Resend verification email"
|
|
580
|
+
}
|
|
581
|
+
) : /* @__PURE__ */ jsx5(PrimaryButton, { onClick: () => onNavigate({ kind: "open-app" }), children: "Open app" }) : /* @__PURE__ */ jsx5(PrimaryButton, { onClick: () => void handleAccept(), disabled: accepting, children: accepting ? "Accepting\u2026" : "Accept invitation" }),
|
|
582
|
+
/* @__PURE__ */ jsx5(SecondaryButton, { onClick: () => onNavigate({ kind: "open-app" }), children: "Not now" })
|
|
583
|
+
] })
|
|
584
|
+
] });
|
|
585
|
+
}
|
|
586
|
+
function Shell({ title, body, children }) {
|
|
587
|
+
return /* @__PURE__ */ jsxs4("div", { className: "mx-auto flex w-full max-w-sm flex-col", children: [
|
|
588
|
+
/* @__PURE__ */ jsxs4("span", { className: "mb-4 flex items-center gap-2 text-[var(--text-muted)]", children: [
|
|
589
|
+
/* @__PURE__ */ jsx5(BrandMark, { size: 22, className: "shrink-0" }),
|
|
590
|
+
/* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold uppercase tracking-[0.05em]", children: "Tangle Teams" })
|
|
591
|
+
] }),
|
|
592
|
+
/* @__PURE__ */ jsx5("h1", { className: "mb-1 text-xl font-semibold tracking-tight text-[var(--text-primary)]", children: title }),
|
|
593
|
+
body && /* @__PURE__ */ jsx5("p", { className: "mb-6 text-sm text-[var(--text-secondary)]", children: body }),
|
|
594
|
+
children
|
|
595
|
+
] });
|
|
596
|
+
}
|
|
597
|
+
function PrimaryButton({ children, onClick, disabled }) {
|
|
598
|
+
return /* @__PURE__ */ jsx5(
|
|
599
|
+
"button",
|
|
600
|
+
{
|
|
601
|
+
type: "button",
|
|
602
|
+
onClick,
|
|
603
|
+
disabled,
|
|
604
|
+
className: "flex-1 rounded bg-[var(--brand-primary)] px-4 py-2 text-sm text-[hsl(var(--primary-foreground))] disabled:opacity-50",
|
|
605
|
+
children
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
function SecondaryButton({ children, onClick }) {
|
|
610
|
+
return /* @__PURE__ */ jsx5(
|
|
611
|
+
"button",
|
|
612
|
+
{
|
|
613
|
+
type: "button",
|
|
614
|
+
onClick,
|
|
615
|
+
className: "flex-1 rounded border border-[var(--border-default)] px-4 py-2 text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)]",
|
|
616
|
+
children
|
|
617
|
+
}
|
|
618
|
+
);
|
|
619
|
+
}
|
|
12
620
|
export {
|
|
13
621
|
InvitationsPanel,
|
|
14
622
|
InviteAcceptPage,
|