@tangle-network/agent-app 0.63.75 → 0.63.76

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.
Files changed (58) hide show
  1. package/dist/{DesignCanvas-566V5KVC.js → DesignCanvas-DRVL3MWL.js} +3 -3
  2. package/dist/{DesignCanvasEditor-PUO5Y6FB.js → DesignCanvasEditor-5T3MHHFH.js} +4 -4
  3. package/dist/agent-profiles/d1.js +3 -3
  4. package/dist/agent-profiles/index.js +3 -3
  5. package/dist/assistant/index.js +3 -3
  6. package/dist/assistant/index.js.map +1 -1
  7. package/dist/chat-routes/index.js +4 -4
  8. package/dist/{chunk-WYQTPFPI.js → chunk-3ELC7F62.js} +2 -2
  9. package/dist/{chunk-2ACI3WYT.js → chunk-5DXOFO4V.js} +2 -2
  10. package/dist/{chunk-E2JMXA2V.js → chunk-CGBB2AUP.js} +5 -5
  11. package/dist/{chunk-E2JMXA2V.js.map → chunk-CGBB2AUP.js.map} +1 -1
  12. package/dist/{chunk-VKJEH6DG.js → chunk-CI6Z2C4L.js} +2 -2
  13. package/dist/{chunk-6IMNAZR7.js → chunk-DS3FDGVJ.js} +2 -2
  14. package/dist/{chunk-XJ7DC2DI.js → chunk-SK6WU2TI.js} +3 -3
  15. package/dist/{chunk-62BPUU3A.js → chunk-V2BC73KQ.js} +5 -5
  16. package/dist/{chunk-I4CFBLSJ.js → chunk-Y3HRQVAO.js} +10 -10
  17. package/dist/{chunk-KBJZMR4E.js → chunk-Y5WTAHWY.js} +1 -1
  18. package/dist/chunk-Y5WTAHWY.js.map +1 -0
  19. package/dist/{chunk-YQD2RISF.js → chunk-YGMJ6NDY.js} +3 -3
  20. package/dist/{chunk-OBKVNZPH.js → chunk-YL5JDX7K.js} +4 -4
  21. package/dist/{chunk-OBKVNZPH.js.map → chunk-YL5JDX7K.js.map} +1 -1
  22. package/dist/design-canvas-react/index.js +9 -9
  23. package/dist/design-canvas-react/lazy.js +1 -1
  24. package/dist/platform/index.js +8 -8
  25. package/dist/preset-cloudflare/index.js +5 -5
  26. package/dist/public-consultation/index.js +4 -4
  27. package/dist/sandbox/index.js +4 -4
  28. package/dist/settings-react/index.js +64 -31
  29. package/dist/settings-react/index.js.map +1 -1
  30. package/dist/settings-react/members-section.d.ts +15 -5
  31. package/dist/stories/settings/settings-demo.d.ts +4 -1
  32. package/dist/teams/index.js +1 -1
  33. package/dist/teams/invitations-api.d.ts +6 -4
  34. package/dist/teams/invitations-api.js +4 -2
  35. package/dist/teams/invitations-api.js.map +1 -1
  36. package/dist/teams/invitations.d.ts +2 -0
  37. package/dist/teams/members-api.js +2 -2
  38. package/dist/teams-react/components/invitation-detail.d.ts +4 -2
  39. package/dist/teams-react/index.js +2 -2
  40. package/dist/theme/tokens.css +19 -19
  41. package/dist/tools/index.js +4 -4
  42. package/dist/web-react/index.js +7 -7
  43. package/dist/work-product/index.js +2 -2
  44. package/dist/worker-build/index.d.ts +26 -0
  45. package/dist/worker-build/index.js +73 -0
  46. package/dist/worker-build/index.js.map +1 -0
  47. package/package.json +12 -7
  48. package/dist/chunk-KBJZMR4E.js.map +0 -1
  49. /package/dist/{DesignCanvas-566V5KVC.js.map → DesignCanvas-DRVL3MWL.js.map} +0 -0
  50. /package/dist/{DesignCanvasEditor-PUO5Y6FB.js.map → DesignCanvasEditor-5T3MHHFH.js.map} +0 -0
  51. /package/dist/{chunk-WYQTPFPI.js.map → chunk-3ELC7F62.js.map} +0 -0
  52. /package/dist/{chunk-2ACI3WYT.js.map → chunk-5DXOFO4V.js.map} +0 -0
  53. /package/dist/{chunk-VKJEH6DG.js.map → chunk-CI6Z2C4L.js.map} +0 -0
  54. /package/dist/{chunk-6IMNAZR7.js.map → chunk-DS3FDGVJ.js.map} +0 -0
  55. /package/dist/{chunk-XJ7DC2DI.js.map → chunk-SK6WU2TI.js.map} +0 -0
  56. /package/dist/{chunk-62BPUU3A.js.map → chunk-V2BC73KQ.js.map} +0 -0
  57. /package/dist/{chunk-I4CFBLSJ.js.map → chunk-Y3HRQVAO.js.map} +0 -0
  58. /package/dist/{chunk-YQD2RISF.js.map → chunk-YGMJ6NDY.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  validateOpenUIJsonNode
3
- } from "./chunk-E2JMXA2V.js";
3
+ } from "./chunk-CGBB2AUP.js";
4
4
  import {
5
5
  ToolInputError
6
6
  } from "./chunk-F4XBNR5L.js";
@@ -27,4 +27,4 @@ function parseRenderUiSchema(value) {
27
27
  export {
28
28
  parseRenderUiSchema
29
29
  };
30
- //# sourceMappingURL=chunk-VKJEH6DG.js.map
30
+ //# sourceMappingURL=chunk-CI6Z2C4L.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  OPENUI_NODE_JSON_SCHEMA,
6
6
  OPENUI_NODE_TYPES
7
- } from "./chunk-E2JMXA2V.js";
7
+ } from "./chunk-CGBB2AUP.js";
8
8
 
9
9
  // src/tools/openai.ts
10
10
  var APP_TOOL_NAMES = ["submit_proposal", "schedule_followup", "render_ui", "add_citation"];
@@ -117,4 +117,4 @@ export {
117
117
  customToolToOpenAI,
118
118
  findCustomTool
119
119
  };
120
- //# sourceMappingURL=chunk-6IMNAZR7.js.map
120
+ //# sourceMappingURL=chunk-DS3FDGVJ.js.map
@@ -4,12 +4,12 @@ import {
4
4
  } from "./chunk-OY7A6M7S.js";
5
5
  import {
6
6
  parseRenderUiSchema
7
- } from "./chunk-VKJEH6DG.js";
7
+ } from "./chunk-CI6Z2C4L.js";
8
8
  import {
9
9
  buildAppToolOpenAITools,
10
10
  findCustomTool,
11
11
  isAppToolName
12
- } from "./chunk-6IMNAZR7.js";
12
+ } from "./chunk-DS3FDGVJ.js";
13
13
  import {
14
14
  ToolInputError
15
15
  } from "./chunk-F4XBNR5L.js";
@@ -212,4 +212,4 @@ export {
212
212
  createAppToolRuntimeExecutor,
213
213
  handleAppToolRequest
214
214
  };
215
- //# sourceMappingURL=chunk-XJ7DC2DI.js.map
215
+ //# sourceMappingURL=chunk-SK6WU2TI.js.map
@@ -3,10 +3,7 @@ import {
3
3
  BrandKnot,
4
4
  DesignCanvas,
5
5
  ShapesGlyph
6
- } from "./chunk-I4CFBLSJ.js";
7
- import {
8
- PlusGlyph
9
- } from "./chunk-P4RRC4AO.js";
6
+ } from "./chunk-Y3HRQVAO.js";
10
7
  import {
11
8
  DEFAULT_INSERT_TEMPLATES,
12
9
  collectGridTargets,
@@ -30,6 +27,9 @@ import {
30
27
  setAttrsCommand,
31
28
  ungroupElementCommand
32
29
  } from "./chunk-CPWMBYLQ.js";
30
+ import {
31
+ PlusGlyph
32
+ } from "./chunk-P4RRC4AO.js";
33
33
  import {
34
34
  SCENE_SCHEMA_VERSION,
35
35
  boundsIntersect,
@@ -2123,4 +2123,4 @@ export {
2123
2123
  Workspace,
2124
2124
  DesignCanvasEditor
2125
2125
  };
2126
- //# sourceMappingURL=chunk-62BPUU3A.js.map
2126
+ //# sourceMappingURL=chunk-V2BC73KQ.js.map
@@ -1,12 +1,3 @@
1
- import {
2
- LockGlyph,
3
- MagnetGlyph,
4
- MinusGlyph,
5
- PlusGlyph,
6
- RedoGlyph,
7
- UndoGlyph,
8
- createEditorGlyph
9
- } from "./chunk-P4RRC4AO.js";
10
1
  import {
11
2
  addPageCommand,
12
3
  bindSlotCommand,
@@ -23,6 +14,15 @@ import {
23
14
  setPagePropsCommand,
24
15
  ungroupElementCommand
25
16
  } from "./chunk-CPWMBYLQ.js";
17
+ import {
18
+ LockGlyph,
19
+ MagnetGlyph,
20
+ MinusGlyph,
21
+ PlusGlyph,
22
+ RedoGlyph,
23
+ UndoGlyph,
24
+ createEditorGlyph
25
+ } from "./chunk-P4RRC4AO.js";
26
26
  import {
27
27
  SIZE_PRESETS,
28
28
  findElement,
@@ -2382,4 +2382,4 @@ export {
2382
2382
  ExportControl,
2383
2383
  DesignCanvas
2384
2384
  };
2385
- //# sourceMappingURL=chunk-I4CFBLSJ.js.map
2385
+ //# sourceMappingURL=chunk-Y3HRQVAO.js.map
@@ -36,4 +36,4 @@ export {
36
36
  generateInvitationToken,
37
37
  inviteUrlForToken
38
38
  };
39
- //# sourceMappingURL=chunk-KBJZMR4E.js.map
39
+ //# sourceMappingURL=chunk-Y5WTAHWY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/teams/invitations.ts"],"sourcesContent":["/**\n * Pure invitation helpers for the teams capability. Zero dependencies: no\n * drizzle, no env, no react, no network. The lifecycle API (`./invitations-api`)\n * and an app's own mail transport build on these; the invitation email itself\n * is `inviteEmail` from `@tangle-network/agent-app/email`.\n */\n\nimport type { AssignableWorkspaceRole } from './roles'\n\n/** The role an invitation grants — the assignable workspace ladder (never owner). */\nexport type InvitationPermission = AssignableWorkspaceRole\n\n/** Define possible states for an invitation's lifecycle including pending, accepted, expired, and revoked */\nexport type InvitationStatus = 'pending' | 'accepted' | 'expired' | 'revoked'\n/** Define possible statuses for the sending state of an invitation email */\nexport type InvitationEmailStatus = 'not_sent' | 'sent' | 'failed'\n/** How an invitation reaches the person: `email` sends them the link; `link` sends nothing, and the inviter shares it. */\nexport type InvitationDelivery = 'email' | 'link'\n\n/** Define the number of days before an invitation expires */\nexport const INVITATION_EXPIRY_DAYS = 7\n\nconst INVITATION_PERMISSIONS = ['admin', 'editor', 'viewer'] as const\nconst TOKEN_BYTE_LENGTH = 32\n\n/** Normalize an invitation email by trimming whitespace and converting to lowercase */\nexport function normalizeInvitationEmail(email: string): string {\n return email.trim().toLowerCase()\n}\n\n// One `@`, a local part, and a domain with a dot and a 2+ letter ending. It is\n// the shape a mail server can deliver to, not full RFC 5322: the invite email\n// itself is the real check, and this only stops `founder@` or `founder@example`.\nconst DELIVERABLE_EMAIL = /^[^\\s@]+@[^\\s@.]+(\\.[^\\s@.]+)*\\.[^\\s@.]{2,}$/\n\n/** Whether an address has the shape an invitation can be delivered to. */\nexport function isInvitationEmail(email: string): boolean {\n return DELIVERABLE_EMAIL.test(email.trim())\n}\n\n/** What to tell someone whose invite address cannot be delivered to. */\nexport const INVITATION_EMAIL_HINT = 'Enter a full email address, such as name@company.com.'\n\n/** Resolve invitation permission from a string or return null if invalid */\nexport function parseInvitationPermission(value: string | undefined): InvitationPermission | null {\n return INVITATION_PERMISSIONS.includes(value as InvitationPermission) ? (value as InvitationPermission) : null\n}\n\n/** Calculate the expiration date of an invitation based on the given or current date */\nexport function getInvitationExpiresAt(now: Date = new Date()): Date {\n return new Date(now.getTime() + INVITATION_EXPIRY_DAYS * 24 * 60 * 60 * 1000)\n}\n\n/**\n * A cryptographically-random, URL-safe invitation token. `inv_`-prefixed so a\n * token is self-identifying and never collides with the workspaceMember invite\n * tokens minted by `members-api` (`generateInviteToken`).\n */\nexport function generateInvitationToken(): string {\n const bytes = new Uint8Array(TOKEN_BYTE_LENGTH)\n globalThis.crypto.getRandomValues(bytes)\n const token = Array.from(bytes, (byte) => String.fromCharCode(byte)).join('')\n return `inv_${btoa(token).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/g, '')}`\n}\n\n/** Generate an invite URL by combining the origin with an encoded token */\nexport function inviteUrlForToken(origin: string, token: string): string {\n return `${origin.replace(/\\/+$/, '')}/invite/${encodeURIComponent(token)}`\n}\n"],"mappings":";AAoBO,IAAM,yBAAyB;AAEtC,IAAM,yBAAyB,CAAC,SAAS,UAAU,QAAQ;AAC3D,IAAM,oBAAoB;AAGnB,SAAS,yBAAyB,OAAuB;AAC9D,SAAO,MAAM,KAAK,EAAE,YAAY;AAClC;AAKA,IAAM,oBAAoB;AAGnB,SAAS,kBAAkB,OAAwB;AACxD,SAAO,kBAAkB,KAAK,MAAM,KAAK,CAAC;AAC5C;AAGO,IAAM,wBAAwB;AAG9B,SAAS,0BAA0B,OAAwD;AAChG,SAAO,uBAAuB,SAAS,KAA6B,IAAK,QAAiC;AAC5G;AAGO,SAAS,uBAAuB,MAAY,oBAAI,KAAK,GAAS;AACnE,SAAO,IAAI,KAAK,IAAI,QAAQ,IAAI,yBAAyB,KAAK,KAAK,KAAK,GAAI;AAC9E;AAOO,SAAS,0BAAkC;AAChD,QAAM,QAAQ,IAAI,WAAW,iBAAiB;AAC9C,aAAW,OAAO,gBAAgB,KAAK;AACvC,QAAM,QAAQ,MAAM,KAAK,OAAO,CAAC,SAAS,OAAO,aAAa,IAAI,CAAC,EAAE,KAAK,EAAE;AAC5E,SAAO,OAAO,KAAK,KAAK,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,QAAQ,EAAE,CAAC;AACvF;AAGO,SAAS,kBAAkB,QAAgB,OAAuB;AACvE,SAAO,GAAG,OAAO,QAAQ,QAAQ,EAAE,CAAC,WAAW,mBAAmB,KAAK,CAAC;AAC1E;","names":[]}
@@ -1,14 +1,14 @@
1
1
  // src/design-canvas-react/lazy.tsx
2
2
  import { lazy } from "react";
3
3
  var DesignCanvasLazy = lazy(
4
- () => import("./DesignCanvasEditor-PUO5Y6FB.js").then((m) => ({ default: m.DesignCanvasEditor }))
4
+ () => import("./DesignCanvasEditor-5T3MHHFH.js").then((m) => ({ default: m.DesignCanvasEditor }))
5
5
  );
6
6
  var DesignCanvasChromeLazy = lazy(
7
- () => import("./DesignCanvas-566V5KVC.js").then((m) => ({ default: m.DesignCanvas }))
7
+ () => import("./DesignCanvas-DRVL3MWL.js").then((m) => ({ default: m.DesignCanvas }))
8
8
  );
9
9
 
10
10
  export {
11
11
  DesignCanvasLazy,
12
12
  DesignCanvasChromeLazy
13
13
  };
14
- //# sourceMappingURL=chunk-YQD2RISF.js.map
14
+ //# sourceMappingURL=chunk-YGMJ6NDY.js.map
@@ -44,14 +44,14 @@ function memberRoleLabel(member) {
44
44
  function shortDate(value) {
45
45
  return new Date(value).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
46
46
  }
47
- function invitationDetail(invitation) {
47
+ function invitationDetail(invitation, delivery = "email") {
48
48
  const role = ROLE_CAPABILITY[invitation.permissions];
49
49
  switch (invitation.status) {
50
50
  case "accepted":
51
51
  return invitation.acceptedAt ? `${role} \xB7 joined ${shortDate(invitation.acceptedAt)}` : `${role} \xB7 joined`;
52
52
  case "pending": {
53
- const delivery = invitation.emailStatus === "sent" ? "email sent" : invitation.emailStatus === "not_sent" ? "email not sent yet" : null;
54
- return [role, delivery, `expires ${shortDate(invitation.expiresAt)}`].filter(Boolean).join(" \xB7 ");
53
+ const sent = delivery === "link" ? null : invitation.emailStatus === "sent" ? "email sent" : invitation.emailStatus === "not_sent" ? "email not sent yet" : null;
54
+ return [role, sent, `expires ${shortDate(invitation.expiresAt)}`].filter(Boolean).join(" \xB7 ");
55
55
  }
56
56
  case "expired":
57
57
  return `${role} \xB7 expired ${shortDate(invitation.expiresAt)}`;
@@ -67,4 +67,4 @@ export {
67
67
  memberRoleLabel,
68
68
  invitationDetail
69
69
  };
70
- //# sourceMappingURL=chunk-OBKVNZPH.js.map
70
+ //# sourceMappingURL=chunk-YL5JDX7K.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/teams-react/components/RoleSelect.tsx","../src/teams-react/components/member-access.ts","../src/teams-react/components/invitation-detail.ts"],"sourcesContent":["/**\n * The role picker both team panels and the settings sections share: the ui\n * `Select`, with each role named by what it lets a person do and, in the open\n * list, one line on what it adds, so choosing one never needs a help page.\n * The trigger shows the name alone and fills its container; give the\n * container the width.\n */\n\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@tangle-network/ui/primitives'\nimport { ASSIGNABLE_WORKSPACE_ROLES, type AssignableWorkspaceRole, type WorkspaceRole } from '../../teams/roles'\n\n/** Each workspace role in the words a person decides by. */\nexport const ROLE_CAPABILITY: Record<WorkspaceRole, string> = {\n viewer: 'Can view',\n editor: 'Can edit',\n admin: 'Can manage settings and people',\n owner: 'Owner',\n}\n\n// What each assignable role adds, under its name in the open list; chatting\n// with the agent is what a viewer cannot do. Each line fits a phone-width\n// trigger, so the open list is never wider than the screen.\nconst ROLE_DESCRIPTION: Record<AssignableWorkspaceRole, string> = {\n viewer: 'Reads everything; can’t chat or edit',\n editor: 'Also chats with the agent and edits',\n admin: 'Also invites people and sets roles',\n}\n\nexport interface RoleSelectProps {\n value: WorkspaceRole\n onChange(role: WorkspaceRole): void\n /** Accessible name (no visible label — the panels label the row). */\n ariaLabel: string\n id?: string\n disabled?: boolean\n}\n\nexport function RoleSelect({ value, onChange, ariaLabel, id, disabled }: RoleSelectProps) {\n return (\n <Select value={value} onValueChange={(role) => onChange(role as WorkspaceRole)} disabled={disabled}>\n <SelectTrigger id={id} aria-label={ariaLabel}>\n <SelectValue>{ROLE_CAPABILITY[value]}</SelectValue>\n </SelectTrigger>\n <SelectContent>\n {ASSIGNABLE_WORKSPACE_ROLES.map((role) => (\n <SelectItem key={role} value={role} textValue={ROLE_CAPABILITY[role]}>\n <span className=\"block\">{ROLE_CAPABILITY[role]}</span>\n <span className=\"block font-normal text-muted-foreground\" data-role-description>{ROLE_DESCRIPTION[role]}</span>\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )\n}\n","/**\n * Who may change a member's access, and the words for a role shown as text.\n * `MembersPanel` and the settings `MembersSection` both read these, so the two\n * member lists apply one rule.\n */\n\nimport { hasWorkspaceRole, type WorkspaceRole } from '../../teams/roles'\nimport type { MemberView } from '../contracts'\nimport { ROLE_CAPABILITY } from './RoleSelect'\n\n/**\n * Whether the viewer can change this member's role or remove them: an admin\n * can, except for an owner, an inherited organization admin, or their own row,\n * so no one demotes or removes themselves from a list.\n */\nexport function canManageMember(member: MemberView, currentRole: WorkspaceRole, currentUserId?: string | null): boolean {\n if (!hasWorkspaceRole(currentRole, 'admin') || member.role === 'owner' || member.inherited) return false\n return !isCurrentMember(member, currentUserId)\n}\n\n/** True on the viewer's own row. */\nexport function isCurrentMember(member: MemberView, currentUserId?: string | null): boolean {\n return currentUserId != null && member.userId === currentUserId\n}\n\n/** A role shown as text rather than a picker. */\nexport function memberRoleLabel(member: MemberView): string {\n if (member.role === 'owner') return member.inherited ? 'Organization admin' : 'Owner'\n return ROLE_CAPABILITY[member.role]\n}\n","/** The line under an invitation's address, shared by `InvitationsPanel` and the settings `InvitationsSection`. */\n\nimport type { InvitationView } from '../contracts'\nimport { ROLE_CAPABILITY } from './RoleSelect'\n\nfunction shortDate(value: Date | number | string): string {\n return new Date(value).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })\n}\n\n/**\n * The line under the address: what the invitee can do, then only what is true\n * of this invitation now. Every status says itself in words, so a past\n * invitation reads as joined, expired or revoked without a badge.\n */\nexport function invitationDetail(invitation: InvitationView): string {\n const role = ROLE_CAPABILITY[invitation.permissions]\n switch (invitation.status) {\n case 'accepted':\n return invitation.acceptedAt ? `${role} · joined ${shortDate(invitation.acceptedAt)}` : `${role} · joined`\n case 'pending': {\n const delivery = invitation.emailStatus === 'sent' ? 'email sent' : invitation.emailStatus === 'not_sent' ? 'email not sent yet' : null\n return [role, delivery, `expires ${shortDate(invitation.expiresAt)}`].filter(Boolean).join(' · ')\n }\n case 'expired':\n return `${role} · expired ${shortDate(invitation.expiresAt)}`\n case 'revoked':\n return `${role} · revoked`\n }\n}\n"],"mappings":";;;;;;AAQA,SAAS,QAAQ,eAAe,YAAY,eAAe,mBAAmB;AAiCtE,cAIE,YAJF;AA7BD,IAAM,kBAAiD;AAAA,EAC5D,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AACT;AAKA,IAAM,mBAA4D;AAAA,EAChE,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AACT;AAWO,SAAS,WAAW,EAAE,OAAO,UAAU,WAAW,IAAI,SAAS,GAAoB;AACxF,SACE,qBAAC,UAAO,OAAc,eAAe,CAAC,SAAS,SAAS,IAAqB,GAAG,UAC9E;AAAA,wBAAC,iBAAc,IAAQ,cAAY,WACjC,8BAAC,eAAa,0BAAgB,KAAK,GAAE,GACvC;AAAA,IACA,oBAAC,iBACE,qCAA2B,IAAI,CAAC,SAC/B,qBAAC,cAAsB,OAAO,MAAM,WAAW,gBAAgB,IAAI,GACjE;AAAA,0BAAC,UAAK,WAAU,SAAS,0BAAgB,IAAI,GAAE;AAAA,MAC/C,oBAAC,UAAK,WAAU,2CAA0C,yBAAqB,MAAE,2BAAiB,IAAI,GAAE;AAAA,SAFzF,IAGjB,CACD,GACH;AAAA,KACF;AAEJ;;;ACtCO,SAAS,gBAAgB,QAAoB,aAA4B,eAAwC;AACtH,MAAI,CAAC,iBAAiB,aAAa,OAAO,KAAK,OAAO,SAAS,WAAW,OAAO,UAAW,QAAO;AACnG,SAAO,CAAC,gBAAgB,QAAQ,aAAa;AAC/C;AAGO,SAAS,gBAAgB,QAAoB,eAAwC;AAC1F,SAAO,iBAAiB,QAAQ,OAAO,WAAW;AACpD;AAGO,SAAS,gBAAgB,QAA4B;AAC1D,MAAI,OAAO,SAAS,QAAS,QAAO,OAAO,YAAY,uBAAuB;AAC9E,SAAO,gBAAgB,OAAO,IAAI;AACpC;;;ACxBA,SAAS,UAAU,OAAuC;AACxD,SAAO,IAAI,KAAK,KAAK,EAAE,mBAAmB,SAAS,EAAE,OAAO,SAAS,KAAK,WAAW,MAAM,UAAU,CAAC;AACxG;AAOO,SAAS,iBAAiB,YAAoC;AACnE,QAAM,OAAO,gBAAgB,WAAW,WAAW;AACnD,UAAQ,WAAW,QAAQ;AAAA,IACzB,KAAK;AACH,aAAO,WAAW,aAAa,GAAG,IAAI,gBAAa,UAAU,WAAW,UAAU,CAAC,KAAK,GAAG,IAAI;AAAA,IACjG,KAAK,WAAW;AACd,YAAM,WAAW,WAAW,gBAAgB,SAAS,eAAe,WAAW,gBAAgB,aAAa,uBAAuB;AACnI,aAAO,CAAC,MAAM,UAAU,WAAW,UAAU,WAAW,SAAS,CAAC,EAAE,EAAE,OAAO,OAAO,EAAE,KAAK,QAAK;AAAA,IAClG;AAAA,IACA,KAAK;AACH,aAAO,GAAG,IAAI,iBAAc,UAAU,WAAW,SAAS,CAAC;AAAA,IAC7D,KAAK;AACH,aAAO,GAAG,IAAI;AAAA,EAClB;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/teams-react/components/RoleSelect.tsx","../src/teams-react/components/member-access.ts","../src/teams-react/components/invitation-detail.ts"],"sourcesContent":["/**\n * The role picker both team panels and the settings sections share: the ui\n * `Select`, with each role named by what it lets a person do and, in the open\n * list, one line on what it adds, so choosing one never needs a help page.\n * The trigger shows the name alone and fills its container; give the\n * container the width.\n */\n\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@tangle-network/ui/primitives'\nimport { ASSIGNABLE_WORKSPACE_ROLES, type AssignableWorkspaceRole, type WorkspaceRole } from '../../teams/roles'\n\n/** Each workspace role in the words a person decides by. */\nexport const ROLE_CAPABILITY: Record<WorkspaceRole, string> = {\n viewer: 'Can view',\n editor: 'Can edit',\n admin: 'Can manage settings and people',\n owner: 'Owner',\n}\n\n// What each assignable role adds, under its name in the open list; chatting\n// with the agent is what a viewer cannot do. Each line fits a phone-width\n// trigger, so the open list is never wider than the screen.\nconst ROLE_DESCRIPTION: Record<AssignableWorkspaceRole, string> = {\n viewer: 'Reads everything; can’t chat or edit',\n editor: 'Also chats with the agent and edits',\n admin: 'Also invites people and sets roles',\n}\n\nexport interface RoleSelectProps {\n value: WorkspaceRole\n onChange(role: WorkspaceRole): void\n /** Accessible name (no visible label — the panels label the row). */\n ariaLabel: string\n id?: string\n disabled?: boolean\n}\n\nexport function RoleSelect({ value, onChange, ariaLabel, id, disabled }: RoleSelectProps) {\n return (\n <Select value={value} onValueChange={(role) => onChange(role as WorkspaceRole)} disabled={disabled}>\n <SelectTrigger id={id} aria-label={ariaLabel}>\n <SelectValue>{ROLE_CAPABILITY[value]}</SelectValue>\n </SelectTrigger>\n <SelectContent>\n {ASSIGNABLE_WORKSPACE_ROLES.map((role) => (\n <SelectItem key={role} value={role} textValue={ROLE_CAPABILITY[role]}>\n <span className=\"block\">{ROLE_CAPABILITY[role]}</span>\n <span className=\"block font-normal text-muted-foreground\" data-role-description>{ROLE_DESCRIPTION[role]}</span>\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )\n}\n","/**\n * Who may change a member's access, and the words for a role shown as text.\n * `MembersPanel` and the settings `MembersSection` both read these, so the two\n * member lists apply one rule.\n */\n\nimport { hasWorkspaceRole, type WorkspaceRole } from '../../teams/roles'\nimport type { MemberView } from '../contracts'\nimport { ROLE_CAPABILITY } from './RoleSelect'\n\n/**\n * Whether the viewer can change this member's role or remove them: an admin\n * can, except for an owner, an inherited organization admin, or their own row,\n * so no one demotes or removes themselves from a list.\n */\nexport function canManageMember(member: MemberView, currentRole: WorkspaceRole, currentUserId?: string | null): boolean {\n if (!hasWorkspaceRole(currentRole, 'admin') || member.role === 'owner' || member.inherited) return false\n return !isCurrentMember(member, currentUserId)\n}\n\n/** True on the viewer's own row. */\nexport function isCurrentMember(member: MemberView, currentUserId?: string | null): boolean {\n return currentUserId != null && member.userId === currentUserId\n}\n\n/** A role shown as text rather than a picker. */\nexport function memberRoleLabel(member: MemberView): string {\n if (member.role === 'owner') return member.inherited ? 'Organization admin' : 'Owner'\n return ROLE_CAPABILITY[member.role]\n}\n","/** The line under an invitation's address, shared by `InvitationsPanel` and the settings `InvitationsSection`. */\n\nimport type { InvitationDelivery } from '../../teams/invitations'\nimport type { InvitationView } from '../contracts'\nimport { ROLE_CAPABILITY } from './RoleSelect'\n\nfunction shortDate(value: Date | number | string): string {\n return new Date(value).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })\n}\n\n/**\n * The line under the address: what the invitee can do, then only what is true\n * of this invitation now. Every status says itself in words, so a past\n * invitation reads as joined, expired or revoked without a badge. A link-only\n * invitation never mentions email.\n */\nexport function invitationDetail(invitation: InvitationView, delivery: InvitationDelivery = 'email'): string {\n const role = ROLE_CAPABILITY[invitation.permissions]\n switch (invitation.status) {\n case 'accepted':\n return invitation.acceptedAt ? `${role} · joined ${shortDate(invitation.acceptedAt)}` : `${role} · joined`\n case 'pending': {\n const sent = delivery === 'link' ? null : invitation.emailStatus === 'sent' ? 'email sent' : invitation.emailStatus === 'not_sent' ? 'email not sent yet' : null\n return [role, sent, `expires ${shortDate(invitation.expiresAt)}`].filter(Boolean).join(' · ')\n }\n case 'expired':\n return `${role} · expired ${shortDate(invitation.expiresAt)}`\n case 'revoked':\n return `${role} · revoked`\n }\n}\n"],"mappings":";;;;;;AAQA,SAAS,QAAQ,eAAe,YAAY,eAAe,mBAAmB;AAiCtE,cAIE,YAJF;AA7BD,IAAM,kBAAiD;AAAA,EAC5D,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AACT;AAKA,IAAM,mBAA4D;AAAA,EAChE,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AACT;AAWO,SAAS,WAAW,EAAE,OAAO,UAAU,WAAW,IAAI,SAAS,GAAoB;AACxF,SACE,qBAAC,UAAO,OAAc,eAAe,CAAC,SAAS,SAAS,IAAqB,GAAG,UAC9E;AAAA,wBAAC,iBAAc,IAAQ,cAAY,WACjC,8BAAC,eAAa,0BAAgB,KAAK,GAAE,GACvC;AAAA,IACA,oBAAC,iBACE,qCAA2B,IAAI,CAAC,SAC/B,qBAAC,cAAsB,OAAO,MAAM,WAAW,gBAAgB,IAAI,GACjE;AAAA,0BAAC,UAAK,WAAU,SAAS,0BAAgB,IAAI,GAAE;AAAA,MAC/C,oBAAC,UAAK,WAAU,2CAA0C,yBAAqB,MAAE,2BAAiB,IAAI,GAAE;AAAA,SAFzF,IAGjB,CACD,GACH;AAAA,KACF;AAEJ;;;ACtCO,SAAS,gBAAgB,QAAoB,aAA4B,eAAwC;AACtH,MAAI,CAAC,iBAAiB,aAAa,OAAO,KAAK,OAAO,SAAS,WAAW,OAAO,UAAW,QAAO;AACnG,SAAO,CAAC,gBAAgB,QAAQ,aAAa;AAC/C;AAGO,SAAS,gBAAgB,QAAoB,eAAwC;AAC1F,SAAO,iBAAiB,QAAQ,OAAO,WAAW;AACpD;AAGO,SAAS,gBAAgB,QAA4B;AAC1D,MAAI,OAAO,SAAS,QAAS,QAAO,OAAO,YAAY,uBAAuB;AAC9E,SAAO,gBAAgB,OAAO,IAAI;AACpC;;;ACvBA,SAAS,UAAU,OAAuC;AACxD,SAAO,IAAI,KAAK,KAAK,EAAE,mBAAmB,SAAS,EAAE,OAAO,SAAS,KAAK,WAAW,MAAM,UAAU,CAAC;AACxG;AAQO,SAAS,iBAAiB,YAA4B,WAA+B,SAAiB;AAC3G,QAAM,OAAO,gBAAgB,WAAW,WAAW;AACnD,UAAQ,WAAW,QAAQ;AAAA,IACzB,KAAK;AACH,aAAO,WAAW,aAAa,GAAG,IAAI,gBAAa,UAAU,WAAW,UAAU,CAAC,KAAK,GAAG,IAAI;AAAA,IACjG,KAAK,WAAW;AACd,YAAM,OAAO,aAAa,SAAS,OAAO,WAAW,gBAAgB,SAAS,eAAe,WAAW,gBAAgB,aAAa,uBAAuB;AAC5J,aAAO,CAAC,MAAM,MAAM,WAAW,UAAU,WAAW,SAAS,CAAC,EAAE,EAAE,OAAO,OAAO,EAAE,KAAK,QAAK;AAAA,IAC9F;AAAA,IACA,KAAK;AACH,aAAO,GAAG,IAAI,iBAAc,UAAU,WAAW,SAAS,CAAC;AAAA,IAC7D,KAAK;AACH,aAAO,GAAG,IAAI;AAAA,EAClB;AACF;","names":[]}
@@ -11,7 +11,7 @@ import {
11
11
  bakeTextTransform,
12
12
  exportDocumentJson,
13
13
  exportPageDataUrl
14
- } from "../chunk-62BPUU3A.js";
14
+ } from "../chunk-V2BC73KQ.js";
15
15
  import {
16
16
  BTN,
17
17
  BTN_ACTIVE,
@@ -39,14 +39,7 @@ import {
39
39
  buildRulerTicks,
40
40
  formatRulerLabel,
41
41
  selectTickStep
42
- } from "../chunk-I4CFBLSJ.js";
43
- import {
44
- DesignCanvasChromeLazy,
45
- DesignCanvasLazy
46
- } from "../chunk-YQD2RISF.js";
47
- import {
48
- LockGlyph
49
- } from "../chunk-P4RRC4AO.js";
42
+ } from "../chunk-Y3HRQVAO.js";
50
43
  import "../chunk-ZN5J47UX.js";
51
44
  import {
52
45
  DEFAULT_INSERT_TEMPLATES,
@@ -89,6 +82,13 @@ import {
89
82
  setPagePropsCommand,
90
83
  ungroupElementCommand
91
84
  } from "../chunk-CPWMBYLQ.js";
85
+ import {
86
+ DesignCanvasChromeLazy,
87
+ DesignCanvasLazy
88
+ } from "../chunk-YGMJ6NDY.js";
89
+ import {
90
+ LockGlyph
91
+ } from "../chunk-P4RRC4AO.js";
92
92
  import {
93
93
  assertSceneMediaSrc,
94
94
  bleedAwareExportBounds,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DesignCanvasChromeLazy,
3
3
  DesignCanvasLazy
4
- } from "../chunk-YQD2RISF.js";
4
+ } from "../chunk-YGMJ6NDY.js";
5
5
  export {
6
6
  DesignCanvasChromeLazy,
7
7
  DesignCanvasLazy
@@ -1,3 +1,11 @@
1
+ import {
2
+ PLATFORM_AGENT_KEY_PROVISIONER,
3
+ PLATFORM_KEY_PREFIX,
4
+ agentOperatorScopes,
5
+ createApiKeyRequestAuth,
6
+ createPlatformAgentKeyVerifier,
7
+ platformKeyRefusal
8
+ } from "../chunk-XB4KZVUV.js";
1
9
  import {
2
10
  TangleSsoAccountConflictError,
3
11
  TangleSsoUserCreateError,
@@ -14,14 +22,6 @@ import {
14
22
  signSessionCookieValue,
15
23
  verifySignedSsoState
16
24
  } from "../chunk-JUQMVD4U.js";
17
- import {
18
- PLATFORM_AGENT_KEY_PROVISIONER,
19
- PLATFORM_KEY_PREFIX,
20
- agentOperatorScopes,
21
- createApiKeyRequestAuth,
22
- createPlatformAgentKeyVerifier,
23
- platformKeyRefusal
24
- } from "../chunk-XB4KZVUV.js";
25
25
  import {
26
26
  assertWorkspaceKeyCryptoUsable
27
27
  } from "../chunk-VGS2NXLB.js";
@@ -1,4 +1,7 @@
1
1
  import "../chunk-KG2Y44XT.js";
2
+ import {
3
+ observeNativeCompletion
4
+ } from "../chunk-5ERXADSW.js";
2
5
  import {
3
6
  createFieldCrypto
4
7
  } from "../chunk-AWIQQEFP.js";
@@ -6,9 +9,6 @@ import {
6
9
  createWorkspaceKeyManager
7
10
  } from "../chunk-2SDX3OC4.js";
8
11
  import "../chunk-VGS2NXLB.js";
9
- import {
10
- observeNativeCompletion
11
- } from "../chunk-5ERXADSW.js";
12
12
  import {
13
13
  assistantRowIdForTurn,
14
14
  createAssistantDraftWriter
@@ -35,9 +35,9 @@ import {
35
35
  import "../chunk-K2JPSXKI.js";
36
36
  import {
37
37
  parseRenderUiSchema
38
- } from "../chunk-VKJEH6DG.js";
38
+ } from "../chunk-CI6Z2C4L.js";
39
39
  import "../chunk-S5SRJJQG.js";
40
- import "../chunk-E2JMXA2V.js";
40
+ import "../chunk-CGBB2AUP.js";
41
41
  import {
42
42
  createTurnTrace
43
43
  } from "../chunk-DCPOEDPK.js";
@@ -26,14 +26,14 @@ import "../chunk-K2JPSXKI.js";
26
26
  import "../chunk-L3QR274L.js";
27
27
  import "../chunk-XELWWXJJ.js";
28
28
  import "../chunk-DSMGS4IV.js";
29
- import "../chunk-XJ7DC2DI.js";
29
+ import "../chunk-SK6WU2TI.js";
30
30
  import "../chunk-OY7A6M7S.js";
31
31
  import "../chunk-O7UX55EU.js";
32
- import "../chunk-VKJEH6DG.js";
32
+ import "../chunk-CI6Z2C4L.js";
33
33
  import "../chunk-S5SRJJQG.js";
34
- import "../chunk-6IMNAZR7.js";
34
+ import "../chunk-DS3FDGVJ.js";
35
35
  import "../chunk-UGWQLQDS.js";
36
- import "../chunk-E2JMXA2V.js";
36
+ import "../chunk-CGBB2AUP.js";
37
37
  import "../chunk-SYV7MIVP.js";
38
38
  import "../chunk-D6UJEOZQ.js";
39
39
  import "../chunk-DCPOEDPK.js";
@@ -165,14 +165,14 @@ import "../chunk-K2JPSXKI.js";
165
165
  import "../chunk-L3QR274L.js";
166
166
  import "../chunk-XELWWXJJ.js";
167
167
  import "../chunk-DSMGS4IV.js";
168
- import "../chunk-XJ7DC2DI.js";
168
+ import "../chunk-SK6WU2TI.js";
169
169
  import "../chunk-OY7A6M7S.js";
170
170
  import "../chunk-O7UX55EU.js";
171
- import "../chunk-VKJEH6DG.js";
171
+ import "../chunk-CI6Z2C4L.js";
172
172
  import "../chunk-S5SRJJQG.js";
173
- import "../chunk-6IMNAZR7.js";
173
+ import "../chunk-DS3FDGVJ.js";
174
174
  import "../chunk-UGWQLQDS.js";
175
- import "../chunk-E2JMXA2V.js";
175
+ import "../chunk-CGBB2AUP.js";
176
176
  import "../chunk-D6UJEOZQ.js";
177
177
  import "../chunk-DCPOEDPK.js";
178
178
  import {
@@ -4,12 +4,12 @@ import {
4
4
  invitationDetail,
5
5
  isCurrentMember,
6
6
  memberRoleLabel
7
- } from "../chunk-OBKVNZPH.js";
7
+ } from "../chunk-YL5JDX7K.js";
8
8
  import {
9
9
  INVITATION_EMAIL_HINT,
10
10
  INVITATION_EXPIRY_DAYS,
11
11
  isInvitationEmail
12
- } from "../chunk-KBJZMR4E.js";
12
+ } from "../chunk-Y5WTAHWY.js";
13
13
  import {
14
14
  hasWorkspaceRole
15
15
  } from "../chunk-6XIAPIW6.js";
@@ -24,12 +24,12 @@ import {
24
24
  import {
25
25
  bindSearchPickerNavigation
26
26
  } from "../chunk-ZAMHLXNS.js";
27
+ import "../chunk-RASGKEAL.js";
27
28
  import {
28
29
  confirmWrite,
29
30
  rejectWrite,
30
31
  useConfirmedMutation
31
32
  } from "../chunk-AVP5SNIG.js";
32
- import "../chunk-RASGKEAL.js";
33
33
  import {
34
34
  useWorkspaceExport
35
35
  } from "../chunk-EZFBGW23.js";
@@ -836,7 +836,11 @@ function plansAction(href, Link) {
836
836
  if (!href) return void 0;
837
837
  return (failure) => failure.code === "plan_limit" ? /* @__PURE__ */ jsx6(Link, { href, className: "font-medium text-[var(--accent-text)] underline-offset-4 hover:underline", children: "View plans" }) : null;
838
838
  }
839
- function InviteDialog({ onInvite, plansHref, LinkComponent, open, onOpenChange }) {
839
+ var INVITE_DIALOG = {
840
+ email: { consequence: `They get an email with a link to join. The link works for ${INVITATION_EXPIRY_DAYS} days.`, confirmLabel: "Send invite" },
841
+ link: { consequence: `No email is sent. You get a link to share with them, and it works for ${INVITATION_EXPIRY_DAYS} days.`, confirmLabel: "Create invite link" }
842
+ };
843
+ function InviteDialog({ onInvite, delivery, onMinted, plansHref, LinkComponent, open, onOpenChange }) {
840
844
  const id = useId2();
841
845
  const [email, setEmail] = useState5("");
842
846
  const [role, setRole] = useState5("editor");
@@ -855,10 +859,13 @@ function InviteDialog({ onInvite, plansHref, LinkComponent, open, onOpenChange }
855
859
  open,
856
860
  onOpenChange,
857
861
  title: "Invite people",
858
- consequence: `They get an email with a link to join. The link works for ${INVITATION_EXPIRY_DAYS} days.`,
859
- confirmLabel: "Send invite",
862
+ ...INVITE_DIALOG[delivery],
860
863
  canConfirm: valid,
861
864
  onConfirm: () => onInvite({ email: email.trim(), role }),
865
+ onConfirmed: (value) => {
866
+ const inviteUrl = value?.inviteUrl;
867
+ if (delivery === "link" && typeof inviteUrl === "string") onMinted({ email: email.trim(), inviteUrl });
868
+ },
862
869
  refusalAction: plansAction(plansHref, LinkComponent),
863
870
  children: [
864
871
  /* @__PURE__ */ jsxs5("div", { className: "grid gap-2", children: [
@@ -887,6 +894,25 @@ function InviteDialog({ onInvite, plansHref, LinkComponent, open, onOpenChange }
887
894
  }
888
895
  );
889
896
  }
897
+ function MintedLinkRow({ email, inviteUrl }) {
898
+ const id = useId2();
899
+ const { note, error, copy } = useCopyLink();
900
+ return /* @__PURE__ */ jsx6(
901
+ SettingsRow,
902
+ {
903
+ label: `Invite link for ${email}`,
904
+ htmlFor: id,
905
+ description: `Share it with them yourself. It works for ${INVITATION_EXPIRY_DAYS} days.`,
906
+ status: note,
907
+ error: error ?? void 0,
908
+ layout: "stacked",
909
+ children: /* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 gap-2", children: [
910
+ /* @__PURE__ */ jsx6(Input2, { id, readOnly: true, value: inviteUrl, className: "min-w-0 flex-1", onFocus: (event) => event.currentTarget.select() }),
911
+ /* @__PURE__ */ jsx6(Button4, { type: "button", variant: "outline", onClick: () => void copy(inviteUrl), children: "Copy link" })
912
+ ] })
913
+ }
914
+ );
915
+ }
890
916
  function MembersSection({
891
917
  id = "members",
892
918
  title = "Members",
@@ -898,11 +924,13 @@ function MembersSection({
898
924
  onChangeRole,
899
925
  onRemove,
900
926
  onInvite,
927
+ delivery = "email",
901
928
  plansHref,
902
929
  LinkComponent = PlainLink,
903
930
  menuItems
904
931
  }) {
905
932
  const [inviting, setInviting] = useState5(false);
933
+ const [minted, setMinted] = useState5(null);
906
934
  const canManage = hasWorkspaceRole(currentRole, "admin");
907
935
  return /* @__PURE__ */ jsxs5(
908
936
  SettingsSection,
@@ -928,56 +956,60 @@ function MembersSection({
928
956
  member.id
929
957
  );
930
958
  }) }),
931
- onInvite && /* @__PURE__ */ jsx6(InviteDialog, { onInvite, plansHref, LinkComponent, open: inviting, onOpenChange: setInviting })
959
+ minted && /* @__PURE__ */ jsx6(MintedLinkRow, { ...minted }, minted.inviteUrl),
960
+ onInvite && /* @__PURE__ */ jsx6(InviteDialog, { onInvite, delivery, onMinted: setMinted, plansHref, LinkComponent, open: inviting, onOpenChange: setInviting })
932
961
  ]
933
962
  }
934
963
  );
935
964
  }
936
965
  var INVITATION_COLUMNS = { action: "8rem", menu: "36px" };
937
- function useFlash() {
938
- const [message, setMessage] = useState5(null);
966
+ function useCopyLink(onCopy) {
967
+ const [note, setNote] = useState5(null);
968
+ const [error, setError] = useState5(null);
939
969
  useEffect5(() => {
940
- if (!message) return;
941
- const timer = setTimeout(() => setMessage(null), SAVED_VISIBLE_MS);
970
+ if (!note) return;
971
+ const timer = setTimeout(() => setNote(null), SAVED_VISIBLE_MS);
942
972
  return () => clearTimeout(timer);
943
- }, [message]);
944
- return [message, setMessage];
945
- }
946
- function PendingInvitation({ invitation, canManage, onResend, onRevoke, onCopy }) {
947
- const [revoking, setRevoking] = useState5(false);
948
- const [note, flash] = useFlash();
949
- const [error, setError] = useState5(null);
950
- const copy = async () => {
973
+ }, [note]);
974
+ const copy = async (inviteUrl) => {
951
975
  try {
952
- if (onCopy) await onCopy({ inviteUrl: invitation.inviteUrl });
953
- else await navigator.clipboard.writeText(invitation.inviteUrl);
976
+ if (onCopy) await onCopy({ inviteUrl });
977
+ else await navigator.clipboard.writeText(inviteUrl);
954
978
  setError(null);
955
- flash("Link copied");
979
+ setNote("Link copied");
956
980
  } catch {
957
- setError("Couldn't copy the link. Select it from the invitation email instead.");
981
+ setError(/* @__PURE__ */ jsxs5(Fragment4, { children: [
982
+ "Couldn\u2019t copy the link. Select it here instead: ",
983
+ breakable(inviteUrl)
984
+ ] }));
958
985
  }
959
986
  };
960
- const resend = async () => {
987
+ return { note, flash: setNote, error, setError, copy };
988
+ }
989
+ function PendingInvitation({ invitation, canManage, delivery, onResend, onRevoke, onCopy }) {
990
+ const [revoking, setRevoking] = useState5(false);
991
+ const { note, flash, error, setError, copy } = useCopyLink(onCopy);
992
+ const resend = onResend && delivery === "email" ? async () => {
961
993
  const outcome = await onResend({ invitationId: invitation.id });
962
994
  if (outcome.succeeded) {
963
995
  setError(null);
964
996
  flash("Sent again");
965
997
  } else setError(outcome.message);
966
- };
967
- const undelivered = invitation.emailStatus === "failed" ? "The email wasn\u2019t delivered. Copy the link and send it yourself." : null;
998
+ } : null;
999
+ const undelivered = delivery === "email" && invitation.emailStatus === "failed" ? "The email wasn\u2019t delivered. Copy the link and send it yourself." : null;
968
1000
  return /* @__PURE__ */ jsxs5(Fragment4, { children: [
969
1001
  /* @__PURE__ */ jsx6(
970
1002
  SettingsListItem,
971
1003
  {
972
1004
  title: breakable(invitation.email),
973
1005
  meta: /* @__PURE__ */ jsxs5("span", { className: "inline-flex flex-wrap items-center gap-x-2", children: [
974
- invitationDetail(invitation),
1006
+ invitationDetail(invitation, delivery),
975
1007
  note && /* @__PURE__ */ jsx6("span", { className: "text-[var(--surface-success-text)]", children: note })
976
1008
  ] }),
977
1009
  error: error ?? undelivered ?? void 0,
978
- action: canManage ? { label: "Copy link", onSelect: () => void copy() } : void 0,
1010
+ action: canManage ? { label: "Copy link", onSelect: () => void copy(invitation.inviteUrl) } : void 0,
979
1011
  menu: canManage ? [
980
- { label: "Resend email", onSelect: () => void resend() },
1012
+ ...resend ? [{ label: "Resend email", onSelect: () => void resend() }] : [],
981
1013
  { label: "Revoke\u2026", tone: "danger", onSelect: () => setRevoking(true) }
982
1014
  ] : void 0
983
1015
  }
@@ -1003,14 +1035,15 @@ function InvitationsSection({
1003
1035
  currentRole,
1004
1036
  onResend,
1005
1037
  onRevoke,
1006
- onCopy
1038
+ onCopy,
1039
+ delivery = "email"
1007
1040
  }) {
1008
1041
  const [showPast, setShowPast] = useState5(false);
1009
1042
  const canManage = hasWorkspaceRole(currentRole, "admin");
1010
1043
  const pending = invitations.filter((invitation) => invitation.status === "pending");
1011
1044
  const past = invitations.filter((invitation) => invitation.status !== "pending");
1012
1045
  return /* @__PURE__ */ jsxs5(SettingsSection, { id, title, children: [
1013
- pending.length === 0 ? /* @__PURE__ */ jsx6(SettingsRow, { label: "No pending invitations", layout: "compact" }) : /* @__PURE__ */ jsx6(SettingsList, { "aria-label": "Pending invitations", columns: INVITATION_COLUMNS, children: pending.map((invitation) => /* @__PURE__ */ jsx6(PendingInvitation, { invitation, canManage, onResend, onRevoke, onCopy }, invitation.id)) }),
1046
+ pending.length === 0 ? /* @__PURE__ */ jsx6(SettingsRow, { label: "No pending invitations", layout: "compact" }) : /* @__PURE__ */ jsx6(SettingsList, { "aria-label": "Pending invitations", columns: INVITATION_COLUMNS, children: pending.map((invitation) => /* @__PURE__ */ jsx6(PendingInvitation, { invitation, canManage, delivery, onResend, onRevoke, onCopy }, invitation.id)) }),
1014
1047
  past.length > 0 && /* @__PURE__ */ jsxs5(Collapsible, { open: showPast, onOpenChange: setShowPast, children: [
1015
1048
  /* @__PURE__ */ jsx6("div", { className: "border-t border-[color:var(--border-subtle)] px-5 py-3 @max-[34rem]/settings-section:px-4", children: /* @__PURE__ */ jsx6(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(Button4, { type: "button", variant: "ghost", className: "-ml-4", children: [
1016
1049
  showPast ? "Hide past invitations" : `Show ${past.length} past ${past.length === 1 ? "invitation" : "invitations"}`,