@microsoft/omnichannel-chat-widget 0.1.0-main.ae27766 → 0.1.0-main.c2417f9

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 (73) hide show
  1. package/README.md +32 -0
  2. package/lib/cjs/common/Constants.js +14 -2
  3. package/lib/cjs/common/telemetry/TelemetryConstants.js +19 -3
  4. package/lib/cjs/common/telemetry/TelemetryManager.js +7 -1
  5. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +17 -16
  6. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
  7. package/lib/cjs/common/utils.js +17 -2
  8. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  9. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +16 -4
  10. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
  11. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +7 -13
  12. package/lib/cjs/components/livechatwidget/common/endChat.js +28 -13
  13. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +12 -3
  14. package/lib/cjs/components/livechatwidget/common/startChat.js +49 -10
  15. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +132 -30
  16. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +4 -5
  17. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +16 -0
  18. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +80 -0
  19. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  20. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  21. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
  22. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  23. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  24. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  25. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -0
  26. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +24 -21
  27. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +3 -1
  28. package/lib/cjs/contexts/createReducer.js +16 -0
  29. package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
  30. package/lib/esm/common/Constants.js +14 -2
  31. package/lib/esm/common/telemetry/TelemetryConstants.js +19 -3
  32. package/lib/esm/common/telemetry/TelemetryManager.js +6 -1
  33. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +18 -13
  34. package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
  35. package/lib/esm/common/utils.js +8 -0
  36. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  37. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +18 -7
  38. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
  39. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +7 -13
  40. package/lib/esm/components/livechatwidget/common/endChat.js +26 -14
  41. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +11 -4
  42. package/lib/esm/components/livechatwidget/common/startChat.js +51 -14
  43. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +122 -30
  44. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +6 -7
  45. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +16 -0
  46. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +72 -0
  47. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  48. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  49. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
  50. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  51. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  52. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  53. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -0
  54. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +24 -21
  55. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +3 -1
  56. package/lib/esm/contexts/createReducer.js +16 -0
  57. package/lib/esm/plugins/newMessageEventHandler.js +10 -12
  58. package/lib/types/common/Constants.d.ts +7 -1
  59. package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
  60. package/lib/types/common/telemetry/TelemetryConstants.d.ts +19 -5
  61. package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -0
  62. package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
  63. package/lib/types/common/utils.d.ts +2 -0
  64. package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
  65. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  66. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  67. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  68. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  69. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  70. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  71. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
  72. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +24 -21
  73. package/package.json +2 -2
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ require("@testing-library/jest-dom/extend-expect");
4
+
5
+ var _cardActionMiddleware = require("./cardActionMiddleware");
6
+
7
+ describe("cardActionMiddleware test", () => {
8
+ it("createCardActionMiddleware() with undefined botMagicCodeConfig should not change the sign in card url", () => {
9
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
10
+
11
+
12
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
13
+ const args = {
14
+ cardAction: {
15
+ type: "signin",
16
+ value: signInUrl
17
+ }
18
+ };
19
+ const results = (0, _cardActionMiddleware.createCardActionMiddleware)(undefined)()(next)(args);
20
+ expect(signInUrl).toEqual(results.cardAction.value);
21
+ });
22
+ it("createCardActionMiddleware() with botMagicCode enabled should not change the sign in card url", () => {
23
+ const botMagicCodeConfig = {
24
+ disabled: false
25
+ };
26
+
27
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
28
+
29
+
30
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
31
+ const args = {
32
+ cardAction: {
33
+ type: "signin",
34
+ value: signInUrl
35
+ }
36
+ };
37
+ const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
38
+ expect(args.cardAction.value).toEqual(results.cardAction.value);
39
+ });
40
+ it("createCardActionMiddleware() with botMagicCode disabled & no fwdUrl should not change the sign in card url", () => {
41
+ const botMagicCodeConfig = {
42
+ disabled: true
43
+ };
44
+
45
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
46
+
47
+
48
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
49
+ const args = {
50
+ cardAction: {
51
+ type: "signin",
52
+ value: signInUrl
53
+ }
54
+ };
55
+ const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
56
+ expect(args.cardAction.value).toEqual(results.cardAction.value);
57
+ });
58
+ it("createCardActionMiddleware() with botMagicCode disabled & fwdUrl should append the fwdUrl in the sign in card url", () => {
59
+ const botMagicCodeConfig = {
60
+ disabled: true,
61
+ fwdUrl: "http://localhost/forwarder.html"
62
+ };
63
+
64
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
65
+
66
+
67
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
68
+ const args = {
69
+ cardAction: {
70
+ type: "signin",
71
+ value: signInUrl
72
+ }
73
+ };
74
+ const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
75
+ expect(signInUrl === results.cardAction.value).toBe(false);
76
+ expect(results.cardAction.value === `${signInUrl}&fwdUrl=${botMagicCodeConfig.fwdUrl}`).toBe(true);
77
+ });
78
+ it("createCardActionMiddleware() should not append fwdUrl if fwdUrl & sign in card url are not in the same domain", () => {
79
+ const botMagicCodeConfig = {
80
+ disabled: true,
81
+ fwdUrl: "https://localhost/forwarder.html"
82
+ };
83
+
84
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
85
+
86
+
87
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
88
+ const args = {
89
+ cardAction: {
90
+ type: "signin",
91
+ value: signInUrl
92
+ }
93
+ };
94
+ const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
95
+ expect(signInUrl === results.cardAction.value).toBe(true);
96
+ expect(results.cardAction.value === `${signInUrl}&fwdUrl=${botMagicCodeConfig.fwdUrl}`).toBe(false);
97
+ });
98
+ });
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _WebChatActionType = require("../../enums/WebChatActionType");
9
+
10
+ var _Constants = require("../../../../../common/Constants");
11
+
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
13
+ const createMessageTimeStampMiddleware = _ref => {
14
+ let {
15
+ dispatch
16
+ } = _ref;
17
+ return next => action => {
18
+ if (isApplicable(action)) {
19
+ return next(evaluateTagsAndOverrideTimeStamp(action));
20
+ }
21
+
22
+ return next(action);
23
+ };
24
+ };
25
+
26
+ const isApplicable = action => {
27
+ return action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && isPVAConversation(action) && isPayloadValid(action) && isValidChannel(action);
28
+ };
29
+
30
+ const isPayloadValid = action => {
31
+ var _action$payload;
32
+
33
+ return action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.activity;
34
+ };
35
+
36
+ const isValidChannel = action => {
37
+ var _action$payload2, _action$payload2$acti;
38
+
39
+ return (action === null || action === void 0 ? void 0 : (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$acti = _action$payload2.activity) === null || _action$payload2$acti === void 0 ? void 0 : _action$payload2$acti.channelId) === _Constants.Constants.acsChannel;
40
+ };
41
+
42
+ const isPVAConversation = action => {
43
+ return !isTagIncluded(action, _Constants.Constants.systemMessageTag) && !isTagIncluded(action, _Constants.Constants.publicMessageTag) && !isRoleUserOn(action);
44
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+
46
+
47
+ const isTagIncluded = (action, tag) => {
48
+ return isDataTagsPresent(action) && action.payload.activity.channelData.tags.includes(tag);
49
+ };
50
+
51
+ const isRoleUserOn = action => {
52
+ var _action$payload3, _action$payload3$acti, _action$payload3$acti2;
53
+
54
+ return (action === null || action === void 0 ? void 0 : (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : (_action$payload3$acti = _action$payload3.activity) === null || _action$payload3$acti === void 0 ? void 0 : (_action$payload3$acti2 = _action$payload3$acti.from) === null || _action$payload3$acti2 === void 0 ? void 0 : _action$payload3$acti2.role) === _Constants.Constants.userMessageTag;
55
+ };
56
+
57
+ const overrideTimeStamp = (timestampOriginal, timeStampNew) => {
58
+ return isTimestampValid(timeStampNew) ? timeStampNew : timestampOriginal;
59
+ };
60
+
61
+ const isTimestampValid = timeStamp => {
62
+ const regex = /(\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(T)(\d{2})(:{1})(\d{2})(:{1})(\d{2})(.\d+)([Z]{1}))/;
63
+ return regex.test(timeStamp);
64
+ };
65
+
66
+ const isDataTagsPresent = action => {
67
+ var _action$payload4, _action$payload4$acti, _action$payload4$acti2;
68
+
69
+ return (action === null || action === void 0 ? void 0 : (_action$payload4 = action.payload) === null || _action$payload4 === void 0 ? void 0 : (_action$payload4$acti = _action$payload4.activity) === null || _action$payload4$acti === void 0 ? void 0 : (_action$payload4$acti2 = _action$payload4$acti.channelData) === null || _action$payload4$acti2 === void 0 ? void 0 : _action$payload4$acti2.tags) && action.payload.activity.channelData.tags.length > 0;
70
+ };
71
+
72
+ const evaluateTagsAndOverrideTimeStamp = action => {
73
+ const tagValue = tagLookup(action, _Constants.Constants.prefixTimestampTag);
74
+
75
+ if (tagValue) {
76
+ const newTimestamp = extractTimeStamp(tagValue);
77
+ action.payload.activity.timestamp = overrideTimeStamp(action.payload.activity.timestamp, newTimestamp);
78
+ }
79
+
80
+ return action;
81
+ };
82
+
83
+ const extractTimeStamp = timeStamp => {
84
+ if (timeStamp && timeStamp.length > 0) {
85
+ const ts = timeStamp.split(_Constants.Constants.prefixTimestampTag);
86
+
87
+ if (ts && ts.length > 1) {
88
+ return ts[1];
89
+ }
90
+ }
91
+
92
+ return timeStamp;
93
+ };
94
+
95
+ const tagLookup = (action, tag) => {
96
+ if (!isDataTagsPresent(action)) {
97
+ return null;
98
+ }
99
+
100
+ const tags = action.payload.activity.channelData.tags;
101
+ let value;
102
+
103
+ if (tags && tags.length > 0) {
104
+ for (let i = 0; i < tags.length; i++) {
105
+ value = tags[i];
106
+
107
+ if (value && value.indexOf(tag) > -1) {
108
+ return value;
109
+ }
110
+ }
111
+ }
112
+
113
+ return null;
114
+ };
115
+
116
+ var _default = createMessageTimeStampMiddleware;
117
+ exports.default = _default;
@@ -10,6 +10,7 @@ var _TelemetryConstants = require("../../../../common/telemetry/TelemetryConstan
10
10
  var _TelemetryHelper = require("../../../../common/telemetry/TelemetryHelper");
11
11
 
12
12
  function createWebChatTelemetry() {
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
14
  const handleTelemetry = event => {
14
15
  const {
15
16
  level
@@ -17,25 +17,28 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
17
17
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT";
18
18
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 7] = "SET_OUTSIDE_OPERATING_HOURS";
19
19
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 8] = "SET_PRE_CHAT_SURVEY_RESPONSE";
20
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 9] = "SET_SHOW_CONFIRMATION";
21
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 10] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
22
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 11] = "SET_PRECHAT_RESPONSE_EMAIL";
23
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 12] = "SET_AUDIO_NOTIFICATION";
24
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 13] = "SET_E2VV_ENABLED";
25
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 14] = "SET_POST_CHAT_CONTEXT";
26
- LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 15] = "SHOW_CALLING_CONTAINER";
27
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 16] = "SET_INCOMING_CALL";
28
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 17] = "DISABLE_VIDEO_CALL";
29
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 18] = "DISABLE_LOCAL_VIDEO";
30
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 19] = "DISABLE_REMOTE_VIDEO";
31
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 20] = "SET_CHAT_TOKEN";
32
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SKIP_CHAT_BUTTON_RENDERING"] = 21] = "SET_SKIP_CHAT_BUTTON_RENDERING";
33
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 22] = "SET_PROACTIVE_CHAT_PARAMS";
34
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 23] = "SET_TELEMETRY_DATA";
35
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 24] = "SET_RECONNECT_ID";
36
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 25] = "SET_UNREAD_MESSAGE_COUNT";
37
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 26] = "SET_FOCUS_CHAT_BUTTON";
38
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT"] = 27] = "SET_CONVERSATION_ENDED_BY_AGENT";
39
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 28] = "SET_WIDGET_STATE";
40
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 29] = "SET_LIVE_CHAT_CONTEXT";
20
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 9] = "SET_CUSTOM_CONTEXT";
21
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 10] = "SET_SHOW_CONFIRMATION";
22
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 11] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
23
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 12] = "SET_PRECHAT_RESPONSE_EMAIL";
24
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 13] = "SET_AUDIO_NOTIFICATION";
25
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 14] = "SET_E2VV_ENABLED";
26
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 15] = "SET_POST_CHAT_CONTEXT";
27
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 16] = "SHOW_CALLING_CONTAINER";
28
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 17] = "SET_INCOMING_CALL";
29
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 18] = "DISABLE_VIDEO_CALL";
30
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 19] = "DISABLE_LOCAL_VIDEO";
31
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 20] = "DISABLE_REMOTE_VIDEO";
32
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 21] = "SET_CHAT_TOKEN";
33
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SKIP_CHAT_BUTTON_RENDERING"] = 22] = "SET_SKIP_CHAT_BUTTON_RENDERING";
34
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 23] = "SET_PROACTIVE_CHAT_PARAMS";
35
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 24] = "SET_TELEMETRY_DATA";
36
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 25] = "SET_RECONNECT_ID";
37
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 26] = "SET_UNREAD_MESSAGE_COUNT";
38
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 27] = "SET_FOCUS_CHAT_BUTTON";
39
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT"] = 28] = "SET_CONVERSATION_ENDED_BY_AGENT";
40
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 29] = "SET_WIDGET_STATE";
41
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 30] = "SET_LIVE_CHAT_CONTEXT";
42
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 31] = "SET_BOT_OAUTH_SIGNIN_ID";
43
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 32] = "SET_WIDGET_SIZE";
41
44
  })(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
@@ -27,7 +27,9 @@ const getLiveChatWidgetContextInitialState = props => {
27
27
  postChatContext: undefined,
28
28
  telemetryInternalData: {},
29
29
  globalDir: "ltr",
30
- liveChatContext: undefined
30
+ liveChatContext: undefined,
31
+ customContext: undefined,
32
+ widgetSize: undefined
31
33
  },
32
34
  appStates: {
33
35
  conversationState: _ConversationState.ConversationState.Closed,
@@ -69,6 +69,14 @@ const createReducer = () => {
69
69
  }
70
70
  };
71
71
 
72
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
73
+ return { ...state,
74
+ domainStates: { ...state.domainStates,
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ customContext: action.payload
77
+ }
78
+ };
79
+
72
80
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT:
73
81
  return { ...state,
74
82
  appStates: { ...state.appStates,
@@ -227,6 +235,14 @@ const createReducer = () => {
227
235
  }
228
236
  };
229
237
 
238
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_SIZE:
239
+ return { ...state,
240
+ domainStates: { ...state.domainStates,
241
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
242
+ widgetSize: action.payload
243
+ }
244
+ };
245
+
230
246
  default:
231
247
  return state;
232
248
  }
@@ -13,8 +13,6 @@ var _Constants = require("../common/Constants");
13
13
 
14
14
  var _TelemetryHelper = require("../common/telemetry/TelemetryHelper");
15
15
 
16
- var _TelemetryManager = require("../common/telemetry/TelemetryManager");
17
-
18
16
  const createOnNewAdapterActivityHandler = (chatId, userId) => {
19
17
  const onNewAdapterActivityHandler = activity => {
20
18
  var _activity$channelData, _activity$channelData2, _activity$channelData3;
@@ -29,18 +27,16 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
29
27
 
30
28
  const raiseMessageEvent = activity => {
31
29
  if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message) {
32
- var _TelemetryManager$Int, _activity$from;
30
+ var _text, _text2, _activity$channelData4, _activity$from;
33
31
 
34
32
  const payload = {
33
+ // To identify hidden contents vs empty content
35
34
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- text: activity === null || activity === void 0 ? void 0 : activity.text,
37
- id: activity === null || activity === void 0 ? void 0 : activity.id,
35
+ text: (activity === null || activity === void 0 ? void 0 : (_text = activity.text) === null || _text === void 0 ? void 0 : _text.length) >= 1 ? `*contents hidden (${activity === null || activity === void 0 ? void 0 : (_text2 = activity.text) === null || _text2 === void 0 ? void 0 : _text2.length} chars)*` : "",
38
36
  type: activity === null || activity === void 0 ? void 0 : activity.type,
39
37
  timestamp: activity === null || activity === void 0 ? void 0 : activity.timestamp,
40
- chatId: chatId,
41
38
  userId: userId,
42
- conversationId: ((_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.conversationId) ?? "",
43
- channelData: activity === null || activity === void 0 ? void 0 : activity.channelData,
39
+ tags: activity === null || activity === void 0 ? void 0 : (_activity$channelData4 = activity.channelData) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.tags,
44
40
  messageType: ""
45
41
  };
46
42
 
@@ -59,18 +55,18 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
59
55
  Description: "New message sent"
60
56
  });
61
57
  } else {
62
- var _activity$channelData4, _activity$channelData5;
58
+ var _activity$channelData5, _activity$channelData6;
63
59
 
64
- if (activity !== null && activity !== void 0 && (_activity$channelData4 = activity.channelData) !== null && _activity$channelData4 !== void 0 && (_activity$channelData5 = _activity$channelData4.tags) !== null && _activity$channelData5 !== void 0 && _activity$channelData5.includes(_Constants.Constants.systemMessageTag)) {
60
+ if (activity !== null && activity !== void 0 && (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(_Constants.Constants.systemMessageTag)) {
65
61
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
62
  payload.messageType = _Constants.Constants.systemMessageTag;
67
63
  } else {
68
- var _activity$channelData6, _activity$channelData7, _activity$channelData8;
64
+ var _activity$channelData7, _activity$channelData8, _activity$channelData9;
69
65
 
70
66
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
67
  const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text); // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
68
 
73
- const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData6 = activity.channelData) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : (_activity$channelData8 = _activity$channelData7.tags) === null || _activity$channelData8 === void 0 ? void 0 : _activity$channelData8.length) === 0; // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
+ const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData7 = activity.channelData) !== null && _activity$channelData7 !== void 0 && _activity$channelData7.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData8 = activity.channelData) === null || _activity$channelData8 === void 0 ? void 0 : (_activity$channelData9 = _activity$channelData8.tags) === null || _activity$channelData9 === void 0 ? void 0 : _activity$channelData9.length) === 0; // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
70
 
75
71
  const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
76
72
 
@@ -90,7 +86,8 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
90
86
 
91
87
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
92
88
  Event: _TelemetryConstants.TelemetryEvent.MessageReceived,
93
- Description: "New message received"
89
+ Description: "New message received",
90
+ Data: payload
94
91
  });
95
92
  }
96
93
  }
@@ -4,6 +4,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
4
4
 
5
5
  export class Constants {}
6
6
 
7
+ _defineProperty(Constants, "magicCodeBroadcastChannel", "MagicCodeChannel");
8
+
9
+ _defineProperty(Constants, "magicCodeResponseBroadcastChannel", "MagicCodeResponseChannel");
10
+
7
11
  _defineProperty(Constants, "systemMessageTag", "system");
8
12
 
9
13
  _defineProperty(Constants, "userMessageTag", "user");
@@ -36,8 +40,6 @@ _defineProperty(Constants, "false", "false");
36
40
 
37
41
  _defineProperty(Constants, "maximumUnreadMessageCount", 99);
38
42
 
39
- _defineProperty(Constants, "widgetStateDataKey", "LcwChatWidgetState");
40
-
41
43
  _defineProperty(Constants, "channelIdKey", "ChannelId-");
42
44
 
43
45
  _defineProperty(Constants, "ChannelId", "lcw");
@@ -72,6 +74,14 @@ _defineProperty(Constants, "averageWaitTimeMessageTag", "averagewaittime");
72
74
 
73
75
  _defineProperty(Constants, "message", "message");
74
76
 
77
+ _defineProperty(Constants, "hiddenTag", "Hidden");
78
+
79
+ _defineProperty(Constants, "prefixTimestampTag", "ServerMessageTimestamp_");
80
+
81
+ _defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
82
+
83
+ _defineProperty(Constants, "publicMessageTag", "public");
84
+
75
85
  _defineProperty(Constants, "supportedAdaptiveCardContentTypes", ["application/vnd.microsoft.card.adaptive", "application/vnd.microsoft.card.audio", "application/vnd.microsoft.card.hero", "application/vnd.microsoft.card.receipt", "application/vnd.microsoft.card.thumbnail", "application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"]);
76
86
 
77
87
  _defineProperty(Constants, "maxUploadFileSize", "500000");
@@ -146,6 +156,8 @@ _defineProperty(Constants, "internetConnectionTestUrl", "https://ocsdk-prod.azur
146
156
 
147
157
  _defineProperty(Constants, "internetConnectionTestUrlText", "Omnichannel Connect Test");
148
158
 
159
+ _defineProperty(Constants, "ChatWidgetStateChangedPrefix", "ChatWidgetStateChanged");
160
+
149
161
  export const Regex = (_class = class Regex {}, _defineProperty(_class, "EmailRegex", "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[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]?|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"), _class);
150
162
  export class HtmlIdNames {}
151
163
 
@@ -26,18 +26,27 @@ export let BroadcastEvent; // Events being logged
26
26
 
27
27
  (function (BroadcastEvent) {
28
28
  BroadcastEvent["LoadPostChatSurvey"] = "LoadPostChatSurvey";
29
- BroadcastEvent["EndChat"] = "ChatEnded";
29
+ BroadcastEvent["ChatEnded"] = "ChatEnded";
30
30
  BroadcastEvent["NewMessageNotification"] = "NewMessageNotification";
31
31
  BroadcastEvent["UnreadMessageCount"] = "UnreadMessageCount";
32
- BroadcastEvent["ChatWidgetStateChanged"] = "ChatWidgetStateChanged";
32
+ BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
33
33
  BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
34
34
  BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
35
+ BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
36
+ BroadcastEvent["ResetProactiveChatParams"] = "ResetProactiveChatParams";
35
37
  BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
36
38
  BroadcastEvent["NewMessageSent"] = "NewMessageSent";
37
39
  BroadcastEvent["NewMessageReceived"] = "NewMessageReceived";
38
40
  BroadcastEvent["RedirectPageRequest"] = "RedirectPageRequest";
41
+ BroadcastEvent["StartChat"] = "StartChat";
39
42
  BroadcastEvent["StartChatSkippingChatButtonRendering"] = "StartChatSkippingChatButtonRendering";
40
43
  BroadcastEvent["StartUnauthenticatedReconnectChat"] = "StartUnauthenticatedReconnectChat";
44
+ BroadcastEvent["InitiateEndChat"] = "InitiateEndChat";
45
+ BroadcastEvent["SetCustomContext"] = "SetCustomContext";
46
+ BroadcastEvent["ChatRetrievedFromCache"] = "ChatRetrievedFromCache";
47
+ BroadcastEvent["MaximizeChat"] = "MaximizeChat";
48
+ BroadcastEvent["ChatInitiated"] = "ChatInitiated";
49
+ BroadcastEvent["CloseChat"] = "CloseChat";
41
50
  })(BroadcastEvent || (BroadcastEvent = {}));
42
51
 
43
52
  export let TelemetryEvent;
@@ -89,8 +98,9 @@ export let TelemetryEvent;
89
98
  TelemetryEvent["PrechatSubmitted"] = "PrechatSubmitted";
90
99
  TelemetryEvent["StartChatSDKCall"] = "StartChatCall";
91
100
  TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
92
- TelemetryEvent["EndChatSDKCall"] = "EndChatCall";
101
+ TelemetryEvent["EndChatSDKCall"] = "EndChatSDKCall";
93
102
  TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
103
+ TelemetryEvent["WindowClosed"] = "WindowClosed";
94
104
  TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
95
105
  TelemetryEvent["OnNewMessageAudioNotificationFailed"] = "OnNewMessageAudioNotificationFailed";
96
106
  TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
@@ -115,6 +125,8 @@ export let TelemetryEvent;
115
125
  TelemetryEvent["EmailTranscriptButtonClicked"] = "EmailTranscriptButtonClicked";
116
126
  TelemetryEvent["EmailTranscriptCancelButtonClicked"] = "EmailTranscriptCancelButtonClicked";
117
127
  TelemetryEvent["AudioToggleButtonClicked"] = "AudioToggleButtonClicked";
128
+ TelemetryEvent["SuppressBotMagicCodeSucceeded"] = "SuppressBotMagicCodeSucceeded";
129
+ TelemetryEvent["SuppressBotMagicCodeFailed"] = "SuppressBotMagicCodeFailed";
118
130
  TelemetryEvent["ProcessingHTMLTextMiddlewareFailed"] = "ProcessingHTMLTextMiddlewareFailed";
119
131
  TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
120
132
  TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
@@ -140,6 +152,7 @@ export let TelemetryEvent;
140
152
  TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
141
153
  TelemetryEvent["MessageSent"] = "MessageSent";
142
154
  TelemetryEvent["MessageReceived"] = "MessageReceived";
155
+ TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
143
156
  })(TelemetryEvent || (TelemetryEvent = {}));
144
157
 
145
158
  export class TelemetryConstants {
@@ -182,6 +195,9 @@ export class TelemetryConstants {
182
195
  case TelemetryEvent.PreChatSurveyStartChatMethodFailed:
183
196
  case TelemetryEvent.HeaderCloseButtonClicked:
184
197
  case TelemetryEvent.HeaderMinimizeButtonClicked:
198
+ case TelemetryEvent.MessageSent:
199
+ case TelemetryEvent.MessageReceived:
200
+ case TelemetryEvent.CustomContextReceived:
185
201
  return ScenarioType.ACTIONS;
186
202
 
187
203
  case TelemetryEvent.StartChatSDKCall:
@@ -5,6 +5,7 @@ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
5
5
  import { ariaTelemetryLogger } from "./loggers/ariaTelemetryLogger";
6
6
  import { consoleLogger } from "./loggers/consoleLogger";
7
7
  import { defaultAriaConfig } from "./defaultConfigs/defaultAriaConfig";
8
+ import { TelemetryHelper } from "./TelemetryHelper";
8
9
  export class TelemetryTimers {}
9
10
 
10
11
  _defineProperty(TelemetryTimers, "LcwLoadToChatButtonTimer", void 0);
@@ -72,7 +73,11 @@ export const RegisterLoggers = () => {
72
73
 
73
74
  const logLevel = telemetryEvent.logLevel ?? LogLevel.INFO;
74
75
  const scenarioType = ((_payload = telemetryEvent.payload) === null || _payload === void 0 ? void 0 : _payload.scenarioType) ?? ScenarioType.UNDEFINED;
75
- logger.log(logLevel, parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload, scenarioType));
76
+ const telemetryInput = parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload, scenarioType);
77
+ telemetryInput.telemetryInfo = {
78
+ telemetryInfo: TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput)
79
+ };
80
+ logger.log(logLevel, telemetryInput);
76
81
  });
77
82
  };
78
83
 
@@ -1,10 +1,8 @@
1
- import { AriaTelemetryConstants, EnvironmentVersion } from "../../../../src/common/Constants";
2
1
  import { getDomain, isNullOrEmptyString, isNullOrUndefined } from "../../utils";
3
2
  import AWTEventProperties from "@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTEventProperties";
4
3
  import AWTLogManager from "@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTLogManager";
5
4
  import { AWTPiiKind } from "@microsoft/omnichannel-chat-sdk/lib/external/aria/common/Enums";
6
- import { Constants } from "../../Constants";
7
- import { TelemetryHelper } from "../TelemetryHelper";
5
+ import { Constants, AriaTelemetryConstants, EnvironmentVersion } from "../../Constants";
8
6
  import { TelemetryManager } from "../TelemetryManager";
9
7
  export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUriForTelemetry, ariaTelemetryApplicationName) => {
10
8
  let _logger;
@@ -50,18 +48,25 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
50
48
 
51
49
  const ariaLogger = {
52
50
  log: (logLevel, telemetryInput) => {
53
- let property;
54
- const eventProperties = new AWTEventProperties();
55
- const event = TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput);
56
- eventProperties.setName(telemetryInput.scenarioType);
51
+ try {
52
+ let property;
53
+ const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo;
54
+ const eventProperties = new AWTEventProperties();
55
+ eventProperties.setName(telemetryInput.scenarioType);
57
56
 
58
- for (const key of Object.keys(event)) {
59
- property = typeof event[key] === "object" ? JSON.stringify(event[key]) : event[key];
60
- eventProperties.setProperty(key, property);
61
- }
57
+ if (telemetryInfo) {
58
+ for (const key of Object.keys(telemetryInfo)) {
59
+ property = typeof telemetryInfo[key] === "object" ? JSON.stringify(telemetryInfo[key]) : telemetryInfo[key];
60
+ eventProperties.setProperty(key, property);
61
+ }
62
62
 
63
- eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, Constants.LiveChatWidget, AWTPiiKind.GenericData);
64
- logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
63
+ eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, Constants.LiveChatWidget, AWTPiiKind.GenericData);
64
+ }
65
+
66
+ logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
67
+ } catch (error) {
68
+ console.error("Error in logging telemetry to Aria logger:" + error);
69
+ }
65
70
  },
66
71
  dispose: () => {
67
72
  AWTLogManager.flush(function () {
@@ -4,27 +4,28 @@ export const consoleLogger = () => {
4
4
  const consoleLogger = {
5
5
  log: (logLevel, telemetryInput) => {
6
6
  const payload = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.payload && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload : "";
7
+ const telemetryInfo = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.telemetryInfo && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo : "";
7
8
 
8
9
  try {
9
10
  switch (logLevel) {
10
11
  case LogLevel.INFO:
11
- console.info(Constants.LiveChatWidget, payload);
12
+ console.info(Constants.LiveChatWidget, payload, telemetryInfo);
12
13
  break;
13
14
 
14
15
  case LogLevel.DEBUG:
15
- console.debug(Constants.LiveChatWidget, payload);
16
+ console.debug(Constants.LiveChatWidget, payload, telemetryInfo);
16
17
  break;
17
18
 
18
19
  case LogLevel.WARN:
19
- console.warn(Constants.LiveChatWidget, payload);
20
+ console.warn(Constants.LiveChatWidget, payload, telemetryInfo);
20
21
  break;
21
22
 
22
23
  case LogLevel.ERROR:
23
- console.error(Constants.LiveChatWidget, payload);
24
+ console.error(Constants.LiveChatWidget, payload, telemetryInfo);
24
25
  break;
25
26
 
26
27
  default:
27
- console.debug(Constants.LiveChatWidget, payload);
28
+ console.debug(Constants.LiveChatWidget, payload, telemetryInfo);
28
29
  break;
29
30
  }
30
31
  } catch (ex) {
@@ -1,5 +1,6 @@
1
1
  import { AriaTelemetryConstants, Constants, LocaleConstants } from "./Constants";
2
2
  import { KeyCodes } from "./KeyCodes";
3
+ import { BroadcastEvent } from "./telemetry/TelemetryConstants";
3
4
 
4
5
  const getElementBySelector = selector => {
5
6
  let element;
@@ -277,6 +278,7 @@ export const createTimer = () => {
277
278
 
278
279
  };
279
280
  }; // Returns the domain of the org
281
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
280
282
 
281
283
  export const getDomain = hostValue => {
282
284
  for (let i = 0; i < AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
@@ -286,4 +288,10 @@ export const getDomain = hostValue => {
286
288
  }
287
289
 
288
290
  return AriaTelemetryConstants.Public;
291
+ };
292
+ export const getWidgetCacheId = (orgId, widgetId) => {
293
+ return `${Constants.ChatWidgetStateChangedPrefix}_${orgId}_${widgetId}`;
294
+ };
295
+ export const getWidgetEndChatEventName = (orgId, widgetId) => {
296
+ return `${BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
289
297
  };