@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.
- 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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var react = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var buffer = require('buffer');
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Enterprise Portal Components
|
|
@@ -756,10 +757,10 @@ var createServiceAccount = defineServerAction({
|
|
|
756
757
|
if (!name || typeof name !== "string" || !name.trim()) {
|
|
757
758
|
throw new Error("Service account name is required");
|
|
758
759
|
}
|
|
759
|
-
const endpoint = `${getApiOrigin()}/
|
|
760
|
+
const endpoint = `${getApiOrigin()}/enterprise-portal/team/service-accounts`;
|
|
760
761
|
if (process.env.NODE_ENV !== "production") {
|
|
761
762
|
console.debug(
|
|
762
|
-
"[portal-components] creating service account via %s",
|
|
763
|
+
"[portal-components] creating service account via %s (Enterprise Portal API)",
|
|
763
764
|
endpoint
|
|
764
765
|
);
|
|
765
766
|
}
|
|
@@ -786,12 +787,12 @@ var fetchCustomBrandingImpl = async () => {
|
|
|
786
787
|
if (!appSlug) {
|
|
787
788
|
throw new Error("PORTAL_APP_SLUG is not configured");
|
|
788
789
|
}
|
|
789
|
-
const url = `${getApiOrigin()}/
|
|
790
|
+
const url = `${getApiOrigin()}/enterprise-portal/public/branding?app_slug=${encodeURIComponent(
|
|
790
791
|
appSlug
|
|
791
792
|
)}`;
|
|
792
793
|
if (process.env.NODE_ENV !== "production") {
|
|
793
794
|
console.debug(
|
|
794
|
-
"[portal-components] fetching custom branding via %s",
|
|
795
|
+
"[portal-components] fetching custom branding via %s (Enterprise Portal API)",
|
|
795
796
|
url
|
|
796
797
|
);
|
|
797
798
|
}
|
|
@@ -806,40 +807,21 @@ var fetchCustomBrandingImpl = async () => {
|
|
|
806
807
|
);
|
|
807
808
|
}
|
|
808
809
|
const payload = await response.json();
|
|
809
|
-
const
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
810
|
+
const brandingObject = {
|
|
811
|
+
logo: payload.logoUrl,
|
|
812
|
+
title: payload.appName,
|
|
813
|
+
customColor1: payload.primaryColor,
|
|
814
|
+
customColor2: payload.secondaryColor,
|
|
815
|
+
favicon: payload.faviconUrl
|
|
816
|
+
};
|
|
817
|
+
const brandingData = buffer.Buffer.from(JSON.stringify(brandingObject)).toString("base64");
|
|
813
818
|
return {
|
|
814
819
|
brandingData,
|
|
815
|
-
documentation:
|
|
820
|
+
documentation: null
|
|
821
|
+
// Documentation not included in new API's public endpoint
|
|
816
822
|
};
|
|
817
823
|
};
|
|
818
824
|
react.cache(fetchCustomBrandingImpl);
|
|
819
|
-
var decodeJwtPayload = (token) => {
|
|
820
|
-
const parts = token.split(".");
|
|
821
|
-
if (parts.length !== 3) {
|
|
822
|
-
throw new Error("Invalid JWT received");
|
|
823
|
-
}
|
|
824
|
-
const payloadSegment = parts[1];
|
|
825
|
-
if (!payloadSegment) {
|
|
826
|
-
throw new Error("JWT payload segment missing");
|
|
827
|
-
}
|
|
828
|
-
const padded = payloadSegment.padEnd(
|
|
829
|
-
payloadSegment.length + (4 - payloadSegment.length % 4) % 4,
|
|
830
|
-
"="
|
|
831
|
-
);
|
|
832
|
-
const decoded = Buffer.from(padded, "base64").toString("utf-8");
|
|
833
|
-
return JSON.parse(decoded);
|
|
834
|
-
};
|
|
835
|
-
var getCustomerIdFromToken = (token) => {
|
|
836
|
-
const payload = decodeJwtPayload(token);
|
|
837
|
-
const customerId = payload?.customer_id || payload?.customerId;
|
|
838
|
-
if (typeof customerId !== "string" || !customerId.trim()) {
|
|
839
|
-
throw new Error("Unable to determine customer_id from session token");
|
|
840
|
-
}
|
|
841
|
-
return customerId.trim();
|
|
842
|
-
};
|
|
843
825
|
|
|
844
826
|
// src/actions/install.ts
|
|
845
827
|
async function fetchChannelReleases(input, context) {
|
|
@@ -847,15 +829,13 @@ async function fetchChannelReleases(input, context) {
|
|
|
847
829
|
if (!token || typeof token !== "string") {
|
|
848
830
|
throw new Error("fetchChannelReleases requires a session token");
|
|
849
831
|
}
|
|
850
|
-
const customerId = getCustomerIdFromToken(token);
|
|
851
832
|
const origin = getApiOrigin();
|
|
852
|
-
const url = new URL(`${origin}/
|
|
853
|
-
url.searchParams.set("customer_id", customerId);
|
|
833
|
+
const url = new URL(`${origin}/enterprise-portal/channel-releases`);
|
|
854
834
|
if (channelId) {
|
|
855
835
|
url.searchParams.set("channel_id", channelId);
|
|
856
836
|
}
|
|
857
837
|
if (process.env.NODE_ENV !== "production") {
|
|
858
|
-
console.debug("[portal-components] fetching channel releases via %s", url.toString());
|
|
838
|
+
console.debug("[portal-components] fetching channel releases via %s (Enterprise Portal API)", url.toString());
|
|
859
839
|
}
|
|
860
840
|
const response = await authenticatedFetch(url.toString(), {
|
|
861
841
|
method: "GET",
|
|
@@ -871,9 +851,10 @@ async function fetchChannelReleases(input, context) {
|
|
|
871
851
|
`Channel releases request failed (${response.status} ${response.statusText}): ${errorText}`
|
|
872
852
|
);
|
|
873
853
|
}
|
|
874
|
-
const
|
|
854
|
+
const envelope = await response.json();
|
|
855
|
+
const payload = envelope.data;
|
|
875
856
|
return {
|
|
876
|
-
channelReleases: payload
|
|
857
|
+
channelReleases: payload?.channelReleases || []
|
|
877
858
|
};
|
|
878
859
|
}
|
|
879
860
|
async function createInstallOptions(input, context) {
|
|
@@ -898,9 +879,8 @@ async function createInstallOptions(input, context) {
|
|
|
898
879
|
if (!serviceAccountId?.trim()) {
|
|
899
880
|
throw new Error("Service account ID is required");
|
|
900
881
|
}
|
|
901
|
-
const customerId = getCustomerIdFromToken(token);
|
|
902
882
|
const origin = getApiOrigin();
|
|
903
|
-
const endpoint = `${origin}/
|
|
883
|
+
const endpoint = `${origin}/enterprise-portal/install-options?includeInstructions=true`;
|
|
904
884
|
const body = {
|
|
905
885
|
install_type: installType,
|
|
906
886
|
instance_name: instanceName.trim(),
|
|
@@ -955,9 +935,8 @@ async function getInstallOptions(input, context) {
|
|
|
955
935
|
if (!installOptionsId?.trim()) {
|
|
956
936
|
throw new Error("Install options ID is required");
|
|
957
937
|
}
|
|
958
|
-
const customerId = getCustomerIdFromToken(token);
|
|
959
938
|
const origin = getApiOrigin();
|
|
960
|
-
const url = new URL(`${origin}/
|
|
939
|
+
const url = new URL(`${origin}/enterprise-portal/install-options/${installOptionsId.trim()}`);
|
|
961
940
|
if (includeInstructions) {
|
|
962
941
|
url.searchParams.set("includeInstructions", "true");
|
|
963
942
|
}
|
|
@@ -968,7 +947,7 @@ async function getInstallOptions(input, context) {
|
|
|
968
947
|
url.searchParams.set("proxyUrl", proxyUrl);
|
|
969
948
|
}
|
|
970
949
|
if (process.env.NODE_ENV !== "production") {
|
|
971
|
-
console.debug("[portal-components] fetching install options via %s", url.toString());
|
|
950
|
+
console.debug("[portal-components] fetching install options via %s (Enterprise Portal API)", url.toString());
|
|
972
951
|
}
|
|
973
952
|
const response = await authenticatedFetch(url.toString(), {
|
|
974
953
|
method: "GET",
|
|
@@ -984,7 +963,8 @@ async function getInstallOptions(input, context) {
|
|
|
984
963
|
`Get install options failed (${response.status} ${response.statusText}): ${errorText}`
|
|
985
964
|
);
|
|
986
965
|
}
|
|
987
|
-
|
|
966
|
+
const envelope = await response.json();
|
|
967
|
+
return envelope.data;
|
|
988
968
|
}
|
|
989
969
|
async function updateInstallOptions(input, context) {
|
|
990
970
|
const {
|
|
@@ -1010,9 +990,8 @@ async function updateInstallOptions(input, context) {
|
|
|
1010
990
|
if (!installOptionsId?.trim()) {
|
|
1011
991
|
throw new Error("Install options ID is required");
|
|
1012
992
|
}
|
|
1013
|
-
const customerId = getCustomerIdFromToken(token);
|
|
1014
993
|
const origin = getApiOrigin();
|
|
1015
|
-
const url = new URL(`${origin}/
|
|
994
|
+
const url = new URL(`${origin}/enterprise-portal/install-options/${installOptionsId.trim()}`);
|
|
1016
995
|
if (includeInstructions) {
|
|
1017
996
|
url.searchParams.set("includeInstructions", "true");
|
|
1018
997
|
}
|