@microsoft/omnichannel-chat-widget 0.1.0-main.170e416 → 0.1.0-main.18d1166

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 (131) hide show
  1. package/README.md +7 -34
  2. package/lib/cjs/assets/Icons.js +4 -2
  3. package/lib/cjs/common/Constants.js +9 -3
  4. package/lib/cjs/common/KeyCodes.js +3 -1
  5. package/lib/cjs/common/contextDataStore/DataStoreManager.js +3 -1
  6. package/lib/cjs/common/storage/default/defaultCacheManager.js +5 -3
  7. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +15 -6
  8. package/lib/cjs/common/telemetry/TelemetryConstants.js +34 -4
  9. package/lib/cjs/common/telemetry/TelemetryHelper.js +5 -2
  10. package/lib/cjs/common/telemetry/TelemetryManager.js +3 -1
  11. package/lib/cjs/common/utils.js +23 -2
  12. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +12 -19
  13. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
  14. package/lib/cjs/components/headerstateful/HeaderStateful.js +7 -4
  15. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +3 -1
  16. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +139 -0
  17. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +3 -1
  18. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +3 -1
  19. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +3 -1
  20. package/lib/cjs/components/livechatwidget/common/Deferred.js +3 -1
  21. package/lib/cjs/components/livechatwidget/common/agentEndConversationHelper.js +36 -0
  22. package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
  23. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +66 -14
  24. package/lib/cjs/components/livechatwidget/common/endChat.js +41 -49
  25. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +11 -49
  26. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +6 -9
  27. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +254 -2
  28. package/lib/cjs/components/livechatwidget/common/startChat.js +76 -53
  29. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +82 -44
  30. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +22 -2
  31. package/lib/cjs/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +57 -0
  32. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -1
  33. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
  34. package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  35. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +3 -1
  36. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +3 -1
  37. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
  38. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -1
  39. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -1
  40. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
  41. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  42. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
  43. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
  44. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +5 -6
  45. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
  46. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  47. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +7 -3
  48. package/lib/cjs/contexts/common/ConversationEndEntity.js +12 -0
  49. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +32 -28
  50. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +9 -3
  51. package/lib/cjs/contexts/createReducer.js +36 -2
  52. package/lib/cjs/hooks/useDebounce.js +28 -0
  53. package/lib/cjs/hooks/useWindowDimensions.js +30 -0
  54. package/lib/cjs/plugins/newMessageEventHandler.js +14 -0
  55. package/lib/esm/assets/Icons.js +2 -1
  56. package/lib/esm/common/Constants.js +9 -3
  57. package/lib/esm/common/KeyCodes.js +3 -1
  58. package/lib/esm/common/contextDataStore/DataStoreManager.js +3 -1
  59. package/lib/esm/common/storage/default/defaultCacheManager.js +5 -3
  60. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +15 -6
  61. package/lib/esm/common/telemetry/TelemetryConstants.js +34 -4
  62. package/lib/esm/common/telemetry/TelemetryHelper.js +5 -2
  63. package/lib/esm/common/telemetry/TelemetryManager.js +3 -1
  64. package/lib/esm/common/utils.js +20 -0
  65. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +12 -19
  66. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
  67. package/lib/esm/components/headerstateful/HeaderStateful.js +7 -4
  68. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +3 -1
  69. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +134 -0
  70. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +3 -1
  71. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +3 -1
  72. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +3 -1
  73. package/lib/esm/components/livechatwidget/common/Deferred.js +3 -1
  74. package/lib/esm/components/livechatwidget/common/agentEndConversationHelper.js +30 -0
  75. package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
  76. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +66 -14
  77. package/lib/esm/components/livechatwidget/common/endChat.js +43 -51
  78. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -51
  79. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +7 -9
  80. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +254 -3
  81. package/lib/esm/components/livechatwidget/common/startChat.js +76 -53
  82. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +83 -45
  83. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +22 -2
  84. package/lib/esm/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +50 -0
  85. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -1
  86. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
  87. package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  88. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +3 -1
  89. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +3 -1
  90. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
  91. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -1
  92. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -1
  93. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
  94. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  95. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
  96. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
  97. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +5 -6
  98. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
  99. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  100. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +5 -3
  101. package/lib/esm/contexts/common/ConversationEndEntity.js +5 -0
  102. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +32 -28
  103. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +9 -3
  104. package/lib/esm/contexts/createReducer.js +36 -2
  105. package/lib/esm/hooks/useDebounce.js +22 -0
  106. package/lib/esm/hooks/useWindowDimensions.js +23 -0
  107. package/lib/esm/plugins/newMessageEventHandler.js +14 -0
  108. package/lib/types/assets/Icons.d.ts +1 -0
  109. package/lib/types/common/Constants.d.ts +4 -0
  110. package/lib/types/common/storage/default/defaultCacheManager.d.ts +1 -1
  111. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +1 -1
  112. package/lib/types/common/telemetry/TelemetryConstants.d.ts +30 -6
  113. package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -0
  114. package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -0
  115. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +4 -0
  116. package/lib/types/common/utils.d.ts +1 -0
  117. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +0 -7
  118. package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +9 -0
  119. package/lib/types/components/livechatwidget/common/agentEndConversationHelper.d.ts +6 -0
  120. package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +1 -1
  121. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +6 -1
  122. package/lib/types/components/livechatwidget/common/startChat.d.ts +3 -3
  123. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +2 -0
  124. package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -0
  125. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +1 -1
  126. package/lib/types/contexts/common/ConversationEndEntity.d.ts +4 -0
  127. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +6 -1
  128. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +32 -28
  129. package/lib/types/hooks/useDebounce.d.ts +3 -0
  130. package/lib/types/hooks/useWindowDimensions.d.ts +4 -0
  131. package/package.json +3 -3
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useWindowDimensions;
7
+ var _react = require("react");
8
+ var _useDebounce = _interopRequireDefault(require("./useDebounce"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ function getWindowDimensions() {
11
+ const {
12
+ innerWidth: width,
13
+ innerHeight: height
14
+ } = window;
15
+ return {
16
+ width,
17
+ height
18
+ };
19
+ }
20
+ function useWindowDimensions() {
21
+ let delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 200;
22
+ const [windowDimensions, setWindowDimensions] = (0, _react.useState)(getWindowDimensions());
23
+ const handleResize = () => setWindowDimensions(getWindowDimensions());
24
+ const debouncedHandleResize = (0, _useDebounce.default)(handleResize, delay);
25
+ (0, _react.useEffect)(() => {
26
+ window.addEventListener("resize", debouncedHandleResize);
27
+ return () => window.removeEventListener("resize", debouncedHandleResize);
28
+ }, []);
29
+ return windowDimensions;
30
+ }
@@ -15,6 +15,7 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
15
15
  const isHistoryMessage = isActivityMessage && ((activity === null || activity === void 0 ? void 0 : (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.tags) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.includes(_Constants.Constants.historyMessageTag)) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData3 = activity.channelData) === null || _activity$channelData3 === void 0 ? void 0 : _activity$channelData3.fromList));
16
16
  raiseMessageEvent(activity, isHistoryMessage);
17
17
  };
18
+ let isHistoryMessageReceivedEventRasied = false;
18
19
  const raiseMessageEvent = (activity, isHistoryMessage) => {
19
20
  if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message) {
20
21
  var _text, _text2, _activity$channelData4, _activity$from;
@@ -45,6 +46,10 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
45
46
  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)) {
46
47
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
48
  payload.messageType = _Constants.Constants.systemMessageTag;
49
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
50
+ Event: _TelemetryConstants.TelemetryEvent.SystemMessageReceived,
51
+ Description: "System message received"
52
+ });
48
53
  } else {
49
54
  var _activity$channelData7, _activity$channelData8, _activity$channelData9;
50
55
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -69,6 +74,15 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
69
74
  Description: "New message received",
70
75
  Data: payload
71
76
  });
77
+ } else {
78
+ if (!isHistoryMessageReceivedEventRasied) {
79
+ isHistoryMessageReceivedEventRasied = true;
80
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
81
+ Event: _TelemetryConstants.TelemetryEvent.HistoryMessageReceived,
82
+ Description: "History message received",
83
+ Data: payload
84
+ });
85
+ }
72
86
  }
73
87
  }
74
88
  }
@@ -8,4 +8,5 @@ export const PDFIcon = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy
8
8
  export const PowerpointIcon = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciDQogICAgdmlld0JveD0iMCAwIDIwNDggMjA0OCINCiAgICB3aWR0aD0iMTJweCINCiAgICBoZWlnaHQ9IjEycHgiPg0KICAgIDxwYXRoIGQ9Ik0yMDQ4IDQ3NXYxNDQ1cTAgMjctMTAgNTB0LTI3IDQwLTQxIDI4LTUwIDEwSDY0MHEtMjcgMC01MC0xMHQtNDAtMjctMjgtNDEtMTAtNTB2LTI1NkgxMTVxLTI0IDAtNDQtOXQtMzctMjUtMjUtMzYtOS00NVY2MjdxMC0yNCA5LTQ0dDI1LTM3IDM2LTI1IDQ1LTloMzk3VjEyOHEwLTI3IDEwLTUwdDI3LTQwIDQxLTI4IDUwLTEwaDkzM3EyNiAwIDQ5IDl0NDIgMjhsMzQ3IDM0N3ExOCAxOCAyNyA0MXQxMCA1MHptLTM4NC0yNTZ2MTY1aDE2NWwtMTY1LTE2NXpNMzY4IDc1MnY2NzJoMTUwdi0yMjZoMTAwcTUyIDAgOTctMTV0NzgtNDYgNTMtNzIgMjAtOTdxMC01Ni0xNy05N3QtNTAtNjctNzYt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PC9zdmc+";
12
+ export const AlertIcon = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMC8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMtU1ZHLTIwMDEwOTA0L0RURC9zdmcxMC5kdGQnPjxzdmcgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMjQgMjQiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjAiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PHBhdGggZD0iTTEzLDE3aC0ydi0yaDJWMTd6IE0xMywxM2gtMlY3aDJWMTN6Ii8+PGc+PHBhdGggZD0iTTEyLDRjNC40LDAsOCwzLjYsOCw4cy0zLjYsOC04LDhzLTgtMy42LTgtOFM3LjYsNCwxMiw0IE0xMiwyQzYuNSwyLDIsNi41LDIsMTJjMCw1LjUsNC41LDEwLDEwLDEwczEwLTQuNSwxMC0xMCAgIEMyMiw2LjUsMTcuNSwyLDEyLDJMMTIsMnoiLz48L2c+PC9zdmc+";
@@ -1,5 +1,7 @@
1
1
  var _class;
2
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3
5
  export class Constants {}
4
6
  _defineProperty(Constants, "magicCodeBroadcastChannel", "MagicCodeChannel");
5
7
  _defineProperty(Constants, "magicCodeResponseBroadcastChannel", "MagicCodeResponseChannel");
@@ -19,6 +21,8 @@ _defineProperty(Constants, "truePascal", "True");
19
21
  _defineProperty(Constants, "true", "true");
20
22
  _defineProperty(Constants, "false", "false");
21
23
  _defineProperty(Constants, "maximumUnreadMessageCount", 99);
24
+ _defineProperty(Constants, "userParticipantTypeTag", "User");
25
+ _defineProperty(Constants, "botParticipantTypeTag", "Bot");
22
26
  _defineProperty(Constants, "channelIdKey", "ChannelId-");
23
27
  _defineProperty(Constants, "ChannelId", "lcw");
24
28
  _defineProperty(Constants, "CustomerTag", "FromCustomer");
@@ -42,8 +46,8 @@ _defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
42
46
  _defineProperty(Constants, "publicMessageTag", "public");
43
47
  _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"]);
44
48
  _defineProperty(Constants, "maxUploadFileSize", "500000");
45
- _defineProperty(Constants, "imageRegex", /(\.)(jpeg|jpg|jiff|png|gif|bmp)$/i);
46
- _defineProperty(Constants, "audioMediaRegex", /(\.)(aac|aiff|alac|flac|mp2|mp3|pcm|wav|wma)$/i);
49
+ _defineProperty(Constants, "imageRegex", /(\.)(jpeg|jpg|jiff|png|gif|bmp|webp)$/i);
50
+ _defineProperty(Constants, "audioMediaRegex", /(\.)(aac|aiff|alac|amr|flac|mp2|mp3|pcm|wav|wma)$/i);
47
51
  _defineProperty(Constants, "videoMediaRegex", /(\.)(avchd|avi|flv|mpe|mpeg|mpg|mpv|mp4|m4p|m4v|mov|qt|swf|webm|wmv)$/i);
48
52
  _defineProperty(Constants, "chromeSupportedInlineMediaRegex", /(\.)(aac|mp3|wav|mp4)$/i);
49
53
  _defineProperty(Constants, "firefoxSupportedInlineMediaRegex", /(\.)(aac|flac|mp3|wav|mp4|mov)$/i);
@@ -80,6 +84,7 @@ _defineProperty(Constants, "internetConnectionTestUrlText", "Omnichannel Connect
80
84
  _defineProperty(Constants, "ChatWidgetStateChangedPrefix", "ChatWidgetStateChanged");
81
85
  _defineProperty(Constants, "PostChatLoadingDurationInMs", 2000);
82
86
  _defineProperty(Constants, "BrowserUnloadConfirmationMessage", "Do you want to leave chat?");
87
+ _defineProperty(Constants, "CacheTtlInMinutes", 15);
83
88
  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);
84
89
  export class HtmlIdNames {}
85
90
  _defineProperty(HtmlIdNames, "MSLiveChatWidget", "MSLiveChatWidget");
@@ -120,6 +125,7 @@ _defineProperty(HtmlAttributeNames, "noreferrerTag", "noreferrer");
120
125
  _defineProperty(HtmlAttributeNames, "adaptiveCardClassName", "ac-adaptiveCard");
121
126
  _defineProperty(HtmlAttributeNames, "adaptiveCardTextBlockClassName", "ac-textBlock");
122
127
  _defineProperty(HtmlAttributeNames, "adaptiveCardToggleInputClassName", "ac-toggleInput");
128
+ _defineProperty(HtmlAttributeNames, "adaptiveCardActionSetClassName", "ac-actionSet");
123
129
  export class WebChatMiddlewareConstants {}
124
130
  _defineProperty(WebChatMiddlewareConstants, "nextVisibleActivity", "nextVisibleActivity");
125
131
  _defineProperty(WebChatMiddlewareConstants, "timeBetweenTimestampGroups", 300000);
@@ -1,3 +1,5 @@
1
1
  var _class;
2
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3
5
  export const KeyCodes = (_class = class KeyCodes {}, _defineProperty(_class, "ENTER", "Enter"), _defineProperty(_class, "TAB", "Tab"), _class);
@@ -1,3 +1,5 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2
4
  export class DataStoreManager {}
3
5
  _defineProperty(DataStoreManager, "clientDataStore", void 0);
@@ -1,14 +1,16 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2
4
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
3
5
  import { getWidgetCacheId } from "../../utils";
4
6
  import { defaultClientDataStoreProvider } from "./defaultClientDataStoreProvider";
5
7
  export class defaultCacheManager {}
6
8
  _defineProperty(defaultCacheManager, "InternalCache", {});
7
- export const registerBroadcastServiceForLocalStorage = (orgid, widgetId, widgetInstanceId) => {
9
+ export const registerBroadcastServiceForLocalStorage = (orgid, widgetId, widgetInstanceId, ttlInMins) => {
8
10
  const widgetCacheId = getWidgetCacheId(orgid, widgetId, widgetInstanceId);
9
11
  BroadcastService.getMessageByEventName(widgetCacheId).subscribe(msg => {
10
12
  try {
11
- defaultClientDataStoreProvider().setData(widgetCacheId, JSON.stringify(msg.payload), "localStorage");
13
+ defaultClientDataStoreProvider(ttlInMins).setData(widgetCacheId, JSON.stringify(msg.payload), "localStorage");
12
14
  } catch (error) {
13
15
  console.error("Error in setting data to localstorage", error);
14
16
  }
@@ -1,18 +1,27 @@
1
- import { inMemoryDataStore } from "./defaultInMemoryDataStore";
2
- import { TelemetryHelper } from "../../telemetry/TelemetryHelper";
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+
3
3
  import { LogLevel, TelemetryEvent } from "../../telemetry/TelemetryConstants";
4
- export const defaultClientDataStoreProvider = () => {
4
+ import { TelemetryHelper } from "../../telemetry/TelemetryHelper";
5
+ import { inMemoryDataStore } from "./defaultInMemoryDataStore";
6
+ export const defaultClientDataStoreProvider = function () {
7
+ let cacheTtlinMins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
8
+ let ttlInMs = 0;
5
9
  const isCookieAllowed = () => {
6
10
  try {
7
11
  localStorage;
8
12
  sessionStorage;
9
13
  return true;
10
14
  } catch (error) {
11
- console.error("Third party cookie blocked");
15
+ if (!window.TPCWarningShown) {
16
+ console.warn("Third party cookies blocked.");
17
+ window.TPCWarningShown = true;
18
+ }
12
19
  return false;
13
20
  }
14
21
  };
15
- const TtlInMs = 15 * 60 * 1000; // 15 mins
22
+ if (ttlInMs == 0) {
23
+ ttlInMs = cacheTtlinMins * 60 * 1000;
24
+ }
16
25
  const dataStoreProvider = {
17
26
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
27
  setData: (key, data, type) => {
@@ -22,7 +31,7 @@ export const defaultClientDataStoreProvider = () => {
22
31
  const now = new Date();
23
32
  const item = {
24
33
  data: data,
25
- expiry: now.getTime() + TtlInMs
34
+ expiry: now.getTime() + ttlInMs
26
35
  };
27
36
  const strItem = JSON.stringify(item);
28
37
  if (type === "localStorage") {
@@ -49,6 +49,12 @@ export let BroadcastEvent;
49
49
  BroadcastEvent["InitiateEndChatOnBrowserUnload"] = "InitiateEndChatOnBrowserUnload";
50
50
  BroadcastEvent["ClosePopoutWindow"] = "ClosePopoutWindow";
51
51
  BroadcastEvent["RaiseErrorEvent"] = "RaiseErrorEvent";
52
+ BroadcastEvent["NetworkDisconnected"] = "NetworkDisconnected";
53
+ BroadcastEvent["NetworkReconnected"] = "NetworkReconnected";
54
+ BroadcastEvent["SigninCardReceived"] = "SignInCardReceived";
55
+ BroadcastEvent["BotAuthConfigRequest"] = "BotAuthConfigRequest";
56
+ BroadcastEvent["BotAuthConfigResponse"] = "BotAuthConfigResponse";
57
+ BroadcastEvent["HideChatVisibilityChangeEvent"] = "hideChatVisibilityChangeEvent";
52
58
  })(BroadcastEvent || (BroadcastEvent = {}));
53
59
  export let TelemetryEvent;
54
60
  (function (TelemetryEvent) {
@@ -84,11 +90,10 @@ export let TelemetryEvent;
84
90
  TelemetryEvent["GetConversationDetailsCallFailed"] = "GetConversationDetailsCallFailed";
85
91
  TelemetryEvent["EndChatSDKCallFailed"] = "EndChatSDKCallFailed";
86
92
  TelemetryEvent["GetChatReconnectContextSDKCallFailed"] = "GetChatReconnectContextSDKCallFailed";
87
- TelemetryEvent["PostChatContextCallSucceed"] = "PostChatContextCallSucceed";
88
- TelemetryEvent["PostChatContextCallFailed"] = "PostChatContextCallFailed";
89
93
  TelemetryEvent["ParseAdaptiveCardFailed"] = "ParseAdaptiveCardFailed";
90
94
  TelemetryEvent["ClientDataStoreProviderFailed"] = "ClientDataStoreProviderFailed";
91
95
  TelemetryEvent["InMemoryDataStoreFailed"] = "InMemoryDataStoreFailed";
96
+ TelemetryEvent["ChatVisibilityChanged"] = "ChatVisibilityChanged";
92
97
  TelemetryEvent["WebChatLoaded"] = "WebChatLoaded";
93
98
  TelemetryEvent["LCWChatButtonClicked"] = "LCWChatButtonClicked";
94
99
  TelemetryEvent["LCWChatButtonShow"] = "LCWChatButtonShow";
@@ -96,6 +101,7 @@ export let TelemetryEvent;
96
101
  TelemetryEvent["WidgetLoadComplete"] = "WidgetLoadComplete";
97
102
  TelemetryEvent["WidgetLoadFailed"] = "WidgetLoadFailed";
98
103
  TelemetryEvent["StartChatMethodException"] = "StartChatMethodException";
104
+ TelemetryEvent["CloseChatCall"] = "CloseChatCall";
99
105
  TelemetryEvent["CloseChatMethodException"] = "CloseChatMethodException";
100
106
  TelemetryEvent["PrechatSurveyLoaded"] = "PrechatSurveyLoaded";
101
107
  TelemetryEvent["PrechatSubmitted"] = "PrechatSubmitted";
@@ -109,6 +115,7 @@ export let TelemetryEvent;
109
115
  TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
110
116
  TelemetryEvent["EmailTranscriptSent"] = "EmailTranscriptSent";
111
117
  TelemetryEvent["EmailTranscriptFailed"] = "EmailTranscriptFailed";
118
+ TelemetryEvent["ErrorUIPaneLoaded"] = "ErrorUIPaneLoaded";
112
119
  TelemetryEvent["DownloadTranscriptFailed"] = "DownloadTranscriptFailed";
113
120
  TelemetryEvent["StartChatFailed"] = "StartChatFailed";
114
121
  TelemetryEvent["IC3ThreadUpdateEventReceived"] = "IC3ThreadUpdateEventReceived";
@@ -117,8 +124,6 @@ export let TelemetryEvent;
117
124
  TelemetryEvent["LoadingPaneLoaded"] = "LoadingPaneLoaded";
118
125
  TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
119
126
  TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
120
- TelemetryEvent["PostChatSurveyLoadingPaneLoaded"] = "PostChatSurveyLoadingPaneLoaded";
121
- TelemetryEvent["PostChatSurveyLoaded"] = "PostChatSurveyLoaded";
122
127
  TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
123
128
  TelemetryEvent["ProactiveChatPaneLoaded"] = "ProactiveChatPaneLoaded";
124
129
  TelemetryEvent["ReconnectChatPaneLoaded"] = "ReconnectChatPaneLoaded";
@@ -131,6 +136,7 @@ export let TelemetryEvent;
131
136
  TelemetryEvent["SuppressBotMagicCodeSucceeded"] = "SuppressBotMagicCodeSucceeded";
132
137
  TelemetryEvent["SuppressBotMagicCodeFailed"] = "SuppressBotMagicCodeFailed";
133
138
  TelemetryEvent["GetConversationDetailsException"] = "GetConversationDetailsException";
139
+ TelemetryEvent["AppStatesException"] = "AppStatesException";
134
140
  TelemetryEvent["BrowserUnloadEventStarted"] = "BrowserUnloadEventStarted";
135
141
  TelemetryEvent["GetAuthTokenCalled"] = "GetAuthTokenCalled";
136
142
  TelemetryEvent["GetAuthTokenFailed"] = "GetAuthTokenFailed";
@@ -138,6 +144,11 @@ export let TelemetryEvent;
138
144
  TelemetryEvent["CustomerVoiceResponsePageLoaded"] = "CustomerVoiceResponsePageLoaded";
139
145
  TelemetryEvent["CustomerVoiceFormResponseSubmitted"] = "CustomerVoiceFormResponseSubmitted";
140
146
  TelemetryEvent["CustomerVoiceFormResponseError"] = "CustomerVoiceFormResponseError";
147
+ TelemetryEvent["BotAuthActivityEmptySasUrl"] = "BotAuthActivityEmptySasUrl";
148
+ TelemetryEvent["SetBotAuthProviderFetchConfig"] = "SetBotAuthProviderFetchConfig";
149
+ TelemetryEvent["SetBotAuthProviderHideCard"] = "SetBotAuthProviderHideCard";
150
+ TelemetryEvent["SetBotAuthProviderDisplayCard"] = "SetBotAuthProviderDisplayCard";
151
+ TelemetryEvent["SetBotAuthProviderNotFound"] = "SetBotAuthProviderNotFound";
141
152
  TelemetryEvent["ProcessingHTMLTextMiddlewareFailed"] = "ProcessingHTMLTextMiddlewareFailed";
142
153
  TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
143
154
  TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
@@ -147,6 +158,8 @@ export let TelemetryEvent;
147
158
  TelemetryEvent["DataMaskingRuleApplyFailed"] = "DataMaskingRuleApplyFailed";
148
159
  TelemetryEvent["IC3ClientEvent"] = "IC3ClientEvent";
149
160
  TelemetryEvent["ConversationEndedThreadEventReceived"] = "ConversationEndedThreadEventReceived";
161
+ TelemetryEvent["ConversationEndedByCustomer"] = "ConversationEndedByCustomer";
162
+ TelemetryEvent["ConversationEndedByAgent"] = "ConversationEndedByAgent";
150
163
  TelemetryEvent["InvalidConfiguration"] = "InvalidConfiguration";
151
164
  TelemetryEvent["SendTypingIndicatorSucceeded"] = "SendTypingIndicatorSucceeded";
152
165
  TelemetryEvent["SendTypingIndicatorFailed"] = "SendTypingIndicatorFailed";
@@ -164,9 +177,20 @@ export let TelemetryEvent;
164
177
  TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
165
178
  TelemetryEvent["MessageSent"] = "MessageSent";
166
179
  TelemetryEvent["MessageReceived"] = "MessageReceived";
180
+ TelemetryEvent["SystemMessageReceived"] = "SystemMessageReceived";
181
+ TelemetryEvent["HistoryMessageReceived"] = "HistoryMessageReceived";
167
182
  TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
168
183
  TelemetryEvent["NetworkDisconnected"] = "NetworkDisconnected";
169
184
  TelemetryEvent["NetworkReconnected"] = "NetworkReconnected";
185
+ TelemetryEvent["LinkModePostChatWorkflowStarted"] = "LinkModePostChatWorkflowStarted";
186
+ TelemetryEvent["EmbedModePostChatWorkflowStarted"] = "EmbedModePostChatWorkflowStarted";
187
+ TelemetryEvent["PostChatWorkflowFromCustomer"] = "PostChatWorkflowFromCustomer";
188
+ TelemetryEvent["PostChatWorkflowFromAgent"] = "PostChatWorkflowFromAgent";
189
+ TelemetryEvent["PostChatWorkflowFromBot"] = "PostChatWorkflowFromBot";
190
+ TelemetryEvent["PostChatContextCallSucceed"] = "PostChatContextCallSucceed";
191
+ TelemetryEvent["PostChatContextCallFailed"] = "PostChatContextCallFailed";
192
+ TelemetryEvent["PostChatSurveyLoadingPaneLoaded"] = "PostChatSurveyLoadingPaneLoaded";
193
+ TelemetryEvent["PostChatSurveyLoaded"] = "PostChatSurveyLoaded";
170
194
  })(TelemetryEvent || (TelemetryEvent = {}));
171
195
  export class TelemetryConstants {
172
196
  static map(eventTypeOrScenarioType) {
@@ -221,6 +245,12 @@ export class TelemetryConstants {
221
245
  case TelemetryEvent.CustomerVoiceResponsePageLoaded:
222
246
  case TelemetryEvent.CustomerVoiceFormResponseSubmitted:
223
247
  case TelemetryEvent.CustomerVoiceFormResponseError:
248
+ case TelemetryEvent.LinkModePostChatWorkflowStarted:
249
+ case TelemetryEvent.EmbedModePostChatWorkflowStarted:
250
+ case TelemetryEvent.PostChatWorkflowFromCustomer:
251
+ case TelemetryEvent.PostChatWorkflowFromAgent:
252
+ case TelemetryEvent.PostChatWorkflowFromBot:
253
+ case TelemetryEvent.AppStatesException:
224
254
  return ScenarioType.ACTIONS;
225
255
  case TelemetryEvent.StartChatSDKCall:
226
256
  case TelemetryEvent.StartChatEventRecevied:
@@ -1,4 +1,6 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2
4
  import { ScenarioType, TelemetryEvent } from "./TelemetryConstants";
3
5
  import { newGuid } from "../utils";
4
6
  import { TelemetryManager } from "./TelemetryManager";
@@ -54,6 +56,7 @@ export class TelemetryHelper {
54
56
  event.ElapsedTimeInMilliseconds = payload.ElapsedTimeInMilliseconds;
55
57
  event.ExceptionDetails = JSON.stringify(payload.ExceptionDetails);
56
58
  event.Description = payload.Description;
59
+ event.CustomProperties = JSON.stringify(payload.CustomProperties);
57
60
  });
58
61
  }
59
62
  static conformToWebChatContract(level, input) {
@@ -159,7 +162,7 @@ export class TelemetryHelper {
159
162
  telemetryDataLocal.widgetId = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.appId;
160
163
  telemetryDataLocal.orgId = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.orgId;
161
164
  telemetryDataLocal.orgUrl = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.orgUrl;
162
- telemetryDataLocal.lcwRuntimeId = newGuid();
165
+ telemetryDataLocal.lcwRuntimeId = telemetryConfig.LCWRuntimeId ?? newGuid();
163
166
  return telemetryDataLocal;
164
167
  }
165
168
  static addSessionDataToTelemetry(chatSession, telemetryInternalData) {
@@ -1,4 +1,6 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2
4
  import { LogLevel, ScenarioType, TelemetryConstants, TelemetryEvent } from "./TelemetryConstants";
3
5
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
4
6
  import { ariaTelemetryLogger } from "./loggers/ariaTelemetryLogger";
@@ -1,3 +1,4 @@
1
+ var _this = this;
1
2
  import { AriaTelemetryConstants, Constants, LocaleConstants } from "./Constants";
2
3
  import { DataStoreManager } from "./contextDataStore/DataStoreManager";
3
4
  import { KeyCodes } from "./KeyCodes";
@@ -304,4 +305,23 @@ export const addDelayInMs = ms => {
304
305
  };
305
306
  export const getBroadcastChannelName = (widgetId, widgetInstanceId) => {
306
307
  return widgetInstanceId && !isNullOrEmptyString(widgetInstanceId) ? `${widgetInstanceId}_${widgetId}` : widgetId;
308
+ };
309
+
310
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
311
+ export const debounceLeading = function (fn) {
312
+ let ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3000;
313
+ let timeoutId;
314
+ return function () {
315
+ // eslint-disable-line @typescript-eslint/no-explicit-any
316
+
317
+ if (!timeoutId) {
318
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
319
+ args[_key] = arguments[_key];
320
+ }
321
+ fn.apply(_this, args);
322
+ }
323
+ timeoutId = setTimeout(() => {
324
+ timeoutId = null;
325
+ }, ms);
326
+ };
307
327
  };
@@ -4,21 +4,17 @@ import React, { useEffect } from "react";
4
4
  import { findAllFocusableElement, findParentFocusableElementsWithoutChildContainer, preventFocusToMoveOutOfElement, setFocusOnElement, setFocusOnSendBox, setTabIndices } from "../../common/utils";
5
5
  import { DimLayer } from "../dimlayer/DimLayer";
6
6
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
7
- import { NotificationHandler } from "../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
8
- import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
9
7
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
10
8
  import useChatAdapterStore from "../../hooks/useChatAdapterStore";
11
9
  import useChatContextStore from "../../hooks/useChatContextStore";
10
+ import { ConversationEndEntity } from "../../contexts/common/ConversationEndEntity";
12
11
 
13
12
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
13
  export const ConfirmationPaneStateful = props => {
15
14
  const initialTabIndexMap = new Map();
16
15
  let elements = [];
17
16
  const [state, dispatch] = useChatContextStore();
18
- const {
19
- prepareEndChat
20
- } = props;
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
22
18
  const [adapter] = useChatAdapterStore();
23
19
  const controlProps = {
24
20
  id: "oc-lcw-confirmation-pane",
@@ -32,18 +28,15 @@ export const ConfirmationPaneStateful = props => {
32
28
  type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
33
29
  payload: false
34
30
  });
35
- try {
36
- setTabIndices(elements, initialTabIndexMap, true);
37
- await prepareEndChat(adapter, state);
38
- } catch (ex) {
39
- TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
40
- Event: TelemetryEvent.GetConversationDetailsCallFailed,
41
- ExceptionDetails: {
42
- exception: `Get Conversation Details Call Failed : ${ex}`
43
- }
44
- });
45
- NotificationHandler.notifyError(NotificationScenarios.Connection, "Get Conversation Details Call Failed: " + ex);
46
- }
31
+ setTabIndices(elements, initialTabIndexMap, true);
32
+ dispatch({
33
+ type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
34
+ payload: ConversationEndEntity.Customer
35
+ });
36
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
37
+ Event: TelemetryEvent.ConversationEndedByCustomer,
38
+ Description: "Conversation is ended by customer."
39
+ });
47
40
  },
48
41
  onCancel: () => {
49
42
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
@@ -82,7 +75,7 @@ export const ConfirmationPaneStateful = props => {
82
75
  Event: TelemetryEvent.ConfirmationPaneLoaded
83
76
  });
84
77
  }, []);
85
- return /*#__PURE__*/React.createElement(React.Fragment, null, !(controlProps !== null && controlProps !== void 0 && controlProps.disableDimLayer) && /*#__PURE__*/React.createElement(DimLayer, {
78
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DimLayer, {
86
79
  brightness: (controlProps === null || controlProps === void 0 ? void 0 : controlProps.brightnessValueOnDim) ?? "0.2"
87
80
  }), /*#__PURE__*/React.createElement(ConfirmationPane, {
88
81
  componentOverrides: props === null || props === void 0 ? void 0 : props.componentOverrides,
@@ -88,7 +88,7 @@ export const EmailTranscriptPaneStateful = props => {
88
88
  Event: TelemetryEvent.EmailTranscriptLoaded
89
89
  });
90
90
  }, [initialEmail]);
91
- return /*#__PURE__*/React.createElement(React.Fragment, null, !(controlProps !== null && controlProps !== void 0 && controlProps.disableDimLayer) && /*#__PURE__*/React.createElement(DimLayer, {
91
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DimLayer, {
92
92
  brightness: (controlProps === null || controlProps === void 0 ? void 0 : controlProps.brightnessValueOnDim) ?? "0.2"
93
93
  }), /*#__PURE__*/React.createElement(InputValidationPane, {
94
94
  componentOverrides: props.componentOverrides,
@@ -7,6 +7,7 @@ import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
7
7
  import { defaultOutOfOfficeHeaderStyleProps } from "./common/styleProps/defaultOutOfOfficeHeaderStyleProps";
8
8
  import useChatAdapterStore from "../../hooks/useChatAdapterStore";
9
9
  import useChatContextStore from "../../hooks/useChatContextStore";
10
+ import { ConversationEndEntity } from "../../contexts/common/ConversationEndEntity";
10
11
  export const HeaderStateful = props => {
11
12
  var _state$domainStates$l, _state$domainStates$l2, _headerProps$controlP, _headerProps$controlP2, _headerProps$controlP3, _outOfOfficeHeaderPro;
12
13
  const [state, dispatch] = useChatContextStore();
@@ -21,6 +22,7 @@ export const HeaderStateful = props => {
21
22
  const [outOfOperatingHours, setOutOfOperatingHours] = useState(((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True");
22
23
  const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
23
24
  const conversationState = useRef(state.appStates.conversationState);
25
+ const conversationEndedBy = useRef(state.appStates.conversationEndedBy);
24
26
  const controlProps = {
25
27
  id: "oc-lcw-header",
26
28
  dir: state.domainStates.globalDir,
@@ -40,7 +42,7 @@ export const HeaderStateful = props => {
40
42
  Event: TelemetryEvent.HeaderCloseButtonClicked,
41
43
  Description: "Header Close button clicked."
42
44
  });
43
- if (conversationState.current === ConversationState.Active) {
45
+ if (conversationState.current === ConversationState.Active || conversationEndedBy.current === ConversationEndEntity.Agent) {
44
46
  dispatch({
45
47
  type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
46
48
  payload: true
@@ -60,9 +62,9 @@ export const HeaderStateful = props => {
60
62
  }
61
63
  },
62
64
  ...(headerProps === null || headerProps === void 0 ? void 0 : headerProps.controlProps),
63
- hideTitle: state.appStates.conversationState === ConversationState.Loading || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
64
- hideIcon: state.appStates.conversationState === ConversationState.Loading || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
65
- hideCloseButton: state.appStates.conversationState === ConversationState.Loading || state.appStates.conversationState === ConversationState.Prechat || state.appStates.conversationState === ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
65
+ hideTitle: state.appStates.conversationState === ConversationState.Loading && !state.appStates.isStartChatFailing || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
66
+ hideIcon: state.appStates.conversationState === ConversationState.Loading && !state.appStates.isStartChatFailing || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
67
+ hideCloseButton: state.appStates.conversationState === ConversationState.Loading && !state.appStates.isStartChatFailing || state.appStates.conversationState === ConversationState.PostchatLoading || state.appStates.conversationState === ConversationState.Prechat || state.appStates.conversationState === ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
66
68
  };
67
69
  const outOfOfficeControlProps = {
68
70
  id: "oc-lcw-header",
@@ -86,6 +88,7 @@ export const HeaderStateful = props => {
86
88
  if (state.appStates.conversationState) {
87
89
  conversationState.current = state.appStates.conversationState;
88
90
  }
91
+ conversationEndedBy.current = state.appStates.conversationEndedBy;
89
92
  }, [state.appStates]);
90
93
  return /*#__PURE__*/React.createElement(Header, {
91
94
  componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
@@ -1,4 +1,6 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2
4
  import { Deferred } from "./Deferred";
3
5
  export class ActivityStreamHandler {
4
6
  // eslint-disable-next-line @typescript-eslint/no-explicit-any