@igstack/app-catalog-frontend-core 6.15.0 → 6.16.0

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 (144) hide show
  1. package/dist/esm/api/infra/trpc.d.ts +36 -0
  2. package/dist/esm/internal.d.ts +1 -0
  3. package/dist/esm/internal.js +2 -0
  4. package/dist/esm/internal.js.map +1 -1
  5. package/dist/esm/lib/externalLink.d.ts +8 -0
  6. package/dist/esm/lib/externalLink.js +9 -0
  7. package/dist/esm/lib/externalLink.js.map +1 -0
  8. package/dist/esm/modules/appCatalog/context/AppCatalogContext.d.ts +3 -1
  9. package/dist/esm/modules/appCatalog/context/AppCatalogContext.js +2 -0
  10. package/dist/esm/modules/appCatalog/context/AppCatalogContext.js.map +1 -1
  11. package/dist/esm/modules/appCatalog/hooks/useUpdateApp.d.ts +36 -36
  12. package/dist/esm/modules/appCatalog/ui/components/SectionTabs.d.ts +2 -1
  13. package/dist/esm/modules/appCatalog/ui/components/SectionTabs.js +11 -1
  14. package/dist/esm/modules/appCatalog/ui/components/SectionTabs.js.map +1 -1
  15. package/dist/esm/modules/appCatalog/ui/components/SourcesList.d.ts +10 -0
  16. package/dist/esm/modules/appCatalog/ui/components/SourcesList.js +51 -0
  17. package/dist/esm/modules/appCatalog/ui/components/SourcesList.js.map +1 -0
  18. package/dist/esm/modules/appCatalog/ui/detail/AppDetails.js +9 -52
  19. package/dist/esm/modules/appCatalog/ui/detail/AppDetails.js.map +1 -1
  20. package/dist/esm/modules/communityTools/useCommunityTools.d.ts +6 -6
  21. package/dist/esm/modules/mcpCatalog/McpAccessLine.d.ts +5 -0
  22. package/dist/esm/modules/mcpCatalog/McpAccessLine.js +48 -0
  23. package/dist/esm/modules/mcpCatalog/McpAccessLine.js.map +1 -0
  24. package/dist/esm/modules/mcpCatalog/McpCatalogPage.d.ts +11 -0
  25. package/dist/esm/modules/mcpCatalog/McpCatalogPage.js +289 -0
  26. package/dist/esm/modules/mcpCatalog/McpCatalogPage.js.map +1 -0
  27. package/dist/esm/modules/mcpCatalog/McpInfoTiles.d.ts +5 -0
  28. package/dist/esm/modules/mcpCatalog/McpInfoTiles.js +88 -0
  29. package/dist/esm/modules/mcpCatalog/McpInfoTiles.js.map +1 -0
  30. package/dist/esm/modules/mcpCatalog/McpSafetyLines.d.ts +5 -0
  31. package/dist/esm/modules/mcpCatalog/McpSafetyLines.js +82 -0
  32. package/dist/esm/modules/mcpCatalog/McpSafetyLines.js.map +1 -0
  33. package/dist/esm/modules/mcpCatalog/McpSearchResult.d.ts +18 -0
  34. package/dist/esm/modules/mcpCatalog/McpSearchResult.js +150 -0
  35. package/dist/esm/modules/mcpCatalog/McpSearchResult.js.map +1 -0
  36. package/dist/esm/modules/mcpCatalog/McpServerDetail.d.ts +8 -0
  37. package/dist/esm/modules/mcpCatalog/McpServerDetail.js +116 -0
  38. package/dist/esm/modules/mcpCatalog/McpServerDetail.js.map +1 -0
  39. package/dist/esm/modules/mcpCatalog/McpServerRow.d.ts +10 -0
  40. package/dist/esm/modules/mcpCatalog/McpServerRow.js +75 -0
  41. package/dist/esm/modules/mcpCatalog/McpServerRow.js.map +1 -0
  42. package/dist/esm/modules/mcpCatalog/McpToolsTable.d.ts +5 -0
  43. package/dist/esm/modules/mcpCatalog/McpToolsTable.js +24 -0
  44. package/dist/esm/modules/mcpCatalog/McpToolsTable.js.map +1 -0
  45. package/dist/esm/modules/mcpCatalog/Triad.d.ts +13 -0
  46. package/dist/esm/modules/mcpCatalog/Triad.js +175 -0
  47. package/dist/esm/modules/mcpCatalog/Triad.js.map +1 -0
  48. package/dist/esm/modules/mcpCatalog/cart/McpCart.d.ts +15 -0
  49. package/dist/esm/modules/mcpCatalog/cart/McpCart.js +156 -0
  50. package/dist/esm/modules/mcpCatalog/cart/McpCart.js.map +1 -0
  51. package/dist/esm/modules/mcpCatalog/cart/useMcpCart.d.ts +11 -0
  52. package/dist/esm/modules/mcpCatalog/cart/useMcpCart.js +48 -0
  53. package/dist/esm/modules/mcpCatalog/cart/useMcpCart.js.map +1 -0
  54. package/dist/esm/modules/mcpCatalog/install/InstallButton.d.ts +12 -0
  55. package/dist/esm/modules/mcpCatalog/install/InstallButton.js +126 -0
  56. package/dist/esm/modules/mcpCatalog/install/InstallButton.js.map +1 -0
  57. package/dist/esm/modules/mcpCatalog/install/InstallMenu.d.ts +14 -0
  58. package/dist/esm/modules/mcpCatalog/install/InstallMenu.js +139 -0
  59. package/dist/esm/modules/mcpCatalog/install/InstallMenu.js.map +1 -0
  60. package/dist/esm/modules/mcpCatalog/install/WhatHappensDialog.d.ts +10 -0
  61. package/dist/esm/modules/mcpCatalog/install/WhatHappensDialog.js +161 -0
  62. package/dist/esm/modules/mcpCatalog/install/WhatHappensDialog.js.map +1 -0
  63. package/dist/esm/modules/mcpCatalog/install/installOptions.d.ts +40 -0
  64. package/dist/esm/modules/mcpCatalog/install/installOptions.js +204 -0
  65. package/dist/esm/modules/mcpCatalog/install/installOptions.js.map +1 -0
  66. package/dist/esm/modules/mcpCatalog/install/useMcpPrefs.d.ts +14 -0
  67. package/dist/esm/modules/mcpCatalog/install/useMcpPrefs.js +39 -0
  68. package/dist/esm/modules/mcpCatalog/install/useMcpPrefs.js.map +1 -0
  69. package/dist/esm/modules/mcpCatalog/searchMcpServers.d.ts +25 -0
  70. package/dist/esm/modules/mcpCatalog/searchMcpServers.js +44 -0
  71. package/dist/esm/modules/mcpCatalog/searchMcpServers.js.map +1 -0
  72. package/dist/esm/modules/mcpCatalog/signIn.d.ts +13 -0
  73. package/dist/esm/modules/mcpCatalog/signIn.js +29 -0
  74. package/dist/esm/modules/mcpCatalog/signIn.js.map +1 -0
  75. package/dist/esm/modules/mcpCatalog/useHasMcpServers.d.ts +8 -0
  76. package/dist/esm/modules/mcpCatalog/useHasMcpServers.js +13 -0
  77. package/dist/esm/modules/mcpCatalog/useHasMcpServers.js.map +1 -0
  78. package/dist/esm/modules/mcpCatalog/useMcpCatalogConfig.d.ts +7 -0
  79. package/dist/esm/modules/mcpCatalog/useMcpCatalogConfig.js +16 -0
  80. package/dist/esm/modules/mcpCatalog/useMcpCatalogConfig.js.map +1 -0
  81. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/schemas.js +3 -3
  82. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/api.js +1 -1
  83. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/checks.js +1 -1
  84. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/schemas.js +2 -2
  85. package/dist/esm/routeTree.gen.d.ts +43 -17
  86. package/dist/esm/routeTree.gen.js +15 -3
  87. package/dist/esm/routeTree.gen.js.map +1 -1
  88. package/dist/esm/routes/_layout/community.$slug.d.ts +3 -3
  89. package/dist/esm/routes/_layout/community.d.ts +3 -3
  90. package/dist/esm/routes/_layout/mcp.$slug.d.ts +9 -0
  91. package/dist/esm/routes/_layout/mcp._slug.js +8 -0
  92. package/dist/esm/routes/_layout/mcp._slug.js.map +1 -0
  93. package/dist/esm/routes/_layout/mcp.d.ts +5 -1
  94. package/dist/esm/routes/_layout/mcp.js +45 -5
  95. package/dist/esm/routes/_layout/mcp.js.map +1 -1
  96. package/dist/esm/ui/button.d.ts +1 -1
  97. package/dist/esm/ui/components/header/Header.js +1 -5
  98. package/dist/esm/ui/components/header/Header.js.map +1 -1
  99. package/dist/esm/ui/empty.d.ts +1 -1
  100. package/dist/esm/ui/item.d.ts +1 -1
  101. package/dist/esm/userDb/AcDb.d.ts +10 -0
  102. package/dist/esm/userDb/AcDb.js +6 -0
  103. package/dist/esm/userDb/AcDb.js.map +1 -1
  104. package/package.json +4 -4
  105. package/src/__tests__/modules/communityTools/timeAgo.test.ts +16 -0
  106. package/src/internal.ts +1 -0
  107. package/src/lib/externalLink.ts +10 -0
  108. package/src/modules/appCatalog/context/AppCatalogContext.tsx +5 -0
  109. package/src/modules/appCatalog/ui/components/SectionTabs.tsx +14 -1
  110. package/src/modules/appCatalog/ui/components/SourcesList.tsx +62 -0
  111. package/src/modules/appCatalog/ui/detail/AppDetails.tsx +6 -52
  112. package/src/modules/mcpCatalog/McpAccessLine.tsx +54 -0
  113. package/src/modules/mcpCatalog/McpCatalogPage.tsx +324 -0
  114. package/src/modules/mcpCatalog/McpInfoTiles.tsx +112 -0
  115. package/src/modules/mcpCatalog/McpSafetyLines.tsx +89 -0
  116. package/src/modules/mcpCatalog/McpSearchResult.tsx +173 -0
  117. package/src/modules/mcpCatalog/McpServerDetail.tsx +145 -0
  118. package/src/modules/mcpCatalog/McpServerRow.tsx +78 -0
  119. package/src/modules/mcpCatalog/McpToolsTable.tsx +36 -0
  120. package/src/modules/mcpCatalog/Triad.tsx +213 -0
  121. package/src/modules/mcpCatalog/cart/McpCart.tsx +171 -0
  122. package/src/modules/mcpCatalog/cart/useMcpCart.ts +64 -0
  123. package/src/modules/mcpCatalog/install/InstallButton.tsx +154 -0
  124. package/src/modules/mcpCatalog/install/InstallMenu.tsx +160 -0
  125. package/src/modules/mcpCatalog/install/WhatHappensDialog.tsx +199 -0
  126. package/src/modules/mcpCatalog/install/installOptions.tsx +266 -0
  127. package/src/modules/mcpCatalog/install/useMcpPrefs.ts +55 -0
  128. package/src/modules/mcpCatalog/searchMcpServers.ts +84 -0
  129. package/src/modules/mcpCatalog/signIn.ts +34 -0
  130. package/src/modules/mcpCatalog/useHasMcpServers.ts +22 -0
  131. package/src/modules/mcpCatalog/useMcpCatalogConfig.ts +20 -0
  132. package/src/routeTree.gen.ts +36 -5
  133. package/src/routes/_layout/mcp.$slug.tsx +10 -0
  134. package/src/routes/_layout/mcp.tsx +63 -3
  135. package/src/ui/components/header/Header.tsx +1 -7
  136. package/src/userDb/AcDb.ts +13 -0
  137. package/dist/esm/modules/appCatalog/ui/pages/McpPage.d.ts +0 -11
  138. package/dist/esm/modules/appCatalog/ui/pages/McpPage.js +0 -227
  139. package/dist/esm/modules/appCatalog/ui/pages/McpPage.js.map +0 -1
  140. package/dist/esm/modules/appCatalog/utils/fetchMcpTools.d.ts +0 -32
  141. package/dist/esm/modules/appCatalog/utils/fetchMcpTools.js +0 -79
  142. package/dist/esm/modules/appCatalog/utils/fetchMcpTools.js.map +0 -1
  143. package/src/modules/appCatalog/ui/pages/McpPage.tsx +0 -275
  144. package/src/modules/appCatalog/utils/fetchMcpTools.ts +0 -140
@@ -0,0 +1,126 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { Check, TriangleAlert, ChevronDown, Sparkles } from "lucide-react";
3
+ import { useRef, useState, useCallback } from "react";
4
+ import { cn } from "../../../lib/utils.js";
5
+ import { useMcpCatalogConfig } from "../useMcpCatalogConfig.js";
6
+ import { InstallMenu } from "./InstallMenu.js";
7
+ import { useInstall, useCopyFlash, INSTALL_OPTIONS } from "./installOptions.js";
8
+ import { useMcpPrefs } from "./useMcpPrefs.js";
9
+ const HALF = "inline-flex min-h-8 items-center gap-1.5 border-0 bg-transparent text-[13px] font-bold";
10
+ function InstallButton({
11
+ servers,
12
+ tone = "light"
13
+ }) {
14
+ var _a;
15
+ const { loading, installWith, setInstallWith } = useMcpPrefs();
16
+ const { run } = useInstall(servers);
17
+ const iconUrl = (_a = useMcpCatalogConfig()) == null ? void 0 : _a.installIconUrl;
18
+ const splitRef = useRef(null);
19
+ const [menuOpen, setMenuOpen] = useState(false);
20
+ const [flash, setFlash] = useCopyFlash();
21
+ const chosen = INSTALL_OPTIONS.find((o) => o.id === installWith && !o.hidden);
22
+ const closeMenu = useCallback(() => setMenuOpen(false), []);
23
+ const go = async (id) => {
24
+ const outcome = await run(id);
25
+ if (outcome !== "opened") setFlash(outcome);
26
+ };
27
+ const pick = async (id) => {
28
+ setMenuOpen(false);
29
+ await go(id);
30
+ await setInstallWith(id);
31
+ };
32
+ const hover = tone === "dark" ? "hover:bg-white/15" : "hover:bg-muted";
33
+ const firstVisit = /* @__PURE__ */ jsxs(Fragment, { children: [
34
+ iconUrl ? /* @__PURE__ */ jsx(
35
+ "img",
36
+ {
37
+ src: iconUrl,
38
+ alt: "",
39
+ className: "-my-[3px] size-[22px] object-contain"
40
+ }
41
+ ) : /* @__PURE__ */ jsx(Sparkles, { "aria-hidden": "true", className: "size-4 text-primary" }),
42
+ "Let me do it for you"
43
+ ] });
44
+ return /* @__PURE__ */ jsxs(
45
+ "div",
46
+ {
47
+ ref: splitRef,
48
+ "data-testid": "mcp-install",
49
+ "aria-busy": loading || void 0,
50
+ className: cn(
51
+ "inline-flex shrink-0 overflow-hidden rounded-[calc(var(--radius)-4px)] border",
52
+ tone === "dark" ? "border-white/20 bg-white/10 text-white" : "border-border bg-card text-foreground"
53
+ ),
54
+ children: [
55
+ /* @__PURE__ */ jsx(
56
+ "button",
57
+ {
58
+ type: "button",
59
+ disabled: loading,
60
+ "data-icon": loading ? "loading" : flash ?? (chosen == null ? void 0 : chosen.id) ?? (iconUrl ? "custom" : "default"),
61
+ title: chosen ? `Install with ${chosen.label}` : "Pick your AI once and it installs this for you",
62
+ onClick: () => chosen ? void go(chosen.id) : setMenuOpen((o) => !o),
63
+ className: cn(
64
+ HALF,
65
+ hover,
66
+ "pr-2.5 pl-2 disabled:hover:bg-transparent",
67
+ flash === "copied" && "text-green-700 dark:text-green-400",
68
+ flash === "copy-failed" && "text-destructive"
69
+ ),
70
+ children: loading ? (
71
+ // Holds the first-visit width without claiming either state.
72
+ /* @__PURE__ */ jsx(
73
+ "span",
74
+ {
75
+ "aria-hidden": "true",
76
+ className: "invisible inline-flex items-center gap-1.5",
77
+ children: firstVisit
78
+ }
79
+ )
80
+ ) : flash === "copied" ? /* @__PURE__ */ jsxs(Fragment, { children: [
81
+ /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", className: "size-4" }),
82
+ "Copied"
83
+ ] }) : flash === "copy-failed" ? /* @__PURE__ */ jsxs(Fragment, { children: [
84
+ /* @__PURE__ */ jsx(TriangleAlert, { "aria-hidden": "true", className: "size-4" }),
85
+ "Copy failed"
86
+ ] }) : chosen ? /* @__PURE__ */ jsxs(Fragment, { children: [
87
+ /* @__PURE__ */ jsx(chosen.Icon, {}),
88
+ "Install"
89
+ ] }) : firstVisit
90
+ }
91
+ ),
92
+ /* @__PURE__ */ jsx(
93
+ "button",
94
+ {
95
+ type: "button",
96
+ "aria-label": "Choose how to install",
97
+ "aria-haspopup": "menu",
98
+ "aria-expanded": menuOpen,
99
+ disabled: loading,
100
+ onClick: () => setMenuOpen((o) => !o),
101
+ className: cn(
102
+ HALF,
103
+ hover,
104
+ "border-l px-1.5",
105
+ tone === "dark" ? "border-white/20" : "border-border"
106
+ ),
107
+ children: /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true", className: "size-3.5" })
108
+ }
109
+ ),
110
+ menuOpen && /* @__PURE__ */ jsx(
111
+ InstallMenu,
112
+ {
113
+ anchor: splitRef,
114
+ current: chosen == null ? void 0 : chosen.id,
115
+ onPick: (id) => void pick(id).catch(console.error),
116
+ onClose: closeMenu
117
+ }
118
+ )
119
+ ]
120
+ }
121
+ );
122
+ }
123
+ export {
124
+ InstallButton
125
+ };
126
+ //# sourceMappingURL=InstallButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InstallButton.js","sources":["../../../../../src/modules/mcpCatalog/install/InstallButton.tsx"],"sourcesContent":["import type { CatalogMcpServer } from '@igstack/app-catalog-backend-core'\nimport type { InstallOptionId } from '@igstack/app-catalog-shared-core'\nimport { Check, ChevronDown, Sparkles, TriangleAlert } from 'lucide-react'\nimport { useCallback, useRef, useState } from 'react'\nimport { cn } from '~/lib/utils'\nimport { useMcpCatalogConfig } from '../useMcpCatalogConfig'\nimport { InstallMenu } from './InstallMenu'\nimport { INSTALL_OPTIONS, useCopyFlash, useInstall } from './installOptions'\nimport { useMcpPrefs } from './useMcpPrefs'\n\nconst HALF =\n 'inline-flex min-h-8 items-center gap-1.5 border-0 bg-transparent text-[13px] font-bold'\n\n/**\n * Split button: the main half installs with the remembered option (or, before\n * any choice, opens the menu); the caret always opens the menu. A copy shows\n * \"Copied\" (or \"Copy failed\") on the main half for a moment. While the\n * remembered choice is still loading it is a blank, disabled placeholder.\n */\nexport function InstallButton({\n servers,\n tone = 'light',\n}: {\n servers: readonly CatalogMcpServer[]\n /** `dark` for a dark bar, such as the cart's. */\n tone?: 'light' | 'dark'\n}) {\n const { loading, installWith, setInstallWith } = useMcpPrefs()\n const { run } = useInstall(servers)\n const iconUrl = useMcpCatalogConfig()?.installIconUrl\n const splitRef = useRef<HTMLDivElement>(null)\n const [menuOpen, setMenuOpen] = useState(false)\n const [flash, setFlash] = useCopyFlash()\n\n const chosen = INSTALL_OPTIONS.find((o) => o.id === installWith && !o.hidden)\n const closeMenu = useCallback(() => setMenuOpen(false), [])\n\n const go = async (id: InstallOptionId) => {\n const outcome = await run(id)\n if (outcome !== 'opened') setFlash(outcome)\n }\n const pick = async (id: InstallOptionId) => {\n setMenuOpen(false)\n // Copy first: the clipboard wants the click's user activation. The pick\n // is stored whatever the copy did.\n await go(id)\n await setInstallWith(id)\n }\n\n const hover = tone === 'dark' ? 'hover:bg-white/15' : 'hover:bg-muted'\n\n const firstVisit = (\n <>\n {iconUrl ? (\n <img\n src={iconUrl}\n alt=\"\"\n className=\"-my-[3px] size-[22px] object-contain\"\n />\n ) : (\n <Sparkles aria-hidden=\"true\" className=\"size-4 text-primary\" />\n )}\n Let me do it for you\n </>\n )\n\n return (\n <div\n ref={splitRef}\n data-testid=\"mcp-install\"\n aria-busy={loading || undefined}\n className={cn(\n 'inline-flex shrink-0 overflow-hidden rounded-[calc(var(--radius)-4px)] border',\n tone === 'dark'\n ? 'border-white/20 bg-white/10 text-white'\n : 'border-border bg-card text-foreground',\n )}\n >\n <button\n type=\"button\"\n disabled={loading}\n data-icon={\n loading\n ? 'loading'\n : (flash ?? chosen?.id ?? (iconUrl ? 'custom' : 'default'))\n }\n title={\n chosen\n ? `Install with ${chosen.label}`\n : 'Pick your AI once and it installs this for you'\n }\n onClick={() => (chosen ? void go(chosen.id) : setMenuOpen((o) => !o))}\n className={cn(\n HALF,\n hover,\n 'pr-2.5 pl-2 disabled:hover:bg-transparent',\n flash === 'copied' && 'text-green-700 dark:text-green-400',\n flash === 'copy-failed' && 'text-destructive',\n )}\n >\n {loading ? (\n // Holds the first-visit width without claiming either state.\n <span\n aria-hidden=\"true\"\n className=\"invisible inline-flex items-center gap-1.5\"\n >\n {firstVisit}\n </span>\n ) : flash === 'copied' ? (\n <>\n <Check aria-hidden=\"true\" className=\"size-4\" />\n Copied\n </>\n ) : flash === 'copy-failed' ? (\n <>\n <TriangleAlert aria-hidden=\"true\" className=\"size-4\" />\n Copy failed\n </>\n ) : chosen ? (\n <>\n <chosen.Icon />\n Install\n </>\n ) : (\n firstVisit\n )}\n </button>\n <button\n type=\"button\"\n aria-label=\"Choose how to install\"\n aria-haspopup=\"menu\"\n aria-expanded={menuOpen}\n disabled={loading}\n onClick={() => setMenuOpen((o) => !o)}\n className={cn(\n HALF,\n hover,\n 'border-l px-1.5',\n tone === 'dark' ? 'border-white/20' : 'border-border',\n )}\n >\n <ChevronDown aria-hidden=\"true\" className=\"size-3.5\" />\n </button>\n {menuOpen && (\n <InstallMenu\n anchor={splitRef}\n current={chosen?.id}\n onPick={(id) => void pick(id).catch(console.error)}\n onClose={closeMenu}\n />\n )}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;;;AAUA,MAAM,OACJ;AAQK,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,OAAO;AACT,GAIG;;AACD,QAAM,EAAE,SAAS,aAAa,eAAA,IAAmB,YAAA;AACjD,QAAM,EAAE,IAAA,IAAQ,WAAW,OAAO;AAClC,QAAM,WAAU,+BAAA,mBAAuB;AACvC,QAAM,WAAW,OAAuB,IAAI;AAC5C,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,CAAC,OAAO,QAAQ,IAAI,aAAA;AAE1B,QAAM,SAAS,gBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,eAAe,C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Y;AAAA,kBACZ,WAAU;AAAA,kBAET,UAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,gBAED,UAAU,WACZ,qBAAA,UAAA,EACE,UAAA;AAAA,cAAA,oBAAC,OAAA,EAAM,eAAY,QAAO,WAAU,UAAS;AAAA,cAAE;AAAA,YAAA,EAAA,CAEjD,IACE,UAAU,gBACZ,qBAAA,UAAA,EACE,UAAA;AAAA,cAAA,oBAAC,eAAA,EAAc,eAAY,QAAO,WAAU,UAAS;AAAA,cAAE;AAAA,YAAA,EAAA,CAEzD,IACE,SACF,qBAAA,UAAA,EACE,UAAA;AAAA,cAAA,oBAAC,OAAO,MAAP,EAAY;AAAA,cAAE;AAAA,YAAA,EAAA,CAEjB,IAEA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGJ;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAW;AAAA,YACX,iBAAc;AAAA,YACd,iBAAe;AAAA,YACf,UAAU;AAAA,YACV,SAAS,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;AAAA,YACpC,WAAW;AAAA,cACT;AAAA,cACA;AAAA,cACA;AAAA,cACA,SAAS,SAAS,oBAAoB;AAAA,YAAA;AAAA,YAGxC,UAAA,oBAAC,aAAA,EAAY,eAAY,QAAO,WAAU,WAAA,CAAW;AAAA,UAAA;AAAA,QAAA;AAAA,QAEtD,YACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,QAAQ;AAAA,YACR,SAAS,iCAAQ;AAAA,YACjB,QAAQ,CAAC,OAAO,KAAK,KAAK,EAAE,EAAE,MAAM,QAAQ,KAAK;AAAA,YACjD,SAAS;AAAA,UAAA;AAAA,QAAA;AAAA,MACX;AAAA,IAAA;AAAA,EAAA;AAIR;"}
@@ -0,0 +1,14 @@
1
+ import { InstallOptionId } from '@igstack/app-catalog-shared-core';
2
+ /**
3
+ * The install choices under a split button: "Install with" an AI, or "Text
4
+ * only". Fixed to the viewport beside `anchor`, in a portal at the end of
5
+ * `<body>` so a dialog's clipping cannot cut it and the dismiss stack sees it
6
+ * on top of the dialog that opened it.
7
+ */
8
+ export declare function InstallMenu({ anchor, current, onPick, onClose, }: {
9
+ /** What the menu opens beside; a press inside it is not "outside". */
10
+ anchor: React.RefObject<HTMLElement | null>;
11
+ current?: InstallOptionId;
12
+ onPick: (id: InstallOptionId) => void;
13
+ onClose: () => void;
14
+ }): import('react').ReactPortal;
@@ -0,0 +1,139 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Check } from "lucide-react";
3
+ import { useRef, useState, useLayoutEffect, useEffect } from "react";
4
+ import { createPortal } from "react-dom";
5
+ import { useDismissable } from "../../dismiss/DismissStack.js";
6
+ import { VISIBLE_INSTALL_OPTIONS } from "./installOptions.js";
7
+ const WIDTH = 280;
8
+ function InstallMenu({
9
+ anchor,
10
+ current,
11
+ onPick,
12
+ onClose
13
+ }) {
14
+ const ref = useRef(null);
15
+ const [pos, setPos] = useState();
16
+ useDismissable(ref, onClose);
17
+ useLayoutEffect(() => {
18
+ var _a;
19
+ const menu = ref.current;
20
+ const r = (_a = anchor.current) == null ? void 0 : _a.getBoundingClientRect();
21
+ if (!menu || !r) return;
22
+ const h = menu.offsetHeight;
23
+ setPos({
24
+ left: Math.max(8, Math.min(r.right - WIDTH, innerWidth - WIDTH - 8)),
25
+ top: r.bottom + 6 + h > innerHeight ? Math.max(8, r.top - h - 6) : r.bottom + 6
26
+ });
27
+ }, [anchor]);
28
+ useEffect(() => {
29
+ var _a;
30
+ if (!pos) return;
31
+ const menu = ref.current;
32
+ (_a = (menu == null ? void 0 : menu.querySelector('[aria-checked="true"]')) ?? (menu == null ? void 0 : menu.querySelector('[role="menuitemradio"]'))) == null ? void 0 : _a.focus();
33
+ }, [pos]);
34
+ useEffect(() => {
35
+ const onPointerDown = (e) => {
36
+ var _a, _b;
37
+ const t = e.target;
38
+ if (!((_a = ref.current) == null ? void 0 : _a.contains(t)) && !((_b = anchor.current) == null ? void 0 : _b.contains(t))) onClose();
39
+ };
40
+ const onScroll = (e) => {
41
+ var _a;
42
+ if (!((_a = ref.current) == null ? void 0 : _a.contains(e.target))) onClose();
43
+ };
44
+ document.addEventListener("pointerdown", onPointerDown);
45
+ window.addEventListener("scroll", onScroll, true);
46
+ return () => {
47
+ document.removeEventListener("pointerdown", onPointerDown);
48
+ window.removeEventListener("scroll", onScroll, true);
49
+ };
50
+ }, [anchor, onClose]);
51
+ const onKeyDown = (e) => {
52
+ var _a, _b;
53
+ if (e.key === "Tab") {
54
+ e.preventDefault();
55
+ onClose();
56
+ return;
57
+ }
58
+ const items = [
59
+ ...((_a = ref.current) == null ? void 0 : _a.querySelectorAll(
60
+ '[role="menuitemradio"]'
61
+ )) ?? []
62
+ ];
63
+ const i = items.indexOf(document.activeElement);
64
+ const next = {
65
+ ArrowDown: (i + 1) % items.length,
66
+ ArrowUp: (i - 1 + items.length) % items.length,
67
+ Home: 0,
68
+ End: items.length - 1
69
+ }[e.key];
70
+ if (next === void 0) return;
71
+ e.preventDefault();
72
+ (_b = items[next]) == null ? void 0 : _b.focus();
73
+ };
74
+ const group = (title, options) => /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": title, children: [
75
+ /* @__PURE__ */ jsx(
76
+ "div",
77
+ {
78
+ "aria-hidden": "true",
79
+ className: "px-2 pt-2 pb-1 text-[11px] font-extrabold tracking-[.06em] text-muted-foreground uppercase",
80
+ children: title
81
+ }
82
+ ),
83
+ options.map((o) => /* @__PURE__ */ jsxs(
84
+ "button",
85
+ {
86
+ type: "button",
87
+ role: "menuitemradio",
88
+ "aria-checked": o.id === current,
89
+ onClick: () => onPick(o.id),
90
+ className: "flex w-full items-center gap-2.5 rounded-[10px] px-2 py-[7px] text-left outline-none hover:bg-muted focus-visible:bg-muted",
91
+ children: [
92
+ /* @__PURE__ */ jsx(o.Icon, {}),
93
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
94
+ /* @__PURE__ */ jsx("b", { className: "block text-[13.5px]", children: o.label }),
95
+ /* @__PURE__ */ jsx("small", { className: "block text-xs text-muted-foreground", children: o.hint })
96
+ ] }),
97
+ o.id === current && /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", className: "size-4 text-primary" })
98
+ ]
99
+ },
100
+ o.id
101
+ ))
102
+ ] });
103
+ return createPortal(
104
+ /* @__PURE__ */ jsxs(
105
+ "div",
106
+ {
107
+ ref,
108
+ role: "menu",
109
+ "aria-label": "Choose how to install",
110
+ onKeyDown,
111
+ style: { width: WIDTH, ...pos, visibility: pos ? void 0 : "hidden" },
112
+ className: "fixed z-[60] rounded-[var(--radius)] border border-border bg-card p-1.5 text-foreground shadow-2xl",
113
+ children: [
114
+ group(
115
+ "Install with",
116
+ VISIBLE_INSTALL_OPTIONS.filter((o) => !o.text)
117
+ ),
118
+ group(
119
+ "Text only",
120
+ VISIBLE_INSTALL_OPTIONS.filter((o) => o.text)
121
+ ),
122
+ /* @__PURE__ */ jsx(
123
+ "div",
124
+ {
125
+ "data-slot": "footer",
126
+ className: "mt-1 border-t border-border px-2 pt-1.5 pb-1 text-[11.5px] text-muted-foreground",
127
+ children: "We remember your choice for next time."
128
+ }
129
+ )
130
+ ]
131
+ }
132
+ ),
133
+ document.body
134
+ );
135
+ }
136
+ export {
137
+ InstallMenu
138
+ };
139
+ //# sourceMappingURL=InstallMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InstallMenu.js","sources":["../../../../../src/modules/mcpCatalog/install/InstallMenu.tsx"],"sourcesContent":["import type { InstallOptionId } from '@igstack/app-catalog-shared-core'\nimport { Check } from 'lucide-react'\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport { useDismissable } from '~/modules/dismiss/DismissStack'\nimport type { InstallOption } from './installOptions'\nimport { VISIBLE_INSTALL_OPTIONS } from './installOptions'\n\nconst WIDTH = 280\n\n/**\n * The install choices under a split button: \"Install with\" an AI, or \"Text\n * only\". Fixed to the viewport beside `anchor`, in a portal at the end of\n * `<body>` so a dialog's clipping cannot cut it and the dismiss stack sees it\n * on top of the dialog that opened it.\n */\nexport function InstallMenu({\n anchor,\n current,\n onPick,\n onClose,\n}: {\n /** What the menu opens beside; a press inside it is not \"outside\". */\n anchor: React.RefObject<HTMLElement | null>\n current?: InstallOptionId\n onPick: (id: InstallOptionId) => void\n onClose: () => void\n}) {\n const ref = useRef<HTMLDivElement>(null)\n const [pos, setPos] = useState<{ left: number; top: number }>()\n useDismissable(ref, onClose)\n\n useLayoutEffect(() => {\n const menu = ref.current\n const r = anchor.current?.getBoundingClientRect()\n if (!menu || !r) return\n const h = menu.offsetHeight\n setPos({\n left: Math.max(8, Math.min(r.right - WIDTH, innerWidth - WIDTH - 8)),\n top:\n r.bottom + 6 + h > innerHeight\n ? Math.max(8, r.top - h - 6)\n : r.bottom + 6,\n })\n }, [anchor])\n\n // Once placed (a hidden element refuses focus): the remembered choice, else\n // the first, and the arrows walk on from there.\n useEffect(() => {\n if (!pos) return\n const menu = ref.current\n ;(\n menu?.querySelector<HTMLElement>('[aria-checked=\"true\"]') ??\n menu?.querySelector<HTMLElement>('[role=\"menuitemradio\"]')\n )?.focus()\n }, [pos])\n\n // A press outside, or a scroll that would leave it floating, closes it.\n useEffect(() => {\n const onPointerDown = (e: PointerEvent) => {\n const t = e.target as Node\n if (!ref.current?.contains(t) && !anchor.current?.contains(t)) onClose()\n }\n const onScroll = (e: Event) => {\n if (!ref.current?.contains(e.target as Node)) onClose()\n }\n document.addEventListener('pointerdown', onPointerDown)\n window.addEventListener('scroll', onScroll, true)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown)\n window.removeEventListener('scroll', onScroll, true)\n }\n }, [anchor, onClose])\n\n // The ARIA menu keys: arrows wrap, Home and End jump, Tab leaves (closing\n // the menu; the dismiss stack hands the caret back to the button).\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'Tab') {\n e.preventDefault()\n onClose()\n return\n }\n const items = [\n ...(ref.current?.querySelectorAll<HTMLElement>(\n '[role=\"menuitemradio\"]',\n ) ?? []),\n ]\n const i = items.indexOf(document.activeElement as HTMLElement)\n const next = (\n {\n ArrowDown: (i + 1) % items.length,\n ArrowUp: (i - 1 + items.length) % items.length,\n Home: 0,\n End: items.length - 1,\n } as Record<string, number | undefined>\n )[e.key]\n if (next === undefined) return\n e.preventDefault()\n items[next]?.focus()\n }\n\n const group = (title: string, options: readonly InstallOption[]) => (\n <div role=\"group\" aria-label={title}>\n <div\n aria-hidden=\"true\"\n className=\"px-2 pt-2 pb-1 text-[11px] font-extrabold tracking-[.06em] text-muted-foreground uppercase\"\n >\n {title}\n </div>\n {options.map((o) => (\n <button\n key={o.id}\n type=\"button\"\n role=\"menuitemradio\"\n aria-checked={o.id === current}\n onClick={() => onPick(o.id)}\n className=\"flex w-full items-center gap-2.5 rounded-[10px] px-2 py-[7px] text-left outline-none hover:bg-muted focus-visible:bg-muted\"\n >\n <o.Icon />\n <span className=\"min-w-0 flex-1\">\n <b className=\"block text-[13.5px]\">{o.label}</b>\n <small className=\"block text-xs text-muted-foreground\">\n {o.hint}\n </small>\n </span>\n {o.id === current && (\n <Check aria-hidden=\"true\" className=\"size-4 text-primary\" />\n )}\n </button>\n ))}\n </div>\n )\n\n return createPortal(\n <div\n ref={ref}\n role=\"menu\"\n aria-label=\"Choose how to install\"\n onKeyDown={onKeyDown}\n style={{ width: WIDTH, ...pos, visibility: pos ? undefined : 'hidden' }}\n className=\"fixed z-[60] rounded-[var(--radius)] border border-border bg-card p-1.5 text-foreground shadow-2xl\"\n >\n {group(\n 'Install with',\n VISIBLE_INSTALL_OPTIONS.filter((o) => !o.text),\n )}\n {group(\n 'Text only',\n VISIBLE_INSTALL_OPTIONS.filter((o) => o.text),\n )}\n <div\n data-slot=\"footer\"\n className=\"mt-1 border-t border-border px-2 pt-1.5 pb-1 text-[11.5px] text-muted-foreground\"\n >\n We remember your choice for next time.\n </div>\n </div>,\n document.body,\n )\n}\n"],"names":[],"mappings":";;;;;;AA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sBAAA,CAAsB;AAAA,QAAA;AAAA,MAAA;AAAA,MAfvD,EAAE;AAAA,IAAA,CAkBV;AAAA,EAAA,GACH;AAGF,SAAO;AAAA,IACL;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,MAAK;AAAA,QACL,cAAW;AAAA,QACX;AAAA,QACA,OAAO,EAAE,OAAO,OAAO,GAAG,KAAK,YAAY,MAAM,SAAY,SAAA;AAAA,QAC7D,WAAU;AAAA,QAET,UAAA;AAAA,UAAA;AAAA,YACC;AAAA,YACA,wBAAwB,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI;AAAA,UAAA;AAAA,UAE9C;AAAA,YACC;AAAA,YACA,wBAAwB,OAAO,CAAC,MAAM,EAAE,IAAI;AAAA,UAAA;AAAA,UAE9C;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,aAAU;AAAA,cACV,WAAU;AAAA,cACX,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAED;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,SAAS;AAAA,EAAA;AAEb;"}
@@ -0,0 +1,10 @@
1
+ import { CatalogMcpServer } from '@igstack/app-catalog-backend-core';
2
+ /**
3
+ * Plain steps for what installing `servers` does with the chosen AI, what it
4
+ * touches on your machine, and the full prompt. Picking an AI here is the
5
+ * same remembered choice the Install menu makes.
6
+ */
7
+ export declare function WhatHappensDialog({ servers, onClose, }: {
8
+ servers: readonly CatalogMcpServer[];
9
+ onClose: () => void;
10
+ }): import('react').ReactPortal;
@@ -0,0 +1,161 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { whatHappensSteps, INSTALL_CONFIG_FILE } from "@igstack/app-catalog-shared-core";
3
+ import { X, Braces, KeyRound, SquareTerminal, ExternalLink, Check, Copy } from "lucide-react";
4
+ import { useRef } from "react";
5
+ import { createPortal } from "react-dom";
6
+ import { useDismissable } from "../../dismiss/DismissStack.js";
7
+ import { Button } from "../../../ui/button.js";
8
+ import { InstallButton } from "./InstallButton.js";
9
+ import { useInstall, useCopyFlash, VISIBLE_INSTALL_OPTIONS, copyText } from "./installOptions.js";
10
+ import { useMcpPrefs } from "./useMcpPrefs.js";
11
+ const GROUP = "w-full text-[11.5px] tracking-[.05em] text-muted-foreground uppercase";
12
+ const CHIP = "inline-flex items-center gap-[5px] rounded-full border border-border bg-card px-[9px] py-0.5 font-semibold [&_svg]:size-[13px]";
13
+ function WhatHappensDialog({
14
+ servers,
15
+ onClose
16
+ }) {
17
+ var _a;
18
+ const ref = useRef(null);
19
+ useDismissable(ref, onClose);
20
+ const { installWith, setInstallWith } = useMcpPrefs();
21
+ const { resolved, apps, prompt } = useInstall(servers);
22
+ const [flash, setFlash] = useCopyFlash();
23
+ const option = (_a = VISIBLE_INSTALL_OPTIONS.find((o) => o.id === installWith)) == null ? void 0 : _a.id;
24
+ const steps = whatHappensSteps(resolved, option, { apps });
25
+ const fullPrompt = prompt(option);
26
+ const tokens = resolved.filter((s) => s.auth.kind === "token").length;
27
+ const runsLocally = resolved.some((s) => s.transport.type === "stdio");
28
+ const hosts = [
29
+ ...new Set(
30
+ resolved.flatMap(
31
+ (s) => s.transport.type === "http" ? [new URL(s.transport.url).host] : []
32
+ )
33
+ )
34
+ ];
35
+ const title = `What happens when you install ${servers.length === 1 ? servers[0].displayName : `${servers.length} servers`}`;
36
+ return createPortal(
37
+ /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex items-start justify-center overflow-y-auto p-4 sm:p-10", children: [
38
+ /* @__PURE__ */ jsx(
39
+ "button",
40
+ {
41
+ type: "button",
42
+ "aria-label": "Close",
43
+ tabIndex: -1,
44
+ onClick: onClose,
45
+ className: "fixed inset-0 -z-10 bg-black/40 backdrop-blur-[2px]"
46
+ }
47
+ ),
48
+ /* @__PURE__ */ jsxs(
49
+ "div",
50
+ {
51
+ ref,
52
+ role: "dialog",
53
+ "aria-modal": "true",
54
+ "aria-label": title,
55
+ tabIndex: -1,
56
+ className: "relative my-auto w-full max-w-[560px] rounded-[var(--radius)] border border-border bg-background px-6 py-5 text-foreground shadow-2xl outline-none",
57
+ children: [
58
+ /* @__PURE__ */ jsx(
59
+ "button",
60
+ {
61
+ type: "button",
62
+ "aria-label": "Close",
63
+ onClick: onClose,
64
+ className: "absolute top-3 right-3 rounded-full p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
65
+ children: /* @__PURE__ */ jsx(X, { className: "size-4" })
66
+ }
67
+ ),
68
+ /* @__PURE__ */ jsx("h2", { className: "m-0 mb-1 pr-8 font-serif text-[22px] font-semibold", children: title }),
69
+ /* @__PURE__ */ jsx("p", { className: "m-0 text-muted-foreground", children: "Install with:" }),
70
+ /* @__PURE__ */ jsx("div", { className: "mt-3.5 mb-1 flex flex-wrap gap-1.5", children: VISIBLE_INSTALL_OPTIONS.map((o, i) => /* @__PURE__ */ jsxs(
71
+ "button",
72
+ {
73
+ type: "button",
74
+ "aria-pressed": o.id === option,
75
+ autoFocus: option ? o.id === option : i === 0,
76
+ onClick: () => void setInstallWith(o.id),
77
+ className: "inline-flex min-h-[30px] items-center gap-1.5 rounded-full border border-border bg-card py-[3px] pr-2.5 pl-1 text-[12.5px] font-bold aria-pressed:border-primary aria-pressed:bg-accent [&_svg]:size-5",
78
+ children: [
79
+ /* @__PURE__ */ jsx(o.Icon, {}),
80
+ o.label
81
+ ]
82
+ },
83
+ o.id
84
+ )) }),
85
+ /* @__PURE__ */ jsx(
86
+ "ol",
87
+ {
88
+ "data-testid": "mcp-what-steps",
89
+ className: "m-0 mt-4 grid list-none gap-0.5 p-0 [counter-reset:w]",
90
+ children: steps.map((step) => /* @__PURE__ */ jsx(
91
+ "li",
92
+ {
93
+ className: "grid grid-cols-[28px_1fr] gap-2.5 border-t border-border py-2 text-[13.5px] [counter-increment:w] first:border-t-0 before:grid before:size-6 before:place-items-center before:rounded-full before:bg-secondary before:text-xs before:font-extrabold before:text-secondary-foreground before:content-[counter(w)]",
94
+ children: /* @__PURE__ */ jsxs("div", { children: [
95
+ /* @__PURE__ */ jsx("b", { className: "block", children: step.title }),
96
+ /* @__PURE__ */ jsx("span", { className: "text-[12.5px] text-muted-foreground", children: step.detail })
97
+ ] })
98
+ },
99
+ step.title
100
+ ))
101
+ }
102
+ ),
103
+ /* @__PURE__ */ jsxs("div", { className: "mt-3.5 flex flex-wrap gap-1.5 rounded-[calc(var(--radius)-2px)] bg-muted px-3 py-2.5 text-[12.5px]", children: [
104
+ /* @__PURE__ */ jsx("b", { className: GROUP, children: "Touches on your machine" }),
105
+ /* @__PURE__ */ jsxs("div", { "data-testid": "mcp-what-touches", className: "contents", children: [
106
+ /* @__PURE__ */ jsxs("span", { className: CHIP, children: [
107
+ /* @__PURE__ */ jsx(Braces, { "aria-hidden": "true" }),
108
+ option ? INSTALL_CONFIG_FILE[option] : "your AI's settings"
109
+ ] }),
110
+ tokens > 0 && /* @__PURE__ */ jsxs("span", { className: CHIP, children: [
111
+ /* @__PURE__ */ jsx(KeyRound, { "aria-hidden": "true" }),
112
+ tokens,
113
+ " token",
114
+ tokens > 1 ? "s" : "",
115
+ " you create"
116
+ ] }),
117
+ runsLocally && /* @__PURE__ */ jsxs("span", { className: CHIP, children: [
118
+ /* @__PURE__ */ jsx(SquareTerminal, { "aria-hidden": "true" }),
119
+ "runs on your computer"
120
+ ] })
121
+ ] }),
122
+ hosts.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
123
+ /* @__PURE__ */ jsx("b", { className: `${GROUP} mt-1.5`, children: "Talks to" }),
124
+ /* @__PURE__ */ jsx("div", { "data-testid": "mcp-what-talks-to", className: "contents", children: hosts.map((h) => /* @__PURE__ */ jsxs("span", { className: CHIP, children: [
125
+ /* @__PURE__ */ jsx(ExternalLink, { "aria-hidden": "true" }),
126
+ h
127
+ ] }, h)) })
128
+ ] })
129
+ ] }),
130
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [
131
+ /* @__PURE__ */ jsx(InstallButton, { servers }),
132
+ /* @__PURE__ */ jsxs(
133
+ Button,
134
+ {
135
+ size: "sm",
136
+ variant: "outline",
137
+ onClick: () => void copyText(fullPrompt).then(
138
+ (ok) => setFlash(ok ? "copied" : "copy-failed")
139
+ ),
140
+ children: [
141
+ flash === "copied" ? /* @__PURE__ */ jsx(Check, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Copy, { "aria-hidden": "true" }),
142
+ flash === "copied" ? "Copied" : flash === "copy-failed" ? "Copy failed" : "Copy full prompt"
143
+ ]
144
+ }
145
+ )
146
+ ] }),
147
+ /* @__PURE__ */ jsxs("details", { className: "mt-2.5", children: [
148
+ /* @__PURE__ */ jsx("summary", { className: "cursor-pointer text-[13px] font-bold text-secondary-foreground", children: "Show the full prompt" }),
149
+ /* @__PURE__ */ jsx("pre", { className: "mt-2 max-h-72 overflow-auto rounded-md bg-muted p-3 text-xs whitespace-pre-wrap", children: fullPrompt })
150
+ ] })
151
+ ]
152
+ }
153
+ )
154
+ ] }),
155
+ document.body
156
+ );
157
+ }
158
+ export {
159
+ WhatHappensDialog
160
+ };
161
+ //# sourceMappingURL=WhatHappensDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WhatHappensDialog.js","sources":["../../../../../src/modules/mcpCatalog/install/WhatHappensDialog.tsx"],"sourcesContent":["import type { CatalogMcpServer } from '@igstack/app-catalog-backend-core'\nimport {\n INSTALL_CONFIG_FILE,\n whatHappensSteps,\n} from '@igstack/app-catalog-shared-core'\nimport {\n Braces,\n Check,\n Copy,\n ExternalLink,\n KeyRound,\n SquareTerminal,\n X,\n} from 'lucide-react'\nimport { useRef } from 'react'\nimport { createPortal } from 'react-dom'\nimport { useDismissable } from '~/modules/dismiss/DismissStack'\nimport { Button } from '~/ui/button'\nimport { InstallButton } from './InstallButton'\nimport {\n VISIBLE_INSTALL_OPTIONS,\n copyText,\n useCopyFlash,\n useInstall,\n} from './installOptions'\nimport { useMcpPrefs } from './useMcpPrefs'\n\nconst GROUP =\n 'w-full text-[11.5px] tracking-[.05em] text-muted-foreground uppercase'\nconst CHIP =\n 'inline-flex items-center gap-[5px] rounded-full border border-border bg-card px-[9px] py-0.5 font-semibold [&_svg]:size-[13px]'\n\n/**\n * Plain steps for what installing `servers` does with the chosen AI, what it\n * touches on your machine, and the full prompt. Picking an AI here is the\n * same remembered choice the Install menu makes.\n */\nexport function WhatHappensDialog({\n servers,\n onClose,\n}: {\n servers: readonly CatalogMcpServer[]\n onClose: () => void\n}) {\n const ref = useRef<HTMLDivElement>(null)\n useDismissable(ref, onClose)\n const { installWith, setInstallWith } = useMcpPrefs()\n const { resolved, apps, prompt } = useInstall(servers)\n const [flash, setFlash] = useCopyFlash()\n\n const option = VISIBLE_INSTALL_OPTIONS.find((o) => o.id === installWith)?.id\n const steps = whatHappensSteps(resolved, option, { apps })\n const fullPrompt = prompt(option)\n const tokens = resolved.filter((s) => s.auth.kind === 'token').length\n const runsLocally = resolved.some((s) => s.transport.type === 'stdio')\n const hosts = [\n ...new Set(\n resolved.flatMap((s) =>\n s.transport.type === 'http' ? [new URL(s.transport.url).host] : [],\n ),\n ),\n ]\n const title = `What happens when you install ${\n servers.length === 1 ? servers[0]!.displayName : `${servers.length} servers`\n }`\n\n return createPortal(\n <div className=\"fixed inset-0 z-50 flex items-start justify-center overflow-y-auto p-4 sm:p-10\">\n <button\n type=\"button\"\n aria-label=\"Close\"\n tabIndex={-1}\n onClick={onClose}\n className=\"fixed inset-0 -z-10 bg-black/40 backdrop-blur-[2px]\"\n />\n <div\n ref={ref}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={title}\n tabIndex={-1}\n className=\"relative my-auto w-full max-w-[560px] rounded-[var(--radius)] border border-border bg-background px-6 py-5 text-foreground shadow-2xl outline-none\"\n >\n <button\n type=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n className=\"absolute top-3 right-3 rounded-full p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n <X className=\"size-4\" />\n </button>\n <h2 className=\"m-0 mb-1 pr-8 font-serif text-[22px] font-semibold\">\n {title}\n </h2>\n <p className=\"m-0 text-muted-foreground\">Install with:</p>\n <div className=\"mt-3.5 mb-1 flex flex-wrap gap-1.5\">\n {VISIBLE_INSTALL_OPTIONS.map((o, i) => (\n <button\n key={o.id}\n type=\"button\"\n aria-pressed={o.id === option}\n // The popup takes the caret: the picked AI, else the first.\n autoFocus={option ? o.id === option : i === 0}\n onClick={() => void setInstallWith(o.id)}\n className=\"inline-flex min-h-[30px] items-center gap-1.5 rounded-full border border-border bg-card py-[3px] pr-2.5 pl-1 text-[12.5px] font-bold aria-pressed:border-primary aria-pressed:bg-accent [&_svg]:size-5\"\n >\n <o.Icon />\n {o.label}\n </button>\n ))}\n </div>\n <ol\n data-testid=\"mcp-what-steps\"\n className=\"m-0 mt-4 grid list-none gap-0.5 p-0 [counter-reset:w]\"\n >\n {steps.map((step) => (\n <li\n key={step.title}\n className=\"grid grid-cols-[28px_1fr] gap-2.5 border-t border-border py-2 text-[13.5px] [counter-increment:w] first:border-t-0 before:grid before:size-6 before:place-items-center before:rounded-full before:bg-secondary before:text-xs before:font-extrabold before:text-secondary-foreground before:content-[counter(w)]\"\n >\n <div>\n <b className=\"block\">{step.title}</b>\n <span className=\"text-[12.5px] text-muted-foreground\">\n {step.detail}\n </span>\n </div>\n </li>\n ))}\n </ol>\n <div className=\"mt-3.5 flex flex-wrap gap-1.5 rounded-[calc(var(--radius)-2px)] bg-muted px-3 py-2.5 text-[12.5px]\">\n <b className={GROUP}>Touches on your machine</b>\n <div data-testid=\"mcp-what-touches\" className=\"contents\">\n <span className={CHIP}>\n <Braces aria-hidden=\"true\" />\n {option ? INSTALL_CONFIG_FILE[option] : \"your AI's settings\"}\n </span>\n {tokens > 0 && (\n <span className={CHIP}>\n <KeyRound aria-hidden=\"true\" />\n {tokens} token{tokens > 1 ? 's' : ''} you create\n </span>\n )}\n {runsLocally && (\n <span className={CHIP}>\n <SquareTerminal aria-hidden=\"true\" />\n runs on your computer\n </span>\n )}\n </div>\n {hosts.length > 0 && (\n <>\n <b className={`${GROUP} mt-1.5`}>Talks to</b>\n <div data-testid=\"mcp-what-talks-to\" className=\"contents\">\n {hosts.map((h) => (\n <span key={h} className={CHIP}>\n <ExternalLink aria-hidden=\"true\" />\n {h}\n </span>\n ))}\n </div>\n </>\n )}\n </div>\n <div className=\"mt-4 flex flex-wrap items-center gap-2\">\n <InstallButton servers={servers} />\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() =>\n void copyText(fullPrompt).then((ok) =>\n setFlash(ok ? 'copied' : 'copy-failed'),\n )\n }\n >\n {flash === 'copied' ? (\n <Check aria-hidden=\"true\" />\n ) : (\n <Copy aria-hidden=\"true\" />\n )}\n {flash === 'copied'\n ? 'Copied'\n : flash === 'copy-failed'\n ? 'Copy failed'\n : 'Copy full prompt'}\n </Button>\n </div>\n <details className=\"mt-2.5\">\n <summary className=\"cursor-pointer text-[13px] font-bold text-secondary-foreground\">\n Show the full prompt\n </summary>\n <pre className=\"mt-2 max-h-72 overflow-auto rounded-md bg-muted p-3 text-xs whitespace-pre-wrap\">\n {fullPrompt}\n </pre>\n </details>\n </div>\n </div>,\n document.body,\n )\n}\n"],"names":[],"mappings":";;;;;;;;;;AA2BA,MAAM,QACJ;AACF,MAAM,OACJ;AAOK,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AACF,GAGG;;AACD,QAAM,MAAM,OAAuB,IAAI;AACvC,iBAAe,KAAK,OAAO;AAC3B,QAAM,EAAE,aAAa,eAAA,IAAmB,YAAA;AACxC,QAAM,EAAE,UAAU,MAAM,OAAA,IAAW,WAAW,OAAO;AACrD,QAAM,CAAC,OAAO,QAAQ,IAAI,aAAA;AAE1B,QAAM,UAAS,6BAAwB,KAAK,CAAC,MAAM,EAAE,OAAO,WAAW,MAAxD,mBAA2D;AAC1E,QAAM,QAAQ,iBAAiB,UAAU,QAAQ,EAAE,MAAM;AACzD,QAAM,aAAa,OAAO,MAAM;AAChC,QAAM,S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UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,GACF;AAAA,IACA,SAAS;AAAA,EAAA;AAEb;"}
@@ -0,0 +1,40 @@
1
+ import { CatalogMcpServer } from '@igstack/app-catalog-backend-core';
2
+ import { InstallOptionId } from '@igstack/app-catalog-shared-core';
3
+ export interface InstallOption {
4
+ id: InstallOptionId;
5
+ label: string;
6
+ hint: string;
7
+ Icon: () => React.ReactNode;
8
+ /** Copies text rather than installing: the menu's "Text only" group. */
9
+ text?: boolean;
10
+ /** In code, not on screen: its link is unverified. */
11
+ hidden?: boolean;
12
+ }
13
+ export declare const INSTALL_OPTIONS: readonly InstallOption[];
14
+ /** The options a person can pick: everything not hidden. */
15
+ export declare const VISIBLE_INSTALL_OPTIONS: InstallOption[];
16
+ /**
17
+ * Copies text, falling back to a hidden textarea where the API is refused.
18
+ * Resolves false when both fail; never rejects.
19
+ */
20
+ export declare function copyText(text: string): Promise<boolean>;
21
+ export type CopyFlash = 'copied' | 'copy-failed' | null;
22
+ /** A copy's outcome, shown for a moment and then cleared. */
23
+ export declare function useCopyFlash(): readonly [CopyFlash, import('react').Dispatch<import('react').SetStateAction<CopyFlash>>];
24
+ /**
25
+ * Everything an install needs for `servers`: their URLs resolved against this
26
+ * host, the prompt for an option, and `run`, which carries the option out and
27
+ * says whether it copied (the caller shows "Copied"), failed to copy, or
28
+ * opened another app.
29
+ */
30
+ export declare function useInstall(servers: readonly CatalogMcpServer[]): {
31
+ resolved: CatalogMcpServer[];
32
+ apps: {
33
+ slug: string;
34
+ name: string;
35
+ url: string;
36
+ }[];
37
+ prompt: (option?: InstallOptionId) => string;
38
+ run: (option: InstallOptionId) => Promise<"copied" | "copy-failed" | "opened">;
39
+ sensitiveDataLabel: string;
40
+ };