@replicated/portal-components 0.0.26 → 0.0.28
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/branding-actions.d.mts +1 -1
- package/dist/actions/branding-actions.d.ts +1 -1
- package/dist/actions/branding-actions.js +15 -5
- package/dist/actions/branding-actions.js.map +1 -1
- package/dist/actions/change-team.js +13 -3
- package/dist/actions/change-team.js.map +1 -1
- package/dist/actions/index.d.mts +1 -1
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +16 -15
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/install-actions.d.mts +1 -1
- package/dist/actions/install-actions.d.ts +1 -1
- package/dist/actions/install-actions.js +13 -3
- package/dist/actions/install-actions.js.map +1 -1
- package/dist/actions/invite-actions.js +13 -3
- package/dist/actions/invite-actions.js.map +1 -1
- package/dist/actions/magic-link-actions.js +13 -3
- package/dist/actions/magic-link-actions.js.map +1 -1
- package/dist/actions/service-account.d.mts +1 -1
- package/dist/actions/service-account.d.ts +1 -1
- package/dist/actions/service-account.js +13 -3
- package/dist/actions/service-account.js.map +1 -1
- package/dist/actions/support-bundles.d.mts +1 -1
- package/dist/actions/support-bundles.d.ts +1 -1
- package/dist/actions/support-bundles.js +13 -3
- package/dist/actions/support-bundles.js.map +1 -1
- package/dist/actions/team-settings.d.mts +1 -1
- package/dist/actions/team-settings.d.ts +1 -1
- package/dist/actions/team-settings.js +13 -3
- package/dist/actions/team-settings.js.map +1 -1
- package/dist/actions/trial-signup-actions.js +13 -3
- package/dist/actions/trial-signup-actions.js.map +1 -1
- package/dist/actions/trial-signup.js +13 -3
- package/dist/actions/trial-signup.js.map +1 -1
- package/dist/actions/user-settings.d.mts +1 -1
- package/dist/actions/user-settings.d.ts +1 -1
- package/dist/actions/user-settings.js +13 -3
- package/dist/actions/user-settings.js.map +1 -1
- package/dist/airgap-instances.d.mts +1 -1
- package/dist/airgap-instances.d.ts +1 -1
- package/dist/api/saml.js +13 -3
- package/dist/api/saml.js.map +1 -1
- package/dist/api/support-bundles.js +13 -3
- package/dist/api/support-bundles.js.map +1 -1
- package/dist/{branding-DmsrDTNE.d.mts → branding-C5H0L6Vi.d.mts} +13 -1
- package/dist/{branding-DmsrDTNE.d.ts → branding-C5H0L6Vi.d.ts} +13 -1
- package/dist/esm/actions/branding-actions.js +15 -5
- package/dist/esm/actions/branding-actions.js.map +1 -1
- package/dist/esm/actions/change-team.js +13 -3
- package/dist/esm/actions/change-team.js.map +1 -1
- package/dist/esm/actions/index.js +16 -15
- package/dist/esm/actions/index.js.map +1 -1
- package/dist/esm/actions/install-actions.js +13 -3
- package/dist/esm/actions/install-actions.js.map +1 -1
- package/dist/esm/actions/invite-actions.js +13 -3
- package/dist/esm/actions/invite-actions.js.map +1 -1
- package/dist/esm/actions/magic-link-actions.js +13 -3
- package/dist/esm/actions/magic-link-actions.js.map +1 -1
- package/dist/esm/actions/service-account.js +13 -3
- package/dist/esm/actions/service-account.js.map +1 -1
- package/dist/esm/actions/support-bundles.js +13 -3
- package/dist/esm/actions/support-bundles.js.map +1 -1
- package/dist/esm/actions/team-settings.js +13 -3
- package/dist/esm/actions/team-settings.js.map +1 -1
- package/dist/esm/actions/trial-signup-actions.js +13 -3
- package/dist/esm/actions/trial-signup-actions.js.map +1 -1
- package/dist/esm/actions/trial-signup.js +13 -3
- package/dist/esm/actions/trial-signup.js.map +1 -1
- package/dist/esm/actions/user-settings.js +13 -3
- package/dist/esm/actions/user-settings.js.map +1 -1
- package/dist/esm/api/saml.js +13 -3
- package/dist/esm/api/saml.js.map +1 -1
- package/dist/esm/api/support-bundles.js +13 -3
- package/dist/esm/api/support-bundles.js.map +1 -1
- package/dist/esm/helm-install-wizard.js +13 -3
- package/dist/esm/helm-install-wizard.js.map +1 -1
- package/dist/esm/index.js +51 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/install-actions.js +13 -3
- package/dist/esm/install-actions.js.map +1 -1
- package/dist/esm/license-details.js +13 -3
- package/dist/esm/license-details.js.map +1 -1
- package/dist/esm/linux-install-wizard.js +13 -3
- package/dist/esm/linux-install-wizard.js.map +1 -1
- package/dist/esm/security-card.js +39 -24
- package/dist/esm/security-card.js.map +1 -1
- package/dist/esm/support-card.js +13 -3
- package/dist/esm/support-card.js.map +1 -1
- package/dist/esm/top-nav.js +34 -7
- package/dist/esm/top-nav.js.map +1 -1
- package/dist/esm/update-layout.js +34 -7
- package/dist/esm/update-layout.js.map +1 -1
- package/dist/esm/user-menu-dropdown.js +6 -3
- package/dist/esm/user-menu-dropdown.js.map +1 -1
- package/dist/esm/utils/index.js +44 -5
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/helm-install-wizard.d.mts +2 -2
- package/dist/helm-install-wizard.d.ts +2 -2
- package/dist/helm-install-wizard.js +13 -3
- package/dist/helm-install-wizard.js.map +1 -1
- package/dist/{index-Bcp17Mf3.d.ts → index-7ibNULXY.d.ts} +3 -1
- package/dist/{index-DaH1bSuO.d.mts → index-CITwEYtK.d.mts} +3 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +51 -8
- package/dist/index.js.map +1 -1
- package/dist/install-actions.d.mts +2 -2
- package/dist/install-actions.d.ts +2 -2
- package/dist/install-actions.js +13 -3
- package/dist/install-actions.js.map +1 -1
- package/dist/instance-card.d.mts +1 -1
- package/dist/instance-card.d.ts +1 -1
- package/dist/license-details.js +13 -3
- package/dist/license-details.js.map +1 -1
- package/dist/linux-install-wizard.d.mts +2 -2
- package/dist/linux-install-wizard.d.ts +2 -2
- package/dist/linux-install-wizard.js +13 -3
- package/dist/linux-install-wizard.js.map +1 -1
- package/dist/online-instance-list.d.mts +1 -1
- package/dist/online-instance-list.d.ts +1 -1
- package/dist/pending-installations.d.mts +1 -1
- package/dist/pending-installations.d.ts +1 -1
- package/dist/security-card.d.mts +1 -1
- package/dist/security-card.d.ts +1 -1
- package/dist/security-card.js +43 -24
- package/dist/security-card.js.map +1 -1
- package/dist/styles.css +16 -12
- package/dist/support-bundles-card.d.mts +1 -1
- package/dist/support-bundles-card.d.ts +1 -1
- package/dist/support-card.js +13 -3
- package/dist/support-card.js.map +1 -1
- package/dist/{top-nav-8f2U69MF.d.ts → top-nav-B2FVC4rl.d.ts} +1 -1
- package/dist/{top-nav-B2yA3PC7.d.mts → top-nav-Cf8zMq1A.d.mts} +1 -1
- package/dist/top-nav.d.mts +2 -2
- package/dist/top-nav.d.ts +2 -2
- package/dist/top-nav.js +34 -7
- package/dist/top-nav.js.map +1 -1
- package/dist/update-layout.js +34 -7
- package/dist/update-layout.js.map +1 -1
- package/dist/user-menu-dropdown.d.mts +2 -1
- package/dist/user-menu-dropdown.d.ts +2 -1
- package/dist/user-menu-dropdown.js +6 -3
- package/dist/user-menu-dropdown.js.map +1 -1
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +44 -4
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -121,7 +121,7 @@ var init_tracer = __esm({
|
|
|
121
121
|
|
|
122
122
|
// package.json
|
|
123
123
|
var package_default = {
|
|
124
|
-
version: "0.0.
|
|
124
|
+
version: "0.0.28"};
|
|
125
125
|
|
|
126
126
|
// src/tokens/index.ts
|
|
127
127
|
var baseTokens = {
|
|
@@ -556,14 +556,17 @@ var verifyMagicLink = defineServerAction({
|
|
|
556
556
|
return { token, raw: payload };
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
|
-
var fetchCustomBrandingImpl = async () => {
|
|
559
|
+
var fetchCustomBrandingImpl = async (version) => {
|
|
560
560
|
const appSlug = process.env.PORTAL_APP_SLUG;
|
|
561
561
|
if (!appSlug) {
|
|
562
562
|
throw new Error("PORTAL_APP_SLUG is not configured");
|
|
563
563
|
}
|
|
564
|
-
|
|
564
|
+
let url = `${getApiOrigin()}/enterprise-portal/public/branding?app_slug=${encodeURIComponent(
|
|
565
565
|
appSlug
|
|
566
566
|
)}`;
|
|
567
|
+
if (version) {
|
|
568
|
+
url += `&version=${encodeURIComponent(version)}`;
|
|
569
|
+
}
|
|
567
570
|
if (process.env.NODE_ENV !== "production") {
|
|
568
571
|
console.debug(
|
|
569
572
|
"[portal-components] fetching custom branding via %s (Enterprise Portal API)",
|
|
@@ -592,7 +595,14 @@ var fetchCustomBrandingImpl = async () => {
|
|
|
592
595
|
background: payload.background,
|
|
593
596
|
backgroundImage: payload.backgroundImage,
|
|
594
597
|
customColor1: payload.customColor1,
|
|
595
|
-
customColor2: payload.customColor2
|
|
598
|
+
customColor2: payload.customColor2,
|
|
599
|
+
headerColor: payload.headerColor,
|
|
600
|
+
headerGradientEnd: payload.headerGradientEnd,
|
|
601
|
+
sidebarColor: payload.sidebarColor,
|
|
602
|
+
sidebarGradientEnd: payload.sidebarGradientEnd,
|
|
603
|
+
contentBackgroundColor: payload.contentBackgroundColor,
|
|
604
|
+
contentBackgroundGradientEnd: payload.contentBackgroundGradientEnd,
|
|
605
|
+
customCSS: payload.customCSS
|
|
596
606
|
};
|
|
597
607
|
const brandingData = Buffer.from(JSON.stringify(brandingObject)).toString("base64");
|
|
598
608
|
return {
|
|
@@ -1568,6 +1578,21 @@ var sanitizeUrlForCss = (url) => {
|
|
|
1568
1578
|
const escaped = trimmed.replace(/\\/g, "\\\\").replace(/\)/g, "\\)").replace(/"/g, '\\"').replace(/'/g, "\\'").replace(/[\x00-\x1F\x7F]/g, "");
|
|
1569
1579
|
return escaped;
|
|
1570
1580
|
};
|
|
1581
|
+
var isDarkColor = (hex) => {
|
|
1582
|
+
if (!hex) return false;
|
|
1583
|
+
const normalized = normalizeColor(hex);
|
|
1584
|
+
if (!normalized) return false;
|
|
1585
|
+
let h = normalized.replace("#", "");
|
|
1586
|
+
if (h.length === 3) {
|
|
1587
|
+
h = h.charAt(0) + h.charAt(0) + h.charAt(1) + h.charAt(1) + h.charAt(2) + h.charAt(2);
|
|
1588
|
+
}
|
|
1589
|
+
const r = parseInt(h.substring(0, 2), 16) / 255;
|
|
1590
|
+
const g = parseInt(h.substring(2, 4), 16) / 255;
|
|
1591
|
+
const b = parseInt(h.substring(4, 6), 16) / 255;
|
|
1592
|
+
const toLinear = (c) => c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
1593
|
+
const luminance = 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
|
|
1594
|
+
return luminance < 0.5;
|
|
1595
|
+
};
|
|
1571
1596
|
var decodeBranding = ({ brandingData }) => {
|
|
1572
1597
|
if (!brandingData || typeof brandingData !== "string") {
|
|
1573
1598
|
return {
|
|
@@ -1593,6 +1618,13 @@ var decodeBranding = ({ brandingData }) => {
|
|
|
1593
1618
|
const backgroundImage = sanitizeUrlForCss(parsed.backgroundImage);
|
|
1594
1619
|
const backgroundGradientStart = normalizeColor(parsed.customColor1);
|
|
1595
1620
|
const backgroundGradientEnd = normalizeColor(parsed.customColor2);
|
|
1621
|
+
const headerColor = normalizeColor(parsed.headerColor);
|
|
1622
|
+
const headerGradientEnd = normalizeColor(parsed.headerGradientEnd);
|
|
1623
|
+
const sidebarColor = normalizeColor(parsed.sidebarColor);
|
|
1624
|
+
const sidebarGradientEnd = normalizeColor(parsed.sidebarGradientEnd);
|
|
1625
|
+
const contentBackgroundColor = normalizeColor(parsed.contentBackgroundColor);
|
|
1626
|
+
const contentBackgroundGradientEnd = normalizeColor(parsed.contentBackgroundGradientEnd);
|
|
1627
|
+
const customCSS = typeof parsed.customCSS === "string" ? parsed.customCSS : void 0;
|
|
1596
1628
|
return {
|
|
1597
1629
|
logo,
|
|
1598
1630
|
title,
|
|
@@ -1604,7 +1636,14 @@ var decodeBranding = ({ brandingData }) => {
|
|
|
1604
1636
|
background,
|
|
1605
1637
|
backgroundImage,
|
|
1606
1638
|
backgroundGradientStart,
|
|
1607
|
-
backgroundGradientEnd
|
|
1639
|
+
backgroundGradientEnd,
|
|
1640
|
+
headerColor,
|
|
1641
|
+
headerGradientEnd,
|
|
1642
|
+
sidebarColor,
|
|
1643
|
+
sidebarGradientEnd,
|
|
1644
|
+
contentBackgroundColor,
|
|
1645
|
+
contentBackgroundGradientEnd,
|
|
1646
|
+
customCSS
|
|
1608
1647
|
};
|
|
1609
1648
|
} catch (error) {
|
|
1610
1649
|
console.debug("[portal-components] unable to parse branding JSON", error);
|
|
@@ -1617,10 +1656,13 @@ var decodeBranding = ({ brandingData }) => {
|
|
|
1617
1656
|
function UserMenuDropdown({
|
|
1618
1657
|
displayLabel,
|
|
1619
1658
|
children,
|
|
1620
|
-
className = ""
|
|
1659
|
+
className = "",
|
|
1660
|
+
dark = false
|
|
1621
1661
|
}) {
|
|
1662
|
+
const summaryClass = dark ? "flex cursor-pointer items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-white/90 hover:bg-white/10 transition-colors list-none border border-transparent hover:border-white/20" : "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";
|
|
1663
|
+
const chevronClass = dark ? "h-4 w-4 text-white/50 transition-transform group-open:rotate-180" : "h-4 w-4 text-gray-500 transition-transform group-open:rotate-180";
|
|
1622
1664
|
return /* @__PURE__ */ jsxs("details", { className: `group relative ${className}`, children: [
|
|
1623
|
-
/* @__PURE__ */ jsxs("summary", { className:
|
|
1665
|
+
/* @__PURE__ */ jsxs("summary", { className: summaryClass, children: [
|
|
1624
1666
|
/* @__PURE__ */ jsx(User, { className: "h-4 w-4" }),
|
|
1625
1667
|
/* @__PURE__ */ jsx("span", { children: displayLabel }),
|
|
1626
1668
|
/* @__PURE__ */ jsx(
|
|
@@ -1635,7 +1677,7 @@ function UserMenuDropdown({
|
|
|
1635
1677
|
strokeWidth: "2",
|
|
1636
1678
|
strokeLinecap: "round",
|
|
1637
1679
|
strokeLinejoin: "round",
|
|
1638
|
-
className:
|
|
1680
|
+
className: chevronClass,
|
|
1639
1681
|
children: /* @__PURE__ */ jsx("polyline", { points: "6 9 12 15 18 9" })
|
|
1640
1682
|
}
|
|
1641
1683
|
)
|
|
@@ -2783,6 +2825,6 @@ async function handleSamlAcs(request) {
|
|
|
2783
2825
|
// src/index.ts
|
|
2784
2826
|
var portalComponentsVersion = package_default.version;
|
|
2785
2827
|
|
|
2786
|
-
export { Button, DEFAULT_FAVICON, DEFAULT_PRIMARY_COLOR, DEFAULT_SECONDARY_COLOR, LicenseDetails, SupportCard, TeamSettingsCard, TopNav, UnauthorizedError, UpdateLayout, UpdatesCard, UserSettings, UserSettingsCard, authenticatedFetch, convertToReleaseEntry, createPortalTheme, decodeBranding, decodeJwtPayload, defaultTopNavLinks, defineServerAction, deleteSupportBundle, downloadSecuritySBOM, downloadSupportBundle, fetchCurrentUser, fetchCustomBranding, fetchDashboardComposite, fetchLicense, fetchNotifications, formatBytes, formatDate, formatDateShort, formatDateTime, formatDateTimeLocal, getCustomerIdFromToken, getSecurityInfo, getSecurityInfoDiff, getSecurityInfoSBOM, getSupportBundleUploadUrl, handleSamlAcs, initiateLogin, isHttpApiOrigin, isRedirectError, listReleases, listSupportBundles, normalizeColor, portalComponentsVersion, portalThemeTokens, sanitizeUrlForCss, setSamlSessionImpl, updateNotifications, updateUser, uploadSupportBundle, uploadSupportBundleWithProgress, validateSession, verifyMagicLink };
|
|
2828
|
+
export { Button, DEFAULT_FAVICON, DEFAULT_PRIMARY_COLOR, DEFAULT_SECONDARY_COLOR, LicenseDetails, SupportCard, TeamSettingsCard, TopNav, UnauthorizedError, UpdateLayout, UpdatesCard, UserSettings, UserSettingsCard, authenticatedFetch, convertToReleaseEntry, createPortalTheme, decodeBranding, decodeJwtPayload, defaultTopNavLinks, defineServerAction, deleteSupportBundle, downloadSecuritySBOM, downloadSupportBundle, fetchCurrentUser, fetchCustomBranding, fetchDashboardComposite, fetchLicense, fetchNotifications, formatBytes, formatDate, formatDateShort, formatDateTime, formatDateTimeLocal, getCustomerIdFromToken, getSecurityInfo, getSecurityInfoDiff, getSecurityInfoSBOM, getSupportBundleUploadUrl, handleSamlAcs, initiateLogin, isDarkColor, isHttpApiOrigin, isRedirectError, listReleases, listSupportBundles, normalizeColor, portalComponentsVersion, portalThemeTokens, sanitizeUrlForCss, setSamlSessionImpl, updateNotifications, updateUser, uploadSupportBundle, uploadSupportBundleWithProgress, validateSession, verifyMagicLink };
|
|
2787
2829
|
//# sourceMappingURL=index.js.map
|
|
2788
2830
|
//# sourceMappingURL=index.js.map
|