botframework-webchat-api 4.14.1 → 4.15.0

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 (308) hide show
  1. package/.eslintrc.yml +4 -105
  2. package/.prettierrc.yml +1 -1
  3. package/lib/StyleOptions.d.ts +242 -12
  4. package/lib/StyleOptions.d.ts.map +1 -1
  5. package/lib/defaultStyleOptions.d.ts.map +1 -1
  6. package/lib/defaultStyleOptions.js +67 -14
  7. package/lib/hooks/Composer.d.ts +1 -1
  8. package/lib/hooks/Composer.d.ts.map +1 -1
  9. package/lib/hooks/Composer.js +24 -8
  10. package/lib/hooks/index.d.ts +11 -1
  11. package/lib/hooks/index.d.ts.map +1 -1
  12. package/lib/hooks/index.js +81 -1
  13. package/lib/hooks/internal/useCreateActivityRendererInternal.d.ts.map +1 -1
  14. package/lib/hooks/internal/useCreateActivityRendererInternal.js +1 -1
  15. package/lib/hooks/internal/useDebugDeps.js +10 -4
  16. package/lib/hooks/internal/usePrevious.d.ts +2 -0
  17. package/lib/hooks/internal/usePrevious.d.ts.map +1 -0
  18. package/lib/hooks/internal/usePrevious.js +17 -0
  19. package/lib/hooks/internal/useValueRef.d.ts +3 -0
  20. package/lib/hooks/internal/useValueRef.d.ts.map +1 -0
  21. package/lib/hooks/internal/useValueRef.js +24 -0
  22. package/lib/hooks/middleware/concatMiddleware.d.ts.map +1 -1
  23. package/lib/hooks/middleware/concatMiddleware.js +2 -2
  24. package/lib/hooks/middleware/createDefaultCardActionMiddleware.d.ts.map +1 -1
  25. package/lib/hooks/middleware/createDefaultCardActionMiddleware.js +1 -1
  26. package/lib/hooks/useActivityKeys.d.ts +3 -0
  27. package/lib/hooks/useActivityKeys.d.ts.map +1 -0
  28. package/lib/hooks/useActivityKeys.js +14 -0
  29. package/lib/hooks/useActivityKeysByRead.d.ts +3 -0
  30. package/lib/hooks/useActivityKeysByRead.d.ts.map +1 -0
  31. package/lib/hooks/useActivityKeysByRead.js +14 -0
  32. package/lib/hooks/useCreateActivityStatusRenderer.d.ts.map +1 -1
  33. package/lib/hooks/useCreateActivityStatusRenderer.js +1 -1
  34. package/lib/hooks/useCreateAvatarRenderer.d.ts +4 -2
  35. package/lib/hooks/useCreateAvatarRenderer.d.ts.map +1 -1
  36. package/lib/hooks/useCreateAvatarRenderer.js +1 -1
  37. package/lib/hooks/useDateFormatter.d.ts.map +1 -1
  38. package/lib/hooks/useDateFormatter.js +1 -1
  39. package/lib/hooks/useDebouncedNotifications.js +1 -1
  40. package/lib/hooks/useGetActivityByKey.d.ts +3 -0
  41. package/lib/hooks/useGetActivityByKey.d.ts.map +1 -0
  42. package/lib/hooks/useGetActivityByKey.js +14 -0
  43. package/lib/hooks/useGetHasAcknowledgedByActivityKey.d.ts +3 -0
  44. package/lib/hooks/useGetHasAcknowledgedByActivityKey.d.ts.map +1 -0
  45. package/lib/hooks/useGetHasAcknowledgedByActivityKey.js +14 -0
  46. package/lib/hooks/useGetKeyByActivity.d.ts +3 -0
  47. package/lib/hooks/useGetKeyByActivity.d.ts.map +1 -0
  48. package/lib/hooks/useGetKeyByActivity.js +14 -0
  49. package/lib/hooks/useGetKeyByActivityId.d.ts +3 -0
  50. package/lib/hooks/useGetKeyByActivityId.d.ts.map +1 -0
  51. package/lib/hooks/useGetKeyByActivityId.js +14 -0
  52. package/lib/hooks/useGetSendTimeoutForActivity.d.ts.map +1 -1
  53. package/lib/hooks/useGetSendTimeoutForActivity.js +1 -1
  54. package/lib/hooks/useGroupActivities.d.ts.map +1 -1
  55. package/lib/hooks/useGroupActivities.js +1 -1
  56. package/lib/hooks/useLastAcknowledgedActivityKey.d.ts +3 -0
  57. package/lib/hooks/useLastAcknowledgedActivityKey.d.ts.map +1 -0
  58. package/lib/hooks/useLastAcknowledgedActivityKey.js +14 -0
  59. package/lib/hooks/useLastReadActivityKey.d.ts +3 -0
  60. package/lib/hooks/useLastReadActivityKey.d.ts.map +1 -0
  61. package/lib/hooks/useLastReadActivityKey.js +14 -0
  62. package/lib/hooks/useLocalizer.d.ts +1 -1
  63. package/lib/hooks/useLocalizer.d.ts.map +1 -1
  64. package/lib/hooks/useLocalizer.js +8 -2
  65. package/lib/hooks/useMarkActivityKeyAsRead.d.ts +3 -0
  66. package/lib/hooks/useMarkActivityKeyAsRead.d.ts.map +1 -0
  67. package/lib/hooks/useMarkActivityKeyAsRead.js +14 -0
  68. package/lib/hooks/useMarkAllAsAcknowledged.d.ts +3 -0
  69. package/lib/hooks/useMarkAllAsAcknowledged.d.ts.map +1 -0
  70. package/lib/hooks/useMarkAllAsAcknowledged.js +14 -0
  71. package/lib/hooks/usePerformCardAction.d.ts +2 -2
  72. package/lib/hooks/usePerformCardAction.d.ts.map +1 -1
  73. package/lib/hooks/usePerformCardAction.js +1 -1
  74. package/lib/hooks/useSubmitSendBox.d.ts.map +1 -1
  75. package/lib/hooks/useSubmitSendBox.js +8 -5
  76. package/lib/hooks/utils/ErrorBoundary.js +1 -1
  77. package/lib/index.js +7 -7
  78. package/lib/localization/Localize.d.ts.map +1 -1
  79. package/lib/localization/Localize.js +12 -6
  80. package/lib/localization/ar-SA.json +23 -4
  81. package/lib/localization/bg-BG.json +23 -4
  82. package/lib/localization/ca-ES.json +23 -4
  83. package/lib/localization/cs-CZ.json +23 -4
  84. package/lib/localization/da-DK.json +23 -4
  85. package/lib/localization/de-DE.json +23 -4
  86. package/lib/localization/el-GR.json +23 -4
  87. package/lib/localization/en-US.json +29 -7
  88. package/lib/localization/es-ES.json +23 -4
  89. package/lib/localization/et-EE.json +23 -4
  90. package/lib/localization/eu-ES.json +23 -4
  91. package/lib/localization/fi-FI.json +23 -4
  92. package/lib/localization/fr-FR.json +23 -4
  93. package/lib/localization/gl-ES.json +23 -4
  94. package/lib/localization/he-IL.json +23 -4
  95. package/lib/localization/hi-IN.json +23 -4
  96. package/lib/localization/hr-HR.json +23 -4
  97. package/lib/localization/hu-HU.json +23 -4
  98. package/lib/localization/id-ID.json +23 -4
  99. package/lib/localization/it-IT.json +23 -4
  100. package/lib/localization/ja-JP.json +23 -4
  101. package/lib/localization/kk-KZ.json +23 -4
  102. package/lib/localization/ko-KR.json +23 -4
  103. package/lib/localization/lt-LT.json +23 -4
  104. package/lib/localization/lv-LV.json +23 -4
  105. package/lib/localization/mergeLocalizedStrings.d.ts.map +1 -1
  106. package/lib/localization/mergeLocalizedStrings.js +11 -4
  107. package/lib/localization/ms-MY.json +23 -4
  108. package/lib/localization/nb-NO.json +23 -4
  109. package/lib/localization/nl-NL.json +23 -4
  110. package/lib/localization/pl-PL.json +23 -4
  111. package/lib/localization/pt-BR.json +23 -4
  112. package/lib/localization/pt-PT.json +23 -4
  113. package/lib/localization/ro-RO.json +23 -4
  114. package/lib/localization/ru-RU.json +23 -4
  115. package/lib/localization/sk-SK.json +23 -4
  116. package/lib/localization/sl-SI.json +23 -4
  117. package/lib/localization/sr-Cyrl-CS.json +23 -4
  118. package/lib/localization/sr-Latn-CS.json +23 -4
  119. package/lib/localization/sv-SE.json +23 -4
  120. package/lib/localization/th-TH.json +23 -4
  121. package/lib/localization/tr-TR.json +23 -4
  122. package/lib/localization/uk-UA.json +23 -4
  123. package/lib/localization/vi-VN.json +23 -4
  124. package/lib/localization/yue.json +26 -7
  125. package/lib/localization/zh-CN.json +23 -4
  126. package/lib/localization/zh-HK.json +23 -4
  127. package/lib/localization/zh-TW.json +23 -4
  128. package/lib/normalizeStyleOptions.d.ts.map +1 -1
  129. package/lib/normalizeStyleOptions.js +47 -2
  130. package/lib/patchStyleOptionsFromDeprecatedProps.js +1 -2
  131. package/lib/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.d.ts +5 -0
  132. package/lib/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.d.ts.map +1 -0
  133. package/lib/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.js +184 -0
  134. package/lib/providers/ActivityAcknowledgement/private/Context.d.ts +13 -0
  135. package/lib/providers/ActivityAcknowledgement/private/Context.d.ts.map +1 -0
  136. package/lib/providers/ActivityAcknowledgement/private/Context.js +13 -0
  137. package/lib/providers/ActivityAcknowledgement/private/types.d.ts +6 -0
  138. package/lib/providers/ActivityAcknowledgement/private/types.d.ts.map +1 -0
  139. package/lib/providers/ActivityAcknowledgement/private/types.js +2 -0
  140. package/lib/providers/ActivityAcknowledgement/private/useContext.d.ts +3 -0
  141. package/lib/providers/ActivityAcknowledgement/private/useContext.d.ts.map +1 -0
  142. package/lib/providers/ActivityAcknowledgement/private/useContext.js +24 -0
  143. package/lib/providers/ActivityAcknowledgement/useActivityKeysByRead.d.ts +5 -0
  144. package/lib/providers/ActivityAcknowledgement/useActivityKeysByRead.d.ts.map +1 -0
  145. package/lib/providers/ActivityAcknowledgement/useActivityKeysByRead.js +18 -0
  146. package/lib/providers/ActivityAcknowledgement/useGetHasAcknowledgedByActivityKey.d.ts +2 -0
  147. package/lib/providers/ActivityAcknowledgement/useGetHasAcknowledgedByActivityKey.d.ts.map +1 -0
  148. package/lib/providers/ActivityAcknowledgement/useGetHasAcknowledgedByActivityKey.js +15 -0
  149. package/lib/providers/ActivityAcknowledgement/useLastAcknowledgedActivityKey.d.ts +2 -0
  150. package/lib/providers/ActivityAcknowledgement/useLastAcknowledgedActivityKey.d.ts.map +1 -0
  151. package/lib/providers/ActivityAcknowledgement/useLastAcknowledgedActivityKey.js +15 -0
  152. package/lib/providers/ActivityAcknowledgement/useLastReadActivityKey.d.ts +2 -0
  153. package/lib/providers/ActivityAcknowledgement/useLastReadActivityKey.d.ts.map +1 -0
  154. package/lib/providers/ActivityAcknowledgement/useLastReadActivityKey.js +15 -0
  155. package/lib/providers/ActivityAcknowledgement/useMarkActivityKeyAsRead.d.ts +2 -0
  156. package/lib/providers/ActivityAcknowledgement/useMarkActivityKeyAsRead.d.ts.map +1 -0
  157. package/lib/providers/ActivityAcknowledgement/useMarkActivityKeyAsRead.js +15 -0
  158. package/lib/providers/ActivityAcknowledgement/useMarkAllAsAcknowledged.d.ts +2 -0
  159. package/lib/providers/ActivityAcknowledgement/useMarkAllAsAcknowledged.d.ts.map +1 -0
  160. package/lib/providers/ActivityAcknowledgement/useMarkAllAsAcknowledged.js +15 -0
  161. package/lib/providers/ActivityKeyer/ActivityKeyerComposer.d.ts +18 -0
  162. package/lib/providers/ActivityKeyer/ActivityKeyerComposer.d.ts.map +1 -0
  163. package/lib/providers/ActivityKeyer/ActivityKeyerComposer.js +153 -0
  164. package/lib/providers/ActivityKeyer/private/Context.d.ts +12 -0
  165. package/lib/providers/ActivityKeyer/private/Context.d.ts.map +1 -0
  166. package/lib/providers/ActivityKeyer/private/Context.js +13 -0
  167. package/lib/providers/ActivityKeyer/private/getActivityId.d.ts +3 -0
  168. package/lib/providers/ActivityKeyer/private/getActivityId.d.ts.map +1 -0
  169. package/lib/providers/ActivityKeyer/private/getActivityId.js +11 -0
  170. package/lib/providers/ActivityKeyer/private/getClientActivityId.d.ts +3 -0
  171. package/lib/providers/ActivityKeyer/private/getClientActivityId.d.ts.map +1 -0
  172. package/lib/providers/ActivityKeyer/private/getClientActivityId.js +13 -0
  173. package/lib/providers/ActivityKeyer/private/uniqueId.d.ts +2 -0
  174. package/lib/providers/ActivityKeyer/private/uniqueId.d.ts.map +1 -0
  175. package/lib/providers/ActivityKeyer/private/uniqueId.js +18 -0
  176. package/lib/providers/ActivityKeyer/private/useContext.d.ts +3 -0
  177. package/lib/providers/ActivityKeyer/private/useContext.d.ts.map +1 -0
  178. package/lib/providers/ActivityKeyer/private/useContext.js +24 -0
  179. package/lib/providers/ActivityKeyer/useActivityKeys.d.ts +2 -0
  180. package/lib/providers/ActivityKeyer/useActivityKeys.d.ts.map +1 -0
  181. package/lib/providers/ActivityKeyer/useActivityKeys.js +15 -0
  182. package/lib/providers/ActivityKeyer/useGetActivityByKey.d.ts +3 -0
  183. package/lib/providers/ActivityKeyer/useGetActivityByKey.d.ts.map +1 -0
  184. package/lib/providers/ActivityKeyer/useGetActivityByKey.js +15 -0
  185. package/lib/providers/ActivityKeyer/useGetKeyByActivity.d.ts +3 -0
  186. package/lib/providers/ActivityKeyer/useGetKeyByActivity.d.ts.map +1 -0
  187. package/lib/providers/ActivityKeyer/useGetKeyByActivity.js +15 -0
  188. package/lib/providers/ActivityKeyer/useGetKeyByActivityId.d.ts +2 -0
  189. package/lib/providers/ActivityKeyer/useGetKeyByActivityId.d.ts.map +1 -0
  190. package/lib/providers/ActivityKeyer/useGetKeyByActivityId.js +15 -0
  191. package/lib/types/CardActionMiddleware.d.ts +3 -1
  192. package/lib/types/CardActionMiddleware.d.ts.map +1 -1
  193. package/lib/utils/createCustomEvent.d.ts.map +1 -1
  194. package/lib/utils/createCustomEvent.js +8 -2
  195. package/lib/utils/findLastIndex.d.ts +2 -0
  196. package/lib/utils/findLastIndex.d.ts.map +1 -0
  197. package/lib/utils/findLastIndex.js +32 -0
  198. package/lib/utils/findMin.js +1 -1
  199. package/lib/utils/mapMap.d.ts.map +1 -1
  200. package/lib/utils/mapMap.js +9 -2
  201. package/lib/utils/randomId.d.ts.map +1 -1
  202. package/lib/utils/randomId.js +1 -1
  203. package/package.json +13 -21
  204. package/src/StyleOptions.ts +293 -12
  205. package/src/defaultStyleOptions.ts +71 -13
  206. package/src/hooks/Composer.tsx +86 -49
  207. package/src/hooks/index.ts +20 -0
  208. package/src/hooks/internal/useCreateActivityRendererInternal.ts +21 -20
  209. package/src/hooks/internal/useDebugDeps.js +9 -2
  210. package/src/hooks/internal/usePrevious.ts +11 -0
  211. package/src/hooks/internal/useValueRef.ts +21 -0
  212. package/src/hooks/middleware/concatMiddleware.ts +6 -4
  213. package/src/hooks/middleware/createDefaultCardActionMiddleware.ts +29 -27
  214. package/src/hooks/useActivityKeys.ts +3 -0
  215. package/src/hooks/useActivityKeysByRead.ts +3 -0
  216. package/src/hooks/useCreateActivityStatusRenderer.tsx +10 -13
  217. package/src/hooks/useCreateAvatarRenderer.ts +23 -19
  218. package/src/hooks/useDateFormatter.ts +4 -3
  219. package/src/hooks/useGetActivityByKey.ts +3 -0
  220. package/src/hooks/useGetHasAcknowledgedByActivityKey.ts +3 -0
  221. package/src/hooks/useGetKeyByActivity.ts +3 -0
  222. package/src/hooks/useGetKeyByActivityId.ts +3 -0
  223. package/src/hooks/useGetSendTimeoutForActivity.ts +7 -6
  224. package/src/hooks/useGroupActivities.ts +1 -5
  225. package/src/hooks/useLastAcknowledgedActivityKey.ts +3 -0
  226. package/src/hooks/useLastReadActivityKey.ts +3 -0
  227. package/src/hooks/useLocalizer.ts +7 -2
  228. package/src/hooks/useMarkActivityKeyAsRead.ts +3 -0
  229. package/src/hooks/useMarkAllAsAcknowledged.ts +3 -0
  230. package/src/hooks/usePerformCardAction.ts +2 -3
  231. package/src/hooks/useSubmitSendBox.ts +2 -5
  232. package/src/localization/Localize.ts +9 -2
  233. package/src/localization/ar-SA.json +23 -4
  234. package/src/localization/bg-BG.json +23 -4
  235. package/src/localization/ca-ES.json +23 -4
  236. package/src/localization/cs-CZ.json +23 -4
  237. package/src/localization/da-DK.json +23 -4
  238. package/src/localization/de-DE.json +23 -4
  239. package/src/localization/el-GR.json +23 -4
  240. package/src/localization/en-US.json +29 -7
  241. package/src/localization/es-ES.json +23 -4
  242. package/src/localization/et-EE.json +23 -4
  243. package/src/localization/eu-ES.json +23 -4
  244. package/src/localization/fi-FI.json +23 -4
  245. package/src/localization/fr-FR.json +23 -4
  246. package/src/localization/gl-ES.json +23 -4
  247. package/src/localization/he-IL.json +23 -4
  248. package/src/localization/hi-IN.json +23 -4
  249. package/src/localization/hr-HR.json +23 -4
  250. package/src/localization/hu-HU.json +23 -4
  251. package/src/localization/id-ID.json +23 -4
  252. package/src/localization/it-IT.json +23 -4
  253. package/src/localization/ja-JP.json +23 -4
  254. package/src/localization/kk-KZ.json +23 -4
  255. package/src/localization/ko-KR.json +23 -4
  256. package/src/localization/lt-LT.json +23 -4
  257. package/src/localization/lv-LV.json +23 -4
  258. package/src/localization/mergeLocalizedStrings.ts +7 -1
  259. package/src/localization/ms-MY.json +23 -4
  260. package/src/localization/nb-NO.json +23 -4
  261. package/src/localization/nl-NL.json +23 -4
  262. package/src/localization/pl-PL.json +23 -4
  263. package/src/localization/pt-BR.json +23 -4
  264. package/src/localization/pt-PT.json +23 -4
  265. package/src/localization/ro-RO.json +23 -4
  266. package/src/localization/ru-RU.json +23 -4
  267. package/src/localization/sk-SK.json +23 -4
  268. package/src/localization/sl-SI.json +23 -4
  269. package/src/localization/sr-Cyrl-CS.json +23 -4
  270. package/src/localization/sr-Latn-CS.json +23 -4
  271. package/src/localization/sv-SE.json +23 -4
  272. package/src/localization/th-TH.json +23 -4
  273. package/src/localization/tr-TR.json +23 -4
  274. package/src/localization/uk-UA.json +23 -4
  275. package/src/localization/vi-VN.json +23 -4
  276. package/src/localization/yue.json +26 -7
  277. package/src/localization/zh-CN.json +23 -4
  278. package/src/localization/zh-HK.json +23 -4
  279. package/src/localization/zh-TW.json +23 -4
  280. package/src/normalizeStyleOptions.ts +70 -0
  281. package/src/patchStyleOptionsFromDeprecatedProps.js +0 -2
  282. package/src/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.tsx +180 -0
  283. package/src/providers/ActivityAcknowledgement/private/Context.ts +18 -0
  284. package/src/providers/ActivityAcknowledgement/private/types.ts +6 -0
  285. package/src/providers/ActivityAcknowledgement/private/useContext.ts +19 -0
  286. package/src/providers/ActivityAcknowledgement/useActivityKeysByRead.tsx +8 -0
  287. package/src/providers/ActivityAcknowledgement/useGetHasAcknowledgedByActivityKey.ts +5 -0
  288. package/src/providers/ActivityAcknowledgement/useLastAcknowledgedActivityKey.ts +5 -0
  289. package/src/providers/ActivityAcknowledgement/useLastReadActivityKey.ts +5 -0
  290. package/src/providers/ActivityAcknowledgement/useMarkActivityKeyAsRead.ts +5 -0
  291. package/src/providers/ActivityAcknowledgement/useMarkAllAsAcknowledged.ts +5 -0
  292. package/src/providers/ActivityKeyer/ActivityKeyerComposer.tsx +151 -0
  293. package/src/providers/ActivityKeyer/private/Context.ts +14 -0
  294. package/src/providers/ActivityKeyer/private/getActivityId.ts +5 -0
  295. package/src/providers/ActivityKeyer/private/getClientActivityId.ts +5 -0
  296. package/src/providers/ActivityKeyer/private/uniqueId.ts +8 -0
  297. package/src/providers/ActivityKeyer/private/useContext.ts +15 -0
  298. package/src/providers/ActivityKeyer/useActivityKeys.ts +5 -0
  299. package/src/providers/ActivityKeyer/useGetActivityByKey.ts +7 -0
  300. package/src/providers/ActivityKeyer/useGetKeyByActivity.ts +7 -0
  301. package/src/providers/ActivityKeyer/useGetKeyByActivityId.ts +5 -0
  302. package/src/types/CardActionMiddleware.ts +1 -1
  303. package/src/utils/createCustomEvent.ts +7 -1
  304. package/src/utils/findLastIndex.spec.js +31 -0
  305. package/src/utils/findLastIndex.ts +11 -0
  306. package/src/utils/mapMap.ts +7 -1
  307. package/src/utils/randomId.ts +1 -1
  308. package/.eslintignore +0 -1
@@ -36,6 +36,8 @@ import {
36
36
  } from 'botframework-webchat-core';
37
37
 
38
38
  import { default as WebChatAPIContext } from './internal/WebChatAPIContext';
39
+ import ActivityAcknowledgementComposer from '../providers/ActivityAcknowledgement/ActivityAcknowledgementComposer';
40
+ import ActivityKeyerComposer from '../providers/ActivityKeyer/ActivityKeyerComposer';
39
41
  import ActivityMiddleware from '../types/ActivityMiddleware';
40
42
  import ActivityStatusMiddleware from '../types/ActivityStatusMiddleware';
41
43
  import AttachmentForScreenReaderMiddleware from '../types/AttachmentForScreenReaderMiddleware';
@@ -63,6 +65,7 @@ import TelemetryMeasurementEvent, { TelemetryExceptionMeasurementEvent } from '.
63
65
  import ToastMiddleware from '../types/ToastMiddleware';
64
66
  import Tracker from './internal/Tracker';
65
67
  import TypingIndicatorMiddleware from '../types/TypingIndicatorMiddleware';
68
+ import useMarkAllAsAcknowledged from './useMarkAllAsAcknowledged';
66
69
  import WebChatReduxContext, { useDispatch } from './internal/WebChatReduxContext';
67
70
 
68
71
  import applyMiddleware, {
@@ -98,7 +101,7 @@ const DISPATCHERS = {
98
101
  submitSendBox
99
102
  };
100
103
 
101
- function createCardActionContext({ cardActionMiddleware, directLine, dispatch }) {
104
+ function createCardActionContext({ cardActionMiddleware, directLine, dispatch, markAllAsAcknowledged }) {
102
105
  const runMiddleware = applyMiddleware(
103
106
  'card action',
104
107
  ...singleToArray(cardActionMiddleware),
@@ -106,8 +109,10 @@ function createCardActionContext({ cardActionMiddleware, directLine, dispatch })
106
109
  )({ dispatch });
107
110
 
108
111
  return {
109
- onCardAction: (cardAction, { target }: { target?: any } = {}) =>
110
- runMiddleware({
112
+ onCardAction: (cardAction, { target }: { target?: any } = {}) => {
113
+ markAllAsAcknowledged();
114
+
115
+ return runMiddleware({
111
116
  cardAction,
112
117
  getSignInUrl:
113
118
  cardAction.type === 'signin'
@@ -131,7 +136,8 @@ function createCardActionContext({ cardActionMiddleware, directLine, dispatch })
131
136
  }
132
137
  : null,
133
138
  target
134
- })
139
+ });
140
+ }
135
141
  };
136
142
  }
137
143
 
@@ -167,6 +173,12 @@ function mergeStringsOverrides(localizedStrings, language, overrideLocalizedStri
167
173
  return { ...localizedStrings, ...overrideLocalizedStrings };
168
174
  }
169
175
 
176
+ // It seems "react/require-default-props" did not pick up `ComposerCore.defaultProps`.
177
+ // And it falsely complaint `optional?: string` must have a corresponding `ComposerCore.defaultProps.optional = undefined`, even we already set it below.
178
+ // Since we set both TypeScript `Props` class and `ComposerCore.propTypes`, this check will be done there as well.
179
+ // Ignoring it in TypeScript version should be safe, as we have `propTypes` version to protect us.
180
+
181
+ /* eslint-disable react/require-default-props */
170
182
  type ComposerCoreProps = {
171
183
  activityMiddleware?: OneOrMany<ActivityMiddleware>;
172
184
  activityStatusMiddleware?: OneOrMany<ActivityStatusMiddleware>;
@@ -182,7 +194,6 @@ type ComposerCoreProps = {
182
194
  grammars?: any;
183
195
  groupActivitiesMiddleware?: OneOrMany<GroupActivitiesMiddleware>;
184
196
  internalErrorBoxClass?: React.Component | Function;
185
- internalRenderErrorBox?: any;
186
197
  locale?: string;
187
198
  onTelemetry?: (event: TelemetryMeasurementEvent) => void;
188
199
  overrideLocalizedStrings?: LocalizedStrings | ((strings: LocalizedStrings, language: string) => LocalizedStrings);
@@ -213,6 +224,7 @@ type ComposerCoreProps = {
213
224
  /** @deprecated Please use "typingIndicatorRenderer" instead. */
214
225
  typingIndicatorRenderer?: any; // TODO: [P4] Remove on or after 2022-06-15.
215
226
  };
227
+ /* eslint-enable react/require-default-props */
216
228
 
217
229
  const ComposerCore: FC<ComposerCoreProps> = ({
218
230
  activityMiddleware,
@@ -289,16 +301,17 @@ const ComposerCore: FC<ComposerCoreProps> = ({
289
301
  };
290
302
  }, [dispatch, directLine, userID, username]);
291
303
 
292
- const cardActionContext = useMemo(() => createCardActionContext({ cardActionMiddleware, directLine, dispatch }), [
293
- cardActionMiddleware,
294
- directLine,
295
- dispatch
296
- ]);
304
+ const markAllAsAcknowledged = useMarkAllAsAcknowledged();
305
+
306
+ const cardActionContext = useMemo(
307
+ () => createCardActionContext({ cardActionMiddleware, directLine, dispatch, markAllAsAcknowledged }),
308
+ [cardActionMiddleware, directLine, dispatch, markAllAsAcknowledged]
309
+ );
297
310
 
298
- const patchedSelectVoice = useMemo(() => selectVoice || defaultSelectVoice.bind(null, { language: locale }), [
299
- locale,
300
- selectVoice
301
- ]);
311
+ const patchedSelectVoice = useMemo(
312
+ () => selectVoice || defaultSelectVoice.bind(null, { language: locale }),
313
+ [locale, selectVoice]
314
+ );
302
315
 
303
316
  const groupActivitiesContext = useMemo(
304
317
  () =>
@@ -310,7 +323,13 @@ const ComposerCore: FC<ComposerCoreProps> = ({
310
323
  );
311
324
 
312
325
  const hoistedDispatchers = useMemo(
313
- () => mapMap(DISPATCHERS, dispatcher => (...args) => dispatch(dispatcher(...args))),
326
+ () =>
327
+ mapMap(
328
+ DISPATCHERS,
329
+ dispatcher =>
330
+ (...args) =>
331
+ dispatch(dispatcher(...args))
332
+ ),
314
333
  [dispatch]
315
334
  );
316
335
 
@@ -358,13 +377,15 @@ const ComposerCore: FC<ComposerCoreProps> = ({
358
377
  'activity',
359
378
  { strict: false },
360
379
  ...singleToArray(activityMiddleware),
361
- () => () => ({ activity }) => {
362
- if (activity) {
363
- throw new Error(`No renderer for activity of type "${activity.type}"`);
364
- } else {
365
- throw new Error('No activity to render');
380
+ () =>
381
+ () =>
382
+ ({ activity }) => {
383
+ if (activity) {
384
+ throw new Error(`No renderer for activity of type "${activity.type}"`);
385
+ } else {
386
+ throw new Error('No activity to render');
387
+ }
366
388
  }
367
- }
368
389
  )({})
369
390
  );
370
391
  }, [activityMiddleware, activityRenderer]);
@@ -392,19 +413,21 @@ const ComposerCore: FC<ComposerCoreProps> = ({
392
413
  'attachment for screen reader',
393
414
  { strict: true },
394
415
  ...singleToArray(attachmentForScreenReaderMiddleware),
395
- () => () => ({ attachment }) => {
396
- if (attachment) {
397
- console.warn(`No renderer for attachment for screen reader of type "${attachment.contentType}"`);
398
- return false;
416
+ () =>
417
+ () =>
418
+ ({ attachment }) => {
419
+ if (attachment) {
420
+ console.warn(`No renderer for attachment for screen reader of type "${attachment.contentType}"`);
421
+ return false;
422
+ }
423
+
424
+ return () => {
425
+ /**
426
+ * @todo TODO: [P4] Might be able to throw without returning a function -- investigate and possibly fix
427
+ */
428
+ throw new Error('No attachment to render');
429
+ };
399
430
  }
400
-
401
- return () => {
402
- /**
403
- * @todo TODO: [P4] Might be able to throw without returning a function -- investigate and possibly fix
404
- */
405
- throw new Error('No attachment to render');
406
- };
407
- }
408
431
  )({}),
409
432
  [attachmentForScreenReaderMiddleware]
410
433
  );
@@ -422,13 +445,15 @@ const ComposerCore: FC<ComposerCoreProps> = ({
422
445
  return applyMiddlewareForLegacyRenderer(
423
446
  'attachment',
424
447
  ...singleToArray(attachmentMiddleware),
425
- () => () => ({ attachment }) => {
426
- if (attachment) {
427
- throw new Error(`No renderer for attachment of type "${attachment.contentType}"`);
428
- } else {
429
- throw new Error('No attachment to render');
448
+ () =>
449
+ () =>
450
+ ({ attachment }) => {
451
+ if (attachment) {
452
+ throw new Error(`No renderer for attachment of type "${attachment.contentType}"`);
453
+ } else {
454
+ throw new Error('No attachment to render');
455
+ }
430
456
  }
431
- }
432
457
  )({});
433
458
  }, [attachmentMiddleware, attachmentRenderer]);
434
459
 
@@ -440,8 +465,11 @@ const ComposerCore: FC<ComposerCoreProps> = ({
440
465
 
441
466
  return (
442
467
  avatarRenderer ||
443
- applyMiddlewareForRenderer('avatar', { strict: false }, ...singleToArray(avatarMiddleware), () => () => () =>
444
- false
468
+ applyMiddlewareForRenderer(
469
+ 'avatar',
470
+ { strict: false },
471
+ ...singleToArray(avatarMiddleware),
472
+ () => () => () => false
445
473
  )({})
446
474
  );
447
475
  }, [avatarMiddleware, avatarRenderer]);
@@ -458,13 +486,15 @@ const ComposerCore: FC<ComposerCoreProps> = ({
458
486
  'toast',
459
487
  { strict: false },
460
488
  ...singleToArray(toastMiddleware),
461
- () => () => ({ notification }) => {
462
- if (notification) {
463
- throw new Error(`No renderer for notification of type "${notification.contentType}"`);
464
- } else {
465
- throw new Error('No notification to render');
489
+ () =>
490
+ () =>
491
+ ({ notification }) => {
492
+ if (notification) {
493
+ throw new Error(`No renderer for notification of type "${notification.contentType}"`);
494
+ } else {
495
+ throw new Error('No notification to render');
496
+ }
466
497
  }
467
- }
468
498
  )({})
469
499
  );
470
500
  }, [toastMiddleware, toastRenderer]);
@@ -672,7 +702,10 @@ ComposerCore.propTypes = {
672
702
  username: PropTypes.string
673
703
  };
674
704
 
675
- type ComposerProps = ComposerCoreProps & { store?: any };
705
+ type ComposerProps = ComposerCoreProps & {
706
+ internalRenderErrorBox?: any;
707
+ store?: any;
708
+ };
676
709
 
677
710
  // We will create a Redux store if it was not passed in
678
711
  const Composer: FC<ComposerProps> = ({ internalRenderErrorBox, onTelemetry, store, ...props }) => {
@@ -696,7 +729,11 @@ const Composer: FC<ComposerProps> = ({ internalRenderErrorBox, onTelemetry, stor
696
729
  ) : (
697
730
  <ErrorBoundary onError={handleError}>
698
731
  <Provider context={WebChatReduxContext} store={memoizedStore}>
699
- <ComposerCore internalRenderErrorBox={internalRenderErrorBox} onTelemetry={onTelemetry} {...props} />
732
+ <ActivityKeyerComposer>
733
+ <ActivityAcknowledgementComposer>
734
+ <ComposerCore onTelemetry={onTelemetry} {...props} />
735
+ </ActivityAcknowledgementComposer>
736
+ </ActivityKeyerComposer>
700
737
  </Provider>
701
738
  </ErrorBoundary>
702
739
  );
@@ -1,5 +1,7 @@
1
1
  import useActiveTyping from './useActiveTyping';
2
2
  import useActivities from './useActivities';
3
+ import useActivityKeys from './useActivityKeys';
4
+ import useActivityKeysByRead from './useActivityKeysByRead';
3
5
  import useAvatarForBot from './useAvatarForBot';
4
6
  import useAvatarForUser from './useAvatarForUser';
5
7
  import useByteFormatter from './useByteFormatter';
@@ -17,16 +19,24 @@ import useDirection from './useDirection';
17
19
  import useDisabled from './useDisabled';
18
20
  import useDismissNotification from './useDismissNotification';
19
21
  import useEmitTypingIndicator from './useEmitTypingIndicator';
22
+ import useGetActivityByKey from './useGetActivityByKey';
23
+ import useGetHasAcknowledgedByActivityKey from './useGetHasAcknowledgedByActivityKey';
24
+ import useGetKeyByActivity from './useGetKeyByActivity';
25
+ import useGetKeyByActivityId from './useGetKeyByActivityId';
20
26
  import useGetSendTimeoutForActivity from './useGetSendTimeoutForActivity';
21
27
  import useGrammars from './useGrammars';
22
28
  import useGroupActivities from './useGroupActivities';
23
29
  import useGroupTimestamp from './useGroupTimestamp';
24
30
  import useLanguage from './useLanguage';
31
+ import useLastAcknowledgedActivityKey from './useLastAcknowledgedActivityKey';
32
+ import useLastReadActivityKey from './useLastReadActivityKey';
25
33
  import useLastTypingAt from './useLastTypingAt';
26
34
  import useLocalize from './useLocalize'; // Deprecated on or after 2022-02-12
27
35
  import useLocalizeDate from './useLocalizeDate'; // Deprecated on or after 2022-02-12
28
36
  import useLocalizer from './useLocalizer';
29
37
  import useMarkActivityAsSpoken from './useMarkActivityAsSpoken';
38
+ import useMarkActivityKeyAsRead from './useMarkActivityKeyAsRead';
39
+ import useMarkAllAsAcknowledged from './useMarkAllAsAcknowledged';
30
40
  import usePerformCardAction from './usePerformCardAction';
31
41
  import usePostActivity from './usePostActivity';
32
42
  import useReferenceGrammarID from './useReferenceGrammarID';
@@ -64,6 +74,8 @@ import useVoiceSelector from './useVoiceSelector';
64
74
  export {
65
75
  useActiveTyping,
66
76
  useActivities,
77
+ useActivityKeys,
78
+ useActivityKeysByRead,
67
79
  useAvatarForBot,
68
80
  useAvatarForUser,
69
81
  useByteFormatter,
@@ -81,16 +93,24 @@ export {
81
93
  useDisabled,
82
94
  useDismissNotification,
83
95
  useEmitTypingIndicator,
96
+ useGetActivityByKey,
97
+ useGetHasAcknowledgedByActivityKey,
98
+ useGetKeyByActivity,
99
+ useGetKeyByActivityId,
84
100
  useGetSendTimeoutForActivity,
85
101
  useGrammars,
86
102
  useGroupActivities,
87
103
  useGroupTimestamp,
88
104
  useLanguage,
105
+ useLastAcknowledgedActivityKey,
106
+ useLastReadActivityKey,
89
107
  useLastTypingAt,
90
108
  useLocalize,
91
109
  useLocalizeDate,
92
110
  useLocalizer,
93
111
  useMarkActivityAsSpoken,
112
+ useMarkActivityKeyAsRead,
113
+ useMarkAllAsAcknowledged,
94
114
  usePerformCardAction,
95
115
  usePostActivity,
96
116
  useReferenceGrammarID,
@@ -14,32 +14,33 @@ export default function useCreateActivityRendererInternal(
14
14
  const renderAttachment: RenderAttachment = renderAttachmentOverride || defaultRenderAttachment;
15
15
 
16
16
  return useMemo(
17
- () => (...createActivityRendererOptions) => {
18
- const renderActivity = createActivityRenderer(...createActivityRendererOptions);
17
+ () =>
18
+ (...createActivityRendererOptions) => {
19
+ const renderActivity = createActivityRenderer(...createActivityRendererOptions);
19
20
 
20
- if (!renderActivity) {
21
- return false;
22
- }
23
-
24
- return renderActivityOptions => {
25
- if (isValidElement(renderActivity)) {
26
- return renderActivity;
21
+ if (!renderActivity) {
22
+ return false;
27
23
  }
28
24
 
29
- const activityElement = renderActivity(
30
- (...renderAttachmentArgs) => renderAttachment(...renderAttachmentArgs),
31
- renderActivityOptions
32
- );
25
+ return renderActivityOptions => {
26
+ if (isValidElement(renderActivity)) {
27
+ return renderActivity;
28
+ }
33
29
 
34
- // "activityElement" cannot be false. If the middleware want to hide the "activityElement", it should return "false" when we call createActivityRenderer().
35
- activityElement ||
36
- console.warn(
37
- 'botframework-webchat: To hide an activity, the activity renderer should return false. It should not return a function that will return false when called.'
30
+ const activityElement = renderActivity(
31
+ (...renderAttachmentArgs) => renderAttachment(...renderAttachmentArgs),
32
+ renderActivityOptions
38
33
  );
39
34
 
40
- return activityElement;
41
- };
42
- },
35
+ // "activityElement" cannot be false. If the middleware want to hide the "activityElement", it should return "false" when we call createActivityRenderer().
36
+ activityElement ||
37
+ console.warn(
38
+ 'botframework-webchat: To hide an activity, the activity renderer should return false. It should not return a function that will return false when called.'
39
+ );
40
+
41
+ return activityElement;
42
+ };
43
+ },
43
44
  [createActivityRenderer, renderAttachment]
44
45
  );
45
46
  }
@@ -1,5 +1,6 @@
1
1
  /* eslint no-console: "off" */
2
2
 
3
+ import { isForbiddenPropertyNames } from 'botframework-webchat-core';
3
4
  import { useRef } from 'react';
4
5
 
5
6
  export default function useDebugDeps(depsMap, name) {
@@ -7,13 +8,19 @@ export default function useDebugDeps(depsMap, name) {
7
8
 
8
9
  const { current: lastDepsMap } = lastDepsMapRef;
9
10
  const keys = new Set([...Object.keys(depsMap), ...Object.keys(lastDepsMap)]);
10
- const keysChanged = Array.from(keys).filter(key => !Object.is(depsMap[key], lastDepsMap[key]));
11
+ const keysChanged = Array.from(keys).filter(
12
+ // Mitigation through denylisting.
13
+ // eslint-disable-next-line security/detect-object-injection
14
+ key => !isForbiddenPropertyNames(key) && !Object.is(depsMap[key], lastDepsMap[key])
15
+ );
11
16
 
12
17
  if (keysChanged.length) {
13
18
  console.groupCollapsed(`Changes found in ${name}`);
14
19
 
15
20
  keysChanged.forEach(key => {
16
- console.log(key, { from: lastDepsMap[key], to: depsMap[key] });
21
+ // Mitigation through denylisting.
22
+ // eslint-disable-next-line security/detect-object-injection
23
+ isForbiddenPropertyNames(key) || console.log(key, { from: lastDepsMap[key], to: depsMap[key] });
17
24
  });
18
25
 
19
26
  console.groupEnd();
@@ -0,0 +1,11 @@
1
+ import { useEffect, useRef } from 'react';
2
+
3
+ export default function usePrevious<T>(value: T): T {
4
+ const ref = useRef<T>();
5
+
6
+ useEffect(() => {
7
+ ref.current = value;
8
+ });
9
+
10
+ return ref.current;
11
+ }
@@ -0,0 +1,21 @@
1
+ import { RefObject, useMemo, useRef } from 'react';
2
+
3
+ export default function useValueRef<T>(value: T): RefObject<T> {
4
+ const ref = useRef<T>();
5
+ const readOnlyRef = useMemo(
6
+ () =>
7
+ Object.create(
8
+ {},
9
+ {
10
+ current: {
11
+ get: () => ref.current
12
+ }
13
+ }
14
+ ),
15
+ []
16
+ );
17
+
18
+ ref.current = value;
19
+
20
+ return readOnlyRef;
21
+ }
@@ -13,11 +13,13 @@ export default function concatMiddleware<Setup, Result>(
13
13
 
14
14
  return last => {
15
15
  const stack = setup.slice();
16
- const work = index => (...runArgs) => {
17
- const next = stack[index];
16
+ const work =
17
+ (index: number) =>
18
+ (...runArgs) => {
19
+ const next = stack[+index];
18
20
 
19
- return (next ? next(work(index + 1)) : last)(...runArgs);
20
- };
21
+ return (next ? next(work(index + 1)) : last)(...runArgs);
22
+ };
21
23
 
22
24
  return work(0);
23
25
  };
@@ -3,38 +3,40 @@ import { sendMessage, sendMessageBack, sendPostBack } from 'botframework-webchat
3
3
  import CardActionMiddleware from '../../types/CardActionMiddleware';
4
4
 
5
5
  export default function createDefaultCardActionMiddleware(): CardActionMiddleware {
6
- return ({ dispatch }) => next => (...args) => {
7
- const [
8
- {
9
- cardAction,
10
- cardAction: { value }
11
- }
12
- ] = args;
13
-
14
- // We cannot use destructured "type" here because TypeScript don't recognize "messageBack" is "MessageBackCardAction".
15
- switch (cardAction.type) {
16
- case 'imBack':
17
- if (typeof value === 'string') {
18
- // TODO: [P4] Instead of calling dispatch, we should move to dispatchers instead for completeness
19
- dispatch(sendMessage(value, 'imBack'));
20
- } else {
21
- throw new Error('cannot send "imBack" with a non-string value');
6
+ return ({ dispatch }) =>
7
+ next =>
8
+ (...args) => {
9
+ const [
10
+ {
11
+ cardAction,
12
+ cardAction: { value }
22
13
  }
14
+ ] = args;
15
+
16
+ // We cannot use destructured "type" here because TypeScript don't recognize "messageBack" is "MessageBackCardAction".
17
+ switch (cardAction.type) {
18
+ case 'imBack':
19
+ if (typeof value === 'string') {
20
+ // TODO: [P4] Instead of calling dispatch, we should move to dispatchers instead for completeness
21
+ dispatch(sendMessage(value, 'imBack'));
22
+ } else {
23
+ throw new Error('cannot send "imBack" with a non-string value');
24
+ }
23
25
 
24
- break;
26
+ break;
25
27
 
26
- case 'messageBack':
27
- dispatch(sendMessageBack(value, cardAction.text, cardAction.displayText));
28
+ case 'messageBack':
29
+ dispatch(sendMessageBack(value, cardAction.text, cardAction.displayText));
28
30
 
29
- break;
31
+ break;
30
32
 
31
- case 'postBack':
32
- dispatch(sendPostBack(value));
33
+ case 'postBack':
34
+ dispatch(sendPostBack(value));
33
35
 
34
- break;
36
+ break;
35
37
 
36
- default:
37
- return next(...args);
38
- }
39
- };
38
+ default:
39
+ return next(...args);
40
+ }
41
+ };
40
42
  }
@@ -0,0 +1,3 @@
1
+ import useActivityKeys from '../providers/ActivityKeyer/useActivityKeys';
2
+
3
+ export default useActivityKeys;
@@ -0,0 +1,3 @@
1
+ import useActivityKeysByRead from '../providers/ActivityAcknowledgement/useActivityKeysByRead';
2
+
3
+ export default useActivityKeysByRead;
@@ -58,19 +58,16 @@ export default function useCreateActivityStatusRenderer(): (renderOptions: {
58
58
  nextVisibleActivity: DirectLineActivity;
59
59
  }) => (props: { hideTimestamp?: boolean }) => ReactNode {
60
60
  return useMemo(
61
- () => ({
62
- activity,
63
- nextVisibleActivity
64
- }: {
65
- activity: DirectLineActivity;
66
- nextVisibleActivity: DirectLineActivity;
67
- }) => ({ hideTimestamp }: { hideTimestamp?: boolean } = {}) => (
68
- <ActivityStatusContainer
69
- activity={activity}
70
- hideTimestamp={hideTimestamp}
71
- nextVisibleActivity={nextVisibleActivity}
72
- />
73
- ),
61
+ () =>
62
+ ({ activity, nextVisibleActivity }: { activity: DirectLineActivity; nextVisibleActivity: DirectLineActivity }) =>
63
+ ({ hideTimestamp }: { hideTimestamp?: boolean } = {}) =>
64
+ (
65
+ <ActivityStatusContainer
66
+ activity={activity}
67
+ hideTimestamp={hideTimestamp}
68
+ nextVisibleActivity={nextVisibleActivity}
69
+ />
70
+ ),
74
71
  []
75
72
  );
76
73
  }
@@ -1,35 +1,39 @@
1
1
  import { DirectLineActivity } from 'botframework-webchat-core';
2
- import { ReactNode, useMemo } from 'react';
2
+ import { useMemo } from 'react';
3
3
 
4
+ import { AvatarComponentFactory } from '../types/AvatarMiddleware';
4
5
  import useStyleOptions from './useStyleOptions';
5
6
  import useWebChatAPIContext from './internal/useWebChatAPIContext';
6
7
 
7
- export default function useCreateAvatarRenderer(): (
8
- activity: DirectLineActivity
9
- ) => (() => Exclude<ReactNode, boolean | null | undefined>) | false {
8
+ export default function useCreateAvatarRenderer(): ({
9
+ activity
10
+ }: {
11
+ activity: DirectLineActivity;
12
+ }) => AvatarComponentFactory {
10
13
  const [styleOptions] = useStyleOptions();
11
14
  const { avatarRenderer } = useWebChatAPIContext();
12
15
 
13
16
  return useMemo(
14
- () => ({ activity }) => {
15
- const { from: { role } = {} }: { from?: { role?: string } } = activity;
17
+ () =>
18
+ ({ activity }) => {
19
+ const { from: { role } = {} }: { from?: { role?: string } } = activity;
16
20
 
17
- const result = avatarRenderer({
18
- activity,
19
- fromUser: role === 'user',
20
- styleOptions
21
- });
21
+ const result = avatarRenderer({
22
+ activity,
23
+ fromUser: role === 'user',
24
+ styleOptions
25
+ });
22
26
 
23
- if (result !== false && typeof result !== 'function') {
24
- console.warn(
25
- 'botframework-webchat: avatarMiddleware should return a function to render the avatar, or return false if avatar should be hidden. Please refer to HOOKS.md for details.'
26
- );
27
+ if (result !== false && typeof result !== 'function') {
28
+ console.warn(
29
+ 'botframework-webchat: avatarMiddleware should return a function to render the avatar, or return false if avatar should be hidden. Please refer to HOOKS.md for details.'
30
+ );
27
31
 
28
- return () => result;
29
- }
32
+ return () => result;
33
+ }
30
34
 
31
- return result;
32
- },
35
+ return result;
36
+ },
33
37
  [avatarRenderer, styleOptions]
34
38
  );
35
39
  }
@@ -5,9 +5,10 @@ import useLocalizedGlobalize from './internal/useLocalizedGlobalize';
5
5
  export default function useDateFormatter(): (date: number | Date) => string {
6
6
  const [globalize] = useLocalizedGlobalize();
7
7
 
8
- const formatDate = useMemo(() => date => globalize.dateFormatter({ skeleton: 'MMMMdhm' })(new Date(date)), [
9
- globalize
10
- ]);
8
+ const formatDate = useMemo(
9
+ () => date => globalize.dateFormatter({ skeleton: 'MMMMdhm' })(new Date(date)),
10
+ [globalize]
11
+ );
11
12
 
12
13
  return formatDate;
13
14
  }
@@ -0,0 +1,3 @@
1
+ import useGetActivityByKey from '../providers/ActivityKeyer/useGetActivityByKey';
2
+
3
+ export default useGetActivityByKey;
@@ -0,0 +1,3 @@
1
+ import useGetHasAcknowledgedByActivityKey from '../providers/ActivityAcknowledgement/useGetHasAcknowledgedByActivityKey';
2
+
3
+ export default useGetHasAcknowledgedByActivityKey;
@@ -0,0 +1,3 @@
1
+ import useGetKeyByActivity from '../providers/ActivityKeyer/useGetKeyByActivity';
2
+
3
+ export default useGetKeyByActivity;
@@ -0,0 +1,3 @@
1
+ import useGetKeyByActivityId from '../providers/ActivityKeyer/useGetKeyByActivityId';
2
+
3
+ export default useGetKeyByActivityId;