@replicated/portal-components 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/metadata/registry.json +2 -2
- package/components/metadata/registry.md +2 -2
- package/dist/actions/index.d.mts +26 -4
- package/dist/actions/index.d.ts +26 -4
- package/dist/actions/index.js +171 -124
- package/dist/actions/index.js.map +1 -1
- package/dist/airgap-instances.js.map +1 -1
- package/dist/esm/actions/index.js +170 -124
- package/dist/esm/actions/index.js.map +1 -1
- package/dist/esm/airgap-instances.js.map +1 -1
- package/dist/esm/helm-install-wizard.js +15 -9
- package/dist/esm/helm-install-wizard.js.map +1 -1
- package/dist/esm/index.js +127 -108
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/install-actions.js +42 -47
- package/dist/esm/install-actions.js.map +1 -1
- package/dist/esm/instance-card.js.map +1 -1
- package/dist/esm/license-details.js +20 -10
- package/dist/esm/license-details.js.map +1 -1
- package/dist/esm/linux-install-wizard.js +26 -47
- package/dist/esm/linux-install-wizard.js.map +1 -1
- package/dist/esm/online-instance-list.js.map +1 -1
- package/dist/esm/support-card.js +18 -49
- package/dist/esm/support-card.js.map +1 -1
- package/dist/esm/top-nav.js +13 -31
- package/dist/esm/top-nav.js.map +1 -1
- package/dist/esm/update-layout.js +13 -31
- package/dist/esm/update-layout.js.map +1 -1
- package/dist/esm/utils/index.js +14 -10
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/helm-install-wizard.js +15 -9
- package/dist/helm-install-wizard.js.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +126 -106
- package/dist/index.js.map +1 -1
- package/dist/install-actions.js +43 -48
- package/dist/install-actions.js.map +1 -1
- package/dist/instance-card.js.map +1 -1
- package/dist/license-details.js +20 -10
- package/dist/license-details.js.map +1 -1
- package/dist/linux-install-wizard.js +26 -47
- package/dist/linux-install-wizard.js.map +1 -1
- package/dist/online-instance-list.js.map +1 -1
- package/dist/support-card.js +18 -49
- package/dist/support-card.js.map +1 -1
- package/dist/top-nav.js +13 -31
- package/dist/top-nav.js.map +1 -1
- package/dist/update-layout.js +13 -31
- package/dist/update-layout.js.map +1 -1
- package/dist/utils/index.js +14 -10
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef, cache, useState, useMemo } from 'react';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { Buffer
|
|
3
|
+
import { Buffer } from 'buffer';
|
|
4
4
|
import Link from 'next/link';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -10,7 +10,7 @@ import Link from 'next/link';
|
|
|
10
10
|
|
|
11
11
|
// package.json
|
|
12
12
|
var package_default = {
|
|
13
|
-
version: "0.0.
|
|
13
|
+
version: "0.0.14"};
|
|
14
14
|
|
|
15
15
|
// src/tokens/index.ts
|
|
16
16
|
var baseTokens = {
|
|
@@ -187,7 +187,7 @@ var initiateLogin = defineServerAction({
|
|
|
187
187
|
visibility: "customer",
|
|
188
188
|
tags: ["auth", "login", "session"],
|
|
189
189
|
async run(input) {
|
|
190
|
-
const endpoint = `${getApiOrigin()}/
|
|
190
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/auth/magic-link`;
|
|
191
191
|
const appSlug = process.env.PORTAL_APP_SLUG;
|
|
192
192
|
if (!appSlug) {
|
|
193
193
|
throw new Error("PORTAL_APP_SLUG is not configured");
|
|
@@ -237,7 +237,7 @@ var verifyMagicLink = defineServerAction({
|
|
|
237
237
|
visibility: "customer",
|
|
238
238
|
tags: ["auth", "login", "verify"],
|
|
239
239
|
async run({ nonce }) {
|
|
240
|
-
const endpoint = `${getApiOrigin()}/
|
|
240
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/auth/magic-link/verify`;
|
|
241
241
|
if (process.env.NODE_ENV !== "production") {
|
|
242
242
|
console.debug(
|
|
243
243
|
"[portal-components] verifying magic link via %s",
|
|
@@ -293,12 +293,12 @@ var fetchCustomBrandingImpl = async () => {
|
|
|
293
293
|
if (!appSlug) {
|
|
294
294
|
throw new Error("PORTAL_APP_SLUG is not configured");
|
|
295
295
|
}
|
|
296
|
-
const url = `${getApiOrigin()}/
|
|
296
|
+
const url = `${getApiOrigin()}/enterprise-portal/public/branding?app_slug=${encodeURIComponent(
|
|
297
297
|
appSlug
|
|
298
298
|
)}`;
|
|
299
299
|
if (process.env.NODE_ENV !== "production") {
|
|
300
300
|
console.debug(
|
|
301
|
-
"[portal-components] fetching custom branding via %s",
|
|
301
|
+
"[portal-components] fetching custom branding via %s (Enterprise Portal API)",
|
|
302
302
|
url
|
|
303
303
|
);
|
|
304
304
|
}
|
|
@@ -313,13 +313,18 @@ var fetchCustomBrandingImpl = async () => {
|
|
|
313
313
|
);
|
|
314
314
|
}
|
|
315
315
|
const payload = await response.json();
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
316
|
+
const brandingObject = {
|
|
317
|
+
logo: payload.logoUrl,
|
|
318
|
+
title: payload.appName,
|
|
319
|
+
customColor1: payload.primaryColor,
|
|
320
|
+
customColor2: payload.secondaryColor,
|
|
321
|
+
favicon: payload.faviconUrl
|
|
322
|
+
};
|
|
323
|
+
const brandingData = Buffer.from(JSON.stringify(brandingObject)).toString("base64");
|
|
320
324
|
return {
|
|
321
325
|
brandingData,
|
|
322
|
-
documentation:
|
|
326
|
+
documentation: null
|
|
327
|
+
// Documentation not included in new API's public endpoint
|
|
323
328
|
};
|
|
324
329
|
};
|
|
325
330
|
var fetchCustomBranding = cache(fetchCustomBrandingImpl);
|
|
@@ -347,22 +352,6 @@ var getCustomerIdFromToken = (token) => {
|
|
|
347
352
|
}
|
|
348
353
|
return customerId.trim();
|
|
349
354
|
};
|
|
350
|
-
var resolveSupportBundlesEndpoint = () => {
|
|
351
|
-
const fallback = `${getApiOrigin()}/v3/supportbundles`;
|
|
352
|
-
const explicit = process.env.SUPPORT_BUNDLES_ENDPOINT;
|
|
353
|
-
if (!explicit) {
|
|
354
|
-
return new URL(fallback);
|
|
355
|
-
}
|
|
356
|
-
try {
|
|
357
|
-
return new URL(explicit);
|
|
358
|
-
} catch (error) {
|
|
359
|
-
console.warn(
|
|
360
|
-
`[portal-components] invalid SUPPORT_BUNDLES_ENDPOINT, using fallback`,
|
|
361
|
-
error
|
|
362
|
-
);
|
|
363
|
-
return new URL(fallback);
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
355
|
var listSupportBundles = defineServerAction({
|
|
367
356
|
id: "support/list-bundles",
|
|
368
357
|
description: "Fetches support bundles associated with the customer found in the portal session JWT.",
|
|
@@ -372,17 +361,11 @@ var listSupportBundles = defineServerAction({
|
|
|
372
361
|
if (!token || typeof token !== "string") {
|
|
373
362
|
throw new Error("Support bundle listing requires a session token");
|
|
374
363
|
}
|
|
375
|
-
const
|
|
376
|
-
const customerId = payload?.customer_id;
|
|
377
|
-
if (typeof customerId !== "string" || !customerId.trim()) {
|
|
378
|
-
throw new Error("Unable to determine customer_id from session token");
|
|
379
|
-
}
|
|
380
|
-
const url = resolveSupportBundlesEndpoint();
|
|
381
|
-
url.searchParams.set("customer_id", customerId.trim());
|
|
364
|
+
const url = `${getApiOrigin()}/enterprise-portal/support-bundles`;
|
|
382
365
|
if (process.env.NODE_ENV !== "production") {
|
|
383
|
-
console.debug("[portal-components] fetching support bundles via %s", url);
|
|
366
|
+
console.debug("[portal-components] fetching support bundles via %s (Enterprise Portal API)", url);
|
|
384
367
|
}
|
|
385
|
-
const response = await authenticatedFetch(url
|
|
368
|
+
const response = await authenticatedFetch(url, {
|
|
386
369
|
token,
|
|
387
370
|
headers: {
|
|
388
371
|
accept: "application/json"
|
|
@@ -397,7 +380,8 @@ var listSupportBundles = defineServerAction({
|
|
|
397
380
|
`Support bundles request failed (${response.status} ${response.statusText})`
|
|
398
381
|
);
|
|
399
382
|
}
|
|
400
|
-
const
|
|
383
|
+
const payload = await response.json();
|
|
384
|
+
const raw = payload.data;
|
|
401
385
|
const rawRecord = raw && typeof raw === "object" ? raw : void 0;
|
|
402
386
|
const parseInsights = (raw2) => {
|
|
403
387
|
if (!Array.isArray(raw2)) return void 0;
|
|
@@ -488,12 +472,8 @@ var downloadSupportBundle = defineServerAction({
|
|
|
488
472
|
if (!bundleId || typeof bundleId !== "string") {
|
|
489
473
|
throw new Error("Support bundle download requires a bundle ID");
|
|
490
474
|
}
|
|
491
|
-
const
|
|
492
|
-
const
|
|
493
|
-
if (typeof customerId !== "string" || !customerId.trim()) {
|
|
494
|
-
throw new Error("Unable to determine customer_id from session token");
|
|
495
|
-
}
|
|
496
|
-
const endpoint = `${getApiOrigin()}/v3/supportbundle/${encodeURIComponent(bundleId)}/download?customer_id=${encodeURIComponent(customerId.trim())}`;
|
|
475
|
+
const customerId = getCustomerIdFromToken(token);
|
|
476
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/support-bundles/${encodeURIComponent(bundleId)}/download?customer_id=${encodeURIComponent(customerId)}`;
|
|
497
477
|
if (process.env.NODE_ENV !== "production") {
|
|
498
478
|
console.debug("[portal-components] getting support bundle download URL via %s", endpoint);
|
|
499
479
|
}
|
|
@@ -531,12 +511,8 @@ var deleteSupportBundle = defineServerAction({
|
|
|
531
511
|
if (!bundleId || typeof bundleId !== "string") {
|
|
532
512
|
throw new Error("Support bundle deletion requires a bundle ID");
|
|
533
513
|
}
|
|
534
|
-
const
|
|
535
|
-
const
|
|
536
|
-
if (typeof customerId !== "string" || !customerId.trim()) {
|
|
537
|
-
throw new Error("Unable to determine customer_id from session token");
|
|
538
|
-
}
|
|
539
|
-
const endpoint = `${getApiOrigin()}/v3/supportbundle/${encodeURIComponent(bundleId)}?customer_id=${encodeURIComponent(customerId.trim())}`;
|
|
514
|
+
const customerId = getCustomerIdFromToken(token);
|
|
515
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/support-bundles/${encodeURIComponent(bundleId)}?customer_id=${encodeURIComponent(customerId)}`;
|
|
540
516
|
if (process.env.NODE_ENV !== "production") {
|
|
541
517
|
console.debug("[portal-components] deleting support bundle via %s", endpoint);
|
|
542
518
|
}
|
|
@@ -575,7 +551,7 @@ var uploadSupportBundle = defineServerAction({
|
|
|
575
551
|
if (!fileContent || !(fileContent instanceof ArrayBuffer)) {
|
|
576
552
|
throw new Error("Support bundle upload requires file content");
|
|
577
553
|
}
|
|
578
|
-
const endpoint = `${getApiOrigin()}/
|
|
554
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/support-bundles/upload/${encodeURIComponent(appId)}`;
|
|
579
555
|
if (process.env.NODE_ENV !== "production") {
|
|
580
556
|
console.debug("[portal-components] uploading support bundle via %s", endpoint);
|
|
581
557
|
}
|
|
@@ -603,7 +579,7 @@ var uploadSupportBundle = defineServerAction({
|
|
|
603
579
|
}
|
|
604
580
|
});
|
|
605
581
|
var getSupportBundleUploadUrl = (appId) => {
|
|
606
|
-
return `${getApiOrigin()}/
|
|
582
|
+
return `${getApiOrigin()}/enterprise-portal/support-bundles/upload/${encodeURIComponent(appId)}`;
|
|
607
583
|
};
|
|
608
584
|
var listReleases = defineServerAction({
|
|
609
585
|
id: "releases/list",
|
|
@@ -614,10 +590,10 @@ var listReleases = defineServerAction({
|
|
|
614
590
|
if (!token || typeof token !== "string") {
|
|
615
591
|
throw new Error("List releases requires a session token");
|
|
616
592
|
}
|
|
617
|
-
const endpoint = `${getApiOrigin()}/
|
|
618
|
-
|
|
619
|
-
endpoint
|
|
620
|
-
}
|
|
593
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/releases`;
|
|
594
|
+
if (process.env.NODE_ENV !== "production") {
|
|
595
|
+
console.debug("[portal-components] fetching releases via %s (Enterprise Portal API)", endpoint);
|
|
596
|
+
}
|
|
621
597
|
const response = await authenticatedFetch(endpoint, {
|
|
622
598
|
method: "GET",
|
|
623
599
|
token,
|
|
@@ -630,7 +606,6 @@ var listReleases = defineServerAction({
|
|
|
630
606
|
console.warn("[portal-components] listReleases read error", error);
|
|
631
607
|
return null;
|
|
632
608
|
});
|
|
633
|
-
console.log("[portal-components] listReleases response", response.status, bodyText);
|
|
634
609
|
if (!response.ok) {
|
|
635
610
|
throw new Error(
|
|
636
611
|
`List releases request failed (${response.status} ${response.statusText})`
|
|
@@ -927,7 +902,10 @@ var fetchLicenseDetails = defineServerAction({
|
|
|
927
902
|
if (typeof token !== "string" || token.trim().length === 0) {
|
|
928
903
|
throw new Error("fetchLicenseDetails requires a non-empty token");
|
|
929
904
|
}
|
|
930
|
-
const endpoint = `${getApiOrigin()}/
|
|
905
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/license`;
|
|
906
|
+
if (process.env.NODE_ENV !== "production") {
|
|
907
|
+
console.debug("[portal-components] fetching license via %s (Enterprise Portal API)", endpoint);
|
|
908
|
+
}
|
|
931
909
|
const response = await authenticatedFetch(endpoint, {
|
|
932
910
|
method: "GET",
|
|
933
911
|
token,
|
|
@@ -942,10 +920,11 @@ var fetchLicenseDetails = defineServerAction({
|
|
|
942
920
|
);
|
|
943
921
|
}
|
|
944
922
|
const payload = await response.json();
|
|
945
|
-
const
|
|
923
|
+
const licenseData = payload.data;
|
|
924
|
+
const license = normalizeLicensePayload(licenseData);
|
|
946
925
|
return {
|
|
947
926
|
license,
|
|
948
|
-
raw:
|
|
927
|
+
raw: licenseData ?? null
|
|
949
928
|
};
|
|
950
929
|
}
|
|
951
930
|
});
|
|
@@ -958,16 +937,14 @@ var getSecurityInfo = defineServerAction({
|
|
|
958
937
|
if (!token || typeof token !== "string") {
|
|
959
938
|
throw new Error("Security info request requires a session token");
|
|
960
939
|
}
|
|
961
|
-
const customerId = getCustomerIdFromToken(token);
|
|
962
940
|
const params = new URLSearchParams({
|
|
963
|
-
customer_id: customerId,
|
|
964
941
|
install_type: installType,
|
|
965
942
|
channel_sequence: channelSequence.toString(),
|
|
966
943
|
is_airgap: isAirgap.toString()
|
|
967
944
|
});
|
|
968
|
-
const url = `${getApiOrigin()}/
|
|
945
|
+
const url = `${getApiOrigin()}/enterprise-portal/security?${params.toString()}`;
|
|
969
946
|
if (process.env.NODE_ENV !== "production") {
|
|
970
|
-
console.debug("[portal-components] fetching security info via %s", url);
|
|
947
|
+
console.debug("[portal-components] fetching security info via %s (Enterprise Portal API)", url);
|
|
971
948
|
}
|
|
972
949
|
const response = await authenticatedFetch(url, {
|
|
973
950
|
token,
|
|
@@ -979,8 +956,8 @@ var getSecurityInfo = defineServerAction({
|
|
|
979
956
|
`Security info request failed (${response.status} ${response.statusText})`
|
|
980
957
|
);
|
|
981
958
|
}
|
|
982
|
-
const
|
|
983
|
-
return data;
|
|
959
|
+
const payload = await response.json();
|
|
960
|
+
return payload.data;
|
|
984
961
|
}
|
|
985
962
|
});
|
|
986
963
|
var getSecurityInfoDiff = defineServerAction({
|
|
@@ -992,15 +969,13 @@ var getSecurityInfoDiff = defineServerAction({
|
|
|
992
969
|
if (!token || typeof token !== "string") {
|
|
993
970
|
throw new Error("Security info diff request requires a session token");
|
|
994
971
|
}
|
|
995
|
-
const customerId = getCustomerIdFromToken(token);
|
|
996
972
|
const params = new URLSearchParams({
|
|
997
|
-
customer_id: customerId,
|
|
998
973
|
install_type: installType,
|
|
999
974
|
from_channel_sequence: fromChannelSequence.toString(),
|
|
1000
975
|
to_channel_sequence: toChannelSequence.toString(),
|
|
1001
976
|
is_airgap: isAirgap.toString()
|
|
1002
977
|
});
|
|
1003
|
-
const url = `${getApiOrigin()}/
|
|
978
|
+
const url = `${getApiOrigin()}/enterprise-portal/security-diff?${params.toString()}`;
|
|
1004
979
|
if (process.env.NODE_ENV !== "production") {
|
|
1005
980
|
console.debug("[portal-components] fetching security info diff via %s", url);
|
|
1006
981
|
}
|
|
@@ -1014,8 +989,8 @@ var getSecurityInfoDiff = defineServerAction({
|
|
|
1014
989
|
`Security info diff request failed (${response.status} ${response.statusText})`
|
|
1015
990
|
);
|
|
1016
991
|
}
|
|
1017
|
-
const
|
|
1018
|
-
return data;
|
|
992
|
+
const envelope = await response.json();
|
|
993
|
+
return envelope.data;
|
|
1019
994
|
}
|
|
1020
995
|
});
|
|
1021
996
|
var getSecurityInfoSBOM = defineServerAction({
|
|
@@ -1027,15 +1002,13 @@ var getSecurityInfoSBOM = defineServerAction({
|
|
|
1027
1002
|
if (!token || typeof token !== "string") {
|
|
1028
1003
|
throw new Error("Security SBOM request requires a session token");
|
|
1029
1004
|
}
|
|
1030
|
-
const customerId = getCustomerIdFromToken(token);
|
|
1031
1005
|
const params = new URLSearchParams({
|
|
1032
|
-
customer_id: customerId,
|
|
1033
1006
|
install_type: installType,
|
|
1034
1007
|
channel_sequence: channelSequence.toString(),
|
|
1035
1008
|
is_airgap: isAirgap.toString(),
|
|
1036
1009
|
unified_sbom: unifiedSbom.toString()
|
|
1037
1010
|
});
|
|
1038
|
-
const url = `${getApiOrigin()}/
|
|
1011
|
+
const url = `${getApiOrigin()}/enterprise-portal/security-sbom?${params.toString()}`;
|
|
1039
1012
|
if (process.env.NODE_ENV !== "production") {
|
|
1040
1013
|
console.debug("[portal-components] fetching security SBOM via %s", url);
|
|
1041
1014
|
}
|
|
@@ -1052,8 +1025,77 @@ var getSecurityInfoSBOM = defineServerAction({
|
|
|
1052
1025
|
`Security SBOM request failed (${response.status} ${response.statusText})`
|
|
1053
1026
|
);
|
|
1054
1027
|
}
|
|
1055
|
-
const
|
|
1056
|
-
return data;
|
|
1028
|
+
const envelope = await response.json();
|
|
1029
|
+
return envelope.data;
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
var fetchDashboardComposite = defineServerAction({
|
|
1033
|
+
id: "dashboard/fetch-composite",
|
|
1034
|
+
description: "Fetches all dashboard data from the composite Enterprise Portal API endpoint",
|
|
1035
|
+
visibility: "customer",
|
|
1036
|
+
tags: ["dashboard", "enterprise-portal-api"],
|
|
1037
|
+
async run({ token }, context) {
|
|
1038
|
+
if (!token || typeof token !== "string") {
|
|
1039
|
+
throw new Error("Dashboard request requires a session token");
|
|
1040
|
+
}
|
|
1041
|
+
const origin = getApiOrigin();
|
|
1042
|
+
const url = `${origin}/enterprise-portal/dashboard`;
|
|
1043
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1044
|
+
console.debug("[portal-components] fetching dashboard via %s (Enterprise Portal API)", url);
|
|
1045
|
+
}
|
|
1046
|
+
const response = await authenticatedFetch(url, {
|
|
1047
|
+
method: "GET",
|
|
1048
|
+
token,
|
|
1049
|
+
headers: { accept: "application/json" },
|
|
1050
|
+
signal: context?.signal
|
|
1051
|
+
});
|
|
1052
|
+
if (!response.ok) {
|
|
1053
|
+
throw new Error(
|
|
1054
|
+
`Dashboard request failed (${response.status} ${response.statusText})`
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1057
|
+
const payload = await response.json();
|
|
1058
|
+
const data = payload.data;
|
|
1059
|
+
const allInstances = data?.instances || [];
|
|
1060
|
+
const channelReleases = data?.channelReleases || [];
|
|
1061
|
+
const licenseData = data?.license || {};
|
|
1062
|
+
const teamStats = data?.teamStats || {};
|
|
1063
|
+
const onlineInstances = allInstances.filter((i) => !i.isAirgap);
|
|
1064
|
+
const airgapInstances = allInstances.filter((i) => i.isAirgap);
|
|
1065
|
+
const twentyFourHoursAgo = Date.now() - 24 * 60 * 60 * 1e3;
|
|
1066
|
+
const activeOnlineInstances = onlineInstances.filter((instance) => {
|
|
1067
|
+
const lastCheckin = instance.lastCheckin ? new Date(instance.lastCheckin).getTime() : 0;
|
|
1068
|
+
return lastCheckin > twentyFourHoursAgo;
|
|
1069
|
+
});
|
|
1070
|
+
const onlineActiveCount = activeOnlineInstances.length;
|
|
1071
|
+
const airgapCount = airgapInstances.length;
|
|
1072
|
+
const calculateUpdates = (instances) => {
|
|
1073
|
+
if (!channelReleases.length) return 0;
|
|
1074
|
+
let numUpdates = 0;
|
|
1075
|
+
for (const instance of instances) {
|
|
1076
|
+
const instanceSequence = instance.channelSequence ?? 0;
|
|
1077
|
+
const matchingReleases = channelReleases.filter(
|
|
1078
|
+
(release) => release.channelId === instance.channelId
|
|
1079
|
+
);
|
|
1080
|
+
for (const release of matchingReleases) {
|
|
1081
|
+
if ((release.channelSequence ?? 0) > instanceSequence) {
|
|
1082
|
+
numUpdates++;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
return numUpdates;
|
|
1087
|
+
};
|
|
1088
|
+
const onlineUpdates = calculateUpdates(activeOnlineInstances);
|
|
1089
|
+
const airgapUpdates = calculateUpdates(airgapInstances);
|
|
1090
|
+
return {
|
|
1091
|
+
onlineActiveCount,
|
|
1092
|
+
airgapCount,
|
|
1093
|
+
onlineUpdates,
|
|
1094
|
+
airgapUpdates,
|
|
1095
|
+
// Additional data available from the composite endpoint
|
|
1096
|
+
license: licenseData,
|
|
1097
|
+
teamStats
|
|
1098
|
+
};
|
|
1057
1099
|
}
|
|
1058
1100
|
});
|
|
1059
1101
|
var fetchCurrentUser = defineServerAction({
|
|
@@ -1065,7 +1107,7 @@ var fetchCurrentUser = defineServerAction({
|
|
|
1065
1107
|
if (!token || typeof token !== "string") {
|
|
1066
1108
|
throw new Error("Fetch current user requires a session token");
|
|
1067
1109
|
}
|
|
1068
|
-
const endpoint = `${getApiOrigin()}/
|
|
1110
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/user/profile`;
|
|
1069
1111
|
if (process.env.NODE_ENV !== "production") {
|
|
1070
1112
|
console.debug("[portal-components] fetching current user via %s", endpoint);
|
|
1071
1113
|
}
|
|
@@ -1102,7 +1144,7 @@ var updateUser = defineServerAction({
|
|
|
1102
1144
|
if (!firstName && !lastName) {
|
|
1103
1145
|
throw new Error("At least one of firstName or lastName must be provided");
|
|
1104
1146
|
}
|
|
1105
|
-
const endpoint = `${getApiOrigin()}/
|
|
1147
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/user/profile`;
|
|
1106
1148
|
if (process.env.NODE_ENV !== "production") {
|
|
1107
1149
|
console.debug("[portal-components] updating user via %s", endpoint);
|
|
1108
1150
|
}
|
|
@@ -1110,7 +1152,7 @@ var updateUser = defineServerAction({
|
|
|
1110
1152
|
if (firstName !== void 0) body.firstName = firstName;
|
|
1111
1153
|
if (lastName !== void 0) body.lastName = lastName;
|
|
1112
1154
|
const response = await authenticatedFetch(endpoint, {
|
|
1113
|
-
method: "
|
|
1155
|
+
method: "PUT",
|
|
1114
1156
|
token,
|
|
1115
1157
|
headers: {
|
|
1116
1158
|
"content-type": "application/json",
|
|
@@ -1138,9 +1180,9 @@ var fetchNotifications = defineServerAction({
|
|
|
1138
1180
|
throw new Error("Fetch notifications requires a session token");
|
|
1139
1181
|
}
|
|
1140
1182
|
if (!customerId || typeof customerId !== "string") {
|
|
1141
|
-
throw new Error("Fetch notifications requires a customerId");
|
|
1183
|
+
throw new Error("Fetch notifications requires a valid customerId");
|
|
1142
1184
|
}
|
|
1143
|
-
const endpoint = `${getApiOrigin()}/
|
|
1185
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/user/notifications?customer_id=${encodeURIComponent(customerId)}`;
|
|
1144
1186
|
if (process.env.NODE_ENV !== "production") {
|
|
1145
1187
|
console.debug("[portal-components] fetching notifications via %s", endpoint);
|
|
1146
1188
|
}
|
|
@@ -1171,12 +1213,12 @@ var updateNotifications = defineServerAction({
|
|
|
1171
1213
|
throw new Error("Update notifications requires a session token");
|
|
1172
1214
|
}
|
|
1173
1215
|
if (!customerId || typeof customerId !== "string") {
|
|
1174
|
-
throw new Error("Update notifications requires a customerId");
|
|
1216
|
+
throw new Error("Update notifications requires a valid customerId");
|
|
1175
1217
|
}
|
|
1176
1218
|
if (!Array.isArray(notifications)) {
|
|
1177
1219
|
throw new Error("Update notifications requires a notifications array");
|
|
1178
1220
|
}
|
|
1179
|
-
const endpoint = `${getApiOrigin()}/
|
|
1221
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/user/notifications?customer_id=${encodeURIComponent(customerId)}`;
|
|
1180
1222
|
if (process.env.NODE_ENV !== "production") {
|
|
1181
1223
|
console.debug("[portal-components] updating notifications via %s", endpoint);
|
|
1182
1224
|
}
|
|
@@ -1461,7 +1503,6 @@ var LicenseDetails = async ({
|
|
|
1461
1503
|
] })
|
|
1462
1504
|
] });
|
|
1463
1505
|
};
|
|
1464
|
-
var defaultHiddenLabels = ["Download"];
|
|
1465
1506
|
var defaultTopNavLinks = [
|
|
1466
1507
|
{
|
|
1467
1508
|
label: "Dashboard",
|
|
@@ -1486,27 +1527,6 @@ var defaultTopNavLinks = [
|
|
|
1486
1527
|
}
|
|
1487
1528
|
)
|
|
1488
1529
|
},
|
|
1489
|
-
{
|
|
1490
|
-
label: "Download",
|
|
1491
|
-
icon: /* @__PURE__ */ jsxs(
|
|
1492
|
-
"svg",
|
|
1493
|
-
{
|
|
1494
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1495
|
-
viewBox: "0 0 24 24",
|
|
1496
|
-
className: "h-4 w-4",
|
|
1497
|
-
fill: "none",
|
|
1498
|
-
stroke: "currentColor",
|
|
1499
|
-
strokeWidth: "2",
|
|
1500
|
-
strokeLinecap: "round",
|
|
1501
|
-
strokeLinejoin: "round",
|
|
1502
|
-
children: [
|
|
1503
|
-
/* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1504
|
-
/* @__PURE__ */ jsx("polyline", { points: "7 10 12 15 17 10" }),
|
|
1505
|
-
/* @__PURE__ */ jsx("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
1506
|
-
]
|
|
1507
|
-
}
|
|
1508
|
-
)
|
|
1509
|
-
},
|
|
1510
1530
|
{
|
|
1511
1531
|
label: "Install",
|
|
1512
1532
|
href: "/install",
|
|
@@ -1687,7 +1707,7 @@ var TopNav = async ({
|
|
|
1687
1707
|
try {
|
|
1688
1708
|
const branding = await fetchCustomBranding();
|
|
1689
1709
|
if (branding.brandingData) {
|
|
1690
|
-
const decoded = Buffer
|
|
1710
|
+
const decoded = Buffer.from(branding.brandingData, "base64").toString(
|
|
1691
1711
|
"utf-8"
|
|
1692
1712
|
);
|
|
1693
1713
|
try {
|
|
@@ -1720,8 +1740,7 @@ var TopNav = async ({
|
|
|
1720
1740
|
console.debug("[portal-components] branding fetch failed", error);
|
|
1721
1741
|
}
|
|
1722
1742
|
const baseLinks = links ?? defaultTopNavLinks;
|
|
1723
|
-
const
|
|
1724
|
-
const hiddenSet = computedHiddenLabels ? new Set(computedHiddenLabels) : null;
|
|
1743
|
+
const hiddenSet = hiddenLabels ? new Set(hiddenLabels) : null;
|
|
1725
1744
|
let resolvedLinks = baseLinks.filter(
|
|
1726
1745
|
(link) => !hiddenSet?.has(link.label)
|
|
1727
1746
|
);
|
|
@@ -2406,6 +2425,6 @@ UpdateLayout.displayName = "UpdateLayout";
|
|
|
2406
2425
|
// src/index.ts
|
|
2407
2426
|
var portalComponentsVersion = package_default.version;
|
|
2408
2427
|
|
|
2409
|
-
export { Button, LicenseDetails, SupportCard, TeamSettingsCard, TopNav, UpdateLayout, UpdatesCard, UserSettings, UserSettingsCard, createPortalTheme, decodeJwtPayload, defaultTopNavLinks, defineServerAction, deleteSupportBundle, downloadSupportBundle, fetchCurrentUser, fetchCustomBranding, fetchLicenseDetails, fetchNotifications, getCustomerIdFromToken, getSecurityInfo, getSecurityInfoDiff, getSecurityInfoSBOM, getSupportBundleUploadUrl, initiateLogin, listReleases, listSupportBundles, portalComponentsVersion, portalThemeTokens, updateNotifications, updateUser, uploadSupportBundle, verifyMagicLink };
|
|
2428
|
+
export { Button, LicenseDetails, SupportCard, TeamSettingsCard, TopNav, UpdateLayout, UpdatesCard, UserSettings, UserSettingsCard, createPortalTheme, decodeJwtPayload, defaultTopNavLinks, defineServerAction, deleteSupportBundle, downloadSupportBundle, fetchCurrentUser, fetchCustomBranding, fetchDashboardComposite, fetchLicenseDetails, fetchNotifications, getCustomerIdFromToken, getSecurityInfo, getSecurityInfoDiff, getSecurityInfoSBOM, getSupportBundleUploadUrl, initiateLogin, listReleases, listSupportBundles, portalComponentsVersion, portalThemeTokens, updateNotifications, updateUser, uploadSupportBundle, verifyMagicLink };
|
|
2410
2429
|
//# sourceMappingURL=index.js.map
|
|
2411
2430
|
//# sourceMappingURL=index.js.map
|