tycho-components 0.44.2 → 0.44.3

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.
@@ -18,6 +18,14 @@ export type BrandConfig = {
18
18
  };
19
19
  };
20
20
  export declare function brandAssetBase(brandId: BrandId, originRaw: string | undefined): string;
21
+ /**
22
+ * Absolute platform logo URL: `{origin}/brands/{id}/logo.png`.
23
+ * Use in shell pages that cannot take an AppCode (NotFound, etc.).
24
+ */
25
+ export declare function resolveBrandLogo(options?: {
26
+ brandId?: string;
27
+ origin?: string;
28
+ }): string;
21
29
  /**
22
30
  * Resolve platform branding for a front-end app.
23
31
  * Pass `options` from Vite plugins (Node) where `import.meta.env` may be unavailable.
@@ -49,6 +49,15 @@ function readEnvOrigin() {
49
49
  return undefined;
50
50
  }
51
51
  }
52
+ /**
53
+ * Absolute platform logo URL: `{origin}/brands/{id}/logo.png`.
54
+ * Use in shell pages that cannot take an AppCode (NotFound, etc.).
55
+ */
56
+ export function resolveBrandLogo(options) {
57
+ const id = resolveBrandId(options?.brandId ?? readEnvBrandId());
58
+ const origin = options?.origin ?? readEnvOrigin();
59
+ return `${brandAssetBase(id, origin)}/logo.png`;
60
+ }
52
61
  /**
53
62
  * Resolve platform branding for a front-end app.
54
63
  * Pass `options` from Vite plugins (Node) where `import.meta.env` may be unavailable.
@@ -73,7 +82,7 @@ export function createBrand(app, options) {
73
82
  id,
74
83
  ...meta,
75
84
  faviconBase,
76
- logo: `${faviconBase}/logo.png`,
85
+ logo: resolveBrandLogo({ brandId: id, origin }),
77
86
  socialMedia: {
78
87
  youtube: DEFAULT_YOUTUBE,
79
88
  },
@@ -35,7 +35,7 @@ export { useCorpusUtils } from "./useCorpusUtils";
35
35
  export { useLoggedUtils } from "./useLoggedUtils";
36
36
  export { useMessageUtils } from "./useMessageUtils";
37
37
  export { useTourUtils } from "./useTourUtils";
38
- export { brandAssetBase, brandFromEnv, createBrand, } from "./brand";
38
+ export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, } from "./brand";
39
39
  export type { AppCode, BrandConfig, BrandId } from "./brand";
40
40
  export { useDriverTour, loadKnowledgeBase, defaultMatchPathnames, buildAnchorMap, flattenWorkflowSteps, getWorkflowsForPath, buildDriveSteps, createTourDriver, hasMatchingWorkflow, resolveAnchor, resolveAnchorById, waitForSelector, localizeKnowledgeBase, pickLocalizedString, resolveTourLocale, TOUR_FALLBACK_LOCALE, TOUR_LOCALES, } from "./tour";
41
41
  export type { AnchorSelector, Driver, KnowledgeBase, KnowledgeBaseRaw, LocalizedString, PopoverSide, ResolveKnowledgeBaseUrl, TourAnchor, TourButtonLabels, TourStep, TourStepCopy, TourStepStructural, TourWorkflow, TourWorkflowRaw, UseDriverTourOptions, } from "./tour";
@@ -19,5 +19,5 @@ export { useCorpusUtils } from "./useCorpusUtils";
19
19
  export { useLoggedUtils } from "./useLoggedUtils";
20
20
  export { useMessageUtils } from "./useMessageUtils";
21
21
  export { useTourUtils } from "./useTourUtils";
22
- export { brandAssetBase, brandFromEnv, createBrand, } from "./brand";
22
+ export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, } from "./brand";
23
23
  export { useDriverTour, loadKnowledgeBase, defaultMatchPathnames, buildAnchorMap, flattenWorkflowSteps, getWorkflowsForPath, buildDriveSteps, createTourDriver, hasMatchingWorkflow, resolveAnchor, resolveAnchorById, waitForSelector, localizeKnowledgeBase, pickLocalizedString, resolveTourLocale, TOUR_FALLBACK_LOCALE, TOUR_LOCALES, } from "./tour";
@@ -3,8 +3,8 @@ import { useEffect } from "react";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import { useNavigate, useRouteError } from "react-router-dom";
5
5
  import { dispatchAccessDeniedError, dispatchClientError, isAccessDeniedApiError, } from "../../configs/api";
6
+ import { resolveBrandLogo } from "../../configs/brand";
6
7
  import CookieStorage from "../../configs/CookieStorage";
7
- import logo from "./logo.png";
8
8
  import "./style.scss";
9
9
  /** Survives remounts so context updates from the toast cannot re-dispatch forever. */
10
10
  let routeErrorReported = false;
@@ -64,7 +64,7 @@ export default function ErrorFound() {
64
64
  const redirectUri = CookieStorage.getRedirectUri();
65
65
  redirectUri ? (window.location.href = redirectUri) : handleRedirect();
66
66
  };
67
- return (_jsx("div", { className: "box-container", children: _jsxs("div", { className: "box", children: [_jsx("img", { src: logo, alt: "" }), _jsx("div", { className: "title", children: accessDenied
67
+ return (_jsx("div", { className: "box-container", children: _jsxs("div", { className: "box", children: [_jsx("img", { src: resolveBrandLogo(), alt: "" }), _jsx("div", { className: "title", children: accessDenied
68
68
  ? t("unauthorized.label.disclaimer")
69
69
  : t("label.error.found") })] }) }));
70
70
  }
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { useNavigate } from 'react-router-dom';
4
- import logo from './logo.png';
4
+ import { resolveBrandLogo } from '../../configs/brand';
5
5
  import './style.scss';
6
6
  export default function NotFound() {
7
7
  const navigate = useNavigate();
@@ -9,5 +9,5 @@ export default function NotFound() {
9
9
  const handleRedirect = () => {
10
10
  navigate('/', { replace: true });
11
11
  };
12
- return (_jsx("div", { className: "box-container", children: _jsxs("div", { className: "box", children: [_jsx("img", { src: logo }), _jsx("div", { className: "title", children: t('notfound.label.disclaimer') }), _jsx("div", { className: "subtitle", onClick: handleRedirect, children: t('label.redirect') })] }) }));
12
+ return (_jsx("div", { className: "box-container", children: _jsxs("div", { className: "box", children: [_jsx("img", { src: resolveBrandLogo(), alt: "" }), _jsx("div", { className: "title", children: t('notfound.label.disclaimer') }), _jsx("div", { className: "subtitle", onClick: handleRedirect, children: t('label.redirect') })] }) }));
13
13
  }
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import logo from './logo.png';
3
2
  import { useTranslation } from 'react-i18next';
4
3
  import './style.scss';
4
+ import { resolveBrandLogo } from '../../configs/brand';
5
5
  import CookieStorage from '../../configs/CookieStorage';
6
6
  import { useLoggedUtils } from '../../configs/useLoggedUtils';
7
7
  export default function Unauthorized() {
@@ -12,5 +12,5 @@ export default function Unauthorized() {
12
12
  setLogged(undefined);
13
13
  window.location.replace(import.meta.env.VITE_APP_AUTH_URL);
14
14
  };
15
- return (_jsx("div", { className: "box-container", children: _jsxs("div", { className: "box", children: [_jsx("img", { src: logo }), _jsx("div", { className: "title", children: t('unauthorized.label.disclaimer') }), _jsx("div", { className: "subtitle", onClick: handleRedirect, children: t('unauthorized.label.redirect') })] }) }));
15
+ return (_jsx("div", { className: "box-container", children: _jsxs("div", { className: "box", children: [_jsx("img", { src: resolveBrandLogo(), alt: "" }), _jsx("div", { className: "title", children: t('unauthorized.label.disclaimer') }), _jsx("div", { className: "subtitle", onClick: handleRedirect, children: t('unauthorized.label.redirect') })] }) }));
16
16
  }
@@ -7,8 +7,8 @@ import { useCorpusUtils } from "../../../configs/useCorpusUtils";
7
7
  import { useLoggedUtils } from "../../../configs/useLoggedUtils";
8
8
  import HeaderButtons from "../HeaderButtons";
9
9
  import HeaderUser from "../HeaderUser";
10
+ import { resolveBrandLogo } from "../../../configs/brand";
10
11
  import { AvailableApps } from "../types/App";
11
- import logo from "./logo.png";
12
12
  import youtube from "./youtube.png";
13
13
  import "./style.scss";
14
14
  export default function HeaderApps({ navigateLogout, navigateNotLogged, hideKeyboard, notifications, keyboardLayout, helpActions, brand, socialMedia, }) {
@@ -20,7 +20,7 @@ export default function HeaderApps({ navigateLogout, navigateNotLogged, hideKeyb
20
20
  const resources = [
21
21
  {
22
22
  code: "platform",
23
- image: brand?.logo || logo,
23
+ image: brand?.logo || resolveBrandLogo(),
24
24
  visibility: "public",
25
25
  external: platformOrigin || undefined,
26
26
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.44.2",
4
+ "version": "0.44.3",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
Binary file