@xapp/stentor-chat-widget 1.80.0 → 1.81.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.
Files changed (2) hide show
  1. package/lib/WidgetEnv.d.ts +29 -1
  2. package/package.json +5 -3
@@ -1,4 +1,5 @@
1
1
  /*! Copyright (c) 2021, XAPPmedia */
2
+ import type { ReactNode } from "react";
2
3
  import { Response } from "stentor-models";
3
4
  import { WidgetTheme } from "./WidgetTheme";
4
5
  import { ChatUserInfo } from "./UserInfo";
@@ -86,6 +87,23 @@ export interface ServerConfig {
86
87
  * Optional nonce used to trigger reconnection when the chat is reset
87
88
  */
88
89
  readonly nonce?: string;
90
+ /**
91
+ * Delay in milliseconds before closing WebSocket connection when page is backgrounded.
92
+ * Only applies to "websocketraw" connection type. Defaults to 60,000 (60 seconds).
93
+ * This prevents losing responses if user quickly switches tabs.
94
+ *
95
+ * @remarks
96
+ * - Set to 0 to disable delay (closes immediately on background)
97
+ * - Recommended range: 30000-300000 (30 seconds to 5 minutes)
98
+ * - Higher values keep connections open longer but use more server resources
99
+ * - The widget sends "user backgrounded" event immediately when tab loses focus
100
+ * - The widget sends "user foregrounded" event when user returns to tab
101
+ * - If user returns before delay expires, connection stays open
102
+ * - If delay expires, WebSocket closes and reconnects when user returns
103
+ *
104
+ * @default 60000
105
+ */
106
+ readonly backgroundSleepDelay?: number;
89
107
  }
90
108
  /**
91
109
  * Environment settings for the Widget
@@ -340,7 +358,17 @@ export interface WidgetMenuItemOpenURL {
340
358
  }
341
359
  export interface WidgetHeaderSubtitleConfig {
342
360
  readonly enabled?: boolean;
343
- readonly text?: string;
361
+ /**
362
+ * Subtitle text to display below the header title.
363
+ * Supports plain strings or JSX elements for custom formatting.
364
+ * @example
365
+ * // String
366
+ * text: "Always Active"
367
+ *
368
+ * // JSX with status indicator
369
+ * text: <span><StatusDot /> Always Active</span>
370
+ */
371
+ readonly text?: ReactNode;
344
372
  }
345
373
  export interface WidgetTypingStatusConfig {
346
374
  readonly textTypingStatusEnabled?: boolean;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "1.80.0",
7
+ "version": "1.81.1",
8
8
  "description": "Chat Widget channel for stentor",
9
9
  "types": "lib/index",
10
10
  "main": "lib/index",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/chai": "4.3.20",
19
+ "@types/react": "^19.0.0",
19
20
  "@types/sinon": "10.0.20",
20
21
  "@types/sinon-chai": "3.2.12",
21
22
  "@xapp/config": "0.2.3",
@@ -32,11 +33,12 @@
32
33
  "stentor-guards": "1.66.25"
33
34
  },
34
35
  "peerDependencies": {
35
- "stentor-models": "1.x"
36
+ "react": "^18.0.0 || ^19.0.0",
37
+ "stentor-models": "^1.0.0"
36
38
  },
37
39
  "scripts": {
38
40
  "build": "tsc -d true -p .",
39
41
  "clean": "rm -rf ./lib/*"
40
42
  },
41
- "gitHead": "6f4f6ac37ee15ed4d1a0d4636ce45883ec956160"
43
+ "gitHead": "1eafcfcfabed5d6d2f22a16e3a2317e478898df7"
42
44
  }