@microsoft/omnichannel-chat-widget 1.8.2-main.fc93d3d → 1.8.3-main.1381896
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 +46 -1
- package/lib/cjs/common/Constants.js +10 -2
- package/lib/cjs/common/telemetry/TelemetryConstants.js +6 -0
- package/lib/cjs/common/telemetry/TelemetryHelper.js +7 -5
- package/lib/cjs/common/utils.js +27 -2
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +4 -4
- package/lib/cjs/components/citationpanestateful/CitationDim.js +29 -0
- package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +199 -0
- package/lib/cjs/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +70 -0
- package/lib/cjs/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +4 -4
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
- package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +22 -9
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +54 -1
- package/lib/cjs/components/livechatwidget/common/customEventHandler.js +53 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +34 -4
- package/lib/cjs/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +12 -5
- package/lib/cjs/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +23 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +8 -6
- package/lib/cjs/components/livechatwidget/interfaces/IMockProps.js +8 -2
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +45 -11
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +114 -13
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -12
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +62 -3
- package/lib/cjs/components/webchatcontainerstateful/common/utils/fontUtils.js +28 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.js +42 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +139 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.js +41 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +54 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +45 -0
- package/lib/cjs/contexts/common/CustomEventType.js +1 -0
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +46 -45
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
- package/lib/cjs/contexts/createReducer.js +15 -0
- package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +101 -36
- package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +39 -21
- package/lib/cjs/firstresponselatency/util.js +24 -10
- package/lib/cjs/index.js +9 -1
- package/lib/cjs/plugins/createChatTranscript.js +13 -0
- package/lib/cjs/plugins/newMessageEventHandler.js +2 -2
- package/lib/esm/common/Constants.js +10 -2
- package/lib/esm/common/telemetry/TelemetryConstants.js +6 -0
- package/lib/esm/common/telemetry/TelemetryHelper.js +7 -5
- package/lib/esm/common/utils.js +21 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +4 -4
- package/lib/esm/components/citationpanestateful/CitationDim.js +20 -0
- package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +188 -0
- package/lib/esm/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +61 -0
- package/lib/esm/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +4 -4
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
- package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +22 -9
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +54 -1
- package/lib/esm/components/livechatwidget/common/customEventHandler.js +45 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +35 -5
- package/lib/esm/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -6
- package/lib/esm/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +23 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +8 -6
- package/lib/esm/components/livechatwidget/interfaces/IMockProps.js +3 -3
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +45 -11
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +114 -14
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -12
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +55 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/fontUtils.js +21 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.js +36 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +133 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.js +33 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +46 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +38 -0
- package/lib/esm/contexts/common/CustomEventType.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +46 -45
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
- package/lib/esm/contexts/createReducer.js +15 -0
- package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +101 -36
- package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +39 -21
- package/lib/esm/firstresponselatency/util.js +21 -8
- package/lib/esm/index.js +1 -0
- package/lib/esm/plugins/createChatTranscript.js +13 -0
- package/lib/esm/plugins/newMessageEventHandler.js +3 -3
- package/lib/types/common/Constants.d.ts +10 -2
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +6 -0
- package/lib/types/common/utils.d.ts +8 -0
- package/lib/types/components/citationpanestateful/CitationDim.d.ts +5 -0
- package/lib/types/components/citationpanestateful/CitationPaneStateful.d.ts +4 -0
- package/lib/types/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.d.ts +11 -0
- package/lib/types/components/citationpanestateful/interfaces/ICitationPaneStatefulProps.d.ts +19 -0
- package/lib/types/components/confirmationpanestateful/common/defaultProps/defaultConfirmationPaneLocalizedTexts.d.ts +1 -1
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/customEventHandler.d.ts +4 -0
- package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +2 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
- package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +5 -3
- package/lib/types/components/webchatcontainerstateful/common/DesignerChatAdapter.d.ts +4 -2
- package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +5 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +8 -1
- package/lib/types/components/webchatcontainerstateful/common/utils/fontUtils.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/ICitation.d.ts +12 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.d.ts +8 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.d.ts +22 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +5 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +5 -0
- package/lib/types/contexts/common/CustomEventType.d.ts +6 -0
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +46 -45
- package/lib/types/firstresponselatency/FirstResponseLatencyTracker.d.ts +2 -2
- package/lib/types/firstresponselatency/util.d.ts +1 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +5 -4
- /package/lib/cjs/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
- /package/lib/esm/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
- /package/lib/types/components/confirmationpanestateful/interfaces/{IConfirmationPaneLocalizedText.d.ts → IConfirmationPaneLocalizedTexts.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -223,6 +223,51 @@ const customizedFooterProp: IFooterProps = {
|
|
|
223
223
|
|
|
224
224
|
> :pushpin: Note that [WebChat hooks](https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/HOOKS.md) can also be used in any custom components.
|
|
225
225
|
|
|
226
|
+
#### Bidirectional Custom Events
|
|
227
|
+
- Sending events from a hosting web page to bots/agents
|
|
228
|
+
- Register a function to post event
|
|
229
|
+
```js
|
|
230
|
+
//define sendCustomEvent function
|
|
231
|
+
const sendCustomEvent = (payload) => {
|
|
232
|
+
const customEvent = {
|
|
233
|
+
eventName: "sendCustomEvent",
|
|
234
|
+
payload
|
|
235
|
+
};
|
|
236
|
+
BroadcastService.postMessage(customEvent);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
//attach the sendCustomEvent function to window object
|
|
240
|
+
window["sendCustomEvent"] = sendCustomEvent;
|
|
241
|
+
|
|
242
|
+
//invoke the sendCustomEvent function with some customized payload
|
|
243
|
+
window.sendCustomEvent({
|
|
244
|
+
customEventName: "TestEvent",
|
|
245
|
+
customEventValue: {
|
|
246
|
+
boolVar: true,
|
|
247
|
+
displayableVar: {
|
|
248
|
+
isDisplayable: true,
|
|
249
|
+
value: "From C2: "+ new Date().toISOString()
|
|
250
|
+
},
|
|
251
|
+
numberVar: -10.5,
|
|
252
|
+
stringVar: "Hello from C2 str: " + new Date().toISOString()
|
|
253
|
+
}
|
|
254
|
+
})
|
|
255
|
+
```
|
|
256
|
+
- Receiving events from bots/agents
|
|
257
|
+
```js
|
|
258
|
+
//define setOnCustomEvent function
|
|
259
|
+
const setOnCustomEvent = (callback) => {
|
|
260
|
+
BroadcastService.getMessageByEventName("onCustomEvent").subscribe((event) => {
|
|
261
|
+
if (event && typeof callback === "function") {
|
|
262
|
+
callback(event);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
//set callback function
|
|
268
|
+
setOnCustomEvent((event) => console.log(event));
|
|
269
|
+
```
|
|
270
|
+
|
|
226
271
|
## See Also
|
|
227
272
|
|
|
228
273
|
[Customizations Dev Guide](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/customizations/getstarted.md)\
|
|
@@ -232,4 +277,4 @@ const customizedFooterProp: IFooterProps = {
|
|
|
232
277
|
[How to Add Visual Regression Tests](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/VisualRegressionTestingGuide.md)\
|
|
233
278
|
[Security](https://github.com/microsoft/omnichannel-chat-widget/blob/main/SECURITY.md)\
|
|
234
279
|
[Third Party Cookie Support](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/Tpc.md)\
|
|
235
|
-
[Storybook](https://microsoft.github.io/omnichannel-chat-widget/docs/storybook/)
|
|
280
|
+
[Storybook](https://microsoft.github.io/omnichannel-chat-widget/docs/storybook/)
|
|
@@ -32,6 +32,7 @@ _defineProperty(Constants, "webchatChannelId", "webchat");
|
|
|
32
32
|
_defineProperty(Constants, "markdown", "markdown");
|
|
33
33
|
_defineProperty(Constants, "actionType", "actionType");
|
|
34
34
|
_defineProperty(Constants, "markDownSystemMessageClass", "webchat__basic-transcript__activity-markdown-body");
|
|
35
|
+
_defineProperty(Constants, "MARKDOWN_LIST_INDENTATION", " ");
|
|
35
36
|
_defineProperty(Constants, "String", "string");
|
|
36
37
|
_defineProperty(Constants, "ChatMessagesJson", "chatMessagesJson");
|
|
37
38
|
_defineProperty(Constants, "truePascal", "True");
|
|
@@ -115,8 +116,7 @@ _defineProperty(Constants, "TargetRelationshipAttributes", "noopener noreferrer"
|
|
|
115
116
|
// Markdown icons
|
|
116
117
|
_defineProperty(Constants, "OpenLinkIconCssClass", "webchat__render-markdown__external-link-icon");
|
|
117
118
|
// internet connection test
|
|
118
|
-
_defineProperty(Constants, "
|
|
119
|
-
_defineProperty(Constants, "internetConnectionTestUrlText", "Omnichannel Connect Test");
|
|
119
|
+
_defineProperty(Constants, "internetConnectionTestPath", "/livechatwidget/version.txt");
|
|
120
120
|
_defineProperty(Constants, "ChatWidgetStateChangedPrefix", "ChatWidgetStateChanged");
|
|
121
121
|
_defineProperty(Constants, "PostChatLoadingDurationInMs", 2000);
|
|
122
122
|
_defineProperty(Constants, "BrowserUnloadConfirmationMessage", "Do you want to leave chat?");
|
|
@@ -132,6 +132,12 @@ _defineProperty(Constants, "InitContextParamsResponse", "initContextParamsRespon
|
|
|
132
132
|
_defineProperty(Constants, "OCOriginalMessageId", "OriginalMessageId");
|
|
133
133
|
_defineProperty(Constants, "WebchatSequenceIdAttribute", "webchat:sequence-id");
|
|
134
134
|
_defineProperty(Constants, "MessageSequenceIdOverride", "MessageSequenceIdOverride");
|
|
135
|
+
_defineProperty(Constants, "sendCustomEvent", "sendCustomEvent");
|
|
136
|
+
_defineProperty(Constants, "onCustomEvent", "onCustomEvent");
|
|
137
|
+
_defineProperty(Constants, "customEventName", "customEventName");
|
|
138
|
+
_defineProperty(Constants, "customEventValue", "customEventValue");
|
|
139
|
+
_defineProperty(Constants, "Hidden", "Hidden");
|
|
140
|
+
_defineProperty(Constants, "EndConversationDueToOverflow", "endconversationduetooverflow");
|
|
135
141
|
const Regex = (_class = /*#__PURE__*/_createClass(function Regex() {
|
|
136
142
|
_classCallCheck(this, Regex);
|
|
137
143
|
}), _defineProperty(_class, "EmailRegex", "^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\")@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\])$"), _class);
|
|
@@ -190,6 +196,8 @@ _defineProperty(HtmlAttributeNames, "adaptiveCardClassName", "ac-adaptiveCard");
|
|
|
190
196
|
_defineProperty(HtmlAttributeNames, "adaptiveCardTextBlockClassName", "ac-textBlock");
|
|
191
197
|
_defineProperty(HtmlAttributeNames, "adaptiveCardToggleInputClassName", "ac-toggleInput");
|
|
192
198
|
_defineProperty(HtmlAttributeNames, "adaptiveCardActionSetClassName", "ac-actionSet");
|
|
199
|
+
_defineProperty(HtmlAttributeNames, "ocwCitationPaneClassName", "ocw-citation-pane");
|
|
200
|
+
_defineProperty(HtmlAttributeNames, "ocwCitationPaneTitle", "Citation");
|
|
193
201
|
let WebChatMiddlewareConstants = /*#__PURE__*/_createClass(function WebChatMiddlewareConstants() {
|
|
194
202
|
_classCallCheck(this, WebChatMiddlewareConstants);
|
|
195
203
|
});
|
|
@@ -154,6 +154,7 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
154
154
|
TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
|
|
155
155
|
TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
|
|
156
156
|
TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
|
|
157
|
+
TelemetryEvent["CitationPaneLoaded"] = "CitationPaneLoaded";
|
|
157
158
|
TelemetryEvent["ProactiveChatPaneLoaded"] = "ProactiveChatPaneLoaded";
|
|
158
159
|
TelemetryEvent["ReconnectChatPaneLoaded"] = "ReconnectChatPaneLoaded";
|
|
159
160
|
TelemetryEvent["HeaderCloseButtonClicked"] = "HeaderCloseButtonClicked";
|
|
@@ -190,10 +191,12 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
190
191
|
TelemetryEvent["BotAuthActivityUndefinedSignInId"] = "BotAuthActivityUndefinedSignInId";
|
|
191
192
|
TelemetryEvent["ThirdPartyCookiesBlocked"] = "ThirdPartyCookiesBlocked";
|
|
192
193
|
TelemetryEvent["ParticipantsRemovedEvent"] = "ParticipantsRemovedEvent";
|
|
194
|
+
TelemetryEvent["QueueOverflowEvent"] = "QueueOverflowEvent";
|
|
193
195
|
TelemetryEvent["ProcessingHTMLTextMiddlewareFailed"] = "ProcessingHTMLTextMiddlewareFailed";
|
|
194
196
|
TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
|
|
195
197
|
TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
|
|
196
198
|
TelemetryEvent["AttachmentUploadValidatorMiddlewareFailed"] = "AttachmentUploadValidatorMiddlewareFailed";
|
|
199
|
+
TelemetryEvent["CitationMiddlewareFailed"] = "CitationMiddlewareFailed";
|
|
197
200
|
TelemetryEvent["QueuePositionMessageRecieved"] = "QueuePositionMessageRecieved";
|
|
198
201
|
TelemetryEvent["AverageWaitTimeMessageRecieved"] = "AverageWaitTimeMessageRecieved";
|
|
199
202
|
TelemetryEvent["DataMaskingRuleApplied"] = "DataMaskingRuleApplied";
|
|
@@ -228,6 +231,7 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
228
231
|
TelemetryEvent["SystemMessageReceived"] = "SystemMessageReceived";
|
|
229
232
|
TelemetryEvent["RehydrateMessageReceived"] = "RehydrateMessageReceived";
|
|
230
233
|
TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
|
|
234
|
+
TelemetryEvent["CustomEventAction"] = "CustomEventAction";
|
|
231
235
|
TelemetryEvent["NetworkDisconnected"] = "NetworkDisconnected";
|
|
232
236
|
TelemetryEvent["NetworkReconnected"] = "NetworkReconnected";
|
|
233
237
|
TelemetryEvent["LinkModePostChatWorkflowStarted"] = "LinkModePostChatWorkflowStarted";
|
|
@@ -277,7 +281,9 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
277
281
|
TelemetryEvent["UXLCWChatButtonLoadingStart"] = "UXLCWChatButtonLoadingStart";
|
|
278
282
|
TelemetryEvent["UXLCWChatButtonLoadingCompleted"] = "UXLCWChatButtonLoadingCompleted";
|
|
279
283
|
TelemetryEvent["UXConfirmationPaneStart"] = "UXConfirmationPaneStart";
|
|
284
|
+
TelemetryEvent["UXCitationPaneStart"] = "UXCitationPaneStart";
|
|
280
285
|
TelemetryEvent["UXConfirmationPaneCompleted"] = "UXConfirmationPaneCompleted";
|
|
286
|
+
TelemetryEvent["UXCitationPaneCompleted"] = "UXCitationPaneCompleted";
|
|
281
287
|
TelemetryEvent["UXLiveChatWidgetStart"] = "UXLiveChatWidgetStart";
|
|
282
288
|
TelemetryEvent["UXLiveChatWidgetCompleted"] = "UXLiveChatWidgetCompleted";
|
|
283
289
|
TelemetryEvent["AppInsightsInitialized"] = "AppInsightsInitialized";
|
|
@@ -236,11 +236,13 @@ let TelemetryHelper = /*#__PURE__*/function () {
|
|
|
236
236
|
}, {
|
|
237
237
|
key: "postTelemetryEvent",
|
|
238
238
|
value: function postTelemetryEvent(eventName, logLevel, payload) {
|
|
239
|
+
var _TelemetryManager$Int16;
|
|
239
240
|
const telemetryEvent = {
|
|
240
241
|
eventName,
|
|
241
242
|
logLevel,
|
|
242
243
|
payload: {
|
|
243
|
-
...payload
|
|
244
|
+
...payload,
|
|
245
|
+
runtimeId: (_TelemetryManager$Int16 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int16 === void 0 ? void 0 : _TelemetryManager$Int16.lcwRuntimeId
|
|
244
246
|
}
|
|
245
247
|
};
|
|
246
248
|
_omnichannelChatComponents.BroadcastService.postMessage(telemetryEvent);
|
|
@@ -267,11 +269,11 @@ _defineProperty(TelemetryHelper, "logActionEvent", (logLevel, payload) => {
|
|
|
267
269
|
TelemetryHelper.postTelemetryEvent((payload === null || payload === void 0 ? void 0 : payload.Event) ?? "", logLevel, payload);
|
|
268
270
|
});
|
|
269
271
|
_defineProperty(TelemetryHelper, "logSDKEvent", (logLevel, payload) => {
|
|
270
|
-
var _TelemetryManager$
|
|
272
|
+
var _TelemetryManager$Int17;
|
|
271
273
|
TelemetryHelper.postTelemetryEvent((payload === null || payload === void 0 ? void 0 : payload.Event) ?? "", logLevel, {
|
|
272
274
|
...payload,
|
|
273
275
|
TransactionId: (0, _utils.newGuid)(),
|
|
274
|
-
RequestId: (_TelemetryManager$
|
|
276
|
+
RequestId: (_TelemetryManager$Int17 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int17 === void 0 ? void 0 : _TelemetryManager$Int17.currentRequestId
|
|
275
277
|
});
|
|
276
278
|
});
|
|
277
279
|
_defineProperty(TelemetryHelper, "logConfigDataEvent", (logLevel, payload) => {
|
|
@@ -306,12 +308,12 @@ _defineProperty(TelemetryHelper, "logFacadeChatSDKEventToAllTelemetry", (logLeve
|
|
|
306
308
|
});
|
|
307
309
|
});
|
|
308
310
|
_defineProperty(TelemetryHelper, "logSDKEventToAllTelemetry", (logLevel, payload) => {
|
|
309
|
-
var _TelemetryManager$
|
|
311
|
+
var _TelemetryManager$Int18;
|
|
310
312
|
TelemetryHelper.postTelemetryEvent((payload === null || payload === void 0 ? void 0 : payload.Event) ?? "", logLevel, {
|
|
311
313
|
...{
|
|
312
314
|
...payload,
|
|
313
315
|
TransactionId: (0, _utils.newGuid)(),
|
|
314
|
-
RequestId: (_TelemetryManager$
|
|
316
|
+
RequestId: (_TelemetryManager$Int18 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int18 === void 0 ? void 0 : _TelemetryManager$Int18.currentRequestId
|
|
315
317
|
},
|
|
316
318
|
LogToAll: true
|
|
317
319
|
});
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.formatTemplateString = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
|
|
6
|
+
exports.getCustomEventValue = exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.formatTemplateString = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
|
|
7
7
|
exports.getDeviceType = getDeviceType;
|
|
8
|
-
exports.
|
|
8
|
+
exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = void 0;
|
|
9
|
+
exports.isEndConversationDueToOverflowActivity = isEndConversationDueToOverflowActivity;
|
|
10
|
+
exports.setTabIndices = exports.setOcUserAgent = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseLowerCaseString = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isValidCustomEvent = exports.isUndefinedOrEmpty = exports.isThisSessionPopout = exports.isNullOrUndefined = exports.isNullOrEmptyString = void 0;
|
|
9
11
|
var _Constants = require("./Constants");
|
|
10
12
|
var _TelemetryConstants = require("./telemetry/TelemetryConstants");
|
|
11
13
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
@@ -494,4 +496,27 @@ function getDeviceType() {
|
|
|
494
496
|
} else {
|
|
495
497
|
return "standard";
|
|
496
498
|
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
//Bots expect a payload containing:
|
|
502
|
+
//1. customEventName: this should be string describe the event name
|
|
503
|
+
//2. customEventValue: given the value is from customer with unknown type, it is required to stringify the payload later
|
|
504
|
+
const isValidCustomEvent = payload => {
|
|
505
|
+
if (_Constants.Constants.customEventName in payload && payload.customEventName && typeof payload.customEventName === _Constants.Constants.String && _Constants.Constants.customEventValue in payload && payload.customEventValue) return true;
|
|
506
|
+
return false;
|
|
507
|
+
};
|
|
508
|
+
exports.isValidCustomEvent = isValidCustomEvent;
|
|
509
|
+
const getCustomEventValue = customEventPayload => {
|
|
510
|
+
let returnVal = "";
|
|
511
|
+
try {
|
|
512
|
+
returnVal = typeof customEventPayload.customEventValue === _Constants.Constants.String ? customEventPayload.customEventValue : JSON.stringify(customEventPayload.customEventValue);
|
|
513
|
+
} catch (error) {
|
|
514
|
+
console.error(error);
|
|
515
|
+
}
|
|
516
|
+
return returnVal;
|
|
517
|
+
};
|
|
518
|
+
exports.getCustomEventValue = getCustomEventValue;
|
|
519
|
+
function isEndConversationDueToOverflowActivity(activity) {
|
|
520
|
+
var _activity$channelData, _activity$channelData2;
|
|
521
|
+
return (activity === null || activity === void 0 ? void 0 : (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : _activity$channelData.tags) && Array.isArray(activity === null || activity === void 0 ? void 0 : (_activity$channelData2 = activity.channelData) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.tags) && activity.channelData.tags.includes(_Constants.Constants.EndConversationDueToOverflow);
|
|
497
522
|
}
|
|
@@ -74,7 +74,6 @@ const ChatButtonStateful = props => {
|
|
|
74
74
|
};
|
|
75
75
|
const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeChatButtonStyleProps.defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
|
|
76
76
|
const controlProps = {
|
|
77
|
-
...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps),
|
|
78
77
|
id: "oc-lcw-chat-button",
|
|
79
78
|
dir: state.domainStates.globalDir,
|
|
80
79
|
titleText: "Let's Chat!",
|
|
@@ -83,7 +82,8 @@ const ChatButtonStateful = props => {
|
|
|
83
82
|
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
|
|
84
83
|
unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
|
|
85
84
|
// Regular chat button onClick - this will always take precedence
|
|
86
|
-
onClick: () => ref.current()
|
|
85
|
+
onClick: () => ref.current(),
|
|
86
|
+
...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
|
|
87
87
|
};
|
|
88
88
|
const outOfOfficeControlProps = {
|
|
89
89
|
// Only take specific properties from outOfOfficeButtonProps, never onClick
|
|
@@ -92,7 +92,6 @@ const ChatButtonStateful = props => {
|
|
|
92
92
|
titleText: (outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : (_outOfOfficeButtonPro = outOfOfficeButtonProps.controlProps) === null || _outOfOfficeButtonPro === void 0 ? void 0 : _outOfOfficeButtonPro.titleText) || "We're Offline",
|
|
93
93
|
subtitleText: (outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : (_outOfOfficeButtonPro2 = outOfOfficeButtonProps.controlProps) === null || _outOfOfficeButtonPro2 === void 0 ? void 0 : _outOfOfficeButtonPro2.subtitleText) || "No agents available",
|
|
94
94
|
unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
|
|
95
|
-
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps),
|
|
96
95
|
// Out-of-office specific onClick - this will ALWAYS take precedence
|
|
97
96
|
onClick: () => {
|
|
98
97
|
if (state.appStates.isMinimized) {
|
|
@@ -105,7 +104,8 @@ const ChatButtonStateful = props => {
|
|
|
105
104
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
106
105
|
payload: _ConversationState.ConversationState.OutOfOffice
|
|
107
106
|
});
|
|
108
|
-
}
|
|
107
|
+
},
|
|
108
|
+
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
|
|
109
109
|
};
|
|
110
110
|
(0, _react.useEffect)(() => {
|
|
111
111
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.CitationDim = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
9
|
+
var _DimLayer = require("../dimlayer/DimLayer");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const CONTAINER_SELECTOR = ".webchat__stacked-layout_container";
|
|
12
|
+
const CitationDim = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
brightness = "0.2"
|
|
15
|
+
} = _ref;
|
|
16
|
+
const container = document.querySelector(CONTAINER_SELECTOR);
|
|
17
|
+
if (!container) return null;
|
|
18
|
+
return /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement("div", {
|
|
19
|
+
style: {
|
|
20
|
+
position: "absolute",
|
|
21
|
+
inset: 0
|
|
22
|
+
}
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement(_DimLayer.DimLayer, {
|
|
24
|
+
brightness: brightness
|
|
25
|
+
})), container);
|
|
26
|
+
};
|
|
27
|
+
exports.CitationDim = CitationDim;
|
|
28
|
+
var _default = CitationDim;
|
|
29
|
+
exports.default = _default;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.CitationPaneStateful = void 0;
|
|
7
|
+
var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _utils = require("../../common/utils");
|
|
10
|
+
var _CitationDim = _interopRequireDefault(require("./CitationDim"));
|
|
11
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
12
|
+
var _Constants = require("../../common/Constants");
|
|
13
|
+
var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
|
|
14
|
+
var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
|
|
15
|
+
var _defaultCitationPaneProps = require("./common/defaultProps/defaultCitationPaneProps");
|
|
16
|
+
var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
+
let uiTimer;
|
|
21
|
+
const CitationPaneStateful = props => {
|
|
22
|
+
var _props$styleProps3;
|
|
23
|
+
(0, _react.useEffect)(() => {
|
|
24
|
+
uiTimer = (0, _utils.createTimer)();
|
|
25
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
26
|
+
Event: _TelemetryConstants.TelemetryEvent.UXCitationPaneStart
|
|
27
|
+
});
|
|
28
|
+
}, []);
|
|
29
|
+
const initialTabIndexMap = new Map();
|
|
30
|
+
let elements = [];
|
|
31
|
+
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
+
const [state, dispatch] = (0, _useChatContextStore.default)();
|
|
34
|
+
|
|
35
|
+
// Use props.id if provided, otherwise fall back to default
|
|
36
|
+
const controlId = props.id || _Constants.HtmlAttributeNames.ocwCitationPaneClassName;
|
|
37
|
+
|
|
38
|
+
// Pane style computed to match the webchat widget container bounds so the pane
|
|
39
|
+
// stays within the widget and scrolls only vertically. We also track an
|
|
40
|
+
// "isReady" flag so we don't render the pane contents until the style is
|
|
41
|
+
// computed — this prevents a transient render that can appear as a flicker.
|
|
42
|
+
const [paneStyle, setPaneStyle] = (0, _react.useState)(null);
|
|
43
|
+
const [isReady, setIsReady] = (0, _react.useState)(false);
|
|
44
|
+
|
|
45
|
+
// Move focus to the container
|
|
46
|
+
(0, _react.useEffect)(() => {
|
|
47
|
+
(0, _utils.preventFocusToMoveOutOfElement)(controlId);
|
|
48
|
+
const focusableElements = (0, _utils.findAllFocusableElement)(`#${controlId}`);
|
|
49
|
+
requestAnimationFrame(() => {
|
|
50
|
+
if (focusableElements && focusableElements.length > 0 && focusableElements[0]) {
|
|
51
|
+
focusableElements[0].focus({
|
|
52
|
+
preventScroll: true
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
elements = (0, _utils.findParentFocusableElementsWithoutChildContainer)(controlId);
|
|
57
|
+
(0, _utils.setTabIndices)(elements, initialTabIndexMap, false);
|
|
58
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
59
|
+
Event: _TelemetryConstants.TelemetryEvent.CitationPaneLoaded
|
|
60
|
+
});
|
|
61
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
62
|
+
Event: _TelemetryConstants.TelemetryEvent.UXCitationPaneCompleted,
|
|
63
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
64
|
+
});
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
// Compute the widget bounds and set pane style accordingly (95% of widget size
|
|
68
|
+
// and centered inside the widget). If the widget container can't be found,
|
|
69
|
+
// fall back to the default pane styles from defaultCitationPaneProps.
|
|
70
|
+
(0, _react.useEffect)(() => {
|
|
71
|
+
const compute = () => {
|
|
72
|
+
var _props$styleProps2;
|
|
73
|
+
try {
|
|
74
|
+
const container = document.querySelector(".webchat__stacked-layout_container");
|
|
75
|
+
if (container) {
|
|
76
|
+
var _props$styleProps;
|
|
77
|
+
const rect = container.getBoundingClientRect();
|
|
78
|
+
const widthPx = Math.round(rect.width * 0.95);
|
|
79
|
+
const heightPx = Math.round(rect.height * 0.95);
|
|
80
|
+
const leftPx = Math.round(rect.left + (rect.width - widthPx) / 2);
|
|
81
|
+
const topPx = Math.round(rect.top + (rect.height - heightPx) / 2);
|
|
82
|
+
// Clone defaults and remove transform so explicit left/top pixel
|
|
83
|
+
// coordinates are respected and the pane stays within the
|
|
84
|
+
// widget bounds.
|
|
85
|
+
const base = Object.assign({}, _defaultCitationPaneProps.defaultCitationPaneStyles.pane);
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
+
if (base && base.transform) {
|
|
88
|
+
// remove centering transform when we compute exact pixel coords
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
|
+
delete base.transform;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Merge user styles first, then computed positioning to ensure proper positioning
|
|
94
|
+
const computedStyle = {
|
|
95
|
+
left: `${leftPx}px`,
|
|
96
|
+
top: `${topPx}px`,
|
|
97
|
+
width: `${widthPx}px`,
|
|
98
|
+
height: `${heightPx}px`
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Apply user styles first, then override with computed positioning
|
|
102
|
+
const generalProps = (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps;
|
|
103
|
+
const userStyles = generalProps && typeof generalProps === "object" ? Object.assign({}, generalProps) : {};
|
|
104
|
+
// Remove positioning properties from user styles that would interfere
|
|
105
|
+
delete userStyles.position;
|
|
106
|
+
delete userStyles.left;
|
|
107
|
+
delete userStyles.top;
|
|
108
|
+
delete userStyles.width;
|
|
109
|
+
delete userStyles.height;
|
|
110
|
+
setPaneStyle(Object.assign({}, base, userStyles, computedStyle));
|
|
111
|
+
// Make the pane visible after the next paint to avoid layout
|
|
112
|
+
// flashes on initial mount.
|
|
113
|
+
requestAnimationFrame(() => setIsReady(true));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
} catch (e) {
|
|
117
|
+
// ignore
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// fallback - merge defaults with user-provided styles but preserve positioning
|
|
121
|
+
const generalProps = (_props$styleProps2 = props.styleProps) === null || _props$styleProps2 === void 0 ? void 0 : _props$styleProps2.generalStyleProps;
|
|
122
|
+
const userStyles = generalProps && typeof generalProps === "object" ? Object.assign({}, generalProps) : {};
|
|
123
|
+
// Remove positioning properties from user styles for fallback
|
|
124
|
+
delete userStyles.position;
|
|
125
|
+
delete userStyles.left;
|
|
126
|
+
delete userStyles.top;
|
|
127
|
+
delete userStyles.width;
|
|
128
|
+
delete userStyles.height;
|
|
129
|
+
const fallbackStyle = Object.assign({}, _defaultCitationPaneProps.defaultCitationPaneStyles.pane, userStyles);
|
|
130
|
+
setPaneStyle(fallbackStyle);
|
|
131
|
+
requestAnimationFrame(() => setIsReady(true));
|
|
132
|
+
};
|
|
133
|
+
compute();
|
|
134
|
+
window.addEventListener("resize", compute);
|
|
135
|
+
return () => window.removeEventListener("resize", compute);
|
|
136
|
+
}, [(_props$styleProps3 = props.styleProps) === null || _props$styleProps3 === void 0 ? void 0 : _props$styleProps3.generalStyleProps]);
|
|
137
|
+
const handleClose = () => {
|
|
138
|
+
if (props.onClose) props.onClose();
|
|
139
|
+
dispatch({
|
|
140
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
|
|
141
|
+
payload: null
|
|
142
|
+
});
|
|
143
|
+
(0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// Merge a safe style object for the container and cast to CSSProperties to satisfy TS
|
|
147
|
+
const baseStyle = Object.assign({
|
|
148
|
+
position: "relative"
|
|
149
|
+
}, paneStyle ?? {
|
|
150
|
+
position: "fixed"
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// If paneStyle hasn't been computed yet, render the DimLayer so clicks
|
|
154
|
+
// still close overlays but hide the pane itself to avoid flashes.
|
|
155
|
+
const hiddenStyle = {
|
|
156
|
+
visibility: isReady ? "visible" : "hidden",
|
|
157
|
+
pointerEvents: isReady ? "auto" : "none"
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// Default wrapper styles - these control the positioning container
|
|
161
|
+
const defaultWrapperStyles = {
|
|
162
|
+
display: "flex",
|
|
163
|
+
flexDirection: "column",
|
|
164
|
+
zIndex: 10001
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// Wrapper styles for the positioning container
|
|
168
|
+
const wrapperStyles = Object.assign({}, baseStyle, hiddenStyle, defaultWrapperStyles);
|
|
169
|
+
|
|
170
|
+
// Merge the computed positioning styles with user's generalStyleProps for the CitationPane
|
|
171
|
+
const mergedStyleProps = props.styleProps ? {
|
|
172
|
+
...props.styleProps,
|
|
173
|
+
generalStyleProps: Object.assign({}, props.styleProps.generalStyleProps)
|
|
174
|
+
} : undefined;
|
|
175
|
+
const controlProps = {
|
|
176
|
+
id: controlId,
|
|
177
|
+
dir: state.domainStates.globalDir,
|
|
178
|
+
titleText: props.title,
|
|
179
|
+
contentHtml: props.contentHtml,
|
|
180
|
+
brightnessValueOnDim: "0.2",
|
|
181
|
+
// Default brightness
|
|
182
|
+
onClose: handleClose,
|
|
183
|
+
...(props === null || props === void 0 ? void 0 : props.controlProps) // User props override defaults
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CitationDim.default, {
|
|
188
|
+
brightness: controlProps.brightnessValueOnDim
|
|
189
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
190
|
+
style: wrapperStyles
|
|
191
|
+
}, /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.CitationPane, {
|
|
192
|
+
componentOverrides: props === null || props === void 0 ? void 0 : props.componentOverrides,
|
|
193
|
+
controlProps: controlProps,
|
|
194
|
+
styleProps: mergedStyleProps
|
|
195
|
+
})));
|
|
196
|
+
};
|
|
197
|
+
exports.CitationPaneStateful = CitationPaneStateful;
|
|
198
|
+
var _default = CitationPaneStateful;
|
|
199
|
+
exports.default = _default;
|
package/lib/cjs/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultCitationPaneStyles = exports.defaultCitationContentCSS = exports.default = void 0;
|
|
7
|
+
const defaultCitationPaneStyles = {
|
|
8
|
+
pane: {
|
|
9
|
+
position: "fixed",
|
|
10
|
+
left: "50%",
|
|
11
|
+
top: "18%",
|
|
12
|
+
transform: "translateX(-50%)",
|
|
13
|
+
background: "#fff",
|
|
14
|
+
width: "85%",
|
|
15
|
+
height: "85%",
|
|
16
|
+
overflowY: "auto",
|
|
17
|
+
overflowX: "hidden",
|
|
18
|
+
padding: 16,
|
|
19
|
+
borderRadius: 6,
|
|
20
|
+
zIndex: 10001,
|
|
21
|
+
boxSizing: "border-box"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.defaultCitationPaneStyles = defaultCitationPaneStyles;
|
|
25
|
+
const defaultCitationContentCSS = controlId => `
|
|
26
|
+
#${controlId} .citation-content {
|
|
27
|
+
flex: 1;
|
|
28
|
+
min-height: 0; /* allow flex child to scroll */
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
overflow-x: auto;
|
|
31
|
+
margin-bottom: 12px;
|
|
32
|
+
white-space: normal; /* wrap normal text */
|
|
33
|
+
word-break: break-word;
|
|
34
|
+
-webkit-overflow-scrolling: touch;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#${controlId} .citation-content pre,
|
|
38
|
+
#${controlId} .citation-content code {
|
|
39
|
+
white-space: pre; /* preserve formatting */
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#${controlId} .citation-content table {
|
|
43
|
+
width: 100%;
|
|
44
|
+
border-collapse: collapse;
|
|
45
|
+
margin-bottom: 12px;
|
|
46
|
+
table-layout: auto;
|
|
47
|
+
overflow-x: auto;
|
|
48
|
+
display: block;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#${controlId} .citation-content table th,
|
|
52
|
+
#${controlId} .citation-content table td {
|
|
53
|
+
padding: 8px 12px;
|
|
54
|
+
border: 1px solid rgba(0,0,0,0.08);
|
|
55
|
+
text-align: left;
|
|
56
|
+
vertical-align: top;
|
|
57
|
+
word-break: break-word;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#${controlId} .citation-content img {
|
|
61
|
+
max-width: 100%;
|
|
62
|
+
height: auto;
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
exports.defaultCitationContentCSS = defaultCitationContentCSS;
|
|
66
|
+
var _default = {
|
|
67
|
+
defaultCitationPaneStyles,
|
|
68
|
+
defaultCitationContentCSS
|
|
69
|
+
};
|
|
70
|
+
exports.default = _default;
|
package/lib/cjs/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -22,13 +22,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
22
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
24
|
const LiveChatWidget = props => {
|
|
25
|
-
var _props$
|
|
25
|
+
var _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv, _props$chatConfig2, _props$chatConfig2$Li;
|
|
26
26
|
const reducer = (0, _createReducer.createReducer)();
|
|
27
27
|
const [state, dispatch] = (0, _react.useReducer)(reducer, (0, _LiveChatWidgetContextInitialState.getLiveChatWidgetContextInitialState)(props));
|
|
28
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
29
|
const [adapter, setAdapter] = (0, _react.useState)(undefined);
|
|
30
30
|
const [facadeChatSDK, setFacadeChatSDK] = (0, _react.useState)(undefined);
|
|
31
|
-
const chatSDK = (0, _getMockChatSDKIfApplicable.getMockChatSDKIfApplicable)(props.chatSDK, props === null || props === void 0 ? void 0 :
|
|
31
|
+
const chatSDK = (0, _getMockChatSDKIfApplicable.getMockChatSDKIfApplicable)(props.chatSDK, props === null || props === void 0 ? void 0 : props.mock);
|
|
32
32
|
const disableReauthentication = ((_props$featureConfigP = props.featureConfigProps) === null || _props$featureConfigP === void 0 ? void 0 : _props$featureConfigP.disableReauthentication) === true;
|
|
33
33
|
(0, _overridePropsOnMockIfApplicable.default)(props);
|
|
34
34
|
if (!props.chatConfig) {
|
|
@@ -38,14 +38,14 @@ const LiveChatWidget = props => {
|
|
|
38
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
39
|
const isAuthenticatedChat = !!((_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction) || (0, _liveChatConfigUtils.isPersistentChatEnabled)((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Li = _props$chatConfig2.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig2$Li === void 0 ? void 0 : _props$chatConfig2$Li.msdyn_conversationmode);
|
|
40
40
|
if (!facadeChatSDK) {
|
|
41
|
-
var _props$
|
|
41
|
+
var _props$mock;
|
|
42
42
|
setFacadeChatSDK(new _FacadeChatSDK.FacadeChatSDK({
|
|
43
43
|
"chatSDK": chatSDK,
|
|
44
44
|
"chatConfig": props.chatConfig,
|
|
45
45
|
"isAuthenticated": isAuthenticatedChat,
|
|
46
46
|
"getAuthToken": props === null || props === void 0 ? void 0 : props.getAuthToken,
|
|
47
47
|
//when type is not undefined, it means the SDK is mocked
|
|
48
|
-
"isSDKMocked": !(0, _utils.isNullOrUndefined)(props === null || props === void 0 ? void 0 : (_props$
|
|
48
|
+
"isSDKMocked": !(0, _utils.isNullOrUndefined)(props === null || props === void 0 ? void 0 : (_props$mock = props.mock) === null || _props$mock === void 0 ? void 0 : _props$mock.type)
|
|
49
49
|
}, disableReauthentication));
|
|
50
50
|
}
|
|
51
51
|
(0, _react.useEffect)(() => {
|
package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js
CHANGED
|
@@ -17,7 +17,6 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
17
17
|
const supportedSignInCardContentTypes = ["application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"];
|
|
18
18
|
const botOauthUrlRegex = /[\S]+.botframework.com\/api\/oauth\/signin\?signin=([\S]+)/;
|
|
19
19
|
const delay = t => new Promise(resolve => setTimeout(resolve, t));
|
|
20
|
-
let response;
|
|
21
20
|
const extractSignInId = signInUrl => {
|
|
22
21
|
const result = botOauthUrlRegex.exec(signInUrl);
|
|
23
22
|
if (result && result[1]) {
|
|
@@ -53,20 +52,20 @@ const fetchBotAuthConfig = async (retries, interval) => {
|
|
|
53
52
|
eventName: _TelemetryConstants.BroadcastEvent.BotAuthConfigRequest
|
|
54
53
|
};
|
|
55
54
|
_omnichannelChatComponents.BroadcastService.postMessage(botAuthConfigRequestEvent);
|
|
55
|
+
let response;
|
|
56
56
|
const listener = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.BotAuthConfigResponse).subscribe(data => {
|
|
57
57
|
var _data$payload, _data$payload2;
|
|
58
58
|
response = ((_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.response) !== undefined ? (_data$payload2 = data.payload) === null || _data$payload2 === void 0 ? void 0 : _data$payload2.response : response;
|
|
59
59
|
listener.unsubscribe();
|
|
60
60
|
});
|
|
61
|
-
if (response !== undefined) {
|
|
62
|
-
//return response;
|
|
63
|
-
return response;
|
|
64
|
-
}
|
|
65
61
|
if (retries === 1) {
|
|
66
62
|
// Base Case
|
|
67
63
|
throw new Error();
|
|
68
64
|
}
|
|
69
65
|
await delay(interval);
|
|
66
|
+
if (response !== undefined) {
|
|
67
|
+
return response;
|
|
68
|
+
}
|
|
70
69
|
return await fetchBotAuthConfig(--retries, interval);
|
|
71
70
|
};
|
|
72
71
|
let BotAuthActivitySubscriber = /*#__PURE__*/function () {
|