@microsoft/omnichannel-chat-widget 0.1.0-main.0d584e6 → 0.1.0-main.0e38a73

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 (253) hide show
  1. package/lib/cjs/common/Constants.js +0 -167
  2. package/lib/cjs/common/KeyCodes.js +0 -3
  3. package/lib/cjs/common/contextDataStore/DataStoreManager.js +0 -4
  4. package/lib/cjs/common/storage/default/defaultCacheManager.js +0 -10
  5. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +4 -16
  6. package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +2 -10
  7. package/lib/cjs/common/telemetry/TelemetryConstants.js +12 -22
  8. package/lib/cjs/common/telemetry/TelemetryHelper.js +16 -57
  9. package/lib/cjs/common/telemetry/TelemetryManager.js +0 -31
  10. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +0 -2
  11. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +2 -21
  12. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +0 -9
  13. package/lib/cjs/common/utils.js +18 -105
  14. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +8 -46
  15. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +2 -24
  16. package/lib/cjs/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  17. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +4 -28
  18. package/lib/cjs/components/dimlayer/DimLayer.js +0 -4
  19. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -32
  20. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -8
  21. package/lib/cjs/components/footerstateful/FooterStateful.js +6 -29
  22. package/lib/cjs/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +0 -6
  23. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +7 -45
  24. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -8
  25. package/lib/cjs/components/headerstateful/HeaderStateful.js +4 -25
  26. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -14
  27. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +2 -9
  28. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +0 -5
  29. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +4 -11
  30. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +11 -19
  31. package/lib/cjs/components/livechatwidget/common/Deferred.js +3 -10
  32. package/lib/cjs/components/livechatwidget/common/authHelper.js +4 -19
  33. package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -13
  34. package/lib/cjs/components/livechatwidget/common/createFooter.js +0 -10
  35. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +2 -14
  36. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +16 -24
  37. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +40 -34
  38. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +0 -3
  39. package/lib/cjs/components/livechatwidget/common/endChat.js +8 -33
  40. package/lib/cjs/components/livechatwidget/common/getGeneralStylesForButton.js +0 -6
  41. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +7 -16
  42. package/lib/cjs/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -8
  43. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +16 -54
  44. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +36 -66
  45. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +4 -17
  46. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +2 -11
  47. package/lib/cjs/components/livechatwidget/common/shareObservable.js +4 -8
  48. package/lib/cjs/components/livechatwidget/common/startChat.js +46 -86
  49. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +0 -8
  50. package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -11
  51. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +72 -162
  52. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +4 -17
  53. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +4 -17
  54. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -17
  55. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -23
  56. package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  57. package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +13 -0
  58. package/lib/cjs/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  59. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  60. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +8 -36
  61. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +2 -32
  62. package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +2 -24
  63. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +19 -38
  64. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +0 -7
  65. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -6
  66. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +9 -26
  67. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +2 -17
  68. package/lib/cjs/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -24
  69. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -15
  70. package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -8
  71. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +0 -4
  72. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -4
  73. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  74. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  75. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  76. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  77. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  78. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  79. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  80. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  81. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +0 -7
  82. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -5
  83. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +17 -41
  84. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +8 -19
  85. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -60
  86. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +7 -15
  87. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +2 -13
  88. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -16
  89. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
  90. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -3
  91. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -3
  92. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
  93. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -9
  94. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +2 -30
  95. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -12
  96. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +6 -28
  97. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  98. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +13 -30
  99. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +3 -9
  100. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -34
  101. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -10
  102. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +1 -12
  103. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +16 -19
  104. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +1 -9
  105. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -9
  106. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -34
  107. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +1 -10
  108. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +7 -11
  109. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +5 -14
  110. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -21
  111. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -12
  112. package/lib/cjs/contexts/ChatAdapterStore.js +0 -2
  113. package/lib/cjs/contexts/ChatContextStore.js +0 -2
  114. package/lib/cjs/contexts/ChatSDKStore.js +0 -2
  115. package/lib/cjs/contexts/common/ConversationState.js +0 -1
  116. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +0 -1
  117. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +0 -9
  118. package/lib/cjs/contexts/createReducer.js +133 -104
  119. package/lib/cjs/controller/componentController.js +1 -30
  120. package/lib/cjs/hooks/useChatAdapterStore.js +0 -6
  121. package/lib/cjs/hooks/useChatContextStore.js +0 -6
  122. package/lib/cjs/hooks/useChatSDKStore.js +0 -6
  123. package/lib/cjs/index.js +0 -5
  124. package/lib/cjs/plugins/newMessageEventHandler.js +15 -36
  125. package/lib/esm/common/Constants.js +0 -155
  126. package/lib/esm/common/KeyCodes.js +0 -2
  127. package/lib/esm/common/contextDataStore/DataStoreManager.js +0 -2
  128. package/lib/esm/common/storage/default/defaultCacheManager.js +0 -3
  129. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +4 -11
  130. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +2 -3
  131. package/lib/esm/common/telemetry/TelemetryConstants.js +16 -19
  132. package/lib/esm/common/telemetry/TelemetryHelper.js +16 -45
  133. package/lib/esm/common/telemetry/TelemetryManager.js +0 -18
  134. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +2 -14
  135. package/lib/esm/common/telemetry/loggers/consoleLogger.js +0 -5
  136. package/lib/esm/common/utils.js +18 -53
  137. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +8 -17
  138. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +2 -7
  139. package/lib/esm/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  140. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +6 -9
  141. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -11
  142. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -6
  143. package/lib/esm/components/footerstateful/FooterStateful.js +8 -10
  144. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +7 -35
  145. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -6
  146. package/lib/esm/components/headerstateful/HeaderStateful.js +4 -10
  147. package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -2
  148. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +2 -6
  149. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +0 -3
  150. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +4 -8
  151. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +11 -15
  152. package/lib/esm/components/livechatwidget/common/Deferred.js +3 -8
  153. package/lib/esm/components/livechatwidget/common/authHelper.js +4 -12
  154. package/lib/esm/components/livechatwidget/common/createAdapter.js +4 -6
  155. package/lib/esm/components/livechatwidget/common/createFooter.js +0 -1
  156. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +2 -5
  157. package/lib/esm/components/livechatwidget/common/createMarkdown.js +18 -18
  158. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +42 -21
  159. package/lib/esm/components/livechatwidget/common/endChat.js +10 -18
  160. package/lib/esm/components/livechatwidget/common/getGeneralStylesForButton.js +0 -2
  161. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +9 -11
  162. package/lib/esm/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -5
  163. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +18 -19
  164. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +37 -51
  165. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +4 -9
  166. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -3
  167. package/lib/esm/components/livechatwidget/common/shareObservable.js +4 -7
  168. package/lib/esm/components/livechatwidget/common/startChat.js +48 -59
  169. package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +4 -2
  170. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +73 -95
  171. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +4 -5
  172. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +4 -5
  173. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -5
  174. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -11
  175. package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  176. package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +6 -0
  177. package/lib/esm/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  178. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  179. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +10 -20
  180. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +4 -8
  181. package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +2 -6
  182. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +17 -11
  183. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  184. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +9 -18
  185. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +2 -13
  186. package/lib/esm/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -16
  187. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -5
  188. package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -6
  189. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +0 -2
  190. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -2
  191. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  192. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  193. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  194. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  195. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  196. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  197. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  198. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  199. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +2 -5
  200. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -4
  201. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +17 -26
  202. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +10 -11
  203. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -38
  204. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +9 -8
  205. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +2 -9
  206. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -14
  207. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
  208. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -1
  209. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -1
  210. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
  211. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -7
  212. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +4 -28
  213. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +3 -3
  214. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +7 -14
  215. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +3 -3
  216. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +15 -19
  217. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +5 -8
  218. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -29
  219. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +3 -7
  220. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +3 -8
  221. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +16 -14
  222. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +3 -7
  223. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -7
  224. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +15 -27
  225. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +3 -5
  226. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +9 -9
  227. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +7 -9
  228. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -13
  229. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -5
  230. package/lib/esm/contexts/ChatAdapterStore.js +2 -1
  231. package/lib/esm/contexts/ChatContextStore.js +2 -1
  232. package/lib/esm/contexts/ChatSDKStore.js +2 -1
  233. package/lib/esm/contexts/common/ConversationState.js +0 -1
  234. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +0 -1
  235. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +0 -3
  236. package/lib/esm/contexts/createReducer.js +133 -101
  237. package/lib/esm/controller/componentController.js +2 -1
  238. package/lib/esm/hooks/useChatAdapterStore.js +0 -4
  239. package/lib/esm/hooks/useChatContextStore.js +0 -4
  240. package/lib/esm/hooks/useChatSDKStore.js +0 -4
  241. package/lib/esm/plugins/newMessageEventHandler.js +15 -26
  242. package/lib/types/common/telemetry/TelemetryConstants.d.ts +7 -2
  243. package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -4
  244. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -5
  245. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -2
  246. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  247. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +5 -0
  248. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  249. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +0 -1
  250. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +2 -0
  251. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
  252. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
  253. package/package.json +3 -3
@@ -4,46 +4,38 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _NotificationHandler = require("../../notification/NotificationHandler");
9
-
10
8
  var _NotificationScenarios = require("../../enums/NotificationScenarios");
11
-
12
9
  var _WebChatActionType = require("../../enums/WebChatActionType");
13
-
14
10
  /******
15
11
  * AttachmentUploadValidatorMiddleware
16
12
  *
17
13
  * Checks if the attachment being uploaded satisfies Omnichannel's requirement on file extensions and file size.
18
14
  ******/
15
+
19
16
  const MBtoBRatio = 1000000;
17
+
20
18
  /*
21
19
  * If an attachment is invalid, delete this attachment from the attachments list
22
20
  * If the result attachment list is empty, return a dummy action
23
21
  */
24
-
25
22
  const validateAttachment = (action, allowedFileExtensions, maxUploadFileSize, localizedTexts) => {
26
23
  var _action$payload, _action$payload$activ, _action$payload2, _action$payload2$acti, _action$payload2$acti2, _action$payload3, _action$payload3$acti, _action$payload3$acti2;
27
-
28
24
  const attachments = action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$activ = _action$payload.activity) === null || _action$payload$activ === void 0 ? void 0 : _action$payload$activ.attachments;
29
25
  const attachmentSizes = 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$acti2 = _action$payload2$acti.channelData) === null || _action$payload2$acti2 === void 0 ? void 0 : _action$payload2$acti2.attachmentSizes;
30
-
31
26
  if (attachments) {
32
27
  for (let i = 0; i < attachments.length; i++) {
33
28
  const fileExtensionValid = validateFileExtension(attachments[i], allowedFileExtensions);
34
29
  const fileSizeValid = validateFileSize(attachmentSizes[i], maxUploadFileSize);
35
30
  const fileIsEmpty = parseInt(attachmentSizes[i]) == 0;
36
-
37
31
  if (!fileExtensionValid || !fileSizeValid || fileIsEmpty) {
38
32
  _NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.AttachmentError, buildErrorMessage(attachments[i].name, fileExtensionValid, fileSizeValid, fileIsEmpty, maxUploadFileSize, localizedTexts));
39
-
40
33
  attachments.splice(i, 1);
41
34
  attachmentSizes.splice(i, 1);
42
35
  i--;
43
36
  }
44
37
  }
45
38
  }
46
-
47
39
  if ((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.attachments) === null || _action$payload3$acti2 === void 0 ? void 0 : _action$payload3$acti2.length) > 0) {
48
40
  return action;
49
41
  } else {
@@ -52,37 +44,30 @@ const validateAttachment = (action, allowedFileExtensions, maxUploadFileSize, lo
52
44
  payload: null
53
45
  };
54
46
  }
55
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
56
-
47
+ };
57
48
 
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
50
  const validateFileExtension = (attachment, allowedFileExtensions) => {
59
51
  if (!allowedFileExtensions) {
60
52
  return true;
61
53
  }
62
-
63
54
  const fileName = attachment.name.toLowerCase();
64
55
  const index = fileName.lastIndexOf(".");
65
-
66
56
  if (!index) {
67
57
  return false;
68
58
  }
69
-
70
59
  const fileExtension = fileName.substring(index);
71
60
  const allExtensions = allowedFileExtensions === null || allowedFileExtensions === void 0 ? void 0 : allowedFileExtensions.toLowerCase().split(",");
72
61
  return allExtensions.indexOf(fileExtension) > -1;
73
62
  };
74
-
75
63
  const validateFileSize = (attachmentSize, maxUploadFileSize) => {
76
64
  return (maxUploadFileSize && parseInt(maxUploadFileSize) * MBtoBRatio) > parseInt(attachmentSize);
77
65
  };
78
-
79
66
  const buildErrorMessage = (fileName, supportedFileExtension, supportedFileSize, fileIsEmpty, maxUploadFileSize, localizedTexts) => {
80
67
  let errorMessage = "";
81
-
82
68
  if (!fileName || !maxUploadFileSize) {
83
69
  return localizedTexts.MIDDLEWARE_BANNER_FILE_NULL_ERROR ?? "";
84
70
  }
85
-
86
71
  if (!supportedFileExtension && !supportedFileSize) {
87
72
  errorMessage = getFileSizeAndFileExtensionErrorMessage(fileName, maxUploadFileSize, localizedTexts);
88
73
  } else if (!supportedFileSize) {
@@ -94,33 +79,25 @@ const buildErrorMessage = (fileName, supportedFileExtension, supportedFileSize,
94
79
  } else {
95
80
  errorMessage = localizedTexts.MIDDLEWARE_BANNER_ERROR_MESSAGE ?? "";
96
81
  }
97
-
98
82
  return errorMessage;
99
83
  };
100
-
101
84
  const getFileSizeAndFileExtensionErrorMessage = (fileName, maxUploadFileSize, localizedTexts) => {
102
85
  const index = fileName.lastIndexOf(".");
103
86
  let errorMessage;
104
-
105
87
  if (index < 0) {
106
88
  errorMessage = localizedTexts.MIDDLEWARE_BANNER_FILE_SIZE_WITHOUT_EXTENSION_ERROR;
107
89
  } else {
108
90
  var _errorMessage;
109
-
110
91
  const fileExtension = fileName.substring(index);
111
92
  errorMessage = localizedTexts.MIDDLEWARE_BANNER_FILE_SIZE_EXTENSION_ERROR;
112
-
113
93
  if ((_errorMessage = errorMessage) !== null && _errorMessage !== void 0 && _errorMessage.includes("{1}")) {
114
94
  errorMessage = errorMessage.replace("{1}", fileExtension);
115
95
  }
116
96
  }
117
-
118
97
  return errorMessage ? errorMessage.includes("{0}") ? errorMessage.replace("{0}", maxUploadFileSize) : errorMessage : "";
119
98
  };
120
-
121
99
  const getFileExtensionErrorMessage = (fileName, localizedTexts) => {
122
100
  const index = fileName.lastIndexOf(".");
123
-
124
101
  if (index < 0) {
125
102
  return localizedTexts.MIDDLEWARE_BANNER_FILE_WITHOUT_EXTENSION ?? "";
126
103
  } else {
@@ -129,13 +106,12 @@ const getFileExtensionErrorMessage = (fileName, localizedTexts) => {
129
106
  return errorMessage ? errorMessage.includes("{0}") ? errorMessage.replace("{0}", fileExtension) : errorMessage : "";
130
107
  }
131
108
  };
132
-
133
109
  const getFileSizeErrorMessage = (maxUploadFileSize, localizedTexts) => {
134
110
  const errorMessage = localizedTexts.MIDDLEWARE_BANNER_FILE_SIZE_ERROR;
135
111
  return errorMessage ? errorMessage.includes("{0}") ? errorMessage.replace("{0}", maxUploadFileSize) : errorMessage : "";
136
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
137
-
112
+ };
138
113
 
114
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
139
115
  const createAttachmentUploadValidatorMiddleware = (allowedFileExtensions, maxUploadFileSize, localizedTexts) => _ref => {
140
116
  let {
141
117
  dispatch
@@ -143,19 +119,15 @@ const createAttachmentUploadValidatorMiddleware = (allowedFileExtensions, maxUpl
143
119
  return next => action => {
144
120
  if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_POST_ACTIVITY) {
145
121
  var _payload$activity, _payload$activity2, _payload$activity2$ch, _payload$activity3, _payload$activity3$at, _payload$activity4, _payload$activity4$ch, _payload$activity4$ch2;
146
-
147
122
  const {
148
123
  payload
149
124
  } = action;
150
-
151
125
  if (payload !== null && payload !== void 0 && (_payload$activity = payload.activity) !== null && _payload$activity !== void 0 && _payload$activity.attachments && payload !== null && payload !== void 0 && (_payload$activity2 = payload.activity) !== null && _payload$activity2 !== void 0 && (_payload$activity2$ch = _payload$activity2.channelData) !== null && _payload$activity2$ch !== void 0 && _payload$activity2$ch.attachmentSizes && (payload === null || payload === void 0 ? void 0 : (_payload$activity3 = payload.activity) === null || _payload$activity3 === void 0 ? void 0 : (_payload$activity3$at = _payload$activity3.attachments) === null || _payload$activity3$at === void 0 ? void 0 : _payload$activity3$at.length) === (payload === null || payload === void 0 ? void 0 : (_payload$activity4 = payload.activity) === null || _payload$activity4 === void 0 ? void 0 : (_payload$activity4$ch = _payload$activity4.channelData) === null || _payload$activity4$ch === void 0 ? void 0 : (_payload$activity4$ch2 = _payload$activity4$ch.attachmentSizes) === null || _payload$activity4$ch2 === void 0 ? void 0 : _payload$activity4$ch2.length)) {
152
126
  return next(validateAttachment(action, allowedFileExtensions, maxUploadFileSize, localizedTexts));
153
127
  }
154
128
  }
155
-
156
129
  return next(action);
157
130
  };
158
131
  };
159
-
160
132
  var _default = createAttachmentUploadValidatorMiddleware;
161
133
  exports.default = _default;
@@ -4,18 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _Constants = require("../../../../../common/Constants");
9
-
10
8
  var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
11
-
12
9
  var _WebChatActionType = require("../../enums/WebChatActionType");
13
-
14
10
  /******
15
11
  * ChannelDataMiddleware
16
12
  *
17
13
  * Adds necessary tags if not present so that the rendering middlewares can process them later.
18
14
  ******/
15
+
19
16
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
20
17
  const channelDataMiddleware = _ref => {
21
18
  let {
@@ -23,16 +20,13 @@ const channelDataMiddleware = _ref => {
23
20
  } = _ref;
24
21
  return next => action => {
25
22
  var _action$payload, _action$payload$activ;
26
-
27
23
  if ((action === null || action === void 0 ? void 0 : action.type) === _WebChatActionType.WebChatActionType.DIRECT_LINE_POST_ACTIVITY_PENDING && action !== null && action !== void 0 && (_action$payload = action.payload) !== null && _action$payload !== void 0 && (_action$payload$activ = _action$payload.activity) !== null && _action$payload$activ !== void 0 && _action$payload$activ.channelData) {
28
24
  const channelIdTag = `${_Constants.Constants.channelIdKey}${_Constants.Constants.ChannelId}`;
29
25
  const customerMessageTag = `${_Constants.Constants.CustomerTag}`;
30
-
31
26
  if (action.payload.activity.channelData.tags) {
32
27
  if (!action.payload.activity.channelData.tags.includes(channelIdTag)) {
33
28
  action.payload.activity.channelData.tags.push(channelIdTag);
34
29
  }
35
-
36
30
  if (!action.payload.activity.channelData.tags.includes(customerMessageTag)) {
37
31
  action.payload.activity.channelData.tags.push(customerMessageTag);
38
32
  }
@@ -40,15 +34,12 @@ const channelDataMiddleware = _ref => {
40
34
  action.payload.activity.channelData.tags = [channelIdTag];
41
35
  action.payload.activity.channelData.tags.push(customerMessageTag);
42
36
  }
43
-
44
37
  action.payload.activity.channelData.metadata = {
45
38
  deliveryMode: _omnichannelChatSdk.DeliveryMode.Bridged
46
39
  };
47
40
  }
48
-
49
41
  return next(action);
50
42
  };
51
43
  };
52
-
53
44
  var _default = channelDataMiddleware;
54
45
  exports.default = _default;
@@ -4,21 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _Constants = require("../../../../../common/Constants");
9
-
10
8
  var _DirectLineSenderRole = require("../../enums/DirectLineSenderRole");
11
-
12
9
  var _MessageType = require("../../enums/MessageType");
13
-
14
10
  var _WebChatActionType = require("../../enums/WebChatActionType");
15
-
16
11
  /******
17
12
  * ConversationEndMiddleware
18
13
  *
19
14
  * This middleware is invoked when the conversation is ended by the agent/bot.
20
15
  * The callback is then invoked to hide the send box (by default).
21
16
  ******/
17
+
22
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
23
19
  const createConversationEndMiddleware = conversationEndCallback => _ref => {
24
20
  let {
@@ -26,32 +22,25 @@ const createConversationEndMiddleware = conversationEndCallback => _ref => {
26
22
  } = _ref;
27
23
  return next => action => {
28
24
  var _action$payload;
29
-
30
25
  if ((action === null || action === void 0 ? void 0 : action.type) == _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
31
26
  var _activity$from, _activity$from2, _activity$channelData7, _activity$channelData8;
32
-
33
27
  const activity = action.payload.activity;
34
-
35
28
  if (((_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === _DirectLineSenderRole.DirectLineSenderRole.Bot && activity.channelId === "ACS_CHANNEL") {
36
29
  var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4, _activity$channelData5, _activity$channelData6;
37
-
38
30
  // ACS
39
31
  if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(_Constants.Constants.systemMessageTag) && ((_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(_Constants.Constants.agentEndConversationMessageTag) || (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(_Constants.Constants.supervisorForceCloseMessageTag))) {
40
32
  conversationEndCallback();
41
33
  }
42
34
  } else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === _DirectLineSenderRole.DirectLineSenderRole.Channel && ((_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : _activity$channelData7.type) === _MessageType.MessageTypes.Thread && (_activity$channelData8 = activity.channelData) !== null && _activity$channelData8 !== void 0 && _activity$channelData8.properties) {
43
35
  var _activity$channelData9, _activity$channelData10, _activity$channelData11, _activity$channelData12;
44
-
45
36
  // IC3
46
37
  if (((_activity$channelData9 = activity.channelData) === null || _activity$channelData9 === void 0 ? void 0 : (_activity$channelData10 = _activity$channelData9.properties) === null || _activity$channelData10 === void 0 ? void 0 : _activity$channelData10.isdeleted) === _Constants.Constants.truePascal || !((_activity$channelData11 = activity.channelData) !== null && _activity$channelData11 !== void 0 && (_activity$channelData12 = _activity$channelData11.properties) !== null && _activity$channelData12 !== void 0 && _activity$channelData12.containsExternalEntitiesListeningAll)) {
47
38
  conversationEndCallback();
48
39
  }
49
40
  }
50
41
  }
51
-
52
42
  return next(action);
53
43
  };
54
44
  };
55
-
56
45
  var _default = createConversationEndMiddleware;
57
46
  exports.default = _default;
@@ -4,27 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
9
-
10
8
  var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
11
-
12
9
  var _WebChatActionType = require("../../enums/WebChatActionType");
13
-
14
10
  var _isMaskingFromCustomer = require("../../../common/utils/isMaskingFromCustomer");
15
-
16
11
  /******
17
12
  * DataMaskingMiddleware
18
13
  *
19
14
  * Applies data masking rules that Omnichannel Admin has configured.
20
15
  ******/
16
+
21
17
  const applyDataMasking = (action, regexCollection) => {
22
18
  const maskedChar = "#"; //to do: load from env once OC SDK supporting.
23
-
24
19
  let {
25
20
  text
26
21
  } = action.payload;
27
-
28
22
  if (!regexCollection) {
29
23
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
30
24
  Event: _TelemetryConstants.TelemetryEvent.InvalidConfiguration,
@@ -32,25 +26,28 @@ const applyDataMasking = (action, regexCollection) => {
32
26
  ErrorDetails: "Invalid data masking rules"
33
27
  }
34
28
  });
35
-
36
29
  return action;
37
30
  }
38
-
31
+ let isRuleMatched = false;
39
32
  for (const ruleId of Object.keys(regexCollection)) {
40
33
  const item = regexCollection[ruleId];
41
-
42
34
  if (item) {
43
35
  try {
44
36
  const regex = new RegExp(item, "gi");
45
- let match; // eslint-disable-next-line no-cond-assign
46
-
37
+ let match;
38
+ // eslint-disable-next-line no-cond-assign
47
39
  while (match = regex.exec(text)) {
48
40
  const replaceStr = match[0].replace(/./gi, maskedChar);
49
41
  text = text.replace(match[0], replaceStr);
42
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
43
+ Event: _TelemetryConstants.TelemetryEvent.DataMaskingRuleApplied,
44
+ Description: `Data Masking Rule Id: ${ruleId} applied.`
45
+ });
46
+ isRuleMatched = true;
50
47
  }
51
48
  } catch (err) {
52
49
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
53
- Event: _TelemetryConstants.TelemetryEvent.DataMaskingRuleApplied,
50
+ Event: _TelemetryConstants.TelemetryEvent.DataMaskingRuleApplyFailed,
54
51
  ExceptionDetails: {
55
52
  RuleId: ruleId,
56
53
  Exception: err
@@ -58,28 +55,28 @@ const applyDataMasking = (action, regexCollection) => {
58
55
  });
59
56
  }
60
57
  }
58
+ // Exit if rule matched
59
+ if (isRuleMatched === true) {
60
+ break;
61
+ }
61
62
  }
62
-
63
63
  action.payload.text = text;
64
64
  return action;
65
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
66
-
65
+ };
67
66
 
67
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
68
68
  const createDataMaskingMiddleware = dataMaskingInfo => _ref => {
69
69
  let {
70
70
  dispatch
71
71
  } = _ref;
72
72
  return next => action => {
73
73
  var _action$payload;
74
-
75
74
  if ((0, _isMaskingFromCustomer.isMaskingforCustomer)(dataMaskingInfo) && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.text && action.type === _WebChatActionType.WebChatActionType.WEB_CHAT_SEND_MESSAGE) {
76
75
  const regexCollection = dataMaskingInfo === null || dataMaskingInfo === void 0 ? void 0 : dataMaskingInfo.dataMaskingRules;
77
76
  return next(applyDataMasking(action, regexCollection));
78
77
  }
79
-
80
78
  return next(action);
81
79
  };
82
80
  };
83
-
84
81
  var _default = createDataMaskingMiddleware;
85
82
  exports.default = _default;
@@ -4,16 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _Constants = require("../../../../../common/Constants");
9
-
10
8
  var _WebChatActionType = require("../../enums/WebChatActionType");
11
-
12
9
  /******
13
10
  * GIFUploadMiddleware
14
11
  *
15
12
  * Ensures that GIF are properly uploaded.
16
13
  ******/
14
+
17
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
18
16
  const gifUploadMiddleware = _ref => {
19
17
  let {
@@ -22,16 +20,13 @@ const gifUploadMiddleware = _ref => {
22
20
  return next => action => {
23
21
  if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_POST_ACTIVITY) {
24
22
  var _activity$attachments, _activity$channelData, _activity$channelData2;
25
-
26
23
  const {
27
24
  payload: {
28
25
  activity
29
26
  }
30
27
  } = action;
31
-
32
28
  if ((activity === null || activity === void 0 ? void 0 : (_activity$attachments = activity.attachments) === null || _activity$attachments === void 0 ? void 0 : _activity$attachments.length) === (activity === null || activity === void 0 ? void 0 : (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.attachmentSizes) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.length)) {
33
29
  var _activity$attachments2;
34
-
35
30
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
31
  activity === null || activity === void 0 ? void 0 : (_activity$attachments2 = activity.attachments) === null || _activity$attachments2 === void 0 ? void 0 : _activity$attachments2.forEach(attachment => {
37
32
  const {
@@ -39,17 +34,14 @@ const gifUploadMiddleware = _ref => {
39
34
  contentUrl,
40
35
  contentType
41
36
  } = attachment;
42
-
43
37
  if (contentType === _Constants.Constants.GifContentType && thumbnailUrl !== contentUrl) {
44
38
  attachment.thumbnailUrl = contentUrl;
45
39
  }
46
40
  });
47
41
  }
48
42
  }
49
-
50
43
  return next(action);
51
44
  };
52
45
  };
53
-
54
46
  var _default = gifUploadMiddleware;
55
47
  exports.default = _default;
@@ -4,21 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _Constants = require("../../../../../common/Constants");
9
-
10
8
  var _WebChatActionType = require("../../enums/WebChatActionType");
11
-
12
9
  /******
13
10
  * HTMLPlayerMiddleware
14
11
  *
15
12
  * Ensures that video/audio attachment are properly rendered.
16
13
  ******/
14
+
17
15
  const disableHTMLPlayerDownloadButton = htmlTag => {
18
16
  setTimeout(() => {
19
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
18
  const elements = document.getElementsByTagName(htmlTag);
21
-
22
19
  for (let index = 0; index < elements.length; index++) {
23
20
  if (!elements[index].getAttribute(_Constants.Constants.controlsList)) {
24
21
  elements[index].setAttribute(_Constants.Constants.controlsList, _Constants.Constants.nodownload);
@@ -30,24 +27,21 @@ const disableHTMLPlayerDownloadButton = htmlTag => {
30
27
  }
31
28
  }
32
29
  }, 500);
33
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
34
-
30
+ };
35
31
 
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
36
33
  const htmlPlayerMiddleware = _ref => {
37
34
  let {
38
35
  dispatch
39
36
  } = _ref;
40
37
  return next => action => {
41
38
  var _action$payload, _action$payload$activ, _action$payload$activ2;
42
-
43
39
  if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && ((_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$activ = _action$payload.activity) === null || _action$payload$activ === void 0 ? void 0 : (_action$payload$activ2 = _action$payload$activ.attachments) === null || _action$payload$activ2 === void 0 ? void 0 : _action$payload$activ2.length) > 0) {
44
40
  disableHTMLPlayerDownloadButton(_Constants.Constants.video);
45
41
  disableHTMLPlayerDownloadButton(_Constants.Constants.audio);
46
42
  }
47
-
48
43
  return next(action);
49
44
  };
50
45
  };
51
-
52
46
  var _default = htmlPlayerMiddleware;
53
47
  exports.default = _default;
@@ -4,36 +4,28 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _Constants = require("../../../../../common/Constants");
9
-
10
8
  var _dompurify = _interopRequireDefault(require("dompurify"));
11
-
12
9
  var _WebChatActionType = require("../../enums/WebChatActionType");
13
-
14
10
  var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
15
-
16
11
  var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
17
-
18
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
13
  /******
21
14
  * HTMLTextMiddleware
22
15
  *
23
16
  * Ensures that links within messages are processed so that the caller website cannot be traced.
24
17
  ******/
18
+
25
19
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
20
  const convertTextToHtmlNode = text => {
27
21
  if (!text) return "";
28
22
  const element = document.createElement(_Constants.HtmlAttributeNames.div);
29
-
30
23
  try {
31
24
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
25
  text = _dompurify.default.sanitize(text);
33
26
  element.innerHTML = text;
34
27
  } catch (e) {
35
28
  const errorMessage = `Failed to purify and set innertHTML with text: ${text}`;
36
-
37
29
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
38
30
  Event: _TelemetryConstants.TelemetryEvent.ProcessingHTMLTextMiddlewareFailed,
39
31
  ExceptionDetails: {
@@ -42,56 +34,50 @@ const convertTextToHtmlNode = text => {
42
34
  }
43
35
  });
44
36
  }
45
-
46
37
  return element;
47
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
-
38
+ };
49
39
 
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
41
  const processHTMLText = (action, text) => {
51
42
  const htmlNode = convertTextToHtmlNode(text);
52
43
  const aNodes = htmlNode.getElementsByTagName(_Constants.HtmlAttributeNames.aTagName);
53
-
54
44
  if ((aNodes === null || aNodes === void 0 ? void 0 : aNodes.length) > 0) {
55
45
  try {
56
46
  for (let index = 0; index < aNodes.length; index++) {
57
47
  var _aNode$tagName;
58
-
59
- const aNode = aNodes[index]; // Skip if the node is not valid or the node's tag name is not equal to 'a', or the node href is empty.
60
-
48
+ const aNode = aNodes[index];
49
+ // Skip if the node is not valid or the node's tag name is not equal to 'a', or the node href is empty.
61
50
  if (((_aNode$tagName = aNode.tagName) === null || _aNode$tagName === void 0 ? void 0 : _aNode$tagName.toLowerCase()) !== _Constants.HtmlAttributeNames.aTagName || !aNode.href) {
62
51
  continue;
63
- } // Add target to 'a' node if target is missing or does not equal to blank
64
-
52
+ }
65
53
 
54
+ // Add target to 'a' node if target is missing or does not equal to blank
66
55
  if (!aNode.target || aNode.target !== _Constants.Constants.blank) {
67
56
  aNode.target = _Constants.Constants.blank;
68
- } // If rel is missing or rel does not include noopener and noreferrer, add them
69
-
57
+ }
70
58
 
59
+ // If rel is missing or rel does not include noopener and noreferrer, add them
71
60
  if (!aNode.rel) {
72
61
  aNode.rel = `${_Constants.HtmlAttributeNames.noopenerTag} ${_Constants.HtmlAttributeNames.noreferrerTag}`;
73
62
  } else {
74
63
  if (aNode.rel.indexOf(_Constants.HtmlAttributeNames.noopenerTag) === -1) {
75
64
  aNode.rel += ` ${_Constants.HtmlAttributeNames.noopenerTag}`;
76
65
  }
77
-
78
66
  if (aNode.rel.indexOf(_Constants.HtmlAttributeNames.noreferrerTag) === -1) {
79
67
  aNode.rel += ` ${_Constants.HtmlAttributeNames.noreferrerTag}`;
80
68
  }
81
69
  }
82
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
-
70
+ }
84
71
 
72
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
73
  action = window.simpleUpdateIn(action, [_Constants.Constants.payload, _Constants.Constants.activity, _Constants.Constants.text], () => htmlNode.innerHTML);
86
74
  } catch (e) {
87
75
  let errorMessage = "Failed to apply action: ";
88
-
89
76
  try {
90
77
  errorMessage += JSON.stringify(action);
91
78
  } catch (e) {
92
79
  errorMessage += " (unable to stringify action)";
93
80
  }
94
-
95
81
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
96
82
  Event: _TelemetryConstants.TelemetryEvent.ProcessingHTMLTextMiddlewareFailed,
97
83
  ExceptionDetails: {
@@ -101,11 +87,10 @@ const processHTMLText = (action, text) => {
101
87
  });
102
88
  }
103
89
  }
104
-
105
90
  return action;
106
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
107
-
91
+ };
108
92
 
93
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
109
94
  const htmlTextMiddleware = _ref => {
110
95
  let {
111
96
  dispatch
@@ -114,21 +99,17 @@ const htmlTextMiddleware = _ref => {
114
99
  if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
115
100
  try {
116
101
  var _action$payload, _action$payload$activ;
117
-
118
102
  const text = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$activ = _action$payload.activity) === null || _action$payload$activ === void 0 ? void 0 : _action$payload$activ.text;
119
-
120
103
  if (text) {
121
104
  action = processHTMLText(action, text);
122
105
  }
123
106
  } catch (e) {
124
107
  let errorMessage = "Failed to validate action.";
125
-
126
108
  try {
127
109
  errorMessage += JSON.stringify(action);
128
110
  } catch (e) {
129
111
  errorMessage += " (unable to stringify action)";
130
112
  }
131
-
132
113
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
133
114
  Event: _TelemetryConstants.TelemetryEvent.ProcessingHTMLTextMiddlewareFailed,
134
115
  ExceptionDetails: {
@@ -138,10 +119,8 @@ const htmlTextMiddleware = _ref => {
138
119
  });
139
120
  }
140
121
  }
141
-
142
122
  return next(action);
143
123
  };
144
124
  };
145
-
146
125
  var _default = htmlTextMiddleware;
147
126
  exports.default = _default;
@@ -4,20 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _NotificationHandler = require("../../notification/NotificationHandler");
9
-
10
8
  var _NotificationScenarios = require("../../enums/NotificationScenarios");
11
-
12
9
  var _WebChatActionType = require("../../enums/WebChatActionType");
13
-
14
10
  var _Constants = require("../../../../../common/Constants");
15
-
16
11
  /******
17
12
  * MaxMessageSizeValidator
18
13
  *
19
14
  * Enforces a max character limit that the sender can send to comply to Omnichannel chat services' limitation.
20
15
  ******/
16
+
21
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
22
18
  const createMaxMessageSizeValidator = localizedTexts => _ref => {
23
19
  let {
@@ -26,21 +22,16 @@ const createMaxMessageSizeValidator = localizedTexts => _ref => {
26
22
  return next => action => {
27
23
  if (action.type === _WebChatActionType.WebChatActionType.WEB_CHAT_SET_SEND_BOX) {
28
24
  var _action$payload, _action$payload$text;
29
-
30
25
  const textLength = ((_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$text = _action$payload.text) === null || _action$payload$text === void 0 ? void 0 : _action$payload$text.length) || 0;
31
-
32
26
  if (textLength > _Constants.WebChatMiddlewareConstants.maxTextLength) {
33
27
  _NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.MaxSizeError, localizedTexts.MIDDLEWARE_MAX_CHARACTER_COUNT_EXCEEDED);
34
-
35
28
  return next(action);
36
29
  } else {
37
30
  _NotificationHandler.NotificationHandler.dismissNotification(_NotificationScenarios.NotificationScenarios.MaxSizeError);
38
31
  }
39
32
  }
40
-
41
33
  return next(action);
42
34
  };
43
35
  };
44
-
45
36
  var _default = createMaxMessageSizeValidator;
46
37
  exports.default = _default;