@avaya/infinity-omni-sdk-messaging-ui 1.0.3 → 1.0.4

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/lib/index.d.ts CHANGED
@@ -36,10 +36,6 @@ export declare type Action = {
36
36
  */
37
37
  export declare enum ActionType {
38
38
  REPLY = "reply",
39
- /**
40
- * @hidden
41
- * This is not intended to be used by consumers, it is reserved for future use.
42
- */
43
39
  LINK = "link",
44
40
  /**
45
41
  * @hidden
@@ -89,6 +85,25 @@ export declare interface Attachment {
89
85
  attachmentUrl: string;
90
86
  }
91
87
 
88
+ /**
89
+ * A flat `autoPopup` proactive-chat config entry. When its timer fires, the chat
90
+ * window is programmatically maximized. The discriminator value `"autoPopup"` is
91
+ * wire-locked.
92
+ */
93
+ export declare type AutoPopupConfigEntry = {
94
+ type: ProactiveChatActionType.AUTO_POPUP;
95
+ details: {
96
+ /**
97
+ * The structured delay before the auto-popup fires. See
98
+ * {@link WebchatActionTimerDelay} for unit/scalar semantics and ranges.
99
+ *
100
+ * Arming is presence-based: an `autoPopup` entry is armed simply by being
101
+ * present in `triggers[]`.
102
+ */
103
+ timerDelay: WebchatActionTimerDelay;
104
+ };
105
+ };
106
+
92
107
  /**
93
108
  * Web Component that implements the Avaya Infinity Messaging UI. The Web Component is
94
109
  * highly customizable and can be easily integrated into the Client website
@@ -250,6 +265,33 @@ export declare class AvayaInfinityOmniSdkMessagingUi extends HTMLElement {
250
265
  /* Excluded from this release type: connectedCallback */
251
266
  }
252
267
 
268
+ /**
269
+ * A `bubbleTeaser` proactive-chat config entry. When its timer fires, the teaser
270
+ * message is shown next to the minimized chat bubble. The discriminator value
271
+ * `"bubbleTeaser"` is wire-locked.
272
+ */
273
+ export declare type BubbleTeaserConfigEntry = {
274
+ type: ProactiveChatActionType.BUBBLE_TEASER;
275
+ details: {
276
+ /**
277
+ * Discriminator for the `message` payload. When absent, the entry is
278
+ * treated as a plain `text` config for backward compatibility.
279
+ */
280
+ messageType?: ProactiveChatMessageType;
281
+ /**
282
+ * The typed message payload. For `text`, this is a string. For `template`
283
+ * and `richMedia`, this is a server-resolved structured payload. Today only
284
+ * the `text` path is wired; non-text payloads are warn-and-skipped.
285
+ */
286
+ message: string | object;
287
+ /**
288
+ * The structured delay before the bubble teaser is shown. See
289
+ * {@link WebchatActionTimerDelay} for unit/scalar semantics and ranges.
290
+ */
291
+ timerDelay: WebchatActionTimerDelay;
292
+ };
293
+ };
294
+
253
295
  /**
254
296
  * The configuration for the button in the theme.
255
297
  */
@@ -262,6 +304,19 @@ export declare type ButtonConfig = {
262
304
  activeTextColor?: CSSProperties["color"];
263
305
  };
264
306
 
307
+ /**
308
+ * The shape of the new `/config` response. `proactiveChatConfigs` is optional
309
+ * on the wire — when omitted (or when the SDK falls back to the legacy
310
+ * `/themes` endpoint on a 404) the proactive-chat engine is a no-op.
311
+ *
312
+ * The `proactiveChatConfigs` list carries only `autoPopup` and `bubbleTeaser`
313
+ * config entries.
314
+ */
315
+ export declare type ConfigResponse = {
316
+ themes: ThemesResponse;
317
+ proactiveChatConfigs?: ReadonlyArray<ProactiveChatConfig>;
318
+ };
319
+
265
320
  /**
266
321
  * State of the connection with Avaya Infinity platform servers.
267
322
  */
@@ -647,6 +702,28 @@ export declare type MessagingUiConfig = {
647
702
  * @param message - The message that is to be rendered.
648
703
  */
649
704
  beforeMessageRender?: (message: Message) => Message;
705
+ /**
706
+ * Client-side override for the Proactive-Chat (auto popup / bubble teaser)
707
+ * configuration. When provided, this overrides any per-URL config rows received
708
+ * from the server. Set to an empty array to disable proactive-chat entirely
709
+ * for this client deployment.
710
+ *
711
+ * This list carries only the two proactive-chat configs: `autoPopup` (flat
712
+ * row) and `bubbleTeaser`.
713
+ *
714
+ * @see {@link ProactiveChatConfig}
715
+ */
716
+ proactiveChatConfigs?: ReadonlyArray<ProactiveChatConfig>;
717
+ /**
718
+ * The handler function that will be called when the SDK fails to fetch the
719
+ * proactive-chat configuration in a non-recoverable way (network error,
720
+ * server 5xx, JWT failure). A graceful 404 fallback to the legacy `/themes`
721
+ * endpoint is NOT routed through this callback — it is the expected state
722
+ * during phased rollout.
723
+ *
724
+ * @param error - The typed error describing what went wrong.
725
+ */
726
+ onProactiveChatError?: (error: ProactiveChatError) => void;
650
727
  };
651
728
 
652
729
  /**
@@ -694,6 +771,37 @@ export declare type MessagingUiTheme = {
694
771
  backgroundColor?: CSSProperties["backgroundColor"];
695
772
  iconSource?: string;
696
773
  border?: CSSProperties["border"];
774
+ /**
775
+ * Visual configuration for the Bubble Teaser — the small message preview
776
+ * that animates next to the minimized chat bubble during proactive
777
+ * engagement.
778
+ *
779
+ * Server values arrive via the `/config` themes payload as
780
+ * `bubbleTeaserBackgroundColor` / `bubbleTeaserTextColor` and are mapped
781
+ * into this `teaser` sub-config during the admin theme merge.
782
+ */
783
+ teaser?: {
784
+ /** Background color of the teaser bubble. Default: `#FFFFFF`. */
785
+ backgroundColor?: CSSProperties["backgroundColor"];
786
+ /** Text color of the teaser bubble. Default: `#1F3A68`. */
787
+ textColor?: CSSProperties["color"];
788
+ /**
789
+ * Close ("dismiss") affordance for the teaser. Client-side only — these
790
+ * are NOT part of the admin `/config` themes payload (the admin merge
791
+ * only maps `bubbleTeaserBackgroundColor` / `bubbleTeaserTextColor`).
792
+ * Consumers may override via a client theme.
793
+ */
794
+ closeButton?: {
795
+ /**
796
+ * Icon for the close button. Accepts a Neo icon class (e.g.
797
+ * `neo-icon-close`) or an image URL, matching {@link CustomIcon}.
798
+ * Default: `neo-icon-close`.
799
+ */
800
+ iconSource?: string;
801
+ /** Color of the close icon. Defaults to the teaser `textColor`. */
802
+ color?: CSSProperties["color"];
803
+ };
804
+ };
697
805
  };
698
806
  messagingWindow?: {
699
807
  title?: {
@@ -915,6 +1023,91 @@ export declare enum ParticipantType {
915
1023
  BOT = "BOT"
916
1024
  }
917
1025
 
1026
+ /**
1027
+ * The well-known `type` discriminators for proactive-chat config entries. The
1028
+ * values are wire-locked: `"autoPopup"` for {@link AutoPopupConfigEntry} and
1029
+ * `"bubbleTeaser"` for {@link BubbleTeaserConfigEntry}.
1030
+ */
1031
+ export declare enum ProactiveChatActionType {
1032
+ AUTO_POPUP = "autoPopup",
1033
+ BUBBLE_TEASER = "bubbleTeaser"
1034
+ }
1035
+
1036
+ /**
1037
+ * A row of proactive-chat config entries scoped to a specific URL pattern.
1038
+ *
1039
+ * Deliberately excludes server-internal fields (`accountId`, `webChatId`, `id`) —
1040
+ * the SDK consumes only the URL and the trigger list. The inner `triggers[]`
1041
+ * array carries the {@link ProactiveChatConfigEntry} discriminated union.
1042
+ */
1043
+ export declare type ProactiveChatConfig = {
1044
+ /**
1045
+ * The URL (or pattern matched by the SPA navigation detector) that this set
1046
+ * of proactive-chat triggers applies to.
1047
+ */
1048
+ url: string;
1049
+ /**
1050
+ * The trigger entries to evaluate when the user is on the matching URL.
1051
+ */
1052
+ triggers: ReadonlyArray<ProactiveChatConfigEntry>;
1053
+ };
1054
+
1055
+ /**
1056
+ * The flat, top-level shape of a single proactive-chat config entry — a
1057
+ * discriminated union on `type` of {@link AutoPopupConfigEntry} and
1058
+ * {@link BubbleTeaserConfigEntry}. The discriminator values `"autoPopup"` and
1059
+ * `"bubbleTeaser"` are wire-locked.
1060
+ */
1061
+ export declare type ProactiveChatConfigEntry = AutoPopupConfigEntry | BubbleTeaserConfigEntry;
1062
+
1063
+ /**
1064
+ * The typed error passed to {@link MessagingUiConfig.onProactiveChatError}.
1065
+ *
1066
+ * A 404 from `/config` is NOT an error — it is the expected fallback path
1067
+ * during phased rollout and is logged at INFO level, not surfaced here.
1068
+ */
1069
+ export declare type ProactiveChatError = {
1070
+ /**
1071
+ * Machine-readable error code.
1072
+ */
1073
+ code: ProactiveChatErrorCode;
1074
+ /**
1075
+ * Human-readable message suitable for logging. Never contains PII or JWTs.
1076
+ */
1077
+ message: string;
1078
+ /**
1079
+ * The HTTP status returned by the server, when the error originated from a
1080
+ * non-404 HTTP response.
1081
+ */
1082
+ status?: number;
1083
+ /**
1084
+ * The underlying error, when the failure was a thrown exception
1085
+ * (e.g., a network error before a response was received).
1086
+ */
1087
+ cause?: unknown;
1088
+ };
1089
+
1090
+ /**
1091
+ * The set of well-known error codes surfaced by {@link MessagingUiConfig.onProactiveChatError}.
1092
+ *
1093
+ * `CONFIG_FETCH_FAILED` is the only code currently emitted; future codes can be
1094
+ * added without breaking existing consumers because the callback receives the
1095
+ * full object.
1096
+ */
1097
+ export declare type ProactiveChatErrorCode = "CONFIG_FETCH_FAILED";
1098
+
1099
+ /**
1100
+ * The well-known set of `messageType` discriminators carried inside a
1101
+ * `bubbleTeaser` config's `details`. The `text` path is the only one wired
1102
+ * end-to-end today; `template` and `richMedia` payloads are accepted on the
1103
+ * wire but the engine warn-and-skips them for now.
1104
+ */
1105
+ export declare enum ProactiveChatMessageType {
1106
+ TEXT = "text",
1107
+ TEMPLATE = "template",
1108
+ RICH_MEDIA = "richMedia"
1109
+ }
1110
+
918
1111
  /**
919
1112
  * The configuration for quick reply buttons, extending ButtonConfig with inactive button state properties.
920
1113
  *
@@ -1030,16 +1223,56 @@ export declare type TextConfig = {
1030
1223
  translations?: Translations;
1031
1224
  };
1032
1225
 
1226
+ /**
1227
+ * The shape of the legacy `/themes` payload — a list of named theme objects with
1228
+ * flat property maps. The SDK consumes the entry named `"default"`.
1229
+ *
1230
+ * The same shape is embedded as the `themes` field of the new `/config`
1231
+ * response.
1232
+ */
1233
+ export declare type ThemesResponse = ReadonlyArray<{
1234
+ name: string;
1235
+ properties?: Record<string, string>;
1236
+ }>;
1237
+
1238
+ /**
1239
+ * The unit a {@link WebchatActionTimerDelay} `scalar` is expressed in. The
1240
+ * values are wire-locked (`"seconds"` / `"minutes"`).
1241
+ */
1242
+ export declare enum TimerDelayUnit {
1243
+ SECONDS = "seconds",
1244
+ MINUTES = "minutes"
1245
+ }
1246
+
1033
1247
  /**
1034
1248
  * The translation for the Messaging UI for different {@link Locale}.
1035
1249
  */
1036
1250
  export declare type Translations = Partial<Record<Locale, string>>;
1037
1251
 
1252
+ /**
1253
+ * A structured delay value used by proactive-chat config entries
1254
+ * (`autoPopup`, `bubbleTeaser`). The admin UI captures both a numeric scalar
1255
+ * and the unit it represents — the SDK converts this to milliseconds when
1256
+ * arming its `setTimeout` (see `ProactiveChatEngine`).
1257
+ *
1258
+ * Server-enforced ranges:
1259
+ * - `seconds`: scalar in `[1, 3600]`
1260
+ * - `minutes`: scalar in `[1, 60]`
1261
+ *
1262
+ * Both ranges resolve to the same maximum (60 minutes / 3600 seconds); `unit` is
1263
+ * a presentation choice, not a capability change.
1264
+ */
1265
+ declare type WebchatActionTimerDelay = {
1266
+ /**
1267
+ * The unit `scalar` is expressed in.
1268
+ */
1269
+ unit: TimerDelayUnit;
1270
+ /**
1271
+ * The numeric delay value. Must be a positive integer within the
1272
+ * unit-appropriate range — out-of-range values cause the engine to
1273
+ * warn-and-skip arming the row.
1274
+ */
1275
+ scalar: number;
1276
+ };
1277
+
1038
1278
  export { }
1039
-
1040
-
1041
- declare global {
1042
- interface Window {
1043
- messagingUiConfig?: MessagingUiConfig;
1044
- }
1045
- }
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
1
  {
2
2
  "name": "@avaya/infinity-omni-sdk-messaging-ui",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "@ant-design/icons": "^5.4.0",
7
- "@avaya/infinity-omni-sdk-core": "^1.0.3",
8
- "@avaya/infinity-omni-sdk-messaging": "^1.0.3",
6
+ "@ant-design/icons": "^5.6.1",
7
+ "@avaya/infinity-omni-sdk-core": "^1.0.4",
8
+ "@avaya/infinity-omni-sdk-messaging": "^1.0.4",
9
9
  "@avaya/neo-react": "^1.1.10",
10
10
  "@emoji-mart/data": "^1.1.2",
11
11
  "@emoji-mart/react": "^1.1.1",
12
- "@reduxjs/toolkit": "^2.2.2",
13
- "@testing-library/jest-dom": "^6.4.5",
14
- "@testing-library/react": "^16.0.0",
15
- "antd": "^5.15.4",
12
+ "@reduxjs/toolkit": "^2.12.0",
13
+ "@testing-library/jest-dom": "^6.9.1",
14
+ "@testing-library/react": "^16.3.2",
15
+ "antd": "^5.29.3",
16
16
  "emoji-mart": "^5.5.2",
17
- "i18next": "^23.10.1",
18
- "lodash": "^4.17.21",
19
- "react": "^18.2.0",
17
+ "i18next": "^23.16.8",
18
+ "lodash": "^4.18.1",
19
+ "react": "^18.3.1",
20
20
  "react-custom-scrollbars-2": "^4.5.0",
21
- "react-dom": "^18.2.0",
22
- "react-i18next": "^15.0.1",
21
+ "react-dom": "^18.3.1",
22
+ "react-i18next": "^15.7.4",
23
23
  "react-markdown": "^10.1.0",
24
- "react-redux": "^9.0.4",
25
- "react-to-print": "3.1.0",
26
- "react-uuid": "^2.0.0",
24
+ "react-redux": "^9.3.0",
25
+ "react-to-print": "3.3.0",
27
26
  "redux": "^5.0.0",
28
- "remark-gfm": "^4.0.1"
27
+ "remark-gfm": "^4.0.1",
28
+ "uuid": "^11.1.1"
29
29
  },
30
30
  "exports": {
31
31
  ".": {