@replicated/portal-components 0.0.12 → 0.0.13

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 (53) hide show
  1. package/components/metadata/registry.json +2 -2
  2. package/components/metadata/registry.md +2 -2
  3. package/dist/actions/index.d.mts +26 -4
  4. package/dist/actions/index.d.ts +26 -4
  5. package/dist/actions/index.js +171 -124
  6. package/dist/actions/index.js.map +1 -1
  7. package/dist/airgap-instances.js.map +1 -1
  8. package/dist/esm/actions/index.js +170 -124
  9. package/dist/esm/actions/index.js.map +1 -1
  10. package/dist/esm/airgap-instances.js.map +1 -1
  11. package/dist/esm/helm-install-wizard.js +15 -9
  12. package/dist/esm/helm-install-wizard.js.map +1 -1
  13. package/dist/esm/index.js +127 -108
  14. package/dist/esm/index.js.map +1 -1
  15. package/dist/esm/install-actions.js +42 -47
  16. package/dist/esm/install-actions.js.map +1 -1
  17. package/dist/esm/instance-card.js.map +1 -1
  18. package/dist/esm/license-details.js +20 -10
  19. package/dist/esm/license-details.js.map +1 -1
  20. package/dist/esm/linux-install-wizard.js +26 -47
  21. package/dist/esm/linux-install-wizard.js.map +1 -1
  22. package/dist/esm/online-instance-list.js.map +1 -1
  23. package/dist/esm/support-card.js +18 -49
  24. package/dist/esm/support-card.js.map +1 -1
  25. package/dist/esm/top-nav.js +13 -31
  26. package/dist/esm/top-nav.js.map +1 -1
  27. package/dist/esm/update-layout.js +13 -31
  28. package/dist/esm/update-layout.js.map +1 -1
  29. package/dist/esm/utils/index.js +14 -10
  30. package/dist/esm/utils/index.js.map +1 -1
  31. package/dist/helm-install-wizard.js +15 -9
  32. package/dist/helm-install-wizard.js.map +1 -1
  33. package/dist/index.d.mts +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.js +126 -106
  36. package/dist/index.js.map +1 -1
  37. package/dist/install-actions.js +43 -48
  38. package/dist/install-actions.js.map +1 -1
  39. package/dist/instance-card.js.map +1 -1
  40. package/dist/license-details.js +20 -10
  41. package/dist/license-details.js.map +1 -1
  42. package/dist/linux-install-wizard.js +26 -47
  43. package/dist/linux-install-wizard.js.map +1 -1
  44. package/dist/online-instance-list.js.map +1 -1
  45. package/dist/support-card.js +18 -49
  46. package/dist/support-card.js.map +1 -1
  47. package/dist/top-nav.js +13 -31
  48. package/dist/top-nav.js.map +1 -1
  49. package/dist/update-layout.js +13 -31
  50. package/dist/update-layout.js.map +1 -1
  51. package/dist/utils/index.js +14 -10
  52. package/dist/utils/index.js.map +1 -1
  53. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -9,7 +9,7 @@ export { UserSettings, UserSettingsCustomer, UserSettingsNotification, UserSetti
9
9
  export { UserSettingsCard } from './user-settings-card.mjs';
10
10
  export { a as TeamSettingsCard, T as TeamSettingsCardProps } from './team-settings-card-Dq1d9b5c.mjs';
11
11
  export { UpdateLayout } from './update-layout.mjs';
12
- export { CustomBrandingResponse, DeleteSupportBundleInput, DeleteSupportBundleResult, DownloadSupportBundleInput, DownloadSupportBundleResult, FetchCurrentUserInput, FetchCurrentUserResult, FetchLicenseDetailsInput, FetchLicenseDetailsResult, FetchNotificationsInput, FetchNotificationsResult, GetSecurityInfoDiffInput, GetSecurityInfoDiffResult, GetSecurityInfoInput, GetSecurityInfoResult, GetSecurityInfoSBOMInput, GetSecurityInfoSBOMResult, InitiateLoginInput, InitiateLoginResult, ListReleasesInput, ListReleasesResult, ListSupportBundlesInput, ListSupportBundlesResult, NotificationSetting, PortalActionContext, PortalActionVisibility, PortalLicenseDetails, PortalLicenseField, PortalServerActionDefinition, SecurityInfoDiff, SecurityInstallType, SecurityReleaseImage, SecurityScanSummary, SecurityScanWrapper, SpdxDocument, SupportBundleInsight, SupportBundleSummary, UnifiedSbom, UpdateNotificationsInput, UpdateNotificationsResult, UpdateUserInput, UpdateUserResult, UploadSupportBundleCompleteInput, UploadSupportBundleCompleteResult, UserProfile, VerifyMagicLinkError, VerifyMagicLinkInput, VerifyMagicLinkResult, decodeJwtPayload, defineServerAction, deleteSupportBundle, downloadSupportBundle, fetchCurrentUser, fetchCustomBranding, fetchLicenseDetails, fetchNotifications, getCustomerIdFromToken, getSecurityInfo, getSecurityInfoDiff, getSecurityInfoSBOM, getSupportBundleUploadUrl, initiateLogin, listReleases, listSupportBundles, updateNotifications, updateUser, uploadSupportBundle, verifyMagicLink } from './actions/index.mjs';
12
+ export { CustomBrandingResponse, DeleteSupportBundleInput, DeleteSupportBundleResult, DownloadSupportBundleInput, DownloadSupportBundleResult, FetchCurrentUserInput, FetchCurrentUserResult, FetchLicenseDetailsInput, FetchLicenseDetailsResult, FetchNotificationsInput, FetchNotificationsResult, GetSecurityInfoDiffInput, GetSecurityInfoDiffResult, GetSecurityInfoInput, GetSecurityInfoResult, GetSecurityInfoSBOMInput, GetSecurityInfoSBOMResult, InitiateLoginInput, InitiateLoginResult, ListReleasesInput, ListReleasesResult, ListSupportBundlesInput, ListSupportBundlesResult, NotificationSetting, PortalActionContext, PortalActionVisibility, PortalLicenseDetails, PortalLicenseField, PortalServerActionDefinition, SecurityInfoDiff, SecurityInstallType, SecurityReleaseImage, SecurityScanSummary, SecurityScanWrapper, SpdxDocument, SupportBundleInsight, SupportBundleSummary, UnifiedSbom, UpdateNotificationsInput, UpdateNotificationsResult, UpdateUserInput, UpdateUserResult, UploadSupportBundleCompleteInput, UploadSupportBundleCompleteResult, UserProfile, VerifyMagicLinkError, VerifyMagicLinkInput, VerifyMagicLinkResult, decodeJwtPayload, defineServerAction, deleteSupportBundle, downloadSupportBundle, fetchCurrentUser, fetchCustomBranding, fetchDashboardComposite, fetchLicenseDetails, fetchNotifications, getCustomerIdFromToken, getSecurityInfo, getSecurityInfoDiff, getSecurityInfoSBOM, getSupportBundleUploadUrl, initiateLogin, listReleases, listSupportBundles, updateNotifications, updateUser, uploadSupportBundle, verifyMagicLink } from './actions/index.mjs';
13
13
  import 'react/jsx-runtime';
14
14
 
15
15
  /**
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { UserSettings, UserSettingsCustomer, UserSettingsNotification, UserSetti
9
9
  export { UserSettingsCard } from './user-settings-card.js';
10
10
  export { a as TeamSettingsCard, T as TeamSettingsCardProps } from './team-settings-card-Dq1d9b5c.js';
11
11
  export { UpdateLayout } from './update-layout.js';
12
- export { CustomBrandingResponse, DeleteSupportBundleInput, DeleteSupportBundleResult, DownloadSupportBundleInput, DownloadSupportBundleResult, FetchCurrentUserInput, FetchCurrentUserResult, FetchLicenseDetailsInput, FetchLicenseDetailsResult, FetchNotificationsInput, FetchNotificationsResult, GetSecurityInfoDiffInput, GetSecurityInfoDiffResult, GetSecurityInfoInput, GetSecurityInfoResult, GetSecurityInfoSBOMInput, GetSecurityInfoSBOMResult, InitiateLoginInput, InitiateLoginResult, ListReleasesInput, ListReleasesResult, ListSupportBundlesInput, ListSupportBundlesResult, NotificationSetting, PortalActionContext, PortalActionVisibility, PortalLicenseDetails, PortalLicenseField, PortalServerActionDefinition, SecurityInfoDiff, SecurityInstallType, SecurityReleaseImage, SecurityScanSummary, SecurityScanWrapper, SpdxDocument, SupportBundleInsight, SupportBundleSummary, UnifiedSbom, UpdateNotificationsInput, UpdateNotificationsResult, UpdateUserInput, UpdateUserResult, UploadSupportBundleCompleteInput, UploadSupportBundleCompleteResult, UserProfile, VerifyMagicLinkError, VerifyMagicLinkInput, VerifyMagicLinkResult, decodeJwtPayload, defineServerAction, deleteSupportBundle, downloadSupportBundle, fetchCurrentUser, fetchCustomBranding, fetchLicenseDetails, fetchNotifications, getCustomerIdFromToken, getSecurityInfo, getSecurityInfoDiff, getSecurityInfoSBOM, getSupportBundleUploadUrl, initiateLogin, listReleases, listSupportBundles, updateNotifications, updateUser, uploadSupportBundle, verifyMagicLink } from './actions/index.js';
12
+ export { CustomBrandingResponse, DeleteSupportBundleInput, DeleteSupportBundleResult, DownloadSupportBundleInput, DownloadSupportBundleResult, FetchCurrentUserInput, FetchCurrentUserResult, FetchLicenseDetailsInput, FetchLicenseDetailsResult, FetchNotificationsInput, FetchNotificationsResult, GetSecurityInfoDiffInput, GetSecurityInfoDiffResult, GetSecurityInfoInput, GetSecurityInfoResult, GetSecurityInfoSBOMInput, GetSecurityInfoSBOMResult, InitiateLoginInput, InitiateLoginResult, ListReleasesInput, ListReleasesResult, ListSupportBundlesInput, ListSupportBundlesResult, NotificationSetting, PortalActionContext, PortalActionVisibility, PortalLicenseDetails, PortalLicenseField, PortalServerActionDefinition, SecurityInfoDiff, SecurityInstallType, SecurityReleaseImage, SecurityScanSummary, SecurityScanWrapper, SpdxDocument, SupportBundleInsight, SupportBundleSummary, UnifiedSbom, UpdateNotificationsInput, UpdateNotificationsResult, UpdateUserInput, UpdateUserResult, UploadSupportBundleCompleteInput, UploadSupportBundleCompleteResult, UserProfile, VerifyMagicLinkError, VerifyMagicLinkInput, VerifyMagicLinkResult, decodeJwtPayload, defineServerAction, deleteSupportBundle, downloadSupportBundle, fetchCurrentUser, fetchCustomBranding, fetchDashboardComposite, fetchLicenseDetails, fetchNotifications, getCustomerIdFromToken, getSecurityInfo, getSecurityInfoDiff, getSecurityInfoSBOM, getSupportBundleUploadUrl, initiateLogin, listReleases, listSupportBundles, updateNotifications, updateUser, uploadSupportBundle, verifyMagicLink } from './actions/index.js';
13
13
  import 'react/jsx-runtime';
14
14
 
15
15
  /**
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ var Link__default = /*#__PURE__*/_interopDefault(Link);
16
16
 
17
17
  // package.json
18
18
  var package_default = {
19
- version: "0.0.12"};
19
+ version: "0.0.13"};
20
20
 
21
21
  // src/tokens/index.ts
22
22
  var baseTokens = {
@@ -193,7 +193,7 @@ var initiateLogin = defineServerAction({
193
193
  visibility: "customer",
194
194
  tags: ["auth", "login", "session"],
195
195
  async run(input) {
196
- const endpoint = `${getApiOrigin()}/v3/login/magic-link`;
196
+ const endpoint = `${getApiOrigin()}/enterprise-portal/auth/magic-link`;
197
197
  const appSlug = process.env.PORTAL_APP_SLUG;
198
198
  if (!appSlug) {
199
199
  throw new Error("PORTAL_APP_SLUG is not configured");
@@ -243,7 +243,7 @@ var verifyMagicLink = defineServerAction({
243
243
  visibility: "customer",
244
244
  tags: ["auth", "login", "verify"],
245
245
  async run({ nonce }) {
246
- const endpoint = `${getApiOrigin()}/v3/login/magic-link/verify`;
246
+ const endpoint = `${getApiOrigin()}/enterprise-portal/auth/magic-link/verify`;
247
247
  if (process.env.NODE_ENV !== "production") {
248
248
  console.debug(
249
249
  "[portal-components] verifying magic link via %s",
@@ -299,12 +299,12 @@ var fetchCustomBrandingImpl = async () => {
299
299
  if (!appSlug) {
300
300
  throw new Error("PORTAL_APP_SLUG is not configured");
301
301
  }
302
- const url = `${getApiOrigin()}/v3/custom-branding?app_slug=${encodeURIComponent(
302
+ const url = `${getApiOrigin()}/enterprise-portal/public/branding?app_slug=${encodeURIComponent(
303
303
  appSlug
304
304
  )}`;
305
305
  if (process.env.NODE_ENV !== "production") {
306
306
  console.debug(
307
- "[portal-components] fetching custom branding via %s",
307
+ "[portal-components] fetching custom branding via %s (Enterprise Portal API)",
308
308
  url
309
309
  );
310
310
  }
@@ -319,13 +319,18 @@ var fetchCustomBrandingImpl = async () => {
319
319
  );
320
320
  }
321
321
  const payload = await response.json();
322
- const brandingData = payload?.branding_data;
323
- if (typeof brandingData !== "string") {
324
- throw new Error("Custom branding response missing branding_data string");
325
- }
322
+ const brandingObject = {
323
+ logo: payload.logoUrl,
324
+ title: payload.appName,
325
+ customColor1: payload.primaryColor,
326
+ customColor2: payload.secondaryColor,
327
+ favicon: payload.faviconUrl
328
+ };
329
+ const brandingData = buffer.Buffer.from(JSON.stringify(brandingObject)).toString("base64");
326
330
  return {
327
331
  brandingData,
328
- documentation: payload?.documentation ?? null
332
+ documentation: null
333
+ // Documentation not included in new API's public endpoint
329
334
  };
330
335
  };
331
336
  var fetchCustomBranding = react.cache(fetchCustomBrandingImpl);
@@ -342,7 +347,7 @@ var decodeJwtPayload = (token) => {
342
347
  payloadSegment.length + (4 - payloadSegment.length % 4) % 4,
343
348
  "="
344
349
  );
345
- const decoded = Buffer.from(padded, "base64").toString("utf-8");
350
+ const decoded = buffer.Buffer.from(padded, "base64").toString("utf-8");
346
351
  return JSON.parse(decoded);
347
352
  };
348
353
  var getCustomerIdFromToken = (token) => {
@@ -353,22 +358,6 @@ var getCustomerIdFromToken = (token) => {
353
358
  }
354
359
  return customerId.trim();
355
360
  };
356
- var resolveSupportBundlesEndpoint = () => {
357
- const fallback = `${getApiOrigin()}/v3/supportbundles`;
358
- const explicit = process.env.SUPPORT_BUNDLES_ENDPOINT;
359
- if (!explicit) {
360
- return new URL(fallback);
361
- }
362
- try {
363
- return new URL(explicit);
364
- } catch (error) {
365
- console.warn(
366
- `[portal-components] invalid SUPPORT_BUNDLES_ENDPOINT, using fallback`,
367
- error
368
- );
369
- return new URL(fallback);
370
- }
371
- };
372
361
  var listSupportBundles = defineServerAction({
373
362
  id: "support/list-bundles",
374
363
  description: "Fetches support bundles associated with the customer found in the portal session JWT.",
@@ -378,17 +367,11 @@ var listSupportBundles = defineServerAction({
378
367
  if (!token || typeof token !== "string") {
379
368
  throw new Error("Support bundle listing requires a session token");
380
369
  }
381
- const payload = decodeJwtPayload(token);
382
- const customerId = payload?.customer_id;
383
- if (typeof customerId !== "string" || !customerId.trim()) {
384
- throw new Error("Unable to determine customer_id from session token");
385
- }
386
- const url = resolveSupportBundlesEndpoint();
387
- url.searchParams.set("customer_id", customerId.trim());
370
+ const url = `${getApiOrigin()}/enterprise-portal/support-bundles`;
388
371
  if (process.env.NODE_ENV !== "production") {
389
- console.debug("[portal-components] fetching support bundles via %s", url);
372
+ console.debug("[portal-components] fetching support bundles via %s (Enterprise Portal API)", url);
390
373
  }
391
- const response = await authenticatedFetch(url.toString(), {
374
+ const response = await authenticatedFetch(url, {
392
375
  token,
393
376
  headers: {
394
377
  accept: "application/json"
@@ -403,7 +386,8 @@ var listSupportBundles = defineServerAction({
403
386
  `Support bundles request failed (${response.status} ${response.statusText})`
404
387
  );
405
388
  }
406
- const raw = await response.json();
389
+ const payload = await response.json();
390
+ const raw = payload.data;
407
391
  const rawRecord = raw && typeof raw === "object" ? raw : void 0;
408
392
  const parseInsights = (raw2) => {
409
393
  if (!Array.isArray(raw2)) return void 0;
@@ -494,12 +478,8 @@ var downloadSupportBundle = defineServerAction({
494
478
  if (!bundleId || typeof bundleId !== "string") {
495
479
  throw new Error("Support bundle download requires a bundle ID");
496
480
  }
497
- const payload = decodeJwtPayload(token);
498
- const customerId = payload?.customer_id;
499
- if (typeof customerId !== "string" || !customerId.trim()) {
500
- throw new Error("Unable to determine customer_id from session token");
501
- }
502
- const endpoint = `${getApiOrigin()}/v3/supportbundle/${encodeURIComponent(bundleId)}/download?customer_id=${encodeURIComponent(customerId.trim())}`;
481
+ const customerId = getCustomerIdFromToken(token);
482
+ const endpoint = `${getApiOrigin()}/enterprise-portal/support-bundles/${encodeURIComponent(bundleId)}/download?customer_id=${encodeURIComponent(customerId)}`;
503
483
  if (process.env.NODE_ENV !== "production") {
504
484
  console.debug("[portal-components] getting support bundle download URL via %s", endpoint);
505
485
  }
@@ -537,12 +517,8 @@ var deleteSupportBundle = defineServerAction({
537
517
  if (!bundleId || typeof bundleId !== "string") {
538
518
  throw new Error("Support bundle deletion requires a bundle ID");
539
519
  }
540
- const payload = decodeJwtPayload(token);
541
- const customerId = payload?.customer_id;
542
- if (typeof customerId !== "string" || !customerId.trim()) {
543
- throw new Error("Unable to determine customer_id from session token");
544
- }
545
- const endpoint = `${getApiOrigin()}/v3/supportbundle/${encodeURIComponent(bundleId)}?customer_id=${encodeURIComponent(customerId.trim())}`;
520
+ const customerId = getCustomerIdFromToken(token);
521
+ const endpoint = `${getApiOrigin()}/enterprise-portal/support-bundles/${encodeURIComponent(bundleId)}?customer_id=${encodeURIComponent(customerId)}`;
546
522
  if (process.env.NODE_ENV !== "production") {
547
523
  console.debug("[portal-components] deleting support bundle via %s", endpoint);
548
524
  }
@@ -581,7 +557,7 @@ var uploadSupportBundle = defineServerAction({
581
557
  if (!fileContent || !(fileContent instanceof ArrayBuffer)) {
582
558
  throw new Error("Support bundle upload requires file content");
583
559
  }
584
- const endpoint = `${getApiOrigin()}/v3/supportbundle/upload/${encodeURIComponent(appId)}`;
560
+ const endpoint = `${getApiOrigin()}/enterprise-portal/support-bundles/upload/${encodeURIComponent(appId)}`;
585
561
  if (process.env.NODE_ENV !== "production") {
586
562
  console.debug("[portal-components] uploading support bundle via %s", endpoint);
587
563
  }
@@ -609,7 +585,7 @@ var uploadSupportBundle = defineServerAction({
609
585
  }
610
586
  });
611
587
  var getSupportBundleUploadUrl = (appId) => {
612
- return `${getApiOrigin()}/v3/supportbundle/upload/${encodeURIComponent(appId)}`;
588
+ return `${getApiOrigin()}/enterprise-portal/support-bundles/upload/${encodeURIComponent(appId)}`;
613
589
  };
614
590
  var listReleases = defineServerAction({
615
591
  id: "releases/list",
@@ -620,10 +596,10 @@ var listReleases = defineServerAction({
620
596
  if (!token || typeof token !== "string") {
621
597
  throw new Error("List releases requires a session token");
622
598
  }
623
- const endpoint = `${getApiOrigin()}/v3/release-history`;
624
- console.log("[portal-components] listReleases request", {
625
- endpoint
626
- });
599
+ const endpoint = `${getApiOrigin()}/enterprise-portal/releases`;
600
+ if (process.env.NODE_ENV !== "production") {
601
+ console.debug("[portal-components] fetching releases via %s (Enterprise Portal API)", endpoint);
602
+ }
627
603
  const response = await authenticatedFetch(endpoint, {
628
604
  method: "GET",
629
605
  token,
@@ -636,7 +612,6 @@ var listReleases = defineServerAction({
636
612
  console.warn("[portal-components] listReleases read error", error);
637
613
  return null;
638
614
  });
639
- console.log("[portal-components] listReleases response", response.status, bodyText);
640
615
  if (!response.ok) {
641
616
  throw new Error(
642
617
  `List releases request failed (${response.status} ${response.statusText})`
@@ -933,7 +908,10 @@ var fetchLicenseDetails = defineServerAction({
933
908
  if (typeof token !== "string" || token.trim().length === 0) {
934
909
  throw new Error("fetchLicenseDetails requires a non-empty token");
935
910
  }
936
- const endpoint = `${getApiOrigin()}/v3/license`;
911
+ const endpoint = `${getApiOrigin()}/enterprise-portal/license`;
912
+ if (process.env.NODE_ENV !== "production") {
913
+ console.debug("[portal-components] fetching license via %s (Enterprise Portal API)", endpoint);
914
+ }
937
915
  const response = await authenticatedFetch(endpoint, {
938
916
  method: "GET",
939
917
  token,
@@ -948,10 +926,11 @@ var fetchLicenseDetails = defineServerAction({
948
926
  );
949
927
  }
950
928
  const payload = await response.json();
951
- const license = normalizeLicensePayload(payload);
929
+ const licenseData = payload.data;
930
+ const license = normalizeLicensePayload(licenseData);
952
931
  return {
953
932
  license,
954
- raw: payload ?? null
933
+ raw: licenseData ?? null
955
934
  };
956
935
  }
957
936
  });
@@ -964,16 +943,14 @@ var getSecurityInfo = defineServerAction({
964
943
  if (!token || typeof token !== "string") {
965
944
  throw new Error("Security info request requires a session token");
966
945
  }
967
- const customerId = getCustomerIdFromToken(token);
968
946
  const params = new URLSearchParams({
969
- customer_id: customerId,
970
947
  install_type: installType,
971
948
  channel_sequence: channelSequence.toString(),
972
949
  is_airgap: isAirgap.toString()
973
950
  });
974
- const url = `${getApiOrigin()}/v3/security-info?${params.toString()}`;
951
+ const url = `${getApiOrigin()}/enterprise-portal/security?${params.toString()}`;
975
952
  if (process.env.NODE_ENV !== "production") {
976
- console.debug("[portal-components] fetching security info via %s", url);
953
+ console.debug("[portal-components] fetching security info via %s (Enterprise Portal API)", url);
977
954
  }
978
955
  const response = await authenticatedFetch(url, {
979
956
  token,
@@ -985,8 +962,8 @@ var getSecurityInfo = defineServerAction({
985
962
  `Security info request failed (${response.status} ${response.statusText})`
986
963
  );
987
964
  }
988
- const data = await response.json();
989
- return data;
965
+ const payload = await response.json();
966
+ return payload.data;
990
967
  }
991
968
  });
992
969
  var getSecurityInfoDiff = defineServerAction({
@@ -998,15 +975,13 @@ var getSecurityInfoDiff = defineServerAction({
998
975
  if (!token || typeof token !== "string") {
999
976
  throw new Error("Security info diff request requires a session token");
1000
977
  }
1001
- const customerId = getCustomerIdFromToken(token);
1002
978
  const params = new URLSearchParams({
1003
- customer_id: customerId,
1004
979
  install_type: installType,
1005
980
  from_channel_sequence: fromChannelSequence.toString(),
1006
981
  to_channel_sequence: toChannelSequence.toString(),
1007
982
  is_airgap: isAirgap.toString()
1008
983
  });
1009
- const url = `${getApiOrigin()}/v3/security-info-diff?${params.toString()}`;
984
+ const url = `${getApiOrigin()}/enterprise-portal/security-diff?${params.toString()}`;
1010
985
  if (process.env.NODE_ENV !== "production") {
1011
986
  console.debug("[portal-components] fetching security info diff via %s", url);
1012
987
  }
@@ -1020,8 +995,8 @@ var getSecurityInfoDiff = defineServerAction({
1020
995
  `Security info diff request failed (${response.status} ${response.statusText})`
1021
996
  );
1022
997
  }
1023
- const data = await response.json();
1024
- return data;
998
+ const envelope = await response.json();
999
+ return envelope.data;
1025
1000
  }
1026
1001
  });
1027
1002
  var getSecurityInfoSBOM = defineServerAction({
@@ -1033,15 +1008,13 @@ var getSecurityInfoSBOM = defineServerAction({
1033
1008
  if (!token || typeof token !== "string") {
1034
1009
  throw new Error("Security SBOM request requires a session token");
1035
1010
  }
1036
- const customerId = getCustomerIdFromToken(token);
1037
1011
  const params = new URLSearchParams({
1038
- customer_id: customerId,
1039
1012
  install_type: installType,
1040
1013
  channel_sequence: channelSequence.toString(),
1041
1014
  is_airgap: isAirgap.toString(),
1042
1015
  unified_sbom: unifiedSbom.toString()
1043
1016
  });
1044
- const url = `${getApiOrigin()}/v3/security-info-sbom?${params.toString()}`;
1017
+ const url = `${getApiOrigin()}/enterprise-portal/security-sbom?${params.toString()}`;
1045
1018
  if (process.env.NODE_ENV !== "production") {
1046
1019
  console.debug("[portal-components] fetching security SBOM via %s", url);
1047
1020
  }
@@ -1058,8 +1031,77 @@ var getSecurityInfoSBOM = defineServerAction({
1058
1031
  `Security SBOM request failed (${response.status} ${response.statusText})`
1059
1032
  );
1060
1033
  }
1061
- const data = await response.json();
1062
- return data;
1034
+ const envelope = await response.json();
1035
+ return envelope.data;
1036
+ }
1037
+ });
1038
+ var fetchDashboardComposite = defineServerAction({
1039
+ id: "dashboard/fetch-composite",
1040
+ description: "Fetches all dashboard data from the composite Enterprise Portal API endpoint",
1041
+ visibility: "customer",
1042
+ tags: ["dashboard", "enterprise-portal-api"],
1043
+ async run({ token }, context) {
1044
+ if (!token || typeof token !== "string") {
1045
+ throw new Error("Dashboard request requires a session token");
1046
+ }
1047
+ const origin = getApiOrigin();
1048
+ const url = `${origin}/enterprise-portal/dashboard`;
1049
+ if (process.env.NODE_ENV !== "production") {
1050
+ console.debug("[portal-components] fetching dashboard via %s (Enterprise Portal API)", url);
1051
+ }
1052
+ const response = await authenticatedFetch(url, {
1053
+ method: "GET",
1054
+ token,
1055
+ headers: { accept: "application/json" },
1056
+ signal: context?.signal
1057
+ });
1058
+ if (!response.ok) {
1059
+ throw new Error(
1060
+ `Dashboard request failed (${response.status} ${response.statusText})`
1061
+ );
1062
+ }
1063
+ const payload = await response.json();
1064
+ const data = payload.data;
1065
+ const allInstances = data?.instances || [];
1066
+ const channelReleases = data?.channelReleases || [];
1067
+ const licenseData = data?.license || {};
1068
+ const teamStats = data?.teamStats || {};
1069
+ const onlineInstances = allInstances.filter((i) => !i.isAirgap);
1070
+ const airgapInstances = allInstances.filter((i) => i.isAirgap);
1071
+ const twentyFourHoursAgo = Date.now() - 24 * 60 * 60 * 1e3;
1072
+ const activeOnlineInstances = onlineInstances.filter((instance) => {
1073
+ const lastCheckin = instance.lastCheckin ? new Date(instance.lastCheckin).getTime() : 0;
1074
+ return lastCheckin > twentyFourHoursAgo;
1075
+ });
1076
+ const onlineActiveCount = activeOnlineInstances.length;
1077
+ const airgapCount = airgapInstances.length;
1078
+ const calculateUpdates = (instances) => {
1079
+ if (!channelReleases.length) return 0;
1080
+ let numUpdates = 0;
1081
+ for (const instance of instances) {
1082
+ const instanceSequence = instance.channelSequence ?? 0;
1083
+ const matchingReleases = channelReleases.filter(
1084
+ (release) => release.channelId === instance.channelId
1085
+ );
1086
+ for (const release of matchingReleases) {
1087
+ if ((release.channelSequence ?? 0) > instanceSequence) {
1088
+ numUpdates++;
1089
+ }
1090
+ }
1091
+ }
1092
+ return numUpdates;
1093
+ };
1094
+ const onlineUpdates = calculateUpdates(activeOnlineInstances);
1095
+ const airgapUpdates = calculateUpdates(airgapInstances);
1096
+ return {
1097
+ onlineActiveCount,
1098
+ airgapCount,
1099
+ onlineUpdates,
1100
+ airgapUpdates,
1101
+ // Additional data available from the composite endpoint
1102
+ license: licenseData,
1103
+ teamStats
1104
+ };
1063
1105
  }
1064
1106
  });
1065
1107
  var fetchCurrentUser = defineServerAction({
@@ -1071,7 +1113,7 @@ var fetchCurrentUser = defineServerAction({
1071
1113
  if (!token || typeof token !== "string") {
1072
1114
  throw new Error("Fetch current user requires a session token");
1073
1115
  }
1074
- const endpoint = `${getApiOrigin()}/v3/user`;
1116
+ const endpoint = `${getApiOrigin()}/enterprise-portal/user/profile`;
1075
1117
  if (process.env.NODE_ENV !== "production") {
1076
1118
  console.debug("[portal-components] fetching current user via %s", endpoint);
1077
1119
  }
@@ -1108,7 +1150,7 @@ var updateUser = defineServerAction({
1108
1150
  if (!firstName && !lastName) {
1109
1151
  throw new Error("At least one of firstName or lastName must be provided");
1110
1152
  }
1111
- const endpoint = `${getApiOrigin()}/v3/user`;
1153
+ const endpoint = `${getApiOrigin()}/enterprise-portal/user/profile`;
1112
1154
  if (process.env.NODE_ENV !== "production") {
1113
1155
  console.debug("[portal-components] updating user via %s", endpoint);
1114
1156
  }
@@ -1116,7 +1158,7 @@ var updateUser = defineServerAction({
1116
1158
  if (firstName !== void 0) body.firstName = firstName;
1117
1159
  if (lastName !== void 0) body.lastName = lastName;
1118
1160
  const response = await authenticatedFetch(endpoint, {
1119
- method: "POST",
1161
+ method: "PUT",
1120
1162
  token,
1121
1163
  headers: {
1122
1164
  "content-type": "application/json",
@@ -1144,9 +1186,9 @@ var fetchNotifications = defineServerAction({
1144
1186
  throw new Error("Fetch notifications requires a session token");
1145
1187
  }
1146
1188
  if (!customerId || typeof customerId !== "string") {
1147
- throw new Error("Fetch notifications requires a customerId");
1189
+ throw new Error("Fetch notifications requires a valid customerId");
1148
1190
  }
1149
- const endpoint = `${getApiOrigin()}/v3/notifications?customer_id=${encodeURIComponent(customerId)}`;
1191
+ const endpoint = `${getApiOrigin()}/enterprise-portal/user/notifications?customer_id=${encodeURIComponent(customerId)}`;
1150
1192
  if (process.env.NODE_ENV !== "production") {
1151
1193
  console.debug("[portal-components] fetching notifications via %s", endpoint);
1152
1194
  }
@@ -1177,12 +1219,12 @@ var updateNotifications = defineServerAction({
1177
1219
  throw new Error("Update notifications requires a session token");
1178
1220
  }
1179
1221
  if (!customerId || typeof customerId !== "string") {
1180
- throw new Error("Update notifications requires a customerId");
1222
+ throw new Error("Update notifications requires a valid customerId");
1181
1223
  }
1182
1224
  if (!Array.isArray(notifications)) {
1183
1225
  throw new Error("Update notifications requires a notifications array");
1184
1226
  }
1185
- const endpoint = `${getApiOrigin()}/v3/notifications?customer_id=${encodeURIComponent(customerId)}`;
1227
+ const endpoint = `${getApiOrigin()}/enterprise-portal/user/notifications?customer_id=${encodeURIComponent(customerId)}`;
1186
1228
  if (process.env.NODE_ENV !== "production") {
1187
1229
  console.debug("[portal-components] updating notifications via %s", endpoint);
1188
1230
  }
@@ -1467,7 +1509,6 @@ var LicenseDetails = async ({
1467
1509
  ] })
1468
1510
  ] });
1469
1511
  };
1470
- var defaultHiddenLabels = ["Download"];
1471
1512
  var defaultTopNavLinks = [
1472
1513
  {
1473
1514
  label: "Dashboard",
@@ -1492,27 +1533,6 @@ var defaultTopNavLinks = [
1492
1533
  }
1493
1534
  )
1494
1535
  },
1495
- {
1496
- label: "Download",
1497
- icon: /* @__PURE__ */ jsxRuntime.jsxs(
1498
- "svg",
1499
- {
1500
- xmlns: "http://www.w3.org/2000/svg",
1501
- viewBox: "0 0 24 24",
1502
- className: "h-4 w-4",
1503
- fill: "none",
1504
- stroke: "currentColor",
1505
- strokeWidth: "2",
1506
- strokeLinecap: "round",
1507
- strokeLinejoin: "round",
1508
- children: [
1509
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
1510
- /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "7 10 12 15 17 10" }),
1511
- /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
1512
- ]
1513
- }
1514
- )
1515
- },
1516
1536
  {
1517
1537
  label: "Install",
1518
1538
  href: "/install",
@@ -1726,8 +1746,7 @@ var TopNav = async ({
1726
1746
  console.debug("[portal-components] branding fetch failed", error);
1727
1747
  }
1728
1748
  const baseLinks = links ?? defaultTopNavLinks;
1729
- const computedHiddenLabels = hiddenLabels ? hiddenLabels : links ? void 0 : defaultHiddenLabels;
1730
- const hiddenSet = computedHiddenLabels ? new Set(computedHiddenLabels) : null;
1749
+ const hiddenSet = hiddenLabels ? new Set(hiddenLabels) : null;
1731
1750
  let resolvedLinks = baseLinks.filter(
1732
1751
  (link) => !hiddenSet?.has(link.label)
1733
1752
  );
@@ -2429,6 +2448,7 @@ exports.deleteSupportBundle = deleteSupportBundle;
2429
2448
  exports.downloadSupportBundle = downloadSupportBundle;
2430
2449
  exports.fetchCurrentUser = fetchCurrentUser;
2431
2450
  exports.fetchCustomBranding = fetchCustomBranding;
2451
+ exports.fetchDashboardComposite = fetchDashboardComposite;
2432
2452
  exports.fetchLicenseDetails = fetchLicenseDetails;
2433
2453
  exports.fetchNotifications = fetchNotifications;
2434
2454
  exports.getCustomerIdFromToken = getCustomerIdFromToken;