@ethora/chat-component 26.4.2 → 26.4.5

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.
@@ -13,6 +13,57 @@ export interface FBConfig {
13
13
  messagingSenderId: string;
14
14
  appId: string;
15
15
  }
16
+ /**
17
+ * A single self-hosted font file to register via an injected `@font-face`
18
+ * rule. Use this for fonts that are not on Google Fonts — e.g. the Ukrainian
19
+ * government "e-Ukraine" family distributed from thedigital.gov.ua. Host the
20
+ * `.woff2`/`.ttf` somewhere reachable and point `src` at it.
21
+ */
22
+ export interface FontFaceSource {
23
+ /** The `font-family` name this file provides, e.g. "e-Ukraine". */
24
+ family: string;
25
+ /** Absolute or relative URL to the font file (`.woff2`, `.woff`, `.ttf`, `.otf`). */
26
+ src: string;
27
+ /** Numeric weight this file covers (e.g. 400, 500, 700). Default 400. */
28
+ weight?: number | string;
29
+ /** Style this file covers. Default "normal". */
30
+ style?: 'normal' | 'italic';
31
+ /** `font-display` strategy. Default "swap" to avoid invisible text. */
32
+ display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
33
+ }
34
+ /**
35
+ * Font configuration for the chat UI. When omitted, the component keeps its
36
+ * default system font stack, so existing integrations are unaffected.
37
+ *
38
+ * Two loading paths are supported and can be combined:
39
+ * - `googleFontsUrl` / `googleFontsFamily` → a Google Fonts stylesheet is
40
+ * injected at runtime (no host setup needed).
41
+ * - `fontFaces` → `@font-face` rules are injected for self-hosted files
42
+ * (e.g. e-Ukraine).
43
+ *
44
+ * `fontFamily` is the family actually applied to the chat (via the
45
+ * `--ethora-font-family` CSS variable). It should match a family you loaded
46
+ * above, optionally followed by fallbacks, e.g. "e-Ukraine, Inter, sans-serif".
47
+ */
48
+ export interface TypographyConfig {
49
+ /** Family applied to the chat UI, optionally with fallbacks. */
50
+ fontFamily?: string;
51
+ /** A full Google Fonts stylesheet URL, e.g.
52
+ * "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap". */
53
+ googleFontsUrl?: string;
54
+ /** Convenience: a Google family name (e.g. "Inter"); a stylesheet URL is
55
+ * built for the weights below. Ignored if `googleFontsUrl` is set. */
56
+ googleFontsFamily?: string;
57
+ /** Self-hosted `@font-face` sources (e.g. e-Ukraine .woff2 files). */
58
+ fontFaces?: FontFaceSource[];
59
+ /** Weight tokens used by the chat; also drives the generated Google URL. */
60
+ weights?: {
61
+ regular?: number;
62
+ medium?: number;
63
+ semibold?: number;
64
+ bold?: number;
65
+ };
66
+ }
16
67
  export interface IConfig {
17
68
  appId?: string;
18
69
  disableHeader?: boolean;
@@ -21,6 +72,8 @@ export interface IConfig {
21
72
  primary: string;
22
73
  secondary: string;
23
74
  };
75
+ /** Configurable font family / weights for the chat UI. See TypographyConfig. */
76
+ typography?: TypographyConfig;
24
77
  googleLogin?: {
25
78
  enabled: boolean;
26
79
  firebaseConfig: FBConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethora/chat-component",
3
- "version": "26.4.2",
3
+ "version": "26.4.5",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",