@microsoft/omnichannel-chat-widget 0.1.0-main.47ede4d → 0.1.0-main.4ceb98d

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 (304) hide show
  1. package/README.md +32 -0
  2. package/lib/cjs/common/Constants.js +29 -152
  3. package/lib/cjs/common/KeyCodes.js +0 -3
  4. package/lib/cjs/common/contextDataStore/DataStoreManager.js +0 -4
  5. package/lib/cjs/common/storage/default/defaultCacheManager.js +24 -0
  6. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +102 -0
  7. package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +78 -0
  8. package/lib/cjs/common/telemetry/TelemetryConstants.js +63 -25
  9. package/lib/cjs/common/telemetry/TelemetryHelper.js +26 -54
  10. package/lib/cjs/common/telemetry/TelemetryManager.js +8 -30
  11. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -3
  12. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +49 -35
  13. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -14
  14. package/lib/cjs/common/utils.js +80 -80
  15. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +21 -45
  16. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -26
  17. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +11 -71
  18. package/lib/cjs/components/dimlayer/DimLayer.js +0 -4
  19. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +8 -36
  20. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -8
  21. package/lib/cjs/components/footerstateful/FooterStateful.js +12 -44
  22. package/lib/cjs/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +0 -6
  23. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +15 -44
  24. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -8
  25. package/lib/cjs/components/headerstateful/HeaderStateful.js +17 -37
  26. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -14
  27. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +37 -0
  28. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +18 -0
  29. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  30. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +32 -0
  31. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +62 -0
  32. package/lib/cjs/components/livechatwidget/common/Deferred.js +35 -0
  33. package/lib/cjs/components/livechatwidget/common/authHelper.js +50 -0
  34. package/lib/cjs/components/livechatwidget/common/createAdapter.js +10 -9
  35. package/lib/cjs/components/livechatwidget/common/createFooter.js +4 -23
  36. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -10
  37. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +36 -43
  38. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +73 -51
  39. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +0 -3
  40. package/lib/cjs/components/livechatwidget/common/endChat.js +79 -21
  41. package/lib/cjs/components/livechatwidget/common/getGeneralStylesForButton.js +0 -6
  42. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +7 -16
  43. package/lib/cjs/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -8
  44. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +38 -52
  45. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +128 -57
  46. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +7 -32
  47. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +2 -15
  48. package/lib/cjs/components/livechatwidget/common/shareObservable.js +41 -0
  49. package/lib/cjs/components/livechatwidget/common/startChat.js +153 -77
  50. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +0 -8
  51. package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -11
  52. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +283 -136
  53. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +4 -17
  54. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +4 -17
  55. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +9 -14
  56. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -23
  57. package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  58. package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +13 -0
  59. package/lib/cjs/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  60. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  61. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +11 -44
  62. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +19 -33
  63. package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +2 -24
  64. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -19
  65. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -7
  66. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -6
  67. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  68. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +9 -26
  69. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +3 -16
  70. package/lib/cjs/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -24
  71. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -15
  72. package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -8
  73. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  74. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  75. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +10 -0
  76. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -4
  77. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  78. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  79. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  80. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  81. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  82. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  83. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  84. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  85. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +0 -7
  86. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -5
  87. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +27 -37
  88. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +9 -19
  89. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -60
  90. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +7 -15
  91. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  92. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +82 -0
  93. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  94. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
  95. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -3
  96. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -3
  97. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
  98. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -9
  99. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +89 -0
  100. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -12
  101. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +6 -28
  102. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  103. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +13 -30
  104. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +3 -9
  105. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -34
  106. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -10
  107. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +1 -12
  108. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +16 -19
  109. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +1 -9
  110. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -9
  111. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -34
  112. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +1 -10
  113. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +7 -11
  114. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +5 -14
  115. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -21
  116. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +33 -0
  117. package/lib/cjs/contexts/ChatAdapterStore.js +0 -2
  118. package/lib/cjs/contexts/ChatContextStore.js +0 -2
  119. package/lib/cjs/contexts/ChatSDKStore.js +0 -2
  120. package/lib/cjs/contexts/common/ConversationState.js +3 -3
  121. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +11 -9
  122. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +12 -12
  123. package/lib/cjs/contexts/createReducer.js +150 -104
  124. package/lib/cjs/controller/componentController.js +4 -33
  125. package/lib/cjs/hooks/useChatAdapterStore.js +0 -6
  126. package/lib/cjs/hooks/useChatContextStore.js +0 -6
  127. package/lib/cjs/hooks/useChatSDKStore.js +0 -6
  128. package/lib/cjs/index.js +0 -5
  129. package/lib/cjs/plugins/newMessageEventHandler.js +22 -46
  130. package/lib/esm/common/Constants.js +26 -140
  131. package/lib/esm/common/KeyCodes.js +0 -2
  132. package/lib/esm/common/contextDataStore/DataStoreManager.js +0 -2
  133. package/lib/esm/common/storage/default/defaultCacheManager.js +16 -0
  134. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +95 -0
  135. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +70 -0
  136. package/lib/esm/common/telemetry/TelemetryConstants.js +67 -22
  137. package/lib/esm/common/telemetry/TelemetryHelper.js +27 -44
  138. package/lib/esm/common/telemetry/TelemetryManager.js +8 -18
  139. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  140. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +49 -23
  141. package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -10
  142. package/lib/esm/common/utils.js +73 -45
  143. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +21 -16
  144. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +23 -13
  145. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +14 -48
  146. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +8 -15
  147. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -6
  148. package/lib/esm/components/footerstateful/FooterStateful.js +14 -25
  149. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +15 -37
  150. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -6
  151. package/lib/esm/components/headerstateful/HeaderStateful.js +17 -22
  152. package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -2
  153. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +30 -0
  154. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +11 -0
  155. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  156. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +25 -0
  157. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +55 -0
  158. package/lib/esm/components/livechatwidget/common/Deferred.js +28 -0
  159. package/lib/esm/components/livechatwidget/common/authHelper.js +42 -0
  160. package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -4
  161. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -16
  162. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -5
  163. package/lib/esm/components/livechatwidget/common/createMarkdown.js +38 -37
  164. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +75 -39
  165. package/lib/esm/components/livechatwidget/common/endChat.js +82 -12
  166. package/lib/esm/components/livechatwidget/common/getGeneralStylesForButton.js +0 -2
  167. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +9 -11
  168. package/lib/esm/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -5
  169. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +41 -22
  170. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +127 -50
  171. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +7 -22
  172. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -7
  173. package/lib/esm/components/livechatwidget/common/shareObservable.js +35 -0
  174. package/lib/esm/components/livechatwidget/common/startChat.js +157 -60
  175. package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +4 -2
  176. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +289 -91
  177. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +4 -5
  178. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +4 -5
  179. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +9 -4
  180. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -11
  181. package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  182. package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +6 -0
  183. package/lib/esm/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  184. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  185. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +15 -29
  186. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +21 -9
  187. package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +2 -6
  188. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -4
  189. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  190. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  191. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  192. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +9 -18
  193. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +3 -12
  194. package/lib/esm/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -16
  195. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -5
  196. package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -6
  197. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  198. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  199. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -0
  200. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -2
  201. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  202. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  203. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  204. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  205. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  206. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  207. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  208. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  209. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +2 -5
  210. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -4
  211. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +27 -22
  212. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +11 -11
  213. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -38
  214. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +9 -8
  215. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +34 -0
  216. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +80 -0
  217. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  218. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
  219. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -1
  220. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -1
  221. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
  222. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -7
  223. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +83 -0
  224. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +3 -3
  225. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +7 -14
  226. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +3 -3
  227. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +15 -19
  228. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +5 -8
  229. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -29
  230. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +3 -7
  231. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +3 -8
  232. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +16 -14
  233. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +3 -7
  234. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -7
  235. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +15 -27
  236. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +3 -5
  237. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +9 -9
  238. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +7 -9
  239. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -13
  240. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +27 -0
  241. package/lib/esm/contexts/ChatAdapterStore.js +2 -1
  242. package/lib/esm/contexts/ChatContextStore.js +2 -1
  243. package/lib/esm/contexts/ChatSDKStore.js +2 -1
  244. package/lib/esm/contexts/common/ConversationState.js +3 -3
  245. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +11 -9
  246. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +12 -8
  247. package/lib/esm/contexts/createReducer.js +150 -101
  248. package/lib/esm/controller/componentController.js +5 -4
  249. package/lib/esm/hooks/useChatAdapterStore.js +0 -4
  250. package/lib/esm/hooks/useChatContextStore.js +0 -4
  251. package/lib/esm/hooks/useChatSDKStore.js +0 -4
  252. package/lib/esm/plugins/newMessageEventHandler.js +22 -35
  253. package/lib/types/common/Constants.d.ts +25 -2
  254. package/lib/types/common/interfaces/IContextDataStore.d.ts +2 -2
  255. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  256. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  257. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  258. package/lib/types/common/telemetry/TelemetryConstants.d.ts +43 -7
  259. package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
  260. package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -4
  261. package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
  262. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
  263. package/lib/types/common/utils.d.ts +8 -1
  264. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -4
  265. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  266. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +2 -1
  267. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  268. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  269. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  270. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  271. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  272. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  273. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  274. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  275. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
  276. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  277. package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
  278. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  279. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
  280. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +4 -3
  281. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  282. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +5 -0
  283. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  284. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
  285. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  286. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  287. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  288. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  289. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
  290. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
  291. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  292. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  293. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  294. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  295. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  296. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
  297. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
  298. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  299. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  300. package/lib/types/contexts/common/ConversationState.d.ts +3 -2
  301. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +4 -2
  302. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +12 -9
  303. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  304. package/package.json +9 -9
package/lib/cjs/index.js CHANGED
@@ -39,13 +39,8 @@ Object.defineProperty(exports, "useChatSDKStore", {
39
39
  return _useChatSDKStore.default;
40
40
  }
41
41
  });
42
-
43
42
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
44
-
45
43
  var _useChatContextStore = _interopRequireDefault(require("./hooks/useChatContextStore"));
46
-
47
44
  var _useChatSDKStore = _interopRequireDefault(require("./hooks/useChatSDKStore"));
48
-
49
45
  var _LiveChatWidget = _interopRequireDefault(require("./components/livechatwidget/LiveChatWidget"));
50
-
51
46
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -4,46 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createOnNewAdapterActivityHandler = void 0;
7
-
8
7
  var _TelemetryConstants = require("../common/telemetry/TelemetryConstants");
9
-
10
8
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
11
-
12
9
  var _Constants = require("../common/Constants");
13
-
14
10
  var _TelemetryHelper = require("../common/telemetry/TelemetryHelper");
15
-
16
- var _TelemetryManager = require("../common/telemetry/TelemetryManager");
17
-
18
11
  const createOnNewAdapterActivityHandler = (chatId, userId) => {
19
12
  const onNewAdapterActivityHandler = activity => {
20
13
  var _activity$channelData, _activity$channelData2, _activity$channelData3;
21
-
22
14
  const isActivityMessage = (activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message;
23
- const isNotHistoryMessage = isActivityMessage && !(activity !== null && activity !== void 0 && (_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(_Constants.Constants.historyMessageTag)) && !(activity !== null && activity !== void 0 && (_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && _activity$channelData3.fromList);
24
-
25
- if (isNotHistoryMessage) {
26
- raiseMessageEvent(activity);
27
- }
15
+ const isHistoryMessage = isActivityMessage && ((activity === null || activity === void 0 ? void 0 : (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.tags) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.includes(_Constants.Constants.historyMessageTag)) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData3 = activity.channelData) === null || _activity$channelData3 === void 0 ? void 0 : _activity$channelData3.fromList));
16
+ raiseMessageEvent(activity, isHistoryMessage);
28
17
  };
29
-
30
- const raiseMessageEvent = activity => {
18
+ const raiseMessageEvent = (activity, isHistoryMessage) => {
31
19
  if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message) {
32
- var _TelemetryManager$Int, _activity$from;
33
-
20
+ var _text, _text2, _activity$channelData4, _activity$from;
34
21
  const payload = {
22
+ // To identify hidden contents vs empty content
35
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- text: activity === null || activity === void 0 ? void 0 : activity.text,
37
- id: activity === null || activity === void 0 ? void 0 : activity.id,
24
+ text: (activity === null || activity === void 0 ? void 0 : (_text = activity.text) === null || _text === void 0 ? void 0 : _text.length) >= 1 ? `*contents hidden (${activity === null || activity === void 0 ? void 0 : (_text2 = activity.text) === null || _text2 === void 0 ? void 0 : _text2.length} chars)*` : "",
38
25
  type: activity === null || activity === void 0 ? void 0 : activity.type,
39
26
  timestamp: activity === null || activity === void 0 ? void 0 : activity.timestamp,
40
- chatId: chatId,
41
27
  userId: userId,
42
- conversationId: ((_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.conversationId) ?? "",
43
- channelData: activity === null || activity === void 0 ? void 0 : activity.channelData,
28
+ tags: activity === null || activity === void 0 ? void 0 : (_activity$channelData4 = activity.channelData) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.tags,
44
29
  messageType: ""
45
30
  };
46
-
47
31
  if ((activity === null || activity === void 0 ? void 0 : (_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === _Constants.Constants.userMessageTag) {
48
32
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
33
  payload.messageType = _Constants.Constants.userMessageTag;
@@ -51,52 +35,44 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
51
35
  eventName: _TelemetryConstants.BroadcastEvent.NewMessageSent,
52
36
  payload: payload
53
37
  };
54
-
55
38
  _omnichannelChatComponents.BroadcastService.postMessage(newMessageSentEvent);
56
-
57
39
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
58
40
  Event: _TelemetryConstants.TelemetryEvent.MessageSent,
59
41
  Description: "New message sent"
60
42
  });
61
43
  } else {
62
- var _activity$channelData4, _activity$channelData5;
63
-
64
- if (activity !== null && activity !== void 0 && (_activity$channelData4 = activity.channelData) !== null && _activity$channelData4 !== void 0 && (_activity$channelData5 = _activity$channelData4.tags) !== null && _activity$channelData5 !== void 0 && _activity$channelData5.includes(_Constants.Constants.systemMessageTag)) {
44
+ var _activity$channelData5, _activity$channelData6;
45
+ if (activity !== null && activity !== void 0 && (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(_Constants.Constants.systemMessageTag)) {
65
46
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
47
  payload.messageType = _Constants.Constants.systemMessageTag;
67
48
  } else {
68
- var _activity$channelData6, _activity$channelData7, _activity$channelData8;
69
-
49
+ var _activity$channelData7, _activity$channelData8, _activity$channelData9;
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text);
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+ const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData7 = activity.channelData) !== null && _activity$channelData7 !== void 0 && _activity$channelData7.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData8 = activity.channelData) === null || _activity$channelData8 === void 0 ? void 0 : (_activity$channelData9 = _activity$channelData8.tags) === null || _activity$channelData9 === void 0 ? void 0 : _activity$channelData9.length) === 0;
70
54
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
- const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text); // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
-
73
- const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData6 = activity.channelData) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : (_activity$channelData8 = _activity$channelData7.tags) === null || _activity$channelData8 === void 0 ? void 0 : _activity$channelData8.length) === 0; // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
-
75
55
  const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
76
-
77
56
  if (messageHasNoTags && messageHasNoText && messageHasNoAttachments) {
78
57
  return;
79
58
  }
80
-
81
59
  payload.messageType = _Constants.Constants.userMessageTag;
82
60
  }
83
-
84
61
  const newMessageReceivedEvent = {
85
- eventName: _TelemetryConstants.BroadcastEvent.NewMessageReceived,
62
+ eventName: isHistoryMessage ? _TelemetryConstants.BroadcastEvent.HistoryMessageReceived : _TelemetryConstants.BroadcastEvent.NewMessageReceived,
86
63
  payload: payload
87
64
  };
88
-
89
65
  _omnichannelChatComponents.BroadcastService.postMessage(newMessageReceivedEvent);
90
-
91
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
92
- Event: _TelemetryConstants.TelemetryEvent.MessageReceived,
93
- Description: "New message received"
94
- });
66
+ if (!isHistoryMessage) {
67
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
68
+ Event: _TelemetryConstants.TelemetryEvent.MessageReceived,
69
+ Description: "New message received",
70
+ Data: payload
71
+ });
72
+ }
95
73
  }
96
74
  }
97
75
  };
98
-
99
76
  return onNewAdapterActivityHandler;
100
77
  };
101
-
102
78
  exports.createOnNewAdapterActivityHandler = createOnNewAdapterActivityHandler;
@@ -1,280 +1,166 @@
1
1
  var _class;
2
-
3
2
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
-
5
3
  export class Constants {}
6
-
4
+ _defineProperty(Constants, "magicCodeBroadcastChannel", "MagicCodeChannel");
5
+ _defineProperty(Constants, "magicCodeResponseBroadcastChannel", "MagicCodeResponseChannel");
7
6
  _defineProperty(Constants, "systemMessageTag", "system");
8
-
9
7
  _defineProperty(Constants, "userMessageTag", "user");
10
-
11
8
  _defineProperty(Constants, "historyMessageTag", "history");
12
-
13
9
  _defineProperty(Constants, "agentEndConversationMessageTag", "agentendconversation");
14
-
15
10
  _defineProperty(Constants, "supervisorForceCloseMessageTag", "supervisorforceclosedconversation");
16
-
17
11
  _defineProperty(Constants, "receivedMessageClassName", "ms_lcw_webchat_received_message");
18
-
19
12
  _defineProperty(Constants, "sentMessageClassName", "ms_lcw_webchat_sent_message");
20
-
21
13
  _defineProperty(Constants, "webchatChannelId", "webchat");
22
-
23
14
  _defineProperty(Constants, "markdown", "markdown");
24
-
25
15
  _defineProperty(Constants, "actionType", "actionType");
26
-
27
16
  _defineProperty(Constants, "String", "string");
28
-
29
17
  _defineProperty(Constants, "ChatMessagesJson", "chatMessagesJson");
30
-
31
18
  _defineProperty(Constants, "truePascal", "True");
32
-
33
19
  _defineProperty(Constants, "true", "true");
34
-
35
20
  _defineProperty(Constants, "false", "false");
36
-
37
21
  _defineProperty(Constants, "maximumUnreadMessageCount", 99);
38
-
39
- _defineProperty(Constants, "widgetStateDataKey", "LcwChatWidgetState");
40
-
41
22
  _defineProperty(Constants, "channelIdKey", "ChannelId-");
42
-
43
23
  _defineProperty(Constants, "ChannelId", "lcw");
44
-
45
24
  _defineProperty(Constants, "CustomerTag", "FromCustomer");
46
-
47
25
  _defineProperty(Constants, "GifContentType", "image/gif");
48
-
49
26
  _defineProperty(Constants, "video", "video");
50
-
51
27
  _defineProperty(Constants, "audio", "audio");
52
-
53
28
  _defineProperty(Constants, "controlsList", "controlsList");
54
-
55
29
  _defineProperty(Constants, "nodownload", "nodownload");
56
-
57
30
  _defineProperty(Constants, "activity", "activity");
58
-
59
31
  _defineProperty(Constants, "payload", "payload");
60
-
61
32
  _defineProperty(Constants, "text", "text");
62
-
63
33
  _defineProperty(Constants, "blank", "_blank");
64
-
65
34
  _defineProperty(Constants, "visitorIdPrefix", "8:");
66
-
67
35
  _defineProperty(Constants, "left", "left");
68
-
69
36
  _defineProperty(Constants, "queuePositionMessageTag", "queueposition");
70
-
71
37
  _defineProperty(Constants, "averageWaitTimeMessageTag", "averagewaittime");
72
-
73
38
  _defineProperty(Constants, "message", "message");
74
-
39
+ _defineProperty(Constants, "hiddenTag", "Hidden");
40
+ _defineProperty(Constants, "prefixTimestampTag", "ServerMessageTimestamp_");
41
+ _defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
42
+ _defineProperty(Constants, "publicMessageTag", "public");
75
43
  _defineProperty(Constants, "supportedAdaptiveCardContentTypes", ["application/vnd.microsoft.card.adaptive", "application/vnd.microsoft.card.audio", "application/vnd.microsoft.card.hero", "application/vnd.microsoft.card.receipt", "application/vnd.microsoft.card.thumbnail", "application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"]);
76
-
77
44
  _defineProperty(Constants, "maxUploadFileSize", "500000");
78
-
79
45
  _defineProperty(Constants, "imageRegex", /(\.)(jpeg|jpg|jiff|png|gif|bmp)$/i);
80
-
81
46
  _defineProperty(Constants, "audioMediaRegex", /(\.)(aac|aiff|alac|flac|mp2|mp3|pcm|wav|wma)$/i);
82
-
83
47
  _defineProperty(Constants, "videoMediaRegex", /(\.)(avchd|avi|flv|mpe|mpeg|mpg|mpv|mp4|m4p|m4v|mov|qt|swf|webm|wmv)$/i);
84
-
85
48
  _defineProperty(Constants, "chromeSupportedInlineMediaRegex", /(\.)(aac|mp3|wav|mp4)$/i);
86
-
87
49
  _defineProperty(Constants, "firefoxSupportedInlineMediaRegex", /(\.)(aac|flac|mp3|wav|mp4|mov)$/i);
88
-
89
50
  _defineProperty(Constants, "CallAdded", "callAdded");
90
-
91
51
  _defineProperty(Constants, "LocalVideoStreamAdded", "localVideoStreamAdded");
92
-
93
52
  _defineProperty(Constants, "LocalVideoStreamRemoved", "localVideoStreamRemoved");
94
-
95
53
  _defineProperty(Constants, "RemoteVideoStreamAdded", "remoteVideoStreamAdded");
96
-
97
54
  _defineProperty(Constants, "RemoteVideoStreamRemoved", "remoteVideoStreamRemoved");
98
-
99
55
  _defineProperty(Constants, "CallDisconnected", "callDisconnected");
100
-
101
56
  _defineProperty(Constants, "IncomingCallEnded", "incomingCallEnded");
102
-
103
57
  _defineProperty(Constants, "VoiceVideoInitialize", "voiceVideoInitialize");
104
-
105
58
  _defineProperty(Constants, "VoiceVideoInitializeException", "voiceVideoInitializeOnException");
106
-
107
59
  _defineProperty(Constants, "VoiceVideoLoading", "voiceVideoLoading");
108
-
109
60
  _defineProperty(Constants, "VoiceVideoNotLoaded", "voiceVideoNotLoaded");
110
-
111
61
  _defineProperty(Constants, "VoiceVideoLoadingException", "voiceVideoLoadingOnException");
112
-
113
62
  _defineProperty(Constants, "VoiceVideoAcceptCallException", "voiceVideoAcceptCallOnException");
114
-
115
63
  _defineProperty(Constants, "VoiceVideoAcceptCallWithVideoException", "voiceVideoAcceptCallWithVideoException");
116
-
117
64
  _defineProperty(Constants, "defaultDownloadTranscriptError", "Download transcript failed.");
118
-
119
65
  _defineProperty(Constants, "ProactiveChatInviteTimeoutInMs", 60000);
120
-
121
66
  _defineProperty(Constants, "InputSubmit", "InputSubmit");
122
-
123
67
  _defineProperty(Constants, "ReconnectIdAttributeName", "oc.reconnectid");
124
-
125
- _defineProperty(Constants, "redirectPageRequest", "redirectPageRequest");
126
-
127
68
  _defineProperty(Constants, "LiveChatWidget", "LiveChatWidgetNew");
128
-
129
69
  _defineProperty(Constants, "GuidPattern", "xx-x-4m-ym-xxx");
130
-
131
70
  _defineProperty(Constants, "Default", "default");
132
-
133
71
  _defineProperty(Constants, "Zero", "zero");
134
-
135
72
  _defineProperty(Constants, "Title", "title");
136
-
137
73
  _defineProperty(Constants, "Target", "target");
138
-
139
74
  _defineProperty(Constants, "Blank", "_blank");
140
-
141
75
  _defineProperty(Constants, "TargetRelationship", "rel");
142
-
143
76
  _defineProperty(Constants, "TargetRelationshipAttributes", "noopener noreferrer");
144
-
145
77
  _defineProperty(Constants, "OpenLinkIconCssClass", "webchat__markdown__external-link-icon");
146
-
147
78
  _defineProperty(Constants, "internetConnectionTestUrl", "https://ocsdk-prod.azureedge.net/public/connecttest.txt");
148
-
149
79
  _defineProperty(Constants, "internetConnectionTestUrlText", "Omnichannel Connect Test");
150
-
80
+ _defineProperty(Constants, "ChatWidgetStateChangedPrefix", "ChatWidgetStateChanged");
81
+ _defineProperty(Constants, "PostChatLoadingDurationInMs", 2000);
82
+ _defineProperty(Constants, "BrowserUnloadConfirmationMessage", "Do you want to leave chat?");
151
83
  export const Regex = (_class = class Regex {}, _defineProperty(_class, "EmailRegex", "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"), _class);
152
84
  export class HtmlIdNames {}
153
-
154
85
  _defineProperty(HtmlIdNames, "MSLiveChatWidget", "MSLiveChatWidget");
155
-
156
86
  export class HtmlClassNames {}
157
-
158
87
  _defineProperty(HtmlClassNames, "webChatBannerCloseButton", "webchat__toast__dismissButton");
159
-
160
88
  _defineProperty(HtmlClassNames, "webChatBannerExpandButton", "webchat__toaster__expandIcon");
161
-
162
89
  export class HtmlElementSelectors {}
163
-
164
90
  _defineProperty(HtmlElementSelectors, "sendBoxSelector", "textarea[data-id=\"webchat-sendbox-input\"]");
165
-
166
91
  export class HtmlAttributeNames {}
167
-
168
92
  _defineProperty(HtmlAttributeNames, "role", "role");
169
-
170
93
  _defineProperty(HtmlAttributeNames, "navigation", "navigation");
171
-
172
94
  _defineProperty(HtmlAttributeNames, "ariaLabel", "aria-label");
173
-
174
95
  _defineProperty(HtmlAttributeNames, "ariaLive", "aria-live");
175
-
176
96
  _defineProperty(HtmlAttributeNames, "ariaDisabled", "aria-disabled");
177
-
178
97
  _defineProperty(HtmlAttributeNames, "form", "form");
179
-
180
98
  _defineProperty(HtmlAttributeNames, "ariaLabelledby", "aria-labelledby");
181
-
182
99
  _defineProperty(HtmlAttributeNames, "tabindex", "tabindex");
183
-
184
100
  _defineProperty(HtmlAttributeNames, "ariaRequired", "aria-required");
185
-
186
101
  _defineProperty(HtmlAttributeNames, "ariaDesribedby", "aria-describedby");
187
-
188
102
  _defineProperty(HtmlAttributeNames, "ariaHidden", "aria-hidden");
189
-
190
103
  _defineProperty(HtmlAttributeNames, "disabled", "disabled");
191
-
192
104
  _defineProperty(HtmlAttributeNames, "hidden", "hidden");
193
-
194
105
  _defineProperty(HtmlAttributeNames, "download", "download");
195
-
196
106
  _defineProperty(HtmlAttributeNames, "href", "href");
197
-
198
107
  _defineProperty(HtmlAttributeNames, "region", "region");
199
-
200
108
  _defineProperty(HtmlAttributeNames, "button", "button");
201
-
202
109
  _defineProperty(HtmlAttributeNames, "input", "Input");
203
-
204
110
  _defineProperty(HtmlAttributeNames, "style", "style");
205
-
206
111
  _defineProperty(HtmlAttributeNames, "head", "head");
207
-
208
112
  _defineProperty(HtmlAttributeNames, "type", "type");
209
-
210
113
  _defineProperty(HtmlAttributeNames, "csstext", "text/css");
211
-
212
114
  _defineProperty(HtmlAttributeNames, "listItem", "LI");
213
-
214
115
  _defineProperty(HtmlAttributeNames, "unorderedList", "UL");
215
-
216
116
  _defineProperty(HtmlAttributeNames, "div", "div");
217
-
218
117
  _defineProperty(HtmlAttributeNames, "aTagName", "a");
219
-
220
118
  _defineProperty(HtmlAttributeNames, "noopenerTag", "noopener");
221
-
222
119
  _defineProperty(HtmlAttributeNames, "noreferrerTag", "noreferrer");
223
-
224
120
  _defineProperty(HtmlAttributeNames, "adaptiveCardClassName", "ac-adaptiveCard");
225
-
226
121
  _defineProperty(HtmlAttributeNames, "adaptiveCardTextBlockClassName", "ac-textBlock");
227
-
228
122
  _defineProperty(HtmlAttributeNames, "adaptiveCardToggleInputClassName", "ac-toggleInput");
229
-
230
123
  export class WebChatMiddlewareConstants {}
231
-
232
124
  _defineProperty(WebChatMiddlewareConstants, "nextVisibleActivity", "nextVisibleActivity");
233
-
234
125
  _defineProperty(WebChatMiddlewareConstants, "timeBetweenTimestampGroups", 300000);
235
-
236
126
  _defineProperty(WebChatMiddlewareConstants, "maxTextLength", 6000);
237
-
238
127
  _defineProperty(WebChatMiddlewareConstants, "adaptiveCard", "AdaptiveCard");
239
-
240
128
  export class MimeTypes {}
241
-
242
129
  _defineProperty(MimeTypes, "UnknownFileType", "application/octet-stream");
243
-
244
130
  export class LocaleConstants {}
245
-
246
131
  _defineProperty(LocaleConstants, "RTL_LOCALES", ["1025", "1037"]);
247
-
248
132
  export let ElementType;
249
-
250
133
  (function (ElementType) {
251
134
  ElementType["CallingContainerSDK"] = "CallingContainerSDK";
252
135
  })(ElementType || (ElementType = {}));
253
-
254
136
  export let ChatSDKError;
255
-
256
137
  (function (ChatSDKError) {
257
138
  ChatSDKError["WidgetUseOutsideOperatingHour"] = "WidgetUseOutsideOperatingHour";
258
139
  })(ChatSDKError || (ChatSDKError = {}));
259
-
140
+ export let EnvironmentVersion;
141
+ (function (EnvironmentVersion) {
142
+ EnvironmentVersion["prod"] = "prod";
143
+ EnvironmentVersion["dogfood"] = "df";
144
+ EnvironmentVersion["int"] = "int";
145
+ EnvironmentVersion["test"] = "test";
146
+ })(EnvironmentVersion || (EnvironmentVersion = {}));
260
147
  export class TranscriptConstants {}
261
-
262
148
  _defineProperty(TranscriptConstants, "ChatTranscriptsBodyColor", "#F5F5F5");
263
-
264
149
  _defineProperty(TranscriptConstants, "TranscriptMessageEmojiMessageType", "http://schema.skype.com/emoji");
265
-
266
150
  _defineProperty(TranscriptConstants, "ChatTranscriptDownloadFile", "ChatTranscripts.html");
267
-
268
151
  _defineProperty(TranscriptConstants, "DefaultFileAttachmentName", "Untitled.txt");
269
-
270
152
  _defineProperty(TranscriptConstants, "CustomerDialogColor", "#E8E8E8");
271
-
272
153
  _defineProperty(TranscriptConstants, "CustomerFontColor", "black");
273
-
274
154
  _defineProperty(TranscriptConstants, "AdaptiveCardType", "adaptivecard");
275
-
276
155
  _defineProperty(TranscriptConstants, "InternalMode", "internal");
277
-
278
156
  _defineProperty(TranscriptConstants, "AgentDialogColor", "#2266E3");
279
-
280
- _defineProperty(TranscriptConstants, "AgentFontColor", "white");
157
+ _defineProperty(TranscriptConstants, "AgentFontColor", "white");
158
+ export class AriaTelemetryConstants {}
159
+ _defineProperty(AriaTelemetryConstants, "GERMANY_ENDPOINT", "https://de.pipe.aria.microsoft.com/Collector/3.0/");
160
+ _defineProperty(AriaTelemetryConstants, "GCCH_ENDPOINT", "https://tb.pipe.aria.microsoft.com/Collector/3.0/");
161
+ _defineProperty(AriaTelemetryConstants, "DOD_ENDPOINT", "https://pf.pipe.aria.microsoft.com/Collector/3.0");
162
+ _defineProperty(AriaTelemetryConstants, "EUROPE_ENDPOINT", "https://eu-mobile.events.data.microsoft.com/Collector/3.0/");
163
+ _defineProperty(AriaTelemetryConstants, "MOONCAKE_ENDPOINT", "");
164
+ _defineProperty(AriaTelemetryConstants, "Public", "Public");
165
+ _defineProperty(AriaTelemetryConstants, "EU", "Europe");
166
+ _defineProperty(AriaTelemetryConstants, "lcwEUDomainNames", ["crm4.omnichannelengagementhub.com", "crm12.omnichannelengagementhub.com", "crm16.omnichannelengagementhub.com", "crm17.omnichannelengagementhub.com", "crm19.omnichannelengagementhub.com"]);
@@ -1,5 +1,3 @@
1
1
  var _class;
2
-
3
2
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
-
5
3
  export const KeyCodes = (_class = class KeyCodes {}, _defineProperty(_class, "ENTER", "Enter"), _defineProperty(_class, "TAB", "Tab"), _class);
@@ -1,5 +1,3 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
2
  export class DataStoreManager {}
4
-
5
3
  _defineProperty(DataStoreManager, "clientDataStore", void 0);
@@ -0,0 +1,16 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
3
+ import { getWidgetCacheId } from "../../utils";
4
+ import { defaultClientDataStoreProvider } from "./defaultClientDataStoreProvider";
5
+ export class defaultCacheManager {}
6
+ _defineProperty(defaultCacheManager, "InternalCache", {});
7
+ export const registerBroadcastServiceForLocalStorage = (orgid, widgetId, widgetInstanceId) => {
8
+ const widgetCacheId = getWidgetCacheId(orgid, widgetId, widgetInstanceId);
9
+ BroadcastService.getMessageByEventName(widgetCacheId).subscribe(msg => {
10
+ try {
11
+ defaultClientDataStoreProvider().setData(widgetCacheId, JSON.stringify(msg.payload), "localStorage");
12
+ } catch (error) {
13
+ console.error("Error in setting data to localstorage", error);
14
+ }
15
+ });
16
+ };
@@ -0,0 +1,95 @@
1
+ import { inMemoryDataStore } from "./defaultInMemoryDataStore";
2
+ import { TelemetryHelper } from "../../telemetry/TelemetryHelper";
3
+ import { LogLevel, TelemetryEvent } from "../../telemetry/TelemetryConstants";
4
+ export const defaultClientDataStoreProvider = () => {
5
+ const isCookieAllowed = () => {
6
+ try {
7
+ localStorage;
8
+ sessionStorage;
9
+ return true;
10
+ } catch (error) {
11
+ console.error("Third party cookie blocked");
12
+ return false;
13
+ }
14
+ };
15
+ const TtlInMs = 15 * 60 * 1000; // 15 mins
16
+ const dataStoreProvider = {
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ setData: (key, data, type) => {
19
+ if (isCookieAllowed()) {
20
+ try {
21
+ if (key) {
22
+ const now = new Date();
23
+ const item = {
24
+ data: data,
25
+ expiry: now.getTime() + TtlInMs
26
+ };
27
+ const strItem = JSON.stringify(item);
28
+ if (type === "localStorage") {
29
+ localStorage.setItem(key, strItem);
30
+ } else {
31
+ sessionStorage.setItem(key, strItem);
32
+ }
33
+ }
34
+ } catch (error) {
35
+ TelemetryHelper.logConfigDataEvent(LogLevel.ERROR, {
36
+ Event: TelemetryEvent.ClientDataStoreProviderFailed,
37
+ ExceptionDetails: error,
38
+ Description: "Unable to store data in localStorage."
39
+ });
40
+ }
41
+ } else {
42
+ const dataToCache = {
43
+ key: key,
44
+ data: data,
45
+ type: type
46
+ };
47
+ parent.postMessage(dataToCache, "*");
48
+ }
49
+ },
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ getData: (key, type) => {
52
+ if (isCookieAllowed()) {
53
+ let item;
54
+ if (type === "localStorage") {
55
+ item = localStorage.getItem(key);
56
+ } else {
57
+ item = sessionStorage.getItem(key);
58
+ }
59
+ //Return item if not expired
60
+ let itemInJson = undefined;
61
+ if (item !== null) {
62
+ itemInJson = JSON.parse(item);
63
+ const now = new Date();
64
+ // compare the expiry time of the item with the current time
65
+ if (now.getTime() > itemInJson.expiry) {
66
+ // If the item is expired, delete the item from storage
67
+ // and return null
68
+ localStorage.removeItem(key);
69
+ return null;
70
+ }
71
+ return itemInJson.data;
72
+ }
73
+ } else {
74
+ // get data from in memory db when cookie is disabled
75
+ return inMemoryDataStore().getData(key);
76
+ }
77
+ },
78
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
+ removeData: (key, type) => {
80
+ if (isCookieAllowed()) {
81
+ if (key) {
82
+ if (type === "localStorage") {
83
+ return localStorage.removeItem(key);
84
+ } else {
85
+ return sessionStorage.removeItem(key);
86
+ }
87
+ }
88
+ } else {
89
+ // get data from in memory db when cookie is disabled
90
+ return inMemoryDataStore().removeData(key);
91
+ }
92
+ }
93
+ };
94
+ return dataStoreProvider;
95
+ };
@@ -0,0 +1,70 @@
1
+ import { LogLevel, TelemetryEvent } from "../../telemetry/TelemetryConstants";
2
+ import { TelemetryHelper } from "../../telemetry/TelemetryHelper";
3
+ import { defaultCacheManager } from "./defaultCacheManager";
4
+ export const defaultInitializeInMemoryDataStore = widgetId => {
5
+ try {
6
+ localStorage;
7
+ } catch (error) {
8
+ // Register below events when localStorage is not accessible
9
+ // Listening to event raised from client browser
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ window.addEventListener("message", function (e) {
12
+ try {
13
+ if (e.data.key) {
14
+ const browserData = e.data;
15
+ if (defaultCacheManager.InternalCache[browserData.key]) {
16
+ delete defaultCacheManager.InternalCache[browserData.key];
17
+ }
18
+ defaultCacheManager.InternalCache[browserData.key] = browserData.data;
19
+ }
20
+ } catch (error) {
21
+ TelemetryHelper.logConfigDataEvent(LogLevel.ERROR, {
22
+ Event: TelemetryEvent.InMemoryDataStoreFailed,
23
+ ExceptionDetails: error,
24
+ Description: "Unable to register default in-memory cache."
25
+ });
26
+ }
27
+ });
28
+
29
+ // send cache initialize message to client
30
+ if (defaultCacheManager.InternalCache === undefined || {}) {
31
+ parent.postMessage({
32
+ data: "cacheinitialize",
33
+ widgetId: widgetId
34
+ }, "*");
35
+ }
36
+ }
37
+ };
38
+ export const inMemoryDataStore = () => {
39
+ const dataStoreProvider = {
40
+ getData: key => {
41
+ if (defaultCacheManager.InternalCache && defaultCacheManager.InternalCache[key]) {
42
+ return defaultCacheManager.InternalCache[key];
43
+ }
44
+ },
45
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
+ setData: (key, data) => {
47
+ try {
48
+ defaultCacheManager.InternalCache[key] = data;
49
+ } catch (error) {
50
+ TelemetryHelper.logConfigDataEvent(LogLevel.ERROR, {
51
+ Event: TelemetryEvent.InMemoryDataStoreFailed,
52
+ ExceptionDetails: error,
53
+ Description: "Unable to set data in default in-memory cache."
54
+ });
55
+ }
56
+ },
57
+ removeData: key => {
58
+ try {
59
+ defaultCacheManager.InternalCache[key] = {};
60
+ } catch (error) {
61
+ TelemetryHelper.logConfigDataEvent(LogLevel.ERROR, {
62
+ Event: TelemetryEvent.InMemoryDataStoreFailed,
63
+ ExceptionDetails: error,
64
+ Description: "Unable to remove data from default in-memory cache."
65
+ });
66
+ }
67
+ }
68
+ };
69
+ return dataStoreProvider;
70
+ };