@microsoft/omnichannel-chat-widget 2.0.0 → 2.0.1-main.38c3c85
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/README.md +61 -2
- package/lib/cjs/common/telemetry/TelemetryConstants.js +8 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +42 -25
- package/lib/cjs/components/livechatwidget/common/endChat.js +39 -0
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +42 -13
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +29 -1
- package/lib/cjs/components/livechatwidget/common/recoveryEligibilityTelemetry.js +60 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +118 -36
- package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +34 -5
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +13 -23
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentForScreenReaderMiddleware.js +159 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.js +16 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.js +68 -40
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +0 -27
- package/lib/esm/common/telemetry/TelemetryConstants.js +8 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +42 -25
- package/lib/esm/components/livechatwidget/common/endChat.js +39 -0
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +40 -13
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +28 -1
- package/lib/esm/components/livechatwidget/common/recoveryEligibilityTelemetry.js +52 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +115 -34
- package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +34 -5
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +14 -24
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +2 -2
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentForScreenReaderMiddleware.js +153 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.js +16 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.js +65 -39
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +0 -27
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +4 -0
- package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +8 -0
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -1
- package/lib/types/components/livechatwidget/common/recoveryEligibilityTelemetry.d.ts +17 -0
- package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentForScreenReaderMiddleware.d.ts +11 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.d.ts +11 -4
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +9 -2
- package/package.json +7 -7
|
@@ -2,26 +2,36 @@
|
|
|
2
2
|
* AttachmentSentAnnouncementMiddleware
|
|
3
3
|
*
|
|
4
4
|
* When a file attachment is successfully sent, announces the result to
|
|
5
|
-
* screen readers
|
|
6
|
-
*
|
|
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
|
******/
|
|
8
12
|
|
|
9
13
|
import { isWebChatAction } from "../../../interfaces/IWebChatAction";
|
|
10
14
|
import { WebChatActionType } from "../../enums/WebChatActionType";
|
|
11
|
-
const
|
|
15
|
+
export const ATTACHMENT_ANNOUNCEMENT_REGION_ID = "oc-lcw-attachment-announcement";
|
|
16
|
+
const DEFAULT_FILE_SENT_TEXT = "File {2} sent";
|
|
17
|
+
const DEFAULT_FILES_SENT_TEXT = "{0} files sent";
|
|
18
|
+
|
|
19
|
+
// Let the send-box focus shift settle before speaking, then keep the node
|
|
20
|
+
// long enough for the screen reader to read it.
|
|
21
|
+
const ANNOUNCE_DELAY_MS = 100;
|
|
22
|
+
const ANNOUNCEMENT_LIFETIME_MS = 5000;
|
|
12
23
|
|
|
13
24
|
/**
|
|
14
|
-
* Ensures a visually-hidden aria-live region exists
|
|
15
|
-
* announcing attachment upload results to screen readers.
|
|
25
|
+
* Ensures a visually-hidden aria-live region exists inside the chat dialog
|
|
26
|
+
* for announcing attachment upload results to screen readers.
|
|
16
27
|
*/
|
|
17
|
-
const ensureAriaLiveRegion =
|
|
18
|
-
|
|
28
|
+
const ensureAriaLiveRegion = widgetElementId => {
|
|
29
|
+
const host = document.getElementById(widgetElementId) || document.body;
|
|
30
|
+
let region = document.getElementById(ATTACHMENT_ANNOUNCEMENT_REGION_ID);
|
|
19
31
|
if (!region) {
|
|
20
32
|
region = document.createElement("div");
|
|
21
|
-
region.id =
|
|
33
|
+
region.id = ATTACHMENT_ANNOUNCEMENT_REGION_ID;
|
|
22
34
|
region.setAttribute("aria-live", "polite");
|
|
23
|
-
region.setAttribute("role", "status");
|
|
24
|
-
region.setAttribute("aria-atomic", "true");
|
|
25
35
|
// Visually hidden but available to screen readers
|
|
26
36
|
Object.assign(region.style, {
|
|
27
37
|
position: "absolute",
|
|
@@ -34,44 +44,60 @@ const ensureAriaLiveRegion = () => {
|
|
|
34
44
|
whiteSpace: "nowrap",
|
|
35
45
|
border: "0"
|
|
36
46
|
});
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
}
|
|
48
|
+
if (region.parentElement !== host) {
|
|
49
|
+
host.appendChild(region);
|
|
39
50
|
}
|
|
40
51
|
return region;
|
|
41
52
|
};
|
|
42
53
|
|
|
43
54
|
/**
|
|
44
|
-
* Announces a message
|
|
45
|
-
*
|
|
55
|
+
* Announces a message by appending a fresh node to the live region.
|
|
56
|
+
* TalkBack reliably speaks newly added nodes but often misses text changes
|
|
57
|
+
* on an existing node, so each announcement gets its own element.
|
|
46
58
|
*/
|
|
47
|
-
const announce = message => {
|
|
48
|
-
const region = ensureAriaLiveRegion();
|
|
49
|
-
region.textContent = "";
|
|
50
|
-
// Small delay so the screen reader detects the content change
|
|
59
|
+
const announce = (message, widgetElementId) => {
|
|
60
|
+
const region = ensureAriaLiveRegion(widgetElementId);
|
|
51
61
|
setTimeout(() => {
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
const node = document.createElement("div");
|
|
63
|
+
node.textContent = message;
|
|
64
|
+
region.appendChild(node);
|
|
65
|
+
setTimeout(() => node.remove(), ANNOUNCEMENT_LIFETIME_MS);
|
|
66
|
+
}, ANNOUNCE_DELAY_MS);
|
|
54
67
|
};
|
|
55
68
|
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
export const getFileSentMessage = (attachments, localizedTexts) => {
|
|
71
|
+
var _attachments$;
|
|
72
|
+
if (attachments.length > 1) {
|
|
73
|
+
// Replacer callbacks insert values literally; a string would treat "$&" or "$$" as patterns.
|
|
74
|
+
return ((localizedTexts === null || localizedTexts === void 0 ? void 0 : localizedTexts.MIDDLEWARE_BANNER_FILES_SENT) || DEFAULT_FILES_SENT_TEXT).replace("{0}", () => String(attachments.length));
|
|
75
|
+
}
|
|
76
|
+
const name = typeof ((_attachments$ = attachments[0]) === null || _attachments$ === void 0 ? void 0 : _attachments$.name) === "string" ? attachments[0].name.trim() : "";
|
|
77
|
+
return ((localizedTexts === null || localizedTexts === void 0 ? void 0 : localizedTexts.MIDDLEWARE_BANNER_FILE_SENT) || DEFAULT_FILE_SENT_TEXT).replace("{2}", () => name).replace(/\s{2,}/g, " ").trim();
|
|
78
|
+
};
|
|
79
|
+
export const createAttachmentSentAnnouncementMiddleware = function (localizedTexts) {
|
|
80
|
+
let widgetElementId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "oc-lcw";
|
|
81
|
+
return (
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
83
|
+
_ref => {
|
|
84
|
+
let dispatch = _ref.dispatch;
|
|
85
|
+
return next => action => {
|
|
86
|
+
if (!isWebChatAction(action)) {
|
|
87
|
+
return next(action);
|
|
88
|
+
}
|
|
63
89
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
90
|
+
// Intercept successfully posted activities that contain attachments
|
|
91
|
+
if (action.type === WebChatActionType.DIRECT_LINE_POST_ACTIVITY_FULFILLED) {
|
|
92
|
+
var _action$payload;
|
|
93
|
+
const attachments = (_action$payload = action.payload) === null || _action$payload === void 0 || (_action$payload = _action$payload.activity) === null || _action$payload === void 0 ? void 0 : _action$payload.attachments;
|
|
94
|
+
if (attachments && attachments.length > 0) {
|
|
95
|
+
announce(getFileSentMessage(attachments, localizedTexts), widgetElementId);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return next(action);
|
|
99
|
+
};
|
|
73
100
|
}
|
|
74
|
-
|
|
75
|
-
};
|
|
101
|
+
);
|
|
76
102
|
};
|
|
77
|
-
export default
|
|
103
|
+
export default createAttachmentSentAnnouncementMiddleware;
|
|
@@ -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
|
}
|
|
@@ -95,8 +95,10 @@ export declare enum TelemetryEvent {
|
|
|
95
95
|
MidConversationAuthSucceeded = "MidConversationAuthSucceeded",
|
|
96
96
|
MidConversationAuthFailed = "MidConversationAuthFailed",
|
|
97
97
|
MidConversationAuthReset = "MidConversationAuthReset",
|
|
98
|
+
RecoveryEligibilityEvaluated = "RecoveryEligibilityEvaluated",
|
|
98
99
|
GetConversationDetailsCallStarted = "GetConversationDetailsCallStarted",
|
|
99
100
|
GetConversationDetailsCallFailed = "GetConversationDetailsCallFailed",
|
|
101
|
+
UpdateTelemetryDataFailed = "UpdateTelemetryDataFailed",
|
|
100
102
|
EndChatSDKCallFailed = "EndChatSDKCallFailed",
|
|
101
103
|
DisconnectEndChatSDKCallFailed = "DisconnectEndChatSDKCallFailed",
|
|
102
104
|
GetChatReconnectContextSDKCallStarted = "GetChatReconnectContextSDKCallStarted",
|
|
@@ -126,6 +128,8 @@ export declare enum TelemetryEvent {
|
|
|
126
128
|
PrechatSubmitted = "PrechatSubmitted",
|
|
127
129
|
StartChatSDKCall = "StartChatCall",
|
|
128
130
|
StartChatEventReceived = "StartChatEventReceived",
|
|
131
|
+
ConcurrentStartChatRejected = "ConcurrentStartChatRejected",
|
|
132
|
+
ChatSDKStateCleanUpDisconnectFailed = "ChatSDKStateCleanUpDisconnectFailed",
|
|
129
133
|
EndChatSDKCall = "EndChatSDKCall",
|
|
130
134
|
PrepareEndChat = "PrepareEndChat",
|
|
131
135
|
EndChatEventReceived = "EndChatEventReceived",
|
|
@@ -4,4 +4,12 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
|
|
|
4
4
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
5
5
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
6
6
|
import { IWebChatProps } from "../../webchatcontainerstateful/interfaces/IWebChatProps";
|
|
7
|
+
import { IWebChatContainerStatefulProps } from "../../webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps";
|
|
8
|
+
/**
|
|
9
|
+
* Renders Markdown for the screen reader text of Adaptive Cards, from the same pieces as the visible card:
|
|
10
|
+
* the host renderMarkdown when set, the hyperlink text override, and the same sanitization.
|
|
11
|
+
* Markdown is always formatted, also when the widget shows Markdown unformatted, so that screen readers do not read the syntax.
|
|
12
|
+
* Styles are removed with their content because the card does not show them.
|
|
13
|
+
*/
|
|
14
|
+
export declare const createScreenReaderMarkdownRenderer: (webChatContainerProps?: IWebChatContainerStatefulProps) => (text: string) => string;
|
|
7
15
|
export declare const initWebChatComposer: (props: ILiveChatWidgetProps, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, facadeChatSDK: FacadeChatSDK, endChat: any) => IWebChatProps;
|
|
@@ -6,7 +6,12 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
|
|
|
6
6
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
7
7
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
8
8
|
declare const handleChatReconnect: (facadeChatSDK: FacadeChatSDK, props: ILiveChatWidgetProps, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, initStartChat: any, state: ILiveChatWidgetContext) => Promise<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* Returns true when chat reconnect took over the start: it started the chat itself or showed the reconnect pane.
|
|
11
|
+
* In that case the caller must not start another chat.
|
|
12
|
+
*/
|
|
13
|
+
declare const isReconnectTriggered: (facadeChatSDK: FacadeChatSDK, props: ILiveChatWidgetProps, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, initStartChat: any, state: ILiveChatWidgetContext) => Promise<boolean>;
|
|
9
14
|
declare const getChatReconnectContext: (facadeChatSDK: FacadeChatSDK, chatConfig: ChatConfig, props: any, isAuthenticatedChat: boolean, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<import("@microsoft/omnichannel-chat-sdk/lib/core/ChatReconnectContext").default | undefined>;
|
|
10
15
|
declare const isReconnectEnabled: (chatConfig?: ChatConfig) => boolean;
|
|
11
16
|
declare const isPersistentEnabled: (chatConfig?: ChatConfig) => boolean;
|
|
12
|
-
export { handleChatReconnect, isReconnectEnabled, isPersistentEnabled, getChatReconnectContext };
|
|
17
|
+
export { handleChatReconnect, isReconnectTriggered, isReconnectEnabled, isPersistentEnabled, getChatReconnectContext };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
2
|
+
export declare enum RecoveryEligibilityReason {
|
|
3
|
+
ReconnectIdPresent = "ReconnectIdPresent",
|
|
4
|
+
ActiveContextPresent = "ActiveContextPresent",
|
|
5
|
+
MissingContext = "MissingContext",
|
|
6
|
+
CachedContextNonActive = "CachedContextNonActive"
|
|
7
|
+
}
|
|
8
|
+
export interface RecoveryEligibilityTelemetryProperties {
|
|
9
|
+
conversationState: string;
|
|
10
|
+
hasReconnectId: boolean;
|
|
11
|
+
hasLiveChatContext: boolean;
|
|
12
|
+
hasRequestId: boolean;
|
|
13
|
+
eligible: boolean;
|
|
14
|
+
reason: RecoveryEligibilityReason;
|
|
15
|
+
}
|
|
16
|
+
export declare const getRecoveryEligibilityTelemetryProperties: (state: ILiveChatWidgetContext, eligible: boolean) => RecoveryEligibilityTelemetryProperties;
|
|
17
|
+
export declare const logRecoveryEligibilityTelemetry: (state: ILiveChatWidgetContext, eligible: boolean) => void;
|
|
@@ -6,6 +6,10 @@ import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
|
6
6
|
import StartChatOptionalParams from "@microsoft/omnichannel-chat-sdk/lib/core/StartChatOptionalParams";
|
|
7
7
|
declare const prepareStartChat: (props: ILiveChatWidgetProps, facadeChatSDK: FacadeChatSDK, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any) => Promise<void>;
|
|
8
8
|
declare const setPreChatAndInitiateChat: (facadeChatSDK: FacadeChatSDK, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, isProactiveChat?: boolean | false, proactiveChatEnablePrechatState?: boolean | false, state?: ILiveChatWidgetContext, props?: ILiveChatWidgetProps) => Promise<void>;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Resolves to `true` when the chat reached Active, and `false` when it failed or the call was dropped.
|
|
11
|
+
* It resolves before React renders Active, so callers must use this value rather than reading the conversation state.
|
|
12
|
+
*/
|
|
13
|
+
declare const initStartChat: (facadeChatSDK: FacadeChatSDK, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, state: ILiveChatWidgetContext | undefined, props?: ILiveChatWidgetProps, params?: StartChatOptionalParams, persistedState?: any) => Promise<boolean>;
|
|
10
14
|
declare const checkIfConversationStillValid: (facadeChatSDK: FacadeChatSDK, dispatch: Dispatch<ILiveChatWidgetAction>, state: ILiveChatWidgetContext) => Promise<boolean>;
|
|
11
15
|
export { prepareStartChat, initStartChat, setPreChatAndInitiateChat, checkIfConversationStillValid };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/******
|
|
2
|
+
* AttachmentForScreenReaderMiddleware
|
|
3
|
+
*
|
|
4
|
+
* Web Chat reads an Adaptive Card to screen readers only from the card's `speak` property.
|
|
5
|
+
* A card without `speak` is announced as "A card" with no content.
|
|
6
|
+
* This middleware sets `speak` from the visible text of the card, then lets Web Chat render it as usual.
|
|
7
|
+
******/
|
|
8
|
+
type RenderMarkdownAsHTML = (markdown: string) => string;
|
|
9
|
+
export declare const getAdaptiveCardSpeak: (content: any, adaptiveCardsPackage: any, renderMarkdownAsHTML: RenderMarkdownAsHTML, adaptiveCardsParserMaxVersion?: string) => string;
|
|
10
|
+
export declare const createAttachmentForScreenReaderMiddleware: (renderMarkdownAsHTML: RenderMarkdownAsHTML) => () => (next: any) => (...args: any[]) => any;
|
|
11
|
+
export {};
|
|
@@ -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
|
|
6
|
-
*
|
|
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
|
|
10
|
-
export
|
|
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
|
-
*
|
|
39
|
-
*
|
|
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.
|
|
3
|
+
"version": "2.0.1-main.38c3c85",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@axe-core/react": "^4.10.2",
|
|
73
73
|
"accessibility-insights-scan": "^3.0.0",
|
|
74
74
|
"@guidepup/guidepup": "^0.24.1",
|
|
75
|
-
"postcss": "
|
|
75
|
+
"postcss": "8.5.19",
|
|
76
76
|
"react": "^18.3.1",
|
|
77
77
|
"react-dom": "^18.3.1",
|
|
78
78
|
"react-native-web": "^0.21.2",
|
|
@@ -93,18 +93,17 @@
|
|
|
93
93
|
"@azure/core-tracing": "^1.2.0",
|
|
94
94
|
"@microsoft/applicationinsights-web": "^3.3.6",
|
|
95
95
|
"@microsoft/omnichannel-chat-components": "1.2.0",
|
|
96
|
-
"@microsoft/omnichannel-chat-sdk": "2.0.
|
|
96
|
+
"@microsoft/omnichannel-chat-sdk": "2.0.2-main.8b19159",
|
|
97
97
|
"@opentelemetry/api": "^1.9.0",
|
|
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": "
|
|
102
|
-
"markdown-it": "^14.3.
|
|
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.6",
|
|
108
107
|
"simple-update-in": "2.2.0",
|
|
109
108
|
"slack-markdown-it": "^1.0.5"
|
|
110
109
|
},
|
|
@@ -163,7 +162,8 @@
|
|
|
163
162
|
"**/@types/minimatch": "3.0.5",
|
|
164
163
|
"**/@types/trusted-types": "2.0.7",
|
|
165
164
|
"**/join-images": "1.1.5",
|
|
166
|
-
"**/valibot": "1.4.2"
|
|
165
|
+
"**/valibot": "1.4.2",
|
|
166
|
+
"**/nanoid": "^3.3.20"
|
|
167
167
|
},
|
|
168
168
|
"jest": {
|
|
169
169
|
"verbose": true,
|