@microsoft/omnichannel-chat-widget 2.0.1-main.a2ef2a3 → 2.0.1-main.eaef039

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 (24) hide show
  1. package/lib/cjs/common/telemetry/TelemetryConstants.js +4 -0
  2. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +42 -25
  3. package/lib/cjs/components/livechatwidget/common/endChat.js +39 -0
  4. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +2 -2
  5. package/lib/cjs/components/livechatwidget/common/startChat.js +107 -33
  6. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +2 -2
  7. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
  8. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.js +16 -2
  9. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.js +68 -40
  10. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +0 -27
  11. package/lib/esm/common/telemetry/TelemetryConstants.js +4 -0
  12. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +42 -25
  13. package/lib/esm/components/livechatwidget/common/endChat.js +39 -0
  14. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +3 -3
  15. package/lib/esm/components/livechatwidget/common/startChat.js +104 -31
  16. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +2 -2
  17. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
  18. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.js +16 -2
  19. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.js +65 -39
  20. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +0 -27
  21. package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -0
  22. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.d.ts +11 -4
  23. package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +9 -2
  24. package/package.json +5 -5
@@ -12,27 +12,6 @@ import { NotificationScenarios } from "../../enums/NotificationScenarios";
12
12
  import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
13
13
  import { WebChatActionType } from "../../enums/WebChatActionType";
14
14
  const MBtoBRatio = 1000000;
15
- const announceFileSent = message => {
16
- // TalkBack on Android WebView reliably announces newly *appended*
17
- // role="alert" nodes but often misses text-content updates on existing
18
- // nodes. Wait 500ms for the send-box focus shift to settle, then inject
19
- // a fresh alert element appended to document.body and remove it after 3s.
20
- setTimeout(() => {
21
- const el = document.createElement("div");
22
- el.setAttribute("role", "alert");
23
- el.setAttribute("aria-live", "assertive");
24
- el.setAttribute("aria-atomic", "true");
25
- el.style.cssText = "position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden;";
26
- el.textContent = message;
27
- document.body.appendChild(el);
28
- // Remove after TalkBack has had time to read it
29
- setTimeout(() => {
30
- if (el.parentNode) {
31
- el.parentNode.removeChild(el);
32
- }
33
- }, 3000);
34
- }, 500);
35
- };
36
15
 
37
16
  /*
38
17
  * If an attachment is invalid, delete this attachment from the attachments list
@@ -221,13 +200,7 @@ const createAttachmentUploadValidatorMiddleware = (allowedFileExtensions, maxFil
221
200
  var _payload$activity, _payload$activity2;
222
201
  const payload = action.payload;
223
202
  if (payload !== null && payload !== void 0 && payload.activity.attachments && payload.activity.attachments.length > 0 && (payload === null || payload === void 0 || (_payload$activity = payload.activity) === null || _payload$activity === void 0 || (_payload$activity = _payload$activity.attachments) === null || _payload$activity === void 0 ? void 0 : _payload$activity.length) === (payload === null || payload === void 0 || (_payload$activity2 = payload.activity) === null || _payload$activity2 === void 0 || (_payload$activity2 = _payload$activity2.channelData) === null || _payload$activity2 === void 0 || (_payload$activity2 = _payload$activity2.attachmentSizes) === null || _payload$activity2 === void 0 ? void 0 : _payload$activity2.length)) {
224
- var _validatedAction$payl;
225
203
  const validatedAction = validateAttachment(action, allowedFileExtensions, maxFileSizeSupportedByDynamics, localizedTexts);
226
-
227
- // Announce to screen readers that the file was sent when validation passes
228
- if (((_validatedAction$payl = validatedAction.payload) === null || _validatedAction$payl === void 0 || (_validatedAction$payl = _validatedAction$payl.activity) === null || _validatedAction$payl === void 0 || (_validatedAction$payl = _validatedAction$payl.attachments) === null || _validatedAction$payl === void 0 ? void 0 : _validatedAction$payl.length) > 0) {
229
- announceFileSent(localizedTexts.MIDDLEWARE_BANNER_FILE_SENT ?? "File sent successfully.");
230
- }
231
204
  return next(validatedAction);
232
205
  }
233
206
  }
@@ -127,6 +127,8 @@ export declare enum TelemetryEvent {
127
127
  PrechatSubmitted = "PrechatSubmitted",
128
128
  StartChatSDKCall = "StartChatCall",
129
129
  StartChatEventReceived = "StartChatEventReceived",
130
+ ConcurrentStartChatRejected = "ConcurrentStartChatRejected",
131
+ ChatSDKStateCleanUpDisconnectFailed = "ChatSDKStateCleanUpDisconnectFailed",
130
132
  EndChatSDKCall = "EndChatSDKCall",
131
133
  PrepareEndChat = "PrepareEndChat",
132
134
  EndChatEventReceived = "EndChatEventReceived",
@@ -2,9 +2,16 @@
2
2
  * AttachmentSentAnnouncementMiddleware
3
3
  *
4
4
  * When a file attachment is successfully sent, announces the result to
5
- * screen readers via an aria-live region so that assistive technology
6
- * users receive immediate feedback.
5
+ * screen readers so that assistive technology users receive immediate
6
+ * feedback ("File report.pdf sent").
7
+ *
8
+ * The announcement region lives inside the chat dialog. While the dialog is
9
+ * open it is aria-modal and its host siblings are aria-hidden, so screen
10
+ * readers (TalkBack, VoiceOver) ignore live regions outside it.
7
11
  ******/
12
+ import { ILiveChatWidgetLocalizedTexts } from "../../../../../contexts/common/ILiveChatWidgetLocalizedTexts";
8
13
  import { WebChatStoreMiddleware } from "../../../interfaces/IWebChatAction";
9
- declare const attachmentSentAnnouncementMiddleware: WebChatStoreMiddleware;
10
- export default attachmentSentAnnouncementMiddleware;
14
+ export declare const ATTACHMENT_ANNOUNCEMENT_REGION_ID = "oc-lcw-attachment-announcement";
15
+ export declare const getFileSentMessage: (attachments: any[], localizedTexts?: ILiveChatWidgetLocalizedTexts) => string;
16
+ export declare const createAttachmentSentAnnouncementMiddleware: (localizedTexts?: ILiveChatWidgetLocalizedTexts, widgetElementId?: string) => WebChatStoreMiddleware;
17
+ export default createAttachmentSentAnnouncementMiddleware;
@@ -35,10 +35,17 @@ export interface ILiveChatWidgetLocalizedTexts {
35
35
  */
36
36
  MIDDLEWARE_BANNER_FILE_IS_MALICIOUS?: string;
37
37
  /**
38
- * Success message announced by screen readers when a file is successfully sent.
39
- * e.g. "File sent successfully."
38
+ * Message announced by screen readers when one file is successfully sent.
39
+ * {2} - File name
40
+ * e.g. "File {2} sent"
40
41
  */
41
42
  MIDDLEWARE_BANNER_FILE_SENT?: string;
43
+ /**
44
+ * Message announced by screen readers when several files are sent in one message.
45
+ * {0} - Number of files
46
+ * e.g. "{0} files sent"
47
+ */
48
+ MIDDLEWARE_BANNER_FILES_SENT?: string;
42
49
  /**
43
50
  * Success message, indicating the email address introduced has been registered to receive the transcript.
44
51
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "2.0.1-main.a2ef2a3",
3
+ "version": "2.0.1-main.eaef039",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -98,13 +98,13 @@
98
98
  "abort-controller": "^3",
99
99
  "botframework-webchat": "4.18.1-hotfix.20260308.b15b405",
100
100
  "core-js-pure": "^3.42.0",
101
- "dompurify": "3.4.16",
102
- "markdown-it": "^14.3.0",
101
+ "dompurify": "3.4.17",
102
+ "markdown-it": "^14.3.3",
103
103
  "markdown-it-attrs": "^4.1.6",
104
104
  "markdown-it-for-inline": "^0.1.1",
105
105
  "md5-typescript": "^1.0.5",
106
106
  "rxjs": "5.5.12",
107
- "sanitize-html": "2.17.7",
107
+ "sanitize-html": "2.18.1",
108
108
  "simple-update-in": "2.2.0",
109
109
  "slack-markdown-it": "^1.0.5"
110
110
  },
@@ -164,7 +164,7 @@
164
164
  "**/@types/trusted-types": "2.0.7",
165
165
  "**/join-images": "1.1.5",
166
166
  "**/valibot": "1.4.2",
167
- "**/nanoid": "3.3.18"
167
+ "**/nanoid": "^3.3.20"
168
168
  },
169
169
  "jest": {
170
170
  "verbose": true,