@replicated/portal-components 0.0.21 → 0.0.23

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 (182) hide show
  1. package/components/metadata/registry.json +2 -2
  2. package/components/metadata/registry.md +2 -2
  3. package/dist/actions/change-team.js +39 -0
  4. package/dist/actions/change-team.js.map +1 -1
  5. package/dist/actions/index.d.mts +1 -1
  6. package/dist/actions/index.d.ts +1 -1
  7. package/dist/actions/index.js +40 -0
  8. package/dist/actions/index.js.map +1 -1
  9. package/dist/actions/install-actions.d.mts +1 -1
  10. package/dist/actions/install-actions.d.ts +1 -1
  11. package/dist/actions/install-actions.js +39 -0
  12. package/dist/actions/install-actions.js.map +1 -1
  13. package/dist/actions/service-account.d.mts +1 -1
  14. package/dist/actions/service-account.d.ts +1 -1
  15. package/dist/actions/service-account.js +39 -0
  16. package/dist/actions/service-account.js.map +1 -1
  17. package/dist/actions/support-bundles.d.mts +1 -1
  18. package/dist/actions/support-bundles.d.ts +1 -1
  19. package/dist/actions/support-bundles.js +39 -0
  20. package/dist/actions/support-bundles.js.map +1 -1
  21. package/dist/actions/team-settings.d.mts +1 -1
  22. package/dist/actions/team-settings.d.ts +1 -1
  23. package/dist/actions/team-settings.js +39 -0
  24. package/dist/actions/team-settings.js.map +1 -1
  25. package/dist/actions/trial-signup.js +39 -0
  26. package/dist/actions/trial-signup.js.map +1 -1
  27. package/dist/actions/user-settings.d.mts +1 -1
  28. package/dist/actions/user-settings.d.ts +1 -1
  29. package/dist/actions/user-settings.js +39 -0
  30. package/dist/actions/user-settings.js.map +1 -1
  31. package/dist/airgap-instances.d.mts +1 -1
  32. package/dist/airgap-instances.d.ts +1 -1
  33. package/dist/airgap-instances.js +3 -2
  34. package/dist/airgap-instances.js.map +1 -1
  35. package/dist/esm/actions/change-team.js +39 -0
  36. package/dist/esm/actions/change-team.js.map +1 -1
  37. package/dist/esm/actions/index.js +40 -1
  38. package/dist/esm/actions/index.js.map +1 -1
  39. package/dist/esm/actions/install-actions.js +39 -0
  40. package/dist/esm/actions/install-actions.js.map +1 -1
  41. package/dist/esm/actions/service-account.js +39 -0
  42. package/dist/esm/actions/service-account.js.map +1 -1
  43. package/dist/esm/actions/support-bundles.js +39 -0
  44. package/dist/esm/actions/support-bundles.js.map +1 -1
  45. package/dist/esm/actions/team-settings.js +39 -0
  46. package/dist/esm/actions/team-settings.js.map +1 -1
  47. package/dist/esm/actions/trial-signup.js +39 -0
  48. package/dist/esm/actions/trial-signup.js.map +1 -1
  49. package/dist/esm/actions/user-settings.js +39 -0
  50. package/dist/esm/actions/user-settings.js.map +1 -1
  51. package/dist/esm/airgap-instances.js +3 -2
  52. package/dist/esm/airgap-instances.js.map +1 -1
  53. package/dist/esm/helm-install-wizard.js +414 -189
  54. package/dist/esm/helm-install-wizard.js.map +1 -1
  55. package/dist/esm/index.js +104 -81
  56. package/dist/esm/index.js.map +1 -1
  57. package/dist/esm/install-actions.js +39 -0
  58. package/dist/esm/install-actions.js.map +1 -1
  59. package/dist/esm/instance-card.js +2 -1
  60. package/dist/esm/instance-card.js.map +1 -1
  61. package/dist/esm/license-details.js +39 -0
  62. package/dist/esm/license-details.js.map +1 -1
  63. package/dist/esm/linux-install-wizard.js +310 -166
  64. package/dist/esm/linux-install-wizard.js.map +1 -1
  65. package/dist/esm/logout-action.js +187 -0
  66. package/dist/esm/logout-action.js.map +1 -0
  67. package/dist/esm/logout-button.js +32 -0
  68. package/dist/esm/logout-button.js.map +1 -0
  69. package/dist/esm/markdown-renderer.js +16 -0
  70. package/dist/esm/markdown-renderer.js.map +1 -0
  71. package/dist/esm/middleware.js +3 -3
  72. package/dist/esm/middleware.js.map +1 -1
  73. package/dist/esm/online-instance-list.js +3 -2
  74. package/dist/esm/online-instance-list.js.map +1 -1
  75. package/dist/esm/saml-callback-client.js +5 -2
  76. package/dist/esm/saml-callback-client.js.map +1 -1
  77. package/dist/esm/saml-handlers.js +104 -0
  78. package/dist/esm/saml-handlers.js.map +1 -1
  79. package/dist/esm/support-bundle-collection-card.js +3 -2
  80. package/dist/esm/support-bundle-collection-card.js.map +1 -1
  81. package/dist/esm/support-bundles-card.js +2 -2
  82. package/dist/esm/support-bundles-card.js.map +1 -1
  83. package/dist/esm/support-card.js +39 -0
  84. package/dist/esm/support-card.js.map +1 -1
  85. package/dist/esm/top-nav-menu-close.js +46 -0
  86. package/dist/esm/top-nav-menu-close.js.map +1 -0
  87. package/dist/esm/top-nav.js +149 -59
  88. package/dist/esm/top-nav.js.map +1 -1
  89. package/dist/esm/trial-signup.js +6 -3
  90. package/dist/esm/trial-signup.js.map +1 -1
  91. package/dist/esm/update-layout.js +149 -59
  92. package/dist/esm/update-layout.js.map +1 -1
  93. package/dist/esm/upload-support-bundle-modal.js +2 -2
  94. package/dist/esm/upload-support-bundle-modal.js.map +1 -1
  95. package/dist/esm/user-menu-dropdown.js +52 -0
  96. package/dist/esm/user-menu-dropdown.js.map +1 -0
  97. package/dist/esm/user-settings.js +5 -5
  98. package/dist/esm/user-settings.js.map +1 -1
  99. package/dist/esm/utils/index.js +54 -17
  100. package/dist/esm/utils/index.js.map +1 -1
  101. package/dist/helm-install-wizard.d.mts +18 -7
  102. package/dist/helm-install-wizard.d.ts +18 -7
  103. package/dist/helm-install-wizard.js +418 -189
  104. package/dist/helm-install-wizard.js.map +1 -1
  105. package/dist/{index-sMbq94M7.d.ts → index-DXy7RxOX.d.ts} +18 -1
  106. package/dist/{index-DyzJ0yKD.d.mts → index-JX9-CIMA.d.mts} +18 -1
  107. package/dist/index.d.mts +1 -1
  108. package/dist/index.d.ts +1 -1
  109. package/dist/index.js +104 -81
  110. package/dist/index.js.map +1 -1
  111. package/dist/install-actions.d.mts +2 -2
  112. package/dist/install-actions.d.ts +2 -2
  113. package/dist/install-actions.js +39 -0
  114. package/dist/install-actions.js.map +1 -1
  115. package/dist/instance-card.d.mts +1 -1
  116. package/dist/instance-card.d.ts +1 -1
  117. package/dist/instance-card.js +2 -1
  118. package/dist/instance-card.js.map +1 -1
  119. package/dist/license-details.js +39 -0
  120. package/dist/license-details.js.map +1 -1
  121. package/dist/linux-install-wizard.d.mts +17 -7
  122. package/dist/linux-install-wizard.d.ts +17 -7
  123. package/dist/linux-install-wizard.js +314 -166
  124. package/dist/linux-install-wizard.js.map +1 -1
  125. package/dist/logout-action.d.mts +7 -0
  126. package/dist/logout-action.d.ts +7 -0
  127. package/dist/logout-action.js +189 -0
  128. package/dist/logout-action.js.map +1 -0
  129. package/dist/logout-button.d.mts +16 -0
  130. package/dist/logout-button.d.ts +16 -0
  131. package/dist/logout-button.js +34 -0
  132. package/dist/logout-button.js.map +1 -0
  133. package/dist/markdown-renderer.d.mts +12 -0
  134. package/dist/markdown-renderer.d.ts +12 -0
  135. package/dist/markdown-renderer.js +22 -0
  136. package/dist/markdown-renderer.js.map +1 -0
  137. package/dist/middleware.js +3 -3
  138. package/dist/middleware.js.map +1 -1
  139. package/dist/online-instance-list.d.mts +1 -1
  140. package/dist/online-instance-list.d.ts +1 -1
  141. package/dist/online-instance-list.js +3 -2
  142. package/dist/online-instance-list.js.map +1 -1
  143. package/dist/pending-installations.d.mts +1 -1
  144. package/dist/pending-installations.d.ts +1 -1
  145. package/dist/saml-callback-client.js +5 -2
  146. package/dist/saml-callback-client.js.map +1 -1
  147. package/dist/saml-handlers.js +104 -0
  148. package/dist/saml-handlers.js.map +1 -1
  149. package/dist/security-card.d.mts +1 -1
  150. package/dist/security-card.d.ts +1 -1
  151. package/dist/styles.css +39 -0
  152. package/dist/support-bundle-collection-card.js +3 -2
  153. package/dist/support-bundle-collection-card.js.map +1 -1
  154. package/dist/support-bundles-card.d.mts +2 -2
  155. package/dist/support-bundles-card.d.ts +2 -2
  156. package/dist/support-bundles-card.js +2 -2
  157. package/dist/support-bundles-card.js.map +1 -1
  158. package/dist/support-card.js +39 -0
  159. package/dist/support-card.js.map +1 -1
  160. package/dist/top-nav-menu-close.d.mts +10 -0
  161. package/dist/top-nav-menu-close.d.ts +10 -0
  162. package/dist/top-nav-menu-close.js +48 -0
  163. package/dist/top-nav-menu-close.js.map +1 -0
  164. package/dist/top-nav.js +149 -59
  165. package/dist/top-nav.js.map +1 -1
  166. package/dist/trial-signup.js +6 -3
  167. package/dist/trial-signup.js.map +1 -1
  168. package/dist/update-layout.js +149 -59
  169. package/dist/update-layout.js.map +1 -1
  170. package/dist/upload-support-bundle-modal.js +2 -2
  171. package/dist/upload-support-bundle-modal.js.map +1 -1
  172. package/dist/user-menu-dropdown.d.mts +25 -0
  173. package/dist/user-menu-dropdown.d.ts +25 -0
  174. package/dist/user-menu-dropdown.js +59 -0
  175. package/dist/user-menu-dropdown.js.map +1 -0
  176. package/dist/user-settings.js +5 -5
  177. package/dist/user-settings.js.map +1 -1
  178. package/dist/utils/index.d.mts +3 -2
  179. package/dist/utils/index.d.ts +3 -2
  180. package/dist/utils/index.js +54 -17
  181. package/dist/utils/index.js.map +1 -1
  182. package/package.json +29 -2
package/dist/esm/index.js CHANGED
@@ -3,6 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { Buffer } from 'buffer';
4
4
  import { cookies } from 'next/headers';
5
5
  import Link from 'next/link';
6
+ import { User } from 'lucide-react';
6
7
 
7
8
  /**
8
9
  * Enterprise Portal Components
@@ -120,7 +121,7 @@ var init_tracer = __esm({
120
121
 
121
122
  // package.json
122
123
  var package_default = {
123
- version: "0.0.21"};
124
+ version: "0.0.23"};
124
125
 
125
126
  // src/tokens/index.ts
126
127
  var baseTokens = {
@@ -531,24 +532,22 @@ async function validateSession(token) {
531
532
  if (!token || typeof token !== "string" || !token.trim()) {
532
533
  return false;
533
534
  }
534
- try {
535
- const endpoint = `${getApiOrigin()}/enterprise-portal/user`;
536
- const response = await fetch(endpoint, {
537
- method: "GET",
538
- headers: {
539
- authorization: `Bearer ${token}`
540
- },
541
- // Short timeout for validation
542
- signal: AbortSignal.timeout(5e3)
543
- });
544
- if (response.status === 401) {
545
- return false;
546
- }
547
- return response.ok;
548
- } catch (error) {
549
- console.warn("[portal-components] session validation error:", error);
550
- return true;
535
+ const endpoint = `${getApiOrigin()}/enterprise-portal/user`;
536
+ const response = await fetch(endpoint, {
537
+ method: "GET",
538
+ headers: {
539
+ authorization: `Bearer ${token}`
540
+ },
541
+ // Short timeout for validation
542
+ signal: AbortSignal.timeout(5e3)
543
+ });
544
+ if (response.status === 401) {
545
+ return false;
551
546
  }
547
+ if (!response.ok) {
548
+ throw new Error(`Session validation failed with status ${response.status}`);
549
+ }
550
+ return true;
552
551
  }
553
552
  async function deleteSessionCookie() {
554
553
  const { cookies: cookies2 } = await import('next/headers');
@@ -1450,6 +1449,45 @@ var updateNotifications = defineServerAction({
1450
1449
  };
1451
1450
  }
1452
1451
  });
1452
+ var fetchDocumentationImpl = async () => {
1453
+ const { cookies: cookies2 } = await import('next/headers');
1454
+ const sessionStore = await cookies2();
1455
+ const session = sessionStore.get("portal_session");
1456
+ const token = session?.value;
1457
+ if (!token) {
1458
+ throw new Error("Authentication required");
1459
+ }
1460
+ const url = `${getApiOrigin()}/enterprise-portal/documentation`;
1461
+ if (process.env.NODE_ENV !== "production") {
1462
+ console.debug(
1463
+ "[portal-components] fetching documentation via %s (Enterprise Portal API)",
1464
+ url
1465
+ );
1466
+ }
1467
+ const response = await authenticatedFetch(url, {
1468
+ method: "GET",
1469
+ token,
1470
+ headers: {
1471
+ accept: "application/json"
1472
+ }
1473
+ });
1474
+ if (!response.ok) {
1475
+ throw new Error(
1476
+ `Documentation request failed (${response.status} ${response.statusText})`
1477
+ );
1478
+ }
1479
+ const data = await response.json();
1480
+ return {
1481
+ helmPreInstall: data.helmPreInstall || "",
1482
+ helmPostInstall: data.helmPostInstall || "",
1483
+ embeddedClusterPreInstall: data.embeddedClusterPreInstall || "",
1484
+ embeddedClusterPostInstall: data.embeddedClusterPostInstall || "",
1485
+ helmInstallUrl: data.helmInstallUrl || "",
1486
+ embeddedClusterInstallUrl: data.embeddedClusterInstallUrl || "",
1487
+ valuesOverrideUrl: data.valuesOverrideUrl || ""
1488
+ };
1489
+ };
1490
+ cache(fetchDocumentationImpl);
1453
1491
  var ShieldIcon = (props) => /* @__PURE__ */ jsx(
1454
1492
  "svg",
1455
1493
  {
@@ -1707,6 +1745,45 @@ var LicenseDetails = async ({
1707
1745
  ] })
1708
1746
  ] });
1709
1747
  };
1748
+ function UserMenuDropdown({
1749
+ displayLabel,
1750
+ children,
1751
+ className = ""
1752
+ }) {
1753
+ return /* @__PURE__ */ jsxs("details", { className: `group relative ${className}`, children: [
1754
+ /* @__PURE__ */ jsxs("summary", { className: "flex cursor-pointer items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 transition-colors list-none border border-transparent hover:border-gray-200", children: [
1755
+ /* @__PURE__ */ jsx(User, { className: "h-4 w-4" }),
1756
+ /* @__PURE__ */ jsx("span", { children: displayLabel }),
1757
+ /* @__PURE__ */ jsx(
1758
+ "svg",
1759
+ {
1760
+ xmlns: "http://www.w3.org/2000/svg",
1761
+ width: "16",
1762
+ height: "16",
1763
+ viewBox: "0 0 24 24",
1764
+ fill: "none",
1765
+ stroke: "currentColor",
1766
+ strokeWidth: "2",
1767
+ strokeLinecap: "round",
1768
+ strokeLinejoin: "round",
1769
+ className: "h-4 w-4 text-gray-500 transition-transform group-open:rotate-180",
1770
+ children: /* @__PURE__ */ jsx("polyline", { points: "6 9 12 15 18 9" })
1771
+ }
1772
+ )
1773
+ ] }),
1774
+ /* @__PURE__ */ jsx("div", { className: "absolute right-0 mt-2 w-52 rounded-lg border border-gray-200 bg-white py-1.5 shadow-xl z-50", children })
1775
+ ] });
1776
+ }
1777
+ function UserMenuItem({ href, children }) {
1778
+ return /* @__PURE__ */ jsx(
1779
+ Link,
1780
+ {
1781
+ href,
1782
+ className: "block w-full px-4 py-2.5 text-sm text-gray-700 hover:bg-gray-50 transition-colors",
1783
+ children
1784
+ }
1785
+ );
1786
+ }
1710
1787
  var defaultTopNavLinks = [
1711
1788
  {
1712
1789
  label: "Dashboard",
@@ -2003,65 +2080,11 @@ var TopNav = async ({
2003
2080
  ),
2004
2081
  /* @__PURE__ */ jsx("span", { className: "text-xl font-bold text-gray-900", children: brandTitle || "Enterprise Portal" })
2005
2082
  ] }),
2006
- /* @__PURE__ */ jsxs("details", { className: "group relative", children: [
2007
- /* @__PURE__ */ jsxs("summary", { className: "flex cursor-pointer items-center gap-2 text-sm font-medium text-gray-600 hover:text-gray-900 list-none", children: [
2008
- /* @__PURE__ */ jsxs(
2009
- "svg",
2010
- {
2011
- xmlns: "http://www.w3.org/2000/svg",
2012
- width: "16",
2013
- height: "16",
2014
- viewBox: "0 0 24 24",
2015
- fill: "none",
2016
- stroke: "currentColor",
2017
- strokeWidth: "2",
2018
- strokeLinecap: "round",
2019
- strokeLinejoin: "round",
2020
- className: "text-gray-500",
2021
- children: [
2022
- /* @__PURE__ */ jsx("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
2023
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "7", r: "4" })
2024
- ]
2025
- }
2026
- ),
2027
- /* @__PURE__ */ jsx("span", { children: displayLabel }),
2028
- /* @__PURE__ */ jsx(
2029
- "svg",
2030
- {
2031
- xmlns: "http://www.w3.org/2000/svg",
2032
- width: "16",
2033
- height: "16",
2034
- viewBox: "0 0 24 24",
2035
- fill: "none",
2036
- stroke: "currentColor",
2037
- strokeWidth: "2",
2038
- strokeLinecap: "round",
2039
- strokeLinejoin: "round",
2040
- className: "text-gray-500",
2041
- children: /* @__PURE__ */ jsx("polyline", { points: "6 9 12 15 18 9" })
2042
- }
2043
- )
2044
- ] }),
2045
- /* @__PURE__ */ jsxs("div", { className: "absolute right-0 mt-2 w-48 rounded-md border border-gray-200 bg-white py-2 text-sm text-gray-700 shadow-lg z-50", children: [
2046
- /* @__PURE__ */ jsx(
2047
- Link,
2048
- {
2049
- href: "/user-settings",
2050
- className: "block w-full px-4 py-2 text-left hover:bg-gray-100",
2051
- children: "User settings"
2052
- }
2053
- ),
2054
- /* @__PURE__ */ jsx(
2055
- Link,
2056
- {
2057
- href: "/team-settings",
2058
- className: "block w-full px-4 py-2 text-left hover:bg-gray-100",
2059
- children: "Team settings"
2060
- }
2061
- ),
2062
- userMenuChildren,
2063
- logoutButton
2064
- ] })
2083
+ /* @__PURE__ */ jsxs(UserMenuDropdown, { displayLabel, children: [
2084
+ /* @__PURE__ */ jsx(UserMenuItem, { href: "/user-settings", children: "User settings" }),
2085
+ /* @__PURE__ */ jsx(UserMenuItem, { href: "/team-settings", children: "Team settings" }),
2086
+ userMenuChildren,
2087
+ logoutButton
2065
2088
  ] })
2066
2089
  ] }),
2067
2090
  /* @__PURE__ */ jsx("div", { className: "mt-3 flex flex-wrap gap-3 pb-2 text-sm font-medium text-gray-500", children: resolvedLinks.map(({ label, icon, href }) => {
@@ -2328,7 +2351,7 @@ var TeamsSection = ({
2328
2351
  "svg",
2329
2352
  {
2330
2353
  className: "h-4 w-4",
2331
- style: { color: primaryColor || DEFAULT_SECONDARY_COLOR },
2354
+ style: { color: primaryColor || DEFAULT_PRIMARY_COLOR },
2332
2355
  fill: "none",
2333
2356
  viewBox: "0 0 24 24",
2334
2357
  stroke: "currentColor",
@@ -2352,7 +2375,7 @@ var TeamsSection = ({
2352
2375
  "svg",
2353
2376
  {
2354
2377
  className: "h-4 w-4",
2355
- style: { color: primaryColor || DEFAULT_SECONDARY_COLOR },
2378
+ style: { color: primaryColor || DEFAULT_PRIMARY_COLOR },
2356
2379
  fill: "none",
2357
2380
  viewBox: "0 0 24 24",
2358
2381
  stroke: "currentColor",
@@ -2418,8 +2441,8 @@ var ProfileSection = ({
2418
2441
  setIsEditing(true);
2419
2442
  };
2420
2443
  const buttonStyle = {
2421
- backgroundColor: primaryColor || DEFAULT_SECONDARY_COLOR,
2422
- borderColor: primaryColor || DEFAULT_SECONDARY_COLOR
2444
+ backgroundColor: primaryColor || DEFAULT_PRIMARY_COLOR,
2445
+ borderColor: primaryColor || DEFAULT_PRIMARY_COLOR
2423
2446
  };
2424
2447
  return /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-gray-200 bg-white p-6 shadow-sm", children: [
2425
2448
  /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [