@microsoft/omnichannel-chat-widget 0.1.0-main.edd8c2a → 0.1.0-main.f4c21f0

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 (369) hide show
  1. package/README.md +259 -0
  2. package/lib/cjs/assets/Audios.js +8 -0
  3. package/lib/cjs/assets/Icons.js +30 -0
  4. package/lib/cjs/common/Constants.js +54 -151
  5. package/lib/cjs/common/KeyCodes.js +3 -4
  6. package/lib/cjs/common/contextDataStore/DataStoreManager.js +12 -0
  7. package/lib/cjs/{assets/assets.d.js → common/interfaces/IContextDataStore.js} +0 -0
  8. package/lib/cjs/common/storage/default/defaultCacheManager.js +26 -0
  9. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +111 -0
  10. package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +78 -0
  11. package/lib/cjs/common/telemetry/TelemetryConstants.js +88 -22
  12. package/lib/cjs/common/telemetry/TelemetryHelper.js +39 -59
  13. package/lib/cjs/common/telemetry/TelemetryManager.js +25 -35
  14. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  15. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -3
  16. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +59 -32
  17. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +9 -14
  18. package/lib/cjs/common/utils.js +80 -80
  19. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +21 -45
  20. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -26
  21. package/lib/cjs/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  22. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +15 -86
  23. package/lib/cjs/components/dimlayer/DimLayer.js +0 -4
  24. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +11 -39
  25. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -8
  26. package/lib/cjs/components/footerstateful/FooterStateful.js +14 -46
  27. package/lib/cjs/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +0 -6
  28. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +15 -44
  29. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -8
  30. package/lib/cjs/components/headerstateful/HeaderStateful.js +26 -35
  31. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -14
  32. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +39 -0
  33. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +20 -0
  34. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  35. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +34 -0
  36. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +64 -0
  37. package/lib/cjs/components/livechatwidget/common/Deferred.js +37 -0
  38. package/lib/cjs/components/livechatwidget/common/authHelper.js +50 -0
  39. package/lib/cjs/components/livechatwidget/common/createAdapter.js +10 -9
  40. package/lib/cjs/components/livechatwidget/common/createFooter.js +4 -23
  41. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -10
  42. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +36 -44
  43. package/lib/cjs/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +14 -0
  44. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +146 -68
  45. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +11 -0
  46. package/lib/cjs/components/livechatwidget/common/endChat.js +168 -54
  47. package/lib/cjs/components/livechatwidget/common/getGeneralStylesForButton.js +0 -6
  48. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +10 -14
  49. package/lib/cjs/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -8
  50. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +51 -54
  51. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +98 -66
  52. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +13 -22
  53. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +18 -29
  54. package/lib/cjs/components/livechatwidget/common/shareObservable.js +41 -0
  55. package/lib/cjs/components/livechatwidget/common/startChat.js +310 -67
  56. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -11
  57. package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -11
  58. package/lib/cjs/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
  59. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +370 -160
  60. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +20 -20
  61. package/lib/cjs/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +57 -0
  62. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +9 -14
  63. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +9 -14
  64. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -23
  65. package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  66. package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +13 -0
  67. package/lib/cjs/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  68. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  69. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +27 -43
  70. package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  71. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +27 -35
  72. package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  73. package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +6 -24
  74. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -19
  75. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -7
  76. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -6
  77. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  78. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +12 -27
  79. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +9 -16
  80. package/lib/cjs/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -24
  81. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +56 -88
  82. package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -8
  83. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  84. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  85. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +12 -0
  86. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -5
  87. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  88. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  89. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  90. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  91. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  92. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  93. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  94. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  95. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +0 -7
  96. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -5
  97. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +33 -80
  98. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +10 -22
  99. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +27 -61
  100. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +7 -15
  101. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  102. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +82 -0
  103. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  104. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
  105. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -3
  106. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -3
  107. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
  108. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -9
  109. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +89 -0
  110. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +7 -18
  111. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +8 -42
  112. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +4 -22
  113. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +13 -30
  114. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +3 -9
  115. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -34
  116. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -10
  117. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +7 -18
  118. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -19
  119. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +1 -9
  120. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -9
  121. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -34
  122. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +1 -10
  123. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +7 -11
  124. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +5 -14
  125. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -21
  126. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +33 -0
  127. package/lib/cjs/contexts/ChatAdapterStore.js +0 -2
  128. package/lib/cjs/contexts/ChatContextStore.js +0 -2
  129. package/lib/cjs/contexts/ChatSDKStore.js +0 -2
  130. package/lib/cjs/contexts/common/ConversationState.js +4 -3
  131. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +30 -23
  132. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +21 -12
  133. package/lib/cjs/contexts/createReducer.js +181 -101
  134. package/lib/cjs/controller/componentController.js +5 -34
  135. package/lib/cjs/hooks/useChatAdapterStore.js +0 -6
  136. package/lib/cjs/hooks/useChatContextStore.js +0 -6
  137. package/lib/cjs/hooks/useChatSDKStore.js +0 -6
  138. package/lib/cjs/index.js +0 -5
  139. package/lib/cjs/plugins/newMessageEventHandler.js +82 -0
  140. package/lib/esm/assets/Audios.js +1 -0
  141. package/lib/esm/assets/Icons.js +12 -0
  142. package/lib/esm/common/Constants.js +49 -139
  143. package/lib/esm/common/KeyCodes.js +3 -3
  144. package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
  145. package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
  146. package/lib/esm/common/storage/default/defaultCacheManager.js +18 -0
  147. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +104 -0
  148. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +70 -0
  149. package/lib/esm/common/telemetry/TelemetryConstants.js +87 -17
  150. package/lib/esm/common/telemetry/TelemetryHelper.js +40 -49
  151. package/lib/esm/common/telemetry/TelemetryManager.js +24 -27
  152. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  153. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  154. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +62 -23
  155. package/lib/esm/common/telemetry/loggers/consoleLogger.js +9 -10
  156. package/lib/esm/common/utils.js +73 -45
  157. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +21 -16
  158. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +23 -13
  159. package/lib/esm/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  160. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +16 -62
  161. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +11 -18
  162. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -6
  163. package/lib/esm/components/footerstateful/FooterStateful.js +15 -26
  164. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +15 -37
  165. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -6
  166. package/lib/esm/components/headerstateful/HeaderStateful.js +27 -21
  167. package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -2
  168. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +32 -0
  169. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +13 -0
  170. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  171. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +27 -0
  172. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +57 -0
  173. package/lib/esm/components/livechatwidget/common/Deferred.js +30 -0
  174. package/lib/esm/components/livechatwidget/common/authHelper.js +42 -0
  175. package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -4
  176. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -16
  177. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -5
  178. package/lib/esm/components/livechatwidget/common/createMarkdown.js +38 -37
  179. package/lib/esm/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +7 -0
  180. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +148 -58
  181. package/lib/esm/components/livechatwidget/common/disposeTelemetryLoggers.js +4 -0
  182. package/lib/esm/components/livechatwidget/common/endChat.js +171 -42
  183. package/lib/esm/components/livechatwidget/common/getGeneralStylesForButton.js +0 -2
  184. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +12 -11
  185. package/lib/esm/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -5
  186. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +53 -26
  187. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +98 -58
  188. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +13 -11
  189. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +19 -21
  190. package/lib/esm/components/livechatwidget/common/shareObservable.js +35 -0
  191. package/lib/esm/components/livechatwidget/common/startChat.js +313 -52
  192. package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
  193. package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +4 -2
  194. package/lib/esm/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
  195. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +371 -114
  196. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +20 -8
  197. package/lib/esm/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +50 -0
  198. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +9 -4
  199. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +9 -4
  200. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -11
  201. package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  202. package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +6 -0
  203. package/lib/esm/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  204. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  205. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +30 -28
  206. package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  207. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +30 -14
  208. package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  209. package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +6 -6
  210. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -4
  211. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  212. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  213. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  214. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +12 -19
  215. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +9 -12
  216. package/lib/esm/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -16
  217. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +7 -17
  218. package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -6
  219. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  220. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  221. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  222. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -3
  223. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  224. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  225. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  226. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  227. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  228. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  229. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  230. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  231. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +2 -5
  232. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -4
  233. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +34 -66
  234. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +12 -14
  235. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +27 -40
  236. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +9 -8
  237. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +34 -0
  238. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +80 -0
  239. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  240. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
  241. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -1
  242. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -1
  243. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
  244. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -7
  245. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +83 -0
  246. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +8 -9
  247. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +9 -28
  248. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +5 -14
  249. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +15 -19
  250. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +5 -8
  251. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -29
  252. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +3 -7
  253. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +9 -14
  254. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -14
  255. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +3 -7
  256. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -7
  257. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +15 -27
  258. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +3 -5
  259. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +9 -9
  260. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +7 -9
  261. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -13
  262. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +27 -0
  263. package/lib/esm/contexts/ChatAdapterStore.js +2 -1
  264. package/lib/esm/contexts/ChatContextStore.js +2 -1
  265. package/lib/esm/contexts/ChatSDKStore.js +2 -1
  266. package/lib/esm/contexts/common/ConversationState.js +4 -3
  267. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +30 -23
  268. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +21 -8
  269. package/lib/esm/contexts/createReducer.js +181 -97
  270. package/lib/esm/controller/componentController.js +6 -5
  271. package/lib/esm/hooks/useChatAdapterStore.js +0 -4
  272. package/lib/esm/hooks/useChatContextStore.js +0 -4
  273. package/lib/esm/hooks/useChatSDKStore.js +0 -4
  274. package/lib/esm/plugins/newMessageEventHandler.js +75 -0
  275. package/lib/types/assets/Audios.d.ts +1 -0
  276. package/lib/types/assets/Icons.d.ts +12 -0
  277. package/lib/types/common/Constants.d.ts +41 -1
  278. package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
  279. package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
  280. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  281. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  282. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  283. package/lib/types/common/telemetry/TelemetryConstants.d.ts +62 -4
  284. package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
  285. package/lib/types/common/telemetry/TelemetryManager.d.ts +1 -0
  286. package/lib/types/common/telemetry/definitions/Contracts.d.ts +7 -4
  287. package/lib/types/common/telemetry/definitions/Payload.d.ts +16 -9
  288. package/lib/types/common/telemetry/interfaces/IChatSDKLogger.d.ts +1 -0
  289. package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +2 -0
  290. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +16 -0
  291. package/lib/types/common/utils.d.ts +8 -1
  292. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
  293. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  294. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +5 -1
  295. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  296. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  297. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  298. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  299. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  300. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  301. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  302. package/lib/types/components/livechatwidget/common/defaultProps/defaultScrollBarProps.d.ts +2 -0
  303. package/lib/types/components/livechatwidget/common/disposeTelemetryLoggers.d.ts +1 -0
  304. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  305. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -4
  306. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  307. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  308. package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -2
  309. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
  310. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  311. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +4 -1
  312. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +8 -3
  313. package/lib/types/components/livechatwidget/interfaces/IScrollBarProps.d.ts +22 -0
  314. package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -0
  315. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  316. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +5 -0
  317. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  318. package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
  319. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
  320. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -2
  321. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  322. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +2 -0
  323. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  324. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  325. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  326. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
  327. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
  328. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  329. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  330. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  331. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  332. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  333. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  334. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
  335. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
  336. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  337. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +1 -1
  338. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  339. package/lib/types/contexts/common/ConversationState.d.ts +4 -2
  340. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +8 -3
  341. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +30 -22
  342. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  343. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  344. package/package.json +14 -13
  345. package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
  346. package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
  347. package/lib/cjs/assets/icons/audioIcon.svg +0 -6
  348. package/lib/cjs/assets/icons/blankIcon.svg +0 -6
  349. package/lib/cjs/assets/icons/excelIcon.svg +0 -6
  350. package/lib/cjs/assets/icons/imageIcon.svg +0 -6
  351. package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
  352. package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
  353. package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
  354. package/lib/cjs/assets/icons/videoIcon.svg +0 -6
  355. package/lib/cjs/assets/icons/visioIcon.svg +0 -6
  356. package/lib/cjs/assets/icons/wordIcon.svg +0 -6
  357. package/lib/esm/assets/assets.d.js +0 -0
  358. package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
  359. package/lib/esm/assets/icons/archiveIcon.svg +0 -3
  360. package/lib/esm/assets/icons/audioIcon.svg +0 -6
  361. package/lib/esm/assets/icons/blankIcon.svg +0 -6
  362. package/lib/esm/assets/icons/excelIcon.svg +0 -6
  363. package/lib/esm/assets/icons/imageIcon.svg +0 -6
  364. package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
  365. package/lib/esm/assets/icons/pdfIcon.svg +0 -6
  366. package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
  367. package/lib/esm/assets/icons/videoIcon.svg +0 -6
  368. package/lib/esm/assets/icons/visioIcon.svg +0 -6
  369. package/lib/esm/assets/icons/wordIcon.svg +0 -6
@@ -4,14 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _WebChatActionType = require("../../enums/WebChatActionType");
9
-
10
8
  /******
11
9
  * AttachmentProcessingMiddleware
12
10
  *
13
11
  * Handles attachment sending.
14
12
  ******/
13
+
15
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
15
  const createSendFileAction = files => {
17
16
  return {
@@ -20,32 +19,27 @@ const createSendFileAction = files => {
20
19
  },
21
20
  type: _WebChatActionType.WebChatActionType.WEB_CHAT_SEND_FILES
22
21
  };
23
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
-
22
+ };
25
23
 
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
25
  const attachmentProcessingMiddleware = _ref => {
27
26
  let {
28
27
  dispatch
29
28
  } = _ref;
30
29
  return next => async action => {
31
30
  var _action$payload, _action$payload$files;
32
-
33
31
  if ((action === null || action === void 0 ? void 0 : action.type) === _WebChatActionType.WebChatActionType.WEB_CHAT_SEND_FILES && (action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$files = _action$payload.files) === null || _action$payload$files === void 0 ? void 0 : _action$payload$files.length) > 0) {
34
32
  const files = action.payload.files;
35
-
36
33
  if (files.length === 1) {
37
34
  return next(action);
38
35
  }
39
-
40
36
  const dispatchAction = createSendFileAction(files.slice(0, files.length - 1));
41
37
  const nextAction = createSendFileAction([files[files.length - 1]]);
42
38
  await dispatch(dispatchAction);
43
39
  return next(nextAction);
44
40
  }
45
-
46
41
  return next(action);
47
42
  };
48
43
  };
49
-
50
44
  var _default = attachmentProcessingMiddleware;
51
45
  exports.default = _default;
@@ -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
- var _activity$from, _activity$from2, _activity$channelData5, _activity$channelData6;
32
-
26
+ var _activity$from, _activity$from2, _activity$channelData7, _activity$channelData8;
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
- var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4;
37
-
29
+ var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4, _activity$channelData5, _activity$channelData6;
38
30
  // ACS
39
- 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)) {
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
- } else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === _DirectLineSenderRole.DirectLineSenderRole.Channel && ((_activity$channelData5 = activity.channelData) === null || _activity$channelData5 === void 0 ? void 0 : _activity$channelData5.type) === _MessageType.MessageTypes.Thread && (_activity$channelData6 = activity.channelData) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.properties) {
43
- var _activity$channelData7, _activity$channelData8, _activity$channelData9, _activity$channelData10;
44
-
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) {
35
+ var _activity$channelData9, _activity$channelData10, _activity$channelData11, _activity$channelData12;
45
36
  // IC3
46
- if (((_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : (_activity$channelData8 = _activity$channelData7.properties) === null || _activity$channelData8 === void 0 ? void 0 : _activity$channelData8.isdeleted) === _Constants.Constants.truePascal || !((_activity$channelData9 = activity.channelData) !== null && _activity$channelData9 !== void 0 && (_activity$channelData10 = _activity$channelData9.properties) !== null && _activity$channelData10 !== void 0 && _activity$channelData10.containsExternalEntitiesListeningAll)) {
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,29 @@ const applyDataMasking = (action, regexCollection) => {
58
55
  });
59
56
  }
60
57
  }
61
- }
62
58
 
59
+ // Exit if rule matched
60
+ if (isRuleMatched === true) {
61
+ break;
62
+ }
63
+ }
63
64
  action.payload.text = text;
64
65
  return action;
65
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
66
-
66
+ };
67
67
 
68
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
68
69
  const createDataMaskingMiddleware = dataMaskingInfo => _ref => {
69
70
  let {
70
71
  dispatch
71
72
  } = _ref;
72
73
  return next => action => {
73
74
  var _action$payload;
74
-
75
75
  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
76
  const regexCollection = dataMaskingInfo === null || dataMaskingInfo === void 0 ? void 0 : dataMaskingInfo.dataMaskingRules;
77
77
  return next(applyDataMasking(action, regexCollection));
78
78
  }
79
-
80
79
  return next(action);
81
80
  };
82
81
  };
83
-
84
82
  var _default = createDataMaskingMiddleware;
85
83
  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;