@unisphere/genie-types 1.24.2 → 1.25.1

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/index.esm.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { createUseTranslation } from '@unisphere/ui-i18n-react';
2
+
1
3
  /** Widget name constant for all Genie experiences */
2
4
  const widgetName = 'unisphere.widget.genie';
3
5
 
@@ -1238,17 +1240,29 @@ const getSourceUrlSchema = {
1238
1240
  type: 'function',
1239
1241
  optional: true
1240
1242
  };
1243
+ const schemaVersionSchema = {
1244
+ type: 'literal',
1245
+ value: '1',
1246
+ optional: true
1247
+ };
1241
1248
 
1242
1249
  /** Runtime name constant for chat experiences */
1243
1250
  const ChatRuntimeName = 'chat';
1251
+ const agentModeSchema = {
1252
+ type: 'primitive',
1253
+ value: 'boolean',
1254
+ optional: true
1255
+ };
1256
+ const avatarContainerModeSchema = {
1257
+ type: 'enum',
1258
+ values: ['dialog', 'contained'],
1259
+ optional: true,
1260
+ deprecationMessage: 'This field is no longer required and will be ignored if provided'
1261
+ };
1244
1262
  const chatRuntimeSettingsSchema = {
1245
1263
  type: 'object',
1246
1264
  properties: {
1247
- schemaVersion: {
1248
- type: 'literal',
1249
- value: '1',
1250
- optional: true
1251
- },
1265
+ schemaVersion: schemaVersionSchema,
1252
1266
  genieServerUrl: {
1253
1267
  type: 'primitive',
1254
1268
  value: 'string',
@@ -1363,16 +1377,36 @@ const chatRuntimeSettingsSchema = {
1363
1377
  optional: true,
1364
1378
  deprecationMessage: 'Use context instead: { type: "entry", id: "your-entry-id" }'
1365
1379
  },
1366
- agentMode: {
1367
- type: 'primitive',
1368
- value: 'boolean',
1369
- optional: true
1370
- },
1380
+ agentMode: agentModeSchema,
1371
1381
  // @deprecated - no longer supported
1372
- avatarContainerMode: {
1373
- type: 'enum',
1374
- values: ['dialog', 'contained'],
1375
- optional: true
1382
+ avatarContainerMode: avatarContainerModeSchema,
1383
+ initialThread: {
1384
+ type: 'orByType',
1385
+ optional: true,
1386
+ schemas: {
1387
+ threadId: {
1388
+ type: 'object',
1389
+ properties: {
1390
+ type: {
1391
+ type: 'literal',
1392
+ value: 'threadId'
1393
+ },
1394
+ threadId: {
1395
+ type: 'primitive',
1396
+ value: 'string'
1397
+ }
1398
+ }
1399
+ },
1400
+ lastThreadByContext: {
1401
+ type: 'object',
1402
+ properties: {
1403
+ type: {
1404
+ type: 'literal',
1405
+ value: 'lastThreadByContext'
1406
+ }
1407
+ }
1408
+ }
1409
+ }
1376
1410
  }
1377
1411
  }
1378
1412
  };
@@ -1385,11 +1419,7 @@ const chatRuntimePlayerPluginSettingsSchema = {
1385
1419
  value: 'string',
1386
1420
  optional: true
1387
1421
  },
1388
- schemaVersion: {
1389
- type: 'literal',
1390
- value: '1',
1391
- optional: true
1392
- },
1422
+ schemaVersion: schemaVersionSchema,
1393
1423
  kalturaServerURI: {
1394
1424
  type: 'primitive',
1395
1425
  value: 'string',
@@ -1411,16 +1441,8 @@ const chatRuntimePlayerPluginSettingsSchema = {
1411
1441
  },
1412
1442
  integrations: integrationsSchema,
1413
1443
  shareUrl: shareUrlSchema,
1414
- agentMode: {
1415
- type: 'primitive',
1416
- value: 'boolean',
1417
- optional: true
1418
- },
1419
- avatarContainerMode: {
1420
- type: 'enum',
1421
- values: ['dialog', 'contained'],
1422
- optional: true
1423
- }
1444
+ agentMode: agentModeSchema,
1445
+ avatarContainerMode: avatarContainerModeSchema
1424
1446
  }
1425
1447
  };
1426
1448
 
@@ -1500,6 +1522,7 @@ const chatCustomizationSchema = {
1500
1522
  type: 'object',
1501
1523
  optional: true,
1502
1524
  allowUnknownProperties: true,
1525
+ deprecationMessage: 'newThread has been deprecated. Use "thread" configuration parameter',
1503
1526
  properties: {
1504
1527
  mode: {
1505
1528
  type: 'primitive',
@@ -1550,7 +1573,7 @@ const chatCustomizationSchema = {
1550
1573
  properties: {
1551
1574
  type: {
1552
1575
  type: 'enum',
1553
- values: ['default', 'banner'],
1576
+ values: ['default', 'banner', 'chatThread'],
1554
1577
  optional: true
1555
1578
  },
1556
1579
  title: {
@@ -1589,25 +1612,92 @@ const chatCustomizationSchema = {
1589
1612
  value: 'string'
1590
1613
  }
1591
1614
  }
1615
+ },
1616
+ openingSystemMessage: {
1617
+ type: 'primitive',
1618
+ value: 'string',
1619
+ optional: true
1620
+ }
1621
+ }
1622
+ },
1623
+ thread: {
1624
+ type: 'object',
1625
+ optional: true,
1626
+ properties: {
1627
+ enabled: {
1628
+ type: 'primitive',
1629
+ value: 'boolean',
1630
+ optional: true
1631
+ },
1632
+ newThread: {
1633
+ type: 'object',
1634
+ optional: true,
1635
+ properties: {
1636
+ enabled: {
1637
+ type: 'primitive',
1638
+ value: 'boolean',
1639
+ optional: true
1640
+ },
1641
+ type: {
1642
+ type: 'enum',
1643
+ values: ['default', 'clear'],
1644
+ optional: true
1645
+ },
1646
+ label: {
1647
+ type: 'primitive',
1648
+ value: 'string',
1649
+ optional: true
1650
+ }
1651
+ }
1652
+ },
1653
+ history: {
1654
+ type: 'object',
1655
+ optional: true,
1656
+ properties: {
1657
+ enabled: {
1658
+ type: 'primitive',
1659
+ value: 'boolean',
1660
+ optional: true
1661
+ }
1662
+ }
1592
1663
  }
1593
1664
  }
1594
1665
  }
1595
1666
  }
1596
1667
  };
1597
1668
 
1598
- const floaterVisualSettingsSchema = {
1669
+ // ---------- Schema constants ----------
1670
+ const scrollSchema = {
1671
+ type: 'enum',
1672
+ values: ['body', 'container', 'modal'],
1673
+ optional: true
1674
+ };
1675
+ const modeSchema = {
1676
+ type: 'enum',
1677
+ values: ['chat', 'everywhere'],
1678
+ optional: true
1679
+ };
1680
+ const initialQuestionSchema = {
1599
1681
  type: 'object',
1682
+ optional: true,
1600
1683
  properties: {
1601
- schemaVersion: {
1602
- type: 'literal',
1603
- value: '1',
1604
- optional: true
1684
+ question: {
1685
+ type: 'primitive',
1686
+ value: 'string'
1605
1687
  },
1606
- mode: {
1688
+ answerType: {
1607
1689
  type: 'enum',
1608
- values: ['chat', 'everywhere'],
1690
+ values: Object.values(AnswerTypeEnum),
1609
1691
  optional: true
1610
- },
1692
+ }
1693
+ }
1694
+ };
1695
+ // ---------- Schemas ----------
1696
+ const floaterVisualSettingsSchema = {
1697
+ type: 'object',
1698
+ properties: {
1699
+ schemaVersion: schemaVersionSchema,
1700
+ mode: modeSchema,
1611
1701
  context: chatContextSchema,
1612
1702
  customization: chatCustomizationSchema
1613
1703
  }
@@ -1615,21 +1705,13 @@ const floaterVisualSettingsSchema = {
1615
1705
  const floaterCTAVisualSettingsSchema = {
1616
1706
  type: 'object',
1617
1707
  properties: {
1618
- schemaVersion: {
1619
- type: 'literal',
1620
- value: '1',
1621
- optional: true
1622
- },
1708
+ schemaVersion: schemaVersionSchema,
1623
1709
  position: {
1624
1710
  type: 'enum',
1625
1711
  values: ['bottom-right', 'bottom-center', 'bottom-left'],
1626
1712
  optional: true
1627
1713
  },
1628
- mode: {
1629
- type: 'enum',
1630
- values: ['chat', 'everywhere'],
1631
- optional: true
1632
- },
1714
+ mode: modeSchema,
1633
1715
  openByDefault: {
1634
1716
  type: 'primitive',
1635
1717
  value: 'boolean',
@@ -1657,16 +1739,8 @@ const floaterCTAVisualSettingsSchema = {
1657
1739
  const containedVisualSettingsSchema = {
1658
1740
  type: 'object',
1659
1741
  properties: {
1660
- schemaVersion: {
1661
- type: 'literal',
1662
- value: '1',
1663
- optional: true
1664
- },
1665
- mode: {
1666
- type: 'enum',
1667
- values: ['chat', 'everywhere'],
1668
- optional: true
1669
- },
1742
+ schemaVersion: schemaVersionSchema,
1743
+ mode: modeSchema,
1670
1744
  customization: chatCustomizationSchema,
1671
1745
  onRequestClose: {
1672
1746
  type: 'function',
@@ -1681,11 +1755,7 @@ const containedVisualSettingsSchema = {
1681
1755
  value: 'boolean',
1682
1756
  optional: true
1683
1757
  },
1684
- scroll: {
1685
- type: 'enum',
1686
- values: ['body', 'container', 'modal'],
1687
- optional: true
1688
- },
1758
+ scroll: scrollSchema,
1689
1759
  context: chatContextSchema,
1690
1760
  closeButtonType: {
1691
1761
  type: 'enum',
@@ -1742,43 +1812,17 @@ const pageContextSchema = {
1742
1812
  const pageVisualSettingsSchema = {
1743
1813
  type: 'object',
1744
1814
  properties: {
1745
- schemaVersion: {
1746
- type: 'literal',
1747
- value: '1',
1748
- optional: true
1749
- },
1750
- scroll: {
1751
- type: 'enum',
1752
- values: ['body', 'container', 'modal'],
1753
- optional: true
1754
- },
1815
+ schemaVersion: schemaVersionSchema,
1816
+ scroll: scrollSchema,
1755
1817
  customization: chatCustomizationSchema,
1756
1818
  context: pageContextSchema,
1757
- initialQuestion: {
1758
- type: 'object',
1759
- optional: true,
1760
- properties: {
1761
- question: {
1762
- type: 'primitive',
1763
- value: 'string'
1764
- },
1765
- answerType: {
1766
- type: 'enum',
1767
- values: Object.values(AnswerTypeEnum),
1768
- optional: true
1769
- }
1770
- }
1771
- }
1819
+ initialQuestion: initialQuestionSchema
1772
1820
  }
1773
1821
  };
1774
1822
  const bannerVisualSettingsSchema = {
1775
1823
  type: 'object',
1776
1824
  properties: {
1777
- schemaVersion: {
1778
- type: 'literal',
1779
- value: '1',
1780
- optional: true
1781
- },
1825
+ schemaVersion: schemaVersionSchema,
1782
1826
  title: {
1783
1827
  type: 'primitive',
1784
1828
  value: 'string',
@@ -1825,32 +1869,10 @@ const bannerVisualSettingsSchema = {
1825
1869
  const popupVisualSettingsSchema = {
1826
1870
  type: 'object',
1827
1871
  properties: {
1828
- schemaVersion: {
1829
- type: 'literal',
1830
- value: '1',
1831
- optional: true
1832
- },
1833
- scroll: {
1834
- type: 'enum',
1835
- values: ['body', 'container', 'modal'],
1836
- optional: true
1837
- },
1872
+ schemaVersion: schemaVersionSchema,
1873
+ scroll: scrollSchema,
1838
1874
  customization: chatCustomizationSchema,
1839
- initialQuestion: {
1840
- type: 'object',
1841
- optional: true,
1842
- properties: {
1843
- question: {
1844
- type: 'primitive',
1845
- value: 'string'
1846
- },
1847
- answerType: {
1848
- type: 'enum',
1849
- values: Object.values(AnswerTypeEnum),
1850
- optional: true
1851
- }
1852
- }
1853
- }
1875
+ initialQuestion: initialQuestionSchema
1854
1876
  }
1855
1877
  };
1856
1878
 
@@ -3212,4 +3234,16 @@ const blockVisualContextSchema = {
3212
3234
  }
3213
3235
  };
3214
3236
 
3215
- export { AVATAR_DEFAULT_CAPABILITIES, AnswerModelEnum, AnswerTypeEnum, AvatarConnectionStatus, AvatarRuntimeName, CHAT_CONTEXT_TYPE, CHAT_CONTEXT_TYPE_GLOBAL, CHAT_DEFAULT_CAPABILITIES, ChatRuntimeName, DeviceType, DisconnectReasons, SUPPORTED_LAYOUT_TYPES, avatarRuntimeChatVisualSettingsSchema, avatarRuntimeContainedVisualSettingsSchema, avatarRuntimeFloaterVisualSettingsSchema, avatarRuntimeSettingsSchema, bannerVisualSettingsSchema, blockVisualContextSchema, chatContextSchema, chatCustomizationSchema, chatRuntimePlayerPluginSettingsSchema, chatRuntimeSettingsSchema, containedVisualSettingsSchema, floaterCTAVisualSettingsSchema, floaterVisualSettingsSchema, getAvatarDefaultCapabilities, getChatDefaultCapabilities, getResolvedRuntimeName, getResolvedWidgetName, getSourceUrlSchema, integrationsSchema, isAvatarConnectionProxyInternalType, pageVisualSettingsSchema, popupVisualSettingsSchema, shareUrlSchema, widgetName };
3237
+ var en = {
3238
+
3239
+ };
3240
+
3241
+ const supportedLanguages = ['en-US'];
3242
+
3243
+ const useTranslation = createUseTranslation({
3244
+ packageName: '@unisphere/genie-types',
3245
+ defaultTranslations: en,
3246
+ supportedLanguages
3247
+ });
3248
+
3249
+ export { AVATAR_DEFAULT_CAPABILITIES, AnswerModelEnum, AnswerTypeEnum, AvatarConnectionStatus, AvatarRuntimeName, CHAT_CONTEXT_TYPE, CHAT_CONTEXT_TYPE_GLOBAL, CHAT_DEFAULT_CAPABILITIES, ChatRuntimeName, DeviceType, DisconnectReasons, SUPPORTED_LAYOUT_TYPES, agentModeSchema, avatarContainerModeSchema, avatarRuntimeChatVisualSettingsSchema, avatarRuntimeContainedVisualSettingsSchema, avatarRuntimeFloaterVisualSettingsSchema, avatarRuntimeSettingsSchema, bannerVisualSettingsSchema, blockVisualContextSchema, chatContextSchema, chatCustomizationSchema, chatRuntimePlayerPluginSettingsSchema, chatRuntimeSettingsSchema, containedVisualSettingsSchema, floaterCTAVisualSettingsSchema, floaterVisualSettingsSchema, getAvatarDefaultCapabilities, getChatDefaultCapabilities, getResolvedRuntimeName, getResolvedWidgetName, getSourceUrlSchema, integrationsSchema, isAvatarConnectionProxyInternalType, pageVisualSettingsSchema, popupVisualSettingsSchema, schemaVersionSchema, shareUrlSchema, useTranslation, widgetName };
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/genie-types",
3
- "version": "1.24.2",
3
+ "version": "1.25.1",
4
4
  "author": "kaltura",
5
5
  "license": "AGPL-3.0",
6
6
  "repository": {
@@ -11,8 +11,9 @@
11
11
  "dependencies": {
12
12
  "@kaltura-sdk/rtc-core": "^1.25.13",
13
13
  "@unisphere/core": "^1.99.0",
14
- "@unisphere/runtime": "^1.97.0",
15
- "@unisphere/runtime-js": "^1.96.0"
14
+ "@unisphere/runtime": "^1.98.0",
15
+ "@unisphere/runtime-js": "^1.96.0",
16
+ "@unisphere/ui-i18n-react": "^1.70.1"
16
17
  },
17
18
  "module": "./index.esm.js",
18
19
  "type": "module",
package/src/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from './lib/types';
5
5
  export * from './lib/avatar-runtime';
6
6
  export * from './lib/chat-customizations-types';
7
7
  export * from './lib/general-visual-types';
8
+ export { useTranslation } from './lib/use-translation';
@@ -0,0 +1 @@
1
+ export declare const supportedLanguages: string[];
@@ -47,7 +47,9 @@ export interface ChatCustomization {
47
47
  /** Indicates genie is embedded inside Kaltura Studio (preview mode) */
48
48
  isPreviewMode?: boolean;
49
49
  };
50
- /** New conversation thread settings */
50
+ /** New conversation thread settings
51
+ * @deprecated
52
+ * */
51
53
  newThread?: {
52
54
  /** Show/hide the new thread button */
53
55
  buttonVisible?: boolean;
@@ -59,13 +61,15 @@ export interface ChatCustomization {
59
61
  /** Initial landing page configuration */
60
62
  initialPage?: {
61
63
  /** Page layout type: 'default' for standard, 'banner' for hero-style */
62
- type?: 'default' | 'banner';
64
+ type?: 'default' | 'banner' | 'chatThread';
63
65
  /** Page title text */
64
66
  title?: string;
65
67
  /** Suggested questions to display on landing page */
66
68
  initialQuestions?: InitialQuestion[];
67
69
  /** Background image configuration */
68
70
  background?: Background;
71
+ /** Opening system message that will appear in the beginning of all threads */
72
+ openingSystemMessage?: string;
69
73
  };
70
74
  /** Layout options for the chat interface */
71
75
  layouts?: {
@@ -77,6 +81,25 @@ export interface ChatCustomization {
77
81
  } | {
78
82
  stage: 'fullscreen';
79
83
  };
84
+ /** thread configuration */
85
+ thread?: {
86
+ /** enabled by default */
87
+ enabled?: boolean;
88
+ /** new thread button/menu item */
89
+ newThread?: {
90
+ /** show/hide enabled by default */
91
+ enabled?: boolean;
92
+ /** default is new thread, changes label and icon */
93
+ type?: 'default' | 'clear';
94
+ /** label override */
95
+ label?: string;
96
+ };
97
+ /** history button/menu item */
98
+ history?: {
99
+ /** show/hide enabled by default */
100
+ enabled?: boolean;
101
+ };
102
+ };
80
103
  }
81
104
  /**
82
105
  * Suggested question for initial chat page.
@@ -1,8 +1,7 @@
1
1
  import { UnisphereRuntimeBaseType } from '@unisphere/runtime';
2
2
  import { ValidatorSchema } from '@unisphere/core';
3
3
  import { widgetName } from '../widget-types';
4
- import { ChatRuntimeName } from './runtime-types';
5
- import { GlobalChatSettings } from './shared-settings';
4
+ import { ChatRuntimeName, BaseChatRuntimeSettings } from './runtime-types';
6
5
  /**
7
6
  * Chat runtime interface for player plugin integration.
8
7
  *
@@ -42,22 +41,10 @@ export interface ChatRuntimePlayerPlugin extends UnisphereRuntimeBaseType<ChatRu
42
41
  * };
43
42
  * ```
44
43
  */
45
- export interface ChatRuntimePlayerPluginSettings {
46
- /** Context for the chat session */
47
- context?: GlobalChatSettings['context'];
48
- /** Kaltura session token for authentication */
49
- ks?: string;
50
- /** Kaltura partner ID */
51
- partnerId?: string;
52
- /** Settings schema version */
53
- schemaVersion?: '1';
54
- /** External service integrations */
55
- integrations?: GlobalChatSettings['integrations'];
56
- /** Configuration for conversation sharing */
57
- shareUrl?: GlobalChatSettings['shareUrl'];
58
- /** Enable agent mode for advanced AI capabilities */
59
- agentMode?: boolean;
60
- /** @deprecated Use customization.avatar.stage instead */
61
- avatarContainerMode?: 'dialog' | 'contained';
44
+ export interface ChatRuntimePlayerPluginSettings extends BaseChatRuntimeSettings {
45
+ /** @deprecated This field is no longer required and will be ignored if provided */
46
+ kalturaServerURI?: string;
47
+ /** @deprecated Use context instead: { type: "entry", id: "your-entry-id" } */
48
+ entryId?: string;
62
49
  }
63
50
  export declare const chatRuntimePlayerPluginSettingsSchema: ValidatorSchema;
@@ -15,6 +15,32 @@ export interface ChatRuntime extends UnisphereRuntimeBaseType<ChatRuntimeSetting
15
15
  readonly runtimeName: typeof ChatRuntimeName;
16
16
  readonly flavor: '';
17
17
  }
18
+ /** Shared settings fields between ChatRuntimeSettings and ChatRuntimePlayerPluginSettings. */
19
+ export interface BaseChatRuntimeSettings {
20
+ /** Kaltura session token for authentication */
21
+ ks?: string;
22
+ /** Kaltura partner ID */
23
+ partnerId?: string;
24
+ /** Settings schema version, defaults to '1' */
25
+ schemaVersion?: '1';
26
+ /** Context for the chat session */
27
+ context?: ChatContext;
28
+ /** Enable agent mode for advanced AI features */
29
+ agentMode?: boolean;
30
+ /** @deprecated Use customization.avatar.stage instead */
31
+ avatarContainerMode?: 'dialog' | 'contained';
32
+ /** External service integrations (Kaltura player, avatar) */
33
+ integrations?: GlobalChatSettings['integrations'];
34
+ /** Configuration for conversation sharing functionality */
35
+ shareUrl?: GlobalChatSettings['shareUrl'];
36
+ }
37
+ /** Initial thread configuration */
38
+ export type InitialThread = {
39
+ type: 'threadId';
40
+ threadId: string;
41
+ } | {
42
+ type: 'lastThreadByContext';
43
+ };
18
44
  /**
19
45
  * Configuration settings for the chat runtime.
20
46
  *
@@ -51,36 +77,20 @@ export interface ChatRuntime extends UnisphereRuntimeBaseType<ChatRuntimeSetting
51
77
  * };
52
78
  * ```
53
79
  */
54
- export interface ChatRuntimeSettings {
55
- /** Kaltura session token for authentication */
56
- ks?: string;
80
+ export interface ChatRuntimeSettings extends BaseChatRuntimeSettings {
57
81
  /** Optional initial question to display when chat starts */
58
82
  initialQuestion?: string;
59
- /** Settings schema version, defaults to '1' */
60
- schemaVersion?: '1';
61
83
  /** Genie server URL for API requests */
62
84
  genieServerUrl?: string;
63
85
  /** Agentic server URL for appInit */
64
86
  agenticServerUrl?: string;
65
- /** Kaltura partner ID */
66
- partnerId?: string;
67
- /** Context for the chat session */
68
- context?: ChatContext;
69
- /** Enable agent mode for advanced AI features */
70
- agentMode?: boolean;
71
87
  /** Callback function to generate source URLs with entry ID and optional start time */
72
88
  getSourceUrl?: GlobalChatSettings['getSourceUrl'];
73
- /** Configuration for conversation sharing functionality */
74
- shareUrl?: GlobalChatSettings['shareUrl'];
75
89
  /** @deprecated Use visual settings or customization settings instead */
76
90
  branding?: {
77
91
  /** Display Kaltura logo in the chat interface */
78
92
  kalturaLogo?: boolean;
79
93
  };
80
- /** External service integrations (Kaltura player, avatar) */
81
- integrations?: GlobalChatSettings['integrations'];
82
- /** @deprecated Use customization.avatar.stage instead */
83
- avatarContainerMode?: 'dialog' | 'contained';
84
94
  /** UI customization options */
85
95
  customization?: {
86
96
  /** Breadcrumb navigation configuration */
@@ -94,5 +104,8 @@ export interface ChatRuntimeSettings {
94
104
  };
95
105
  };
96
106
  };
107
+ initialThread?: InitialThread;
97
108
  }
109
+ export declare const agentModeSchema: ValidatorSchema;
110
+ export declare const avatarContainerModeSchema: ValidatorSchema;
98
111
  export declare const chatRuntimeSettingsSchema: ValidatorSchema;
@@ -165,3 +165,4 @@ export declare const chatContextSchema: ValidatorSchema;
165
165
  export declare const integrationsSchema: ValidatorSchema;
166
166
  export declare const shareUrlSchema: ValidatorSchema;
167
167
  export declare const getSourceUrlSchema: ValidatorSchema;
168
+ export declare const schemaVersionSchema: ValidatorSchema;
@@ -2,6 +2,39 @@ import { ValidatorSchema } from '@unisphere/core';
2
2
  import { ChatCustomization } from '../chat-customizations-types';
3
3
  import { ChatContext } from './shared-settings';
4
4
  import { AnswerTypeEnum } from '../types';
5
+ interface BaseVisualSettings {
6
+ /** Settings schema version */
7
+ schemaVersion?: '1';
8
+ }
9
+ /**
10
+ * Visual settings with scroll and customization support.
11
+ * Base for page, popup, and contained layouts.
12
+ */
13
+ interface ScrollableVisualSettings extends BaseVisualSettings {
14
+ /** Scroll container mode: 'body' for page scroll, 'container' for internal scroll, 'modal' for modal dialog */
15
+ scroll?: 'body' | 'container' | 'modal';
16
+ /** Custom UI styling and behavior options */
17
+ customization?: ChatCustomization;
18
+ }
19
+ /**
20
+ * Visual settings with mode and context support.
21
+ * Base for floater, floaterCTA, and contained layouts.
22
+ */
23
+ interface ModeContextVisualSettings extends BaseVisualSettings {
24
+ /** Chat mode: 'chat' for chat-only, 'everywhere' for all pages */
25
+ mode?: 'chat' | 'everywhere';
26
+ /** Context for the chat session */
27
+ context?: ChatContext;
28
+ /** Custom UI styling and behavior options */
29
+ customization?: ChatCustomization;
30
+ }
31
+ /** Initial question shape shared between popup and page visual settings. */
32
+ type InitialQuestion = {
33
+ /** Question text */
34
+ question: string;
35
+ /** Preferred answer type */
36
+ answerType?: AnswerTypeEnum;
37
+ };
5
38
  /**
6
39
  * Visual settings for page-embedded chat experiences.
7
40
  *
@@ -15,13 +48,7 @@ import { AnswerTypeEnum } from '../types';
15
48
  * };
16
49
  * ```
17
50
  */
18
- export interface PageVisualSettings {
19
- /** Settings schema version */
20
- schemaVersion?: '1';
21
- /** Scroll container mode: 'body' for page scroll, 'container' for internal scroll, 'modal' for modal dialog */
22
- scroll?: 'body' | 'container' | 'modal';
23
- /** Custom UI styling and behavior options */
24
- customization?: ChatCustomization;
51
+ export interface PageVisualSettings extends ScrollableVisualSettings {
25
52
  /** Context for the chat session — host-provided, not user-controllable */
26
53
  context?: Pick<ChatContext, 'type' | 'id'>;
27
54
  }
@@ -46,9 +73,7 @@ export interface PageVisualSettings {
46
73
  * };
47
74
  * ```
48
75
  */
49
- export interface BannerVisualSettings {
50
- /** Settings schema version */
51
- schemaVersion?: '1';
76
+ export interface BannerVisualSettings extends BaseVisualSettings {
52
77
  /** Banner title text */
53
78
  title?: string;
54
79
  /** Background image configuration */
@@ -82,62 +107,32 @@ export interface BannerVisualSettings {
82
107
  * };
83
108
  * ```
84
109
  */
85
- export interface PopupVisualSettings {
86
- /** Settings schema version */
87
- schemaVersion?: '1';
88
- /** Scroll container mode: 'body' for page scroll, 'container' for internal scroll, 'modal' for modal dialog */
89
- scroll?: 'body' | 'container' | 'modal';
90
- /** Custom UI styling and behavior options */
91
- customization?: ChatCustomization;
110
+ export interface PopupVisualSettings extends ScrollableVisualSettings {
92
111
  /** Optional question to ask automatically when popup opens */
93
- initialQuestion?: {
94
- /** Question text */
95
- question: string;
96
- /** Preferred answer type */
97
- answerType?: AnswerTypeEnum;
98
- };
112
+ initialQuestion?: InitialQuestion;
99
113
  }
100
- export interface ContainedVisualSettings {
101
- /** Settings schema version */
102
- schemaVersion?: '1';
103
- /** Contained type */
104
- mode?: 'chat' | 'everywhere';
105
- /** Custom UI styling and behavior options */
106
- customization?: ChatCustomization;
114
+ export interface ContainedVisualSettings extends ScrollableVisualSettings, ModeContextVisualSettings {
107
115
  /** Callback invoked when the widget requests to be closed */
108
116
  onRequestClose?: () => void;
109
117
  /** Callback invoked when the user clicks the expand button */
110
118
  onExpand?: () => void;
111
119
  /** Whether the host has expanded the widget; drives the expand/collapse icon in the header */
112
120
  isExpanded?: boolean;
113
- /** Scroll container mode: 'body' for page scroll, 'container' for internal scroll, 'modal' for modal dialog */
114
- scroll?: 'body' | 'container' | 'modal';
115
- /** Context for the chat session */
116
- context?: ChatContext;
117
121
  /** Type of close button to display in the header */
118
122
  closeButtonType?: 'none' | 'drawer' | 'close';
119
123
  }
120
- export type FloaterCTAVisualSettings = {
121
- schemaVersion?: '1';
124
+ export interface FloaterCTAVisualSettings extends ModeContextVisualSettings {
122
125
  position?: 'bottom-right' | 'bottom-center' | 'bottom-left';
123
- mode?: 'chat' | 'everywhere';
124
126
  openByDefault?: boolean;
125
- context?: ChatContext;
126
- customization?: ChatCustomization;
127
- } & {
128
127
  type?: 'button';
129
128
  text?: string;
130
129
  showIcon?: boolean;
131
- };
132
- export interface FloaterVisualSettings {
133
- schemaVersion?: '1';
134
- mode?: 'chat' | 'everywhere';
135
- context?: ChatContext;
136
- customization?: ChatCustomization;
137
130
  }
131
+ export type FloaterVisualSettings = ModeContextVisualSettings;
138
132
  export declare const floaterVisualSettingsSchema: ValidatorSchema;
139
133
  export declare const floaterCTAVisualSettingsSchema: ValidatorSchema;
140
134
  export declare const containedVisualSettingsSchema: ValidatorSchema;
141
135
  export declare const pageVisualSettingsSchema: ValidatorSchema;
142
136
  export declare const bannerVisualSettingsSchema: ValidatorSchema;
143
137
  export declare const popupVisualSettingsSchema: ValidatorSchema;
138
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const useTranslation: () => {
2
+ t: (key: string, options?: {
3
+ [x: string]: string | number;
4
+ } | undefined) => string;
5
+ };