@microsoft/omnichannel-chat-widget 2.0.1-main.38e7390 → 2.0.1-main.5b375de

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 (33) hide show
  1. package/README.md +57 -0
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +10 -0
  3. package/lib/cjs/common/telemetry/TelemetryHelper.js +8 -0
  4. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -0
  5. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +31 -7
  6. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +29 -1
  7. package/lib/cjs/components/livechatwidget/common/recoveryEligibilityTelemetry.js +11 -1
  8. package/lib/cjs/components/livechatwidget/common/startChat.js +15 -7
  9. package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +34 -5
  10. package/lib/cjs/components/livechatwidget/common/useChatTokenRenewal.js +252 -0
  11. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +5 -17
  12. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentForScreenReaderMiddleware.js +159 -0
  13. package/lib/esm/common/telemetry/TelemetryConstants.js +10 -0
  14. package/lib/esm/common/telemetry/TelemetryHelper.js +8 -0
  15. package/lib/esm/components/livechatwidget/LiveChatWidget.js +3 -1
  16. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +28 -6
  17. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +28 -1
  18. package/lib/esm/components/livechatwidget/common/recoveryEligibilityTelemetry.js +11 -1
  19. package/lib/esm/components/livechatwidget/common/startChat.js +15 -7
  20. package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +34 -5
  21. package/lib/esm/components/livechatwidget/common/useChatTokenRenewal.js +245 -0
  22. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +6 -18
  23. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentForScreenReaderMiddleware.js +153 -0
  24. package/lib/types/common/telemetry/TelemetryConstants.d.ts +5 -0
  25. package/lib/types/common/telemetry/TelemetryHelper.d.ts +6 -0
  26. package/lib/types/common/telemetry/definitions/Contracts.d.ts +6 -0
  27. package/lib/types/common/telemetry/definitions/Payload.d.ts +6 -0
  28. package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +8 -0
  29. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -1
  30. package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -1
  31. package/lib/types/components/livechatwidget/common/useChatTokenRenewal.d.ts +5 -0
  32. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentForScreenReaderMiddleware.d.ts +11 -0
  33. package/package.json +5 -6
@@ -38,6 +38,12 @@ export interface ActionsContract extends BaseContract {
38
38
  ActionType?: string;
39
39
  Description?: string;
40
40
  CustomProperties?: any;
41
+ conversationState?: string;
42
+ hasReconnectId?: string;
43
+ hasLiveChatContext?: string;
44
+ hasRequestId?: string;
45
+ eligible?: string;
46
+ reason?: string;
41
47
  }
42
48
  export interface IC3ClientContract extends BaseContract {
43
49
  Event?: string;
@@ -88,6 +88,12 @@ export interface ActionTelemetryData extends BaseTelemetryData {
88
88
  ExceptionDetails?: object;
89
89
  Description?: string;
90
90
  CustomProperties?: any;
91
+ conversationState?: string;
92
+ hasReconnectId?: string;
93
+ hasLiveChatContext?: string;
94
+ hasRequestId?: string;
95
+ eligible?: string;
96
+ reason?: string;
91
97
  }
92
98
  export interface CallingTelemetryData extends BaseTelemetryData {
93
99
  CallId?: string;
@@ -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 };
@@ -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
- declare const initStartChat: (facadeChatSDK: FacadeChatSDK, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, state: ILiveChatWidgetContext | undefined, props?: ILiveChatWidgetProps, params?: StartChatOptionalParams, persistedState?: any) => Promise<void>;
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,5 @@
1
+ import { Dispatch } from "react";
2
+ import { FacadeChatSDK } from "../../../common/facades/FacadeChatSDK";
3
+ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
4
+ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
5
+ export declare const useChatTokenRenewal: (facade: FacadeChatSDK | undefined, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, widgetCacheId: string) => void;
@@ -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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "2.0.1-main.38e7390",
3
+ "version": "2.0.1-main.5b375de",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -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.1",
96
+ "@microsoft/omnichannel-chat-sdk": "2.0.2-main.355218f",
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": "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",
108
107
  "simple-update-in": "2.2.0",
109
108
  "slack-markdown-it": "^1.0.5"
110
109
  },
@@ -164,7 +163,7 @@
164
163
  "**/@types/trusted-types": "2.0.7",
165
164
  "**/join-images": "1.1.5",
166
165
  "**/valibot": "1.4.2",
167
- "**/nanoid": "3.3.18"
166
+ "**/nanoid": "^3.3.20"
168
167
  },
169
168
  "jest": {
170
169
  "verbose": true,