botframework-webchat 4.13.0 → 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 (260) hide show
  1. package/.eslintrc.yml +5 -104
  2. package/.prettierrc.yml +1 -1
  3. package/README.md +33 -36
  4. package/babel.config.json +2 -2
  5. package/babel.sanitize-html.config.json +10 -0
  6. package/lib/AddFullBundle.d.ts +30 -0
  7. package/lib/AddFullBundle.d.ts.map +1 -0
  8. package/lib/AddFullBundle.js +76 -0
  9. package/lib/FullComposer.d.ts +8 -0
  10. package/lib/FullComposer.d.ts.map +1 -0
  11. package/lib/FullComposer.js +6 -16
  12. package/lib/FullReactWebChat.d.ts +8 -0
  13. package/lib/FullReactWebChat.d.ts.map +1 -0
  14. package/lib/FullReactWebChat.js +8 -23
  15. package/lib/adaptiveCards/AdaptiveCardsComposer.d.ts +10 -0
  16. package/lib/adaptiveCards/AdaptiveCardsComposer.d.ts.map +1 -0
  17. package/lib/adaptiveCards/AdaptiveCardsComposer.js +6 -2
  18. package/lib/adaptiveCards/AdaptiveCardsContext.d.ts +8 -0
  19. package/lib/adaptiveCards/AdaptiveCardsContext.d.ts.map +1 -0
  20. package/lib/adaptiveCards/AdaptiveCardsContext.js +3 -3
  21. package/lib/adaptiveCards/AdaptiveCardsStyleOptions.d.ts +5 -3
  22. package/lib/adaptiveCards/AdaptiveCardsStyleOptions.d.ts.map +1 -1
  23. package/lib/adaptiveCards/AdaptiveCardsStyleSet.d.ts +7 -0
  24. package/lib/adaptiveCards/AdaptiveCardsStyleSet.d.ts.map +1 -0
  25. package/lib/{FullBundleStyleOptions.js → adaptiveCards/AdaptiveCardsStyleSet.js} +0 -0
  26. package/lib/adaptiveCards/Attachment/AdaptiveCardAttachment.d.ts +9 -0
  27. package/lib/adaptiveCards/Attachment/AdaptiveCardAttachment.d.ts.map +1 -0
  28. package/lib/adaptiveCards/Attachment/AdaptiveCardAttachment.js +1 -1
  29. package/lib/adaptiveCards/Attachment/AdaptiveCardBuilder.d.ts +28 -0
  30. package/lib/adaptiveCards/Attachment/AdaptiveCardBuilder.d.ts.map +1 -0
  31. package/lib/adaptiveCards/Attachment/AdaptiveCardBuilder.js +13 -6
  32. package/lib/adaptiveCards/Attachment/AdaptiveCardContent.d.ts +9 -0
  33. package/lib/adaptiveCards/Attachment/AdaptiveCardContent.d.ts.map +1 -0
  34. package/lib/adaptiveCards/Attachment/AdaptiveCardContent.js +8 -4
  35. package/lib/adaptiveCards/Attachment/AdaptiveCardRenderer.d.ts +12 -0
  36. package/lib/adaptiveCards/Attachment/AdaptiveCardRenderer.d.ts.map +1 -0
  37. package/lib/adaptiveCards/Attachment/AdaptiveCardRenderer.js +310 -85
  38. package/lib/adaptiveCards/Attachment/AnimationCardContent.d.ts +10 -0
  39. package/lib/adaptiveCards/Attachment/AnimationCardContent.d.ts.map +1 -0
  40. package/lib/adaptiveCards/Attachment/AnimationCardContent.js +1 -1
  41. package/lib/adaptiveCards/Attachment/AudioCardContent.d.ts +10 -0
  42. package/lib/adaptiveCards/Attachment/AudioCardContent.d.ts.map +1 -0
  43. package/lib/adaptiveCards/Attachment/AudioCardContent.js +1 -1
  44. package/lib/adaptiveCards/Attachment/CommonCard.js +11 -6
  45. package/lib/adaptiveCards/Attachment/HeroCardContent.d.ts +10 -0
  46. package/lib/adaptiveCards/Attachment/HeroCardContent.d.ts.map +1 -0
  47. package/lib/adaptiveCards/Attachment/HeroCardContent.js +11 -6
  48. package/lib/adaptiveCards/Attachment/OAuthCardContent.d.ts +10 -0
  49. package/lib/adaptiveCards/Attachment/OAuthCardContent.d.ts.map +1 -0
  50. package/lib/adaptiveCards/Attachment/OAuthCardContent.js +11 -6
  51. package/lib/adaptiveCards/Attachment/ReceiptCardContent.d.ts +10 -0
  52. package/lib/adaptiveCards/Attachment/ReceiptCardContent.d.ts.map +1 -0
  53. package/lib/adaptiveCards/Attachment/ReceiptCardContent.js +11 -6
  54. package/lib/adaptiveCards/Attachment/SignInCardContent.d.ts +10 -0
  55. package/lib/adaptiveCards/Attachment/SignInCardContent.d.ts.map +1 -0
  56. package/lib/adaptiveCards/Attachment/SignInCardContent.js +1 -1
  57. package/lib/adaptiveCards/Attachment/ThumbnailCardContent.d.ts +10 -0
  58. package/lib/adaptiveCards/Attachment/ThumbnailCardContent.d.ts.map +1 -0
  59. package/lib/adaptiveCards/Attachment/ThumbnailCardContent.js +11 -6
  60. package/lib/adaptiveCards/Attachment/VideoCardContent.d.ts +20 -0
  61. package/lib/adaptiveCards/Attachment/VideoCardContent.d.ts.map +1 -0
  62. package/lib/adaptiveCards/Attachment/VideoCardContent.js +7 -5
  63. package/lib/adaptiveCards/AttachmentForScreenReader/AdaptiveCardAttachment.js +7 -3
  64. package/lib/adaptiveCards/AttachmentForScreenReader/RichCardAttachment.js +1 -1
  65. package/lib/adaptiveCards/Styles/StyleSet/AdaptiveCardRenderer.d.ts +59 -0
  66. package/lib/adaptiveCards/Styles/StyleSet/AdaptiveCardRenderer.d.ts.map +1 -0
  67. package/lib/adaptiveCards/Styles/StyleSet/AdaptiveCardRenderer.js +8 -1
  68. package/lib/adaptiveCards/Styles/adaptiveCardHostConfig.d.ts +126 -0
  69. package/lib/adaptiveCards/Styles/adaptiveCardHostConfig.d.ts.map +1 -0
  70. package/lib/adaptiveCards/Styles/adaptiveCardHostConfig.js +29 -9
  71. package/lib/adaptiveCards/Styles/createAdaptiveCardsStyleSet.d.ts +5 -0
  72. package/lib/adaptiveCards/Styles/createAdaptiveCardsStyleSet.d.ts.map +1 -0
  73. package/lib/adaptiveCards/Styles/createAdaptiveCardsStyleSet.js +2 -2
  74. package/lib/adaptiveCards/createAdaptiveCardsAttachmentForScreenReaderMiddleware.d.ts +3 -0
  75. package/lib/adaptiveCards/createAdaptiveCardsAttachmentForScreenReaderMiddleware.d.ts.map +1 -0
  76. package/lib/adaptiveCards/createAdaptiveCardsAttachmentForScreenReaderMiddleware.js +5 -11
  77. package/lib/adaptiveCards/createAdaptiveCardsAttachmentMiddleware.d.ts +3 -0
  78. package/lib/adaptiveCards/createAdaptiveCardsAttachmentMiddleware.d.ts.map +1 -0
  79. package/lib/adaptiveCards/createAdaptiveCardsAttachmentMiddleware.js +2 -15
  80. package/lib/adaptiveCards/defaultStyleOptions.d.ts +4 -0
  81. package/lib/adaptiveCards/defaultStyleOptions.d.ts.map +1 -0
  82. package/lib/adaptiveCards/defaultStyleOptions.js +3 -2
  83. package/lib/adaptiveCards/hooks/internal/useAdaptiveCardsContext.d.ts +3 -0
  84. package/lib/adaptiveCards/hooks/internal/useAdaptiveCardsContext.d.ts.map +1 -0
  85. package/lib/adaptiveCards/hooks/internal/useAdaptiveCardsContext.js +1 -1
  86. package/lib/adaptiveCards/hooks/internal/useParseAdaptiveCardJSON.d.ts +2 -0
  87. package/lib/adaptiveCards/hooks/internal/useParseAdaptiveCardJSON.d.ts.map +1 -0
  88. package/lib/adaptiveCards/hooks/internal/useParseAdaptiveCardJSON.js +7 -5
  89. package/lib/adaptiveCards/hooks/internal/useUniqueId.js +1 -1
  90. package/lib/adaptiveCards/hooks/useAdaptiveCardsHostConfig.d.ts +2 -0
  91. package/lib/adaptiveCards/hooks/useAdaptiveCardsHostConfig.d.ts.map +1 -0
  92. package/lib/adaptiveCards/hooks/useAdaptiveCardsHostConfig.js +3 -5
  93. package/lib/adaptiveCards/hooks/useAdaptiveCardsPackage.d.ts +3 -0
  94. package/lib/adaptiveCards/hooks/useAdaptiveCardsPackage.d.ts.map +1 -0
  95. package/lib/adaptiveCards/hooks/useAdaptiveCardsPackage.js +1 -1
  96. package/lib/adaptiveCards/normalizeStyleOptions.d.ts +3 -0
  97. package/lib/adaptiveCards/normalizeStyleOptions.d.ts.map +1 -0
  98. package/lib/adaptiveCards/normalizeStyleOptions.js +1 -1
  99. package/lib/addVersion.js +2 -2
  100. package/lib/createBrowserWebSpeechPonyfillFactory.d.ts +3 -0
  101. package/lib/createBrowserWebSpeechPonyfillFactory.d.ts.map +1 -0
  102. package/lib/createBrowserWebSpeechPonyfillFactory.js +7 -4
  103. package/lib/createCognitiveServicesSpeechServicesPonyfillFactory.d.ts +17 -0
  104. package/lib/createCognitiveServicesSpeechServicesPonyfillFactory.d.ts.map +1 -0
  105. package/lib/createCognitiveServicesSpeechServicesPonyfillFactory.js +17 -11
  106. package/lib/createDirectLine.d.ts +17 -0
  107. package/lib/createDirectLine.d.ts.map +1 -0
  108. package/lib/createDirectLine.js +3 -2
  109. package/lib/createDirectLineAppServiceExtension.d.ts +7 -0
  110. package/lib/createDirectLineAppServiceExtension.d.ts.map +1 -0
  111. package/lib/createDirectLineAppServiceExtension.js +1 -1
  112. package/lib/createDirectLineSpeechAdapters.d.ts +25 -0
  113. package/lib/createDirectLineSpeechAdapters.d.ts.map +1 -0
  114. package/lib/createDirectLineSpeechAdapters.js +57 -3
  115. package/lib/createFullStyleSet.d.ts +1375 -0
  116. package/lib/createFullStyleSet.d.ts.map +1 -0
  117. package/lib/createFullStyleSet.js +2 -2
  118. package/lib/fullBundleDefaultStyleOptions.js +4 -4
  119. package/lib/hooks/useStyleOptions.d.ts +3 -0
  120. package/lib/hooks/useStyleOptions.d.ts.map +1 -0
  121. package/lib/hooks/useStyleOptions.js +21 -0
  122. package/lib/index-es5.d.ts +4 -20
  123. package/lib/index-es5.d.ts.map +1 -1
  124. package/lib/index-es5.js +3 -43
  125. package/lib/index-minimal.d.ts +9 -6
  126. package/lib/index-minimal.d.ts.map +1 -1
  127. package/lib/index-minimal.js +27 -21
  128. package/lib/index.d.ts +164 -18
  129. package/lib/index.d.ts.map +1 -1
  130. package/lib/index.js +19 -12
  131. package/lib/polyfill.d.ts +23 -0
  132. package/lib/polyfill.d.ts.map +1 -0
  133. package/lib/polyfill.js +46 -0
  134. package/lib/renderMarkdown.d.ts +6 -0
  135. package/lib/renderMarkdown.d.ts.map +1 -0
  136. package/lib/renderMarkdown.js +36 -5
  137. package/lib/renderWebChat.d.ts +3 -0
  138. package/lib/renderWebChat.d.ts.map +1 -0
  139. package/lib/renderWebChat.js +1 -1
  140. package/lib/speech/CustomAudioInputStream.d.ts +94 -0
  141. package/lib/speech/CustomAudioInputStream.d.ts.map +1 -0
  142. package/lib/speech/CustomAudioInputStream.js +441 -0
  143. package/lib/speech/bytesPerSample.d.ts +2 -0
  144. package/lib/speech/bytesPerSample.d.ts.map +1 -0
  145. package/lib/speech/bytesPerSample.js +12 -0
  146. package/lib/speech/createAudioConfig.d.ts +23 -0
  147. package/lib/speech/createAudioConfig.d.ts.map +1 -0
  148. package/lib/speech/createAudioConfig.js +90 -0
  149. package/lib/speech/createAudioContext.d.ts +3 -0
  150. package/lib/speech/createAudioContext.d.ts.map +1 -0
  151. package/lib/speech/createAudioContext.js +22 -0
  152. package/lib/speech/createMicrophoneAudioConfigAndAudioContext.d.ts +9 -0
  153. package/lib/speech/createMicrophoneAudioConfigAndAudioContext.d.ts.map +1 -0
  154. package/lib/speech/createMicrophoneAudioConfigAndAudioContext.js +161 -0
  155. package/lib/speech/getUserMedia.d.ts +2 -0
  156. package/lib/speech/getUserMedia.d.ts.map +1 -0
  157. package/lib/speech/getUserMedia.js +25 -0
  158. package/lib/types/AdaptiveCardsPackage.d.ts +13 -0
  159. package/lib/types/AdaptiveCardsPackage.d.ts.map +1 -0
  160. package/lib/types/AdaptiveCardsPackage.js +2 -0
  161. package/lib/types/CognitiveServicesAudioOutputFormat.d.ts +3 -0
  162. package/lib/types/CognitiveServicesAudioOutputFormat.d.ts.map +1 -0
  163. package/lib/types/CognitiveServicesAudioOutputFormat.js +2 -0
  164. package/lib/types/CognitiveServicesCredentials.d.ts +18 -0
  165. package/lib/types/CognitiveServicesCredentials.d.ts.map +1 -0
  166. package/lib/types/CognitiveServicesCredentials.js +2 -0
  167. package/lib/types/CognitiveServicesTextNormalization.d.ts +3 -0
  168. package/lib/types/CognitiveServicesTextNormalization.d.ts.map +1 -0
  169. package/lib/types/CognitiveServicesTextNormalization.js +2 -0
  170. package/lib/{FullBundleStyleOptions.d.ts → types/FullBundleStyleOptions.d.ts} +1 -1
  171. package/lib/types/FullBundleStyleOptions.d.ts.map +1 -0
  172. package/lib/types/FullBundleStyleOptions.js +2 -0
  173. package/lib/useComposerProps.d.ts +22 -0
  174. package/lib/useComposerProps.d.ts.map +1 -0
  175. package/lib/useComposerProps.js +6 -8
  176. package/package.json +46 -48
  177. package/src/AddFullBundle.tsx +93 -0
  178. package/src/FullComposer.tsx +38 -0
  179. package/src/FullReactWebChat.tsx +32 -0
  180. package/src/__tests__/createDirectLine.spec.js +2 -0
  181. package/src/__tests__/renderMarkdown.spec.js +1 -1
  182. package/src/__tests__/versionTag.es5.spec.js +3 -0
  183. package/src/__tests__/versionTag.full.spec.js +3 -0
  184. package/src/__tests__/versionTag.minimal.spec.js +3 -0
  185. package/src/adaptiveCards/{AdaptiveCardsComposer.js → AdaptiveCardsComposer.tsx} +17 -5
  186. package/src/adaptiveCards/AdaptiveCardsContext.ts +12 -0
  187. package/src/adaptiveCards/AdaptiveCardsStyleOptions.ts +5 -3
  188. package/src/adaptiveCards/AdaptiveCardsStyleSet.ts +7 -0
  189. package/src/adaptiveCards/Attachment/{AdaptiveCardAttachment.js → AdaptiveCardAttachment.tsx} +8 -2
  190. package/src/adaptiveCards/Attachment/AdaptiveCardBuilder.ts +27 -17
  191. package/src/adaptiveCards/Attachment/{AdaptiveCardContent.js → AdaptiveCardContent.tsx} +8 -2
  192. package/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx +768 -0
  193. package/src/adaptiveCards/Attachment/{AnimationCardContent.js → AnimationCardContent.tsx} +9 -2
  194. package/src/adaptiveCards/Attachment/{AudioCardContent.js → AudioCardContent.tsx} +9 -2
  195. package/src/adaptiveCards/Attachment/CommonCard.js +2 -1
  196. package/src/adaptiveCards/Attachment/{HeroCardContent.js → HeroCardContent.tsx} +12 -3
  197. package/src/adaptiveCards/Attachment/{OAuthCardContent.js → OAuthCardContent.tsx} +11 -3
  198. package/src/adaptiveCards/Attachment/{ReceiptCardContent.js → ReceiptCardContent.tsx} +58 -28
  199. package/src/adaptiveCards/Attachment/{SignInCardContent.js → SignInCardContent.tsx} +9 -2
  200. package/src/adaptiveCards/Attachment/{ThumbnailCardContent.js → ThumbnailCardContent.tsx} +12 -3
  201. package/src/adaptiveCards/Attachment/{VideoCardContent.js → VideoCardContent.tsx} +15 -3
  202. package/src/adaptiveCards/Styles/StyleSet/AdaptiveCardRenderer.ts +9 -1
  203. package/src/adaptiveCards/Styles/adaptiveCardHostConfig.ts +28 -8
  204. package/src/adaptiveCards/Styles/createAdaptiveCardsStyleSet.spec.js +2 -0
  205. package/src/adaptiveCards/Styles/createAdaptiveCardsStyleSet.ts +7 -4
  206. package/src/adaptiveCards/{createAdaptiveCardsAttachmentForScreenReaderMiddleware.js → createAdaptiveCardsAttachmentForScreenReaderMiddleware.tsx} +16 -15
  207. package/src/adaptiveCards/createAdaptiveCardsAttachmentMiddleware.tsx +44 -0
  208. package/src/adaptiveCards/defaultStyleOptions.ts +2 -1
  209. package/src/adaptiveCards/hooks/internal/{useAdaptiveCardsContext.js → useAdaptiveCardsContext.ts} +1 -1
  210. package/src/adaptiveCards/hooks/internal/{useParseAdaptiveCardJSON.js → useParseAdaptiveCardJSON.ts} +5 -2
  211. package/src/adaptiveCards/hooks/internal/{useUniqueId.js → useUniqueId.ts} +1 -1
  212. package/src/adaptiveCards/hooks/{useAdaptiveCardsHostConfig.js → useAdaptiveCardsHostConfig.ts} +6 -8
  213. package/src/adaptiveCards/hooks/{useAdaptiveCardsPackage.js → useAdaptiveCardsPackage.ts} +2 -1
  214. package/src/createBrowserWebSpeechPonyfillFactory.ts +21 -0
  215. package/src/createCognitiveServicesSpeechServicesPonyfillFactory.spec.js +36 -6
  216. package/src/createCognitiveServicesSpeechServicesPonyfillFactory.ts +78 -0
  217. package/src/createDirectLine.ts +65 -0
  218. package/src/createDirectLineAppServiceExtension.ts +22 -0
  219. package/src/createDirectLineSpeechAdapters.ts +84 -0
  220. package/src/createFullStyleSet.ts +2 -2
  221. package/src/fullBundleDefaultStyleOptions.ts +3 -3
  222. package/src/hooks/useStyleOptions.ts +9 -0
  223. package/src/index-es5.ts +3 -28
  224. package/src/index-minimal.ts +3 -2
  225. package/src/index.ts +22 -10
  226. package/src/polyfill.ts +29 -0
  227. package/src/renderMarkdown.ts +140 -0
  228. package/src/renderWebChat.tsx +6 -0
  229. package/src/speech/CustomAudioInputStream.ts +356 -0
  230. package/src/speech/bytesPerSample.ts +4 -0
  231. package/src/speech/createAudioConfig.spec.js +23 -0
  232. package/src/speech/createAudioConfig.ts +77 -0
  233. package/src/speech/createAudioContext.ts +16 -0
  234. package/src/speech/createMicrophoneAudioConfigAndAudioContext.ts +146 -0
  235. package/src/speech/getUserMedia.ts +14 -0
  236. package/src/tsconfig.json +1 -1
  237. package/src/types/AdaptiveCardsPackage.ts +23 -0
  238. package/src/types/CognitiveServicesAudioOutputFormat.ts +28 -0
  239. package/src/types/CognitiveServicesCredentials.ts +28 -0
  240. package/src/types/CognitiveServicesTextNormalization.ts +3 -0
  241. package/src/{FullBundleStyleOptions.ts → types/FullBundleStyleOptions.ts} +1 -1
  242. package/src/{useComposerProps.js → useComposerProps.ts} +21 -11
  243. package/webpack.config.js +46 -6
  244. package/.eslintignore +0 -9
  245. package/lib/FullBundleStyleOptions.d.ts.map +0 -1
  246. package/src/FullComposer.js +0 -40
  247. package/src/FullReactWebChat.js +0 -47
  248. package/src/adaptiveCards/AdaptiveCardsContext.js +0 -5
  249. package/src/adaptiveCards/Attachment/AdaptiveCardRenderer.js +0 -492
  250. package/src/adaptiveCards/createAdaptiveCardsAttachmentMiddleware.js +0 -41
  251. package/src/createBrowserWebSpeechPonyfillFactory.js +0 -16
  252. package/src/createCognitiveServicesSpeechServicesPonyfillFactory.js +0 -58
  253. package/src/createDirectLine.js +0 -38
  254. package/src/createDirectLineAppServiceExtension.js +0 -12
  255. package/src/createDirectLineSpeechAdapters.js +0 -5
  256. package/src/index-es5.tsx +0 -49
  257. package/src/index-minimal.tsx +0 -9
  258. package/src/index.tsx +0 -45
  259. package/src/renderMarkdown.js +0 -97
  260. package/src/renderWebChat.js +0 -6
@@ -1,15 +1,22 @@
1
1
  /* eslint react/no-array-index-key: "off" */
2
2
 
3
+ import { DirectLineAnimationCard } from 'botframework-webchat-core';
3
4
  import { Components, hooks } from 'botframework-webchat-component';
4
5
  import PropTypes from 'prop-types';
5
- import React from 'react';
6
+ import React, { FC } from 'react';
6
7
 
7
8
  import CommonCard from './CommonCard';
8
9
 
9
10
  const { ImageContent, VideoContent } = Components;
10
11
  const { useStyleSet } = hooks;
11
12
 
12
- const AnimationCardContent = ({ actionPerformedClassName, content, disabled }) => {
13
+ type AnimationCardContentProps = {
14
+ actionPerformedClassName?: string;
15
+ content: DirectLineAnimationCard;
16
+ disabled?: boolean;
17
+ };
18
+
19
+ const AnimationCardContent: FC<AnimationCardContentProps> = ({ actionPerformedClassName, content, disabled }) => {
13
20
  const { media = [] } = content;
14
21
  const [{ animationCardAttachment: animationCardAttachmentStyleSet }] = useStyleSet();
15
22
 
@@ -1,15 +1,22 @@
1
1
  /* eslint react/no-array-index-key: "off" */
2
2
 
3
+ import { DirectLineAudioCard } from 'botframework-webchat-core';
3
4
  import { Components, hooks } from 'botframework-webchat-component';
4
5
  import PropTypes from 'prop-types';
5
- import React from 'react';
6
+ import React, { FC } from 'react';
6
7
 
7
8
  import CommonCard from './CommonCard';
8
9
 
9
10
  const { AudioContent } = Components;
10
11
  const { useStyleSet } = hooks;
11
12
 
12
- const AudioCardContent = ({ actionPerformedClassName, content, disabled }) => {
13
+ type AudioCardContentProps = {
14
+ actionPerformedClassName?: string;
15
+ content: DirectLineAudioCard;
16
+ disabled?: boolean;
17
+ };
18
+
19
+ const AudioCardContent: FC<AudioCardContentProps> = ({ actionPerformedClassName, content, disabled }) => {
13
20
  const [{ audioCardAttachment: audioCardAttachmentStyleSet }] = useStyleSet();
14
21
  const { autostart = false, autoloop = false, image: { url: imageURL = '' } = {}, media = [] } = content;
15
22
 
@@ -6,8 +6,9 @@ import { hooks } from 'botframework-webchat-component';
6
6
  import AdaptiveCardBuilder from './AdaptiveCardBuilder';
7
7
  import AdaptiveCardRenderer from './AdaptiveCardRenderer';
8
8
  import useAdaptiveCardsPackage from '../hooks/useAdaptiveCardsPackage';
9
+ import useStyleOptions from '../../hooks/useStyleOptions';
9
10
 
10
- const { useDirection, useStyleOptions } = hooks;
11
+ const { useDirection } = hooks;
11
12
 
12
13
  const CommonCard = ({ actionPerformedClassName, content, disabled }) => {
13
14
  const [adaptiveCardsPackage] = useAdaptiveCardsPackage();
@@ -1,17 +1,26 @@
1
+ import { DirectLineHeroCard } from 'botframework-webchat-core';
1
2
  import { hooks } from 'botframework-webchat-component';
2
3
  import PropTypes from 'prop-types';
3
- import React, { useMemo } from 'react';
4
+ import React, { FC, useMemo } from 'react';
4
5
 
5
6
  import AdaptiveCardBuilder from './AdaptiveCardBuilder';
6
7
  import AdaptiveCardRenderer from './AdaptiveCardRenderer';
7
8
  import useAdaptiveCardsPackage from '../hooks/useAdaptiveCardsPackage';
9
+ import useStyleOptions from '../../hooks/useStyleOptions';
8
10
 
9
- const { useDirection, useStyleOptions } = hooks;
11
+ const { useDirection } = hooks;
10
12
 
11
- const HeroCardContent = ({ actionPerformedClassName, content, disabled }) => {
13
+ type HeroCardContentProps = {
14
+ actionPerformedClassName?: string;
15
+ content: DirectLineHeroCard;
16
+ disabled?: boolean;
17
+ };
18
+
19
+ const HeroCardContent: FC<HeroCardContentProps> = ({ actionPerformedClassName, content, disabled }) => {
12
20
  const [adaptiveCardsPackage] = useAdaptiveCardsPackage();
13
21
  const [styleOptions] = useStyleOptions();
14
22
  const [direction] = useDirection();
23
+
15
24
  const builtCard = useMemo(() => {
16
25
  const builder = new AdaptiveCardBuilder(adaptiveCardsPackage, styleOptions, direction);
17
26
 
@@ -1,14 +1,22 @@
1
+ import { DirectLineOAuthCard } from 'botframework-webchat-core';
1
2
  import { hooks } from 'botframework-webchat-component';
2
3
  import PropTypes from 'prop-types';
3
- import React, { useMemo } from 'react';
4
+ import React, { FC, useMemo } from 'react';
4
5
 
5
6
  import AdaptiveCardBuilder from './AdaptiveCardBuilder';
6
7
  import AdaptiveCardRenderer from './AdaptiveCardRenderer';
7
8
  import useAdaptiveCardsPackage from '../hooks/useAdaptiveCardsPackage';
9
+ import useStyleOptions from '../../hooks/useStyleOptions';
8
10
 
9
- const { useDirection, useStyleOptions } = hooks;
11
+ const { useDirection } = hooks;
10
12
 
11
- const OAuthCardContent = ({ actionPerformedClassName, content, disabled }) => {
13
+ type OAuthCardContentProps = {
14
+ actionPerformedClassName?: string;
15
+ content: DirectLineOAuthCard;
16
+ disabled?: boolean;
17
+ };
18
+
19
+ const OAuthCardContent: FC<OAuthCardContentProps> = ({ actionPerformedClassName, content, disabled }) => {
12
20
  const [adaptiveCardsPackage] = useAdaptiveCardsPackage();
13
21
  const [direction] = useDirection();
14
22
  const [styleOptions] = useStyleOptions();
@@ -1,20 +1,28 @@
1
1
  /* eslint no-magic-numbers: ["error", { "ignore": [0, 1, 10, 15, 25, 50, 75] }] */
2
2
 
3
+ import { DirectLineReceiptCard } from 'botframework-webchat-core';
3
4
  import { hooks } from 'botframework-webchat-component';
4
5
  import PropTypes from 'prop-types';
5
- import React, { useMemo } from 'react';
6
+ import React, { FC, useMemo } from 'react';
6
7
 
7
8
  import AdaptiveCardBuilder from './AdaptiveCardBuilder';
8
9
  import AdaptiveCardRenderer from './AdaptiveCardRenderer';
9
10
  import useAdaptiveCardsPackage from '../hooks/useAdaptiveCardsPackage';
11
+ import useStyleOptions from '../../hooks/useStyleOptions';
10
12
 
11
- const { useDirection, useLocalizer, useStyleOptions } = hooks;
13
+ const { useDirection, useLocalizer } = hooks;
12
14
 
13
15
  function nullOrUndefined(obj) {
14
16
  return obj === null || typeof obj === 'undefined';
15
17
  }
16
18
 
17
- const ReceiptCardContent = ({ actionPerformedClassName, content, disabled }) => {
19
+ type ReceiptCardContentProps = {
20
+ actionPerformedClassName?: string;
21
+ content: DirectLineReceiptCard;
22
+ disabled?: boolean;
23
+ };
24
+
25
+ const ReceiptCardContent: FC<ReceiptCardContentProps> = ({ actionPerformedClassName, content, disabled }) => {
18
26
  const [adaptiveCardsPackage] = useAdaptiveCardsPackage();
19
27
  const [direction] = useDirection();
20
28
  const [styleOptions] = useStyleOptions();
@@ -47,32 +55,54 @@ const ReceiptCardContent = ({ actionPerformedClassName, content, disabled }) =>
47
55
  }
48
56
 
49
57
  items &&
50
- items.map(({ image: { alt, tap: imageTap, url } = {}, price, quantity, subtitle, tap, text, title }) => {
51
- let itemColumns;
52
-
53
- if (url) {
54
- const [itemImageColumn, ...columns] = builder.addColumnSet([15, 75, 10]);
55
-
56
- itemColumns = columns;
57
- builder.addImage(url, itemImageColumn, imageTap, alt);
58
- } else {
59
- itemColumns = builder.addColumnSet([75, 25], undefined, tap && tap);
60
- }
61
-
62
- const [itemTitleColumn, itemPriceColumn] = itemColumns;
63
-
64
- builder.addTextBlock(
65
- quantity ? `${title} &times; ${quantity}` : title,
66
- { size: TextSize.Medium, weight: TextWeight.Bolder, wrap: richCardWrapTitle },
67
- itemTitleColumn
68
- );
69
- builder.addTextBlock(subtitle, { size: TextSize.Medium, wrap: richCardWrapTitle }, itemTitleColumn);
70
- builder.addTextBlock(price, { horizontalAlignment: HorizontalAlignment.Right }, itemPriceColumn);
71
-
72
- if (text) {
73
- builder.addTextBlock(text, { size: TextSize.Medium, wrap: richCardWrapTitle }, itemTitleColumn);
58
+ items.map(
59
+ ({
60
+ image: { alt, tap: imageTap, url } = {},
61
+ price,
62
+ quantity,
63
+ subtitle,
64
+ tap,
65
+ text,
66
+ title
67
+ }: {
68
+ image: {
69
+ alt?: string;
70
+ tap?: any;
71
+ url?: string;
72
+ };
73
+ price: string;
74
+ quantity: string;
75
+ subtitle: string;
76
+ tap: any;
77
+ text: string;
78
+ title: string;
79
+ }) => {
80
+ let itemColumns;
81
+
82
+ if (url) {
83
+ const [itemImageColumn, ...columns] = builder.addColumnSet([15, 75, 10]);
84
+
85
+ itemColumns = columns;
86
+ builder.addImage(url, itemImageColumn, imageTap, alt);
87
+ } else {
88
+ itemColumns = builder.addColumnSet([75, 25], undefined, tap && tap);
89
+ }
90
+
91
+ const [itemTitleColumn, itemPriceColumn] = itemColumns;
92
+
93
+ builder.addTextBlock(
94
+ quantity ? `${title} &times; ${quantity}` : title,
95
+ { size: TextSize.Medium, weight: TextWeight.Bolder, wrap: richCardWrapTitle },
96
+ itemTitleColumn
97
+ );
98
+ builder.addTextBlock(subtitle, { size: TextSize.Medium, wrap: richCardWrapTitle }, itemTitleColumn);
99
+ builder.addTextBlock(price, { horizontalAlignment: HorizontalAlignment.Right }, itemPriceColumn);
100
+
101
+ if (text) {
102
+ builder.addTextBlock(text, { size: TextSize.Medium, wrap: richCardWrapTitle }, itemTitleColumn);
103
+ }
74
104
  }
75
- });
105
+ );
76
106
 
77
107
  if (!nullOrUndefined(vat)) {
78
108
  const vatCol = builder.addColumnSet([75, 25]);
@@ -1,12 +1,19 @@
1
+ import { DirectLineSignInCard } from 'botframework-webchat-core';
1
2
  import { hooks } from 'botframework-webchat-component';
2
3
  import PropTypes from 'prop-types';
3
- import React from 'react';
4
+ import React, { FC } from 'react';
4
5
 
5
6
  import CommonCard from './CommonCard';
6
7
 
7
8
  const { useStyleSet } = hooks;
8
9
 
9
- const SignInCardContent = ({ actionPerformedClassName, content, disabled }) => {
10
+ type SignInCardContentProps = {
11
+ actionPerformedClassName?: string;
12
+ content: DirectLineSignInCard;
13
+ disabled?: boolean;
14
+ };
15
+
16
+ const SignInCardContent: FC<SignInCardContentProps> = ({ actionPerformedClassName, content, disabled }) => {
10
17
  const [{ animationCardAttachment: animationCardAttachmentStyleSet }] = useStyleSet();
11
18
 
12
19
  return (
@@ -1,19 +1,28 @@
1
1
  /* eslint no-magic-numbers: ["error", { "ignore": [25, 75] }] */
2
2
 
3
+ import { DirectLineThumbnailCard } from 'botframework-webchat-core';
3
4
  import { hooks } from 'botframework-webchat-component';
4
5
  import PropTypes from 'prop-types';
5
- import React, { useMemo } from 'react';
6
+ import React, { FC, useMemo } from 'react';
6
7
 
7
8
  import AdaptiveCardBuilder from './AdaptiveCardBuilder';
8
9
  import AdaptiveCardRenderer from './AdaptiveCardRenderer';
9
10
  import useAdaptiveCardsPackage from '../hooks/useAdaptiveCardsPackage';
11
+ import useStyleOptions from '../../hooks/useStyleOptions';
10
12
 
11
- const { useDirection, useStyleOptions } = hooks;
13
+ const { useDirection } = hooks;
12
14
 
13
- const ThumbnailCardContent = ({ actionPerformedClassName, content, disabled }) => {
15
+ type ThumbnailCardContentProps = {
16
+ actionPerformedClassName?: string;
17
+ content: DirectLineThumbnailCard;
18
+ disabled?: boolean;
19
+ };
20
+
21
+ const ThumbnailCardContent: FC<ThumbnailCardContentProps> = ({ actionPerformedClassName, content, disabled }) => {
14
22
  const [adaptiveCardsPackage] = useAdaptiveCardsPackage();
15
23
  const [direction] = useDirection();
16
24
  const [styleOptions] = useStyleOptions();
25
+
17
26
  const builtCard = useMemo(() => {
18
27
  if (content) {
19
28
  const builder = new AdaptiveCardBuilder(adaptiveCardsPackage, styleOptions, direction);
@@ -1,16 +1,28 @@
1
1
  /* eslint react/no-array-index-key: "off" */
2
2
 
3
+ import { DirectLineVideoCard } from 'botframework-webchat-core';
3
4
  import { Components, hooks } from 'botframework-webchat-component';
4
5
  import PropTypes from 'prop-types';
5
- import React from 'react';
6
+ import React, { FC } from 'react';
6
7
 
7
8
  import CommonCard from './CommonCard';
8
9
 
9
10
  const { useStyleSet } = hooks;
10
11
  const { VideoContent } = Components;
11
12
 
12
- const VideoCardContent = ({ actionPerformedClassName, content, disabled }) => {
13
- const { media, autostart, autoloop, image: { url: imageURL } = {} } = content;
13
+ type VideoCardContentProps = {
14
+ actionPerformedClassName?: string;
15
+ content: DirectLineVideoCard & {
16
+ autoloop?: boolean;
17
+ autostart?: boolean;
18
+ image?: { url?: string };
19
+ media?: { profile?: string; url?: string }[];
20
+ };
21
+ disabled?: boolean;
22
+ };
23
+
24
+ const VideoCardContent: FC<VideoCardContentProps> = ({ actionPerformedClassName, content, disabled }) => {
25
+ const { autoloop, autostart, image: { url: imageURL } = { url: undefined }, media } = content;
14
26
  const [{ audioCardAttachment: audioCardAttachmentStyleSet }] = useStyleSet();
15
27
 
16
28
  return (
@@ -1,4 +1,4 @@
1
- import FullBundleStyleOptions from '../../../FullBundleStyleOptions';
1
+ import FullBundleStyleOptions from '../../../types/FullBundleStyleOptions';
2
2
 
3
3
  export default function ({
4
4
  cardPushButtonBackgroundColor,
@@ -9,6 +9,14 @@ export default function ({
9
9
  }: FullBundleStyleOptions) {
10
10
  return {
11
11
  '&.webchat__adaptive-card-renderer': {
12
+ // Related to #4075.
13
+ // Adaptive Cards assume its host is in "forced border-box" mode.
14
+ // In CSS, the default is "content-box" mode.
15
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing#values
16
+ '& *': {
17
+ boxSizing: 'border-box'
18
+ },
19
+
12
20
  '& .ac-input, & .ac-inlineActionButton, & .ac-quickActionButton': {
13
21
  fontFamily: primaryFont
14
22
  },
@@ -1,6 +1,6 @@
1
1
  import { normalizeStyleOptions } from 'botframework-webchat-api';
2
2
 
3
- import FullBundleStyleOptions from '../../FullBundleStyleOptions';
3
+ import FullBundleStyleOptions from '../../types/FullBundleStyleOptions';
4
4
  import normalizeAdaptiveCardsStyleOptions from '../normalizeStyleOptions';
5
5
 
6
6
  // https://docs.microsoft.com/en-us/adaptive-cards/rendering-cards/host-config
@@ -21,7 +21,27 @@ export default function createAdaptiveCardsHostConfig(styleOptions: FullBundleSt
21
21
  },
22
22
  accent: {
23
23
  default: accent,
24
- subtle: accent
24
+ subtle: '#0078D4'
25
+ },
26
+ attention: {
27
+ default: '#D13438',
28
+ subtle: '#A4262C'
29
+ },
30
+ dark: {
31
+ default: '#000000',
32
+ subtle: '#646464'
33
+ },
34
+ good: {
35
+ default: '#0B6A0B',
36
+ subtle: '#028A02'
37
+ },
38
+ light: {
39
+ default: '#FFFFFF',
40
+ subtle
41
+ },
42
+ warning: {
43
+ default: '#B75C00',
44
+ subtle: '#986F0B'
25
45
  }
26
46
  }
27
47
  },
@@ -29,8 +49,8 @@ export default function createAdaptiveCardsHostConfig(styleOptions: FullBundleSt
29
49
  backgroundColor: cardEmphasisBackgroundColor,
30
50
  foregroundColors: {
31
51
  default: {
32
- default: bubbleTextColor,
33
- subtle
52
+ default: '#000000',
53
+ subtle: '#484644'
34
54
  }
35
55
  }
36
56
  },
@@ -39,7 +59,7 @@ export default function createAdaptiveCardsHostConfig(styleOptions: FullBundleSt
39
59
  foregroundColors: {
40
60
  default: {
41
61
  default: '#333333',
42
- subtle: '#EE333333'
62
+ subtle: '#484644'
43
63
  }
44
64
  }
45
65
  },
@@ -48,7 +68,7 @@ export default function createAdaptiveCardsHostConfig(styleOptions: FullBundleSt
48
68
  foregroundColors: {
49
69
  default: {
50
70
  default: '#333333',
51
- subtle: '#EE333333'
71
+ subtle: '#484644'
52
72
  }
53
73
  }
54
74
  },
@@ -57,7 +77,7 @@ export default function createAdaptiveCardsHostConfig(styleOptions: FullBundleSt
57
77
  foregroundColors: {
58
78
  default: {
59
79
  default: '#333333',
60
- subtle: '#EE333333'
80
+ subtle: '#484644'
61
81
  }
62
82
  }
63
83
  },
@@ -66,7 +86,7 @@ export default function createAdaptiveCardsHostConfig(styleOptions: FullBundleSt
66
86
  foregroundColors: {
67
87
  default: {
68
88
  default: '#333333',
69
- subtle: '#EE333333'
89
+ subtle: '#484644'
70
90
  }
71
91
  }
72
92
  }
@@ -1,3 +1,5 @@
1
+ /** @jest-environment jsdom */
2
+
1
3
  import createStyleSet from './createAdaptiveCardsStyleSet';
2
4
 
3
5
  describe('createAdaptiveCardsStyleSet', () => {
@@ -1,6 +1,7 @@
1
- import { normalizeStyleOptions, StyleOptions } from 'botframework-webchat-api';
1
+ import { normalizeStyleOptions, StrictStyleOptions, StyleOptions } from 'botframework-webchat-api';
2
2
 
3
- import AdaptiveCardsStyleOptions from '../AdaptiveCardsStyleOptions';
3
+ import AdaptiveCardsStyleOptions, { StrictAdaptiveCardsStyleOptions } from '../AdaptiveCardsStyleOptions';
4
+ import AdaptiveCardsStyleSet from '../AdaptiveCardsStyleSet';
4
5
  import createAdaptiveCardRendererStyle from './StyleSet/AdaptiveCardRenderer';
5
6
  import createAnimationCardAttachmentStyle from './StyleSet/AnimationCardAttachment';
6
7
  import createAudioCardAttachmentStyle from './StyleSet/AudioCardAttachment';
@@ -10,8 +11,10 @@ import normalizeAdaptiveCardsStyleOptions from '../normalizeStyleOptions';
10
11
  // "styleSet" is actually CSS stylesheet and it is based on the DOM tree.
11
12
  // DOM tree may change from time to time, thus, maintaining "styleSet" becomes a constant effort.
12
13
 
13
- export default function createAdaptiveCardsStyleSet(options: StyleOptions & AdaptiveCardsStyleOptions): any {
14
- const strictOptions = {
14
+ export default function createAdaptiveCardsStyleSet(
15
+ options: StyleOptions & AdaptiveCardsStyleOptions
16
+ ): AdaptiveCardsStyleSet {
17
+ const strictOptions: StrictStyleOptions & StrictAdaptiveCardsStyleOptions = {
15
18
  ...normalizeStyleOptions(options),
16
19
  ...normalizeAdaptiveCardsStyleOptions(options)
17
20
  };
@@ -1,3 +1,4 @@
1
+ import { AttachmentForScreenReaderMiddleware } from 'botframework-webchat-api';
1
2
  import React from 'react';
2
3
 
3
4
  import AdaptiveCardAttachment from './AttachmentForScreenReader/AdaptiveCardAttachment';
@@ -14,20 +15,20 @@ const RICH_CARD_CONTENT_TYPES = [
14
15
  'application/vnd.microsoft.card.video'
15
16
  ];
16
17
 
17
- export default function createAdaptiveCardsAttachmentMiddleware() {
18
- return () => next => (...args) => {
19
- const [
20
- {
21
- activity,
22
- attachment,
23
- attachment: { content, contentType }
24
- }
25
- ] = args;
18
+ export default function createAdaptiveCardsAttachmentMiddleware(): AttachmentForScreenReaderMiddleware {
19
+ return () =>
20
+ next =>
21
+ (...args) => {
22
+ const [
23
+ {
24
+ attachment: { content, contentType }
25
+ }
26
+ ] = args;
26
27
 
27
- return content && RICH_CARD_CONTENT_TYPES.includes(contentType)
28
- ? () => <RichCardAttachment content={content} />
29
- : content && contentType === 'application/vnd.microsoft.card.adaptive'
30
- ? () => <AdaptiveCardAttachment content={content} />
31
- : next({ activity, attachment });
32
- };
28
+ return content && RICH_CARD_CONTENT_TYPES.includes(contentType)
29
+ ? () => <RichCardAttachment content={content} />
30
+ : content && contentType === 'application/vnd.microsoft.card.adaptive'
31
+ ? () => <AdaptiveCardAttachment content={content} />
32
+ : next(...args);
33
+ };
33
34
  }
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+
3
+ import { AttachmentMiddleware } from 'botframework-webchat-api';
4
+
5
+ import AdaptiveCardAttachment from './Attachment/AdaptiveCardAttachment';
6
+ import AnimationCardAttachment from './Attachment/AnimationCardAttachment';
7
+ import AudioCardAttachment from './Attachment/AudioCardAttachment';
8
+ import HeroCardAttachment from './Attachment/HeroCardAttachment';
9
+ import OAuthCardAttachment from './Attachment/OAuthCardAttachment';
10
+ import ReceiptCardAttachment from './Attachment/ReceiptCardAttachment';
11
+ import SignInCardAttachment from './Attachment/SignInCardAttachment';
12
+ import ThumbnailCardAttachment from './Attachment/ThumbnailCardAttachment';
13
+ import VideoCardAttachment from './Attachment/VideoCardAttachment';
14
+
15
+ export default function createAdaptiveCardsAttachmentMiddleware(): AttachmentMiddleware {
16
+ // This is not returning a React component, but a render function.
17
+ return () =>
18
+ next =>
19
+ (...args) => {
20
+ const [{ attachment }] = args;
21
+
22
+ return attachment.contentType === 'application/vnd.microsoft.card.hero' ? (
23
+ <HeroCardAttachment attachment={attachment} />
24
+ ) : attachment.contentType === 'application/vnd.microsoft.card.adaptive' ? (
25
+ <AdaptiveCardAttachment attachment={attachment} />
26
+ ) : attachment.contentType === 'application/vnd.microsoft.card.animation' ? (
27
+ <AnimationCardAttachment attachment={attachment} />
28
+ ) : attachment.contentType === 'application/vnd.microsoft.card.audio' ? (
29
+ <AudioCardAttachment attachment={attachment} />
30
+ ) : attachment.contentType === 'application/vnd.microsoft.card.oauth' ? (
31
+ <OAuthCardAttachment attachment={attachment} />
32
+ ) : attachment.contentType === 'application/vnd.microsoft.card.receipt' ? (
33
+ <ReceiptCardAttachment attachment={attachment} />
34
+ ) : attachment.contentType === 'application/vnd.microsoft.card.signin' ? (
35
+ <SignInCardAttachment attachment={attachment} />
36
+ ) : attachment.contentType === 'application/vnd.microsoft.card.thumbnail' ? (
37
+ <ThumbnailCardAttachment attachment={attachment} />
38
+ ) : attachment.contentType === 'application/vnd.microsoft.card.video' ? (
39
+ <VideoCardAttachment attachment={attachment} />
40
+ ) : (
41
+ next(...args)
42
+ );
43
+ };
44
+ }
@@ -1,9 +1,10 @@
1
1
  import AdaptiveCardsStyleOptions from './AdaptiveCardsStyleOptions';
2
2
 
3
3
  const ADAPTIVE_CARDS_DEFAULT_STYLE_OPTIONS: Required<AdaptiveCardsStyleOptions> = {
4
+ adaptiveCardsParserMaxVersion: undefined,
4
5
  cardEmphasisBackgroundColor: '#F0F0F0',
5
6
  cardPushButtonBackgroundColor: '#0063B1',
6
- cardPushButtonTextColor: 'white',
7
+ cardPushButtonTextColor: 'White',
7
8
  richCardWrapTitle: false
8
9
  };
9
10
 
@@ -2,7 +2,7 @@ import { useContext } from 'react';
2
2
 
3
3
  import AdaptiveCardsContext from '../../AdaptiveCardsContext';
4
4
 
5
- export default function useAdaptiveCardsContext() {
5
+ export default function useAdaptiveCardsContext(): AdaptiveCardsContext {
6
6
  const context = useContext(AdaptiveCardsContext);
7
7
 
8
8
  if (!context) {
@@ -2,8 +2,9 @@ import { hooks } from 'botframework-webchat-component';
2
2
  import { useCallback, useMemo } from 'react';
3
3
 
4
4
  import useAdaptiveCardsPackage from '../useAdaptiveCardsPackage';
5
+ import useStyleOptions from '../../../hooks/useStyleOptions';
5
6
 
6
- const { useDirection, useStyleOptions } = hooks;
7
+ const { useDirection } = hooks;
7
8
 
8
9
  function updateRTLInline(element, rtl, adaptiveCardsPackage) {
9
10
  if (element instanceof adaptiveCardsPackage.Container) {
@@ -33,7 +34,9 @@ export default function useParseAdaptiveCardJSON() {
33
34
  const maxVersion = Version.parse(adaptiveCardsParserMaxVersion, new SerializationContext());
34
35
 
35
36
  if (maxVersion && !maxVersion.isValid) {
36
- return console.warn('botframework-webchat: "adaptiveCardsParserMaxVersion" specified is not a valid version.');
37
+ console.warn('botframework-webchat: "adaptiveCardsParserMaxVersion" specified is not a valid version.');
38
+
39
+ return;
37
40
  }
38
41
 
39
42
  return maxVersion;
@@ -3,7 +3,7 @@
3
3
  import { useMemo } from 'react';
4
4
  import random from 'math-random';
5
5
 
6
- export default function useUniqueId(prefix) {
6
+ export default function useUniqueId(prefix?: string): string {
7
7
  const id = useMemo(() => random().toString(36).substr(2, 5), []);
8
8
 
9
9
  prefix = prefix ? `${prefix}--` : '';
@@ -1,19 +1,17 @@
1
- import { hooks } from 'botframework-webchat-component';
2
1
  import { useMemo } from 'react';
3
2
 
4
3
  import createDefaultAdaptiveCardHostConfig from '../Styles/adaptiveCardHostConfig';
5
4
  import useAdaptiveCardsContext from './internal/useAdaptiveCardsContext';
5
+ import useStyleOptions from '../../hooks/useStyleOptions';
6
6
 
7
- const { useStyleOptions } = hooks;
8
-
9
- export default function useAdaptiveCardsHostConfig() {
7
+ export default function useAdaptiveCardsHostConfig(): [any] {
10
8
  const { hostConfigFromProps } = useAdaptiveCardsContext();
11
9
  const [styleOptions] = useStyleOptions();
12
10
 
13
- const patchedHostConfig = useMemo(() => hostConfigFromProps || createDefaultAdaptiveCardHostConfig(styleOptions), [
14
- hostConfigFromProps,
15
- styleOptions
16
- ]);
11
+ const patchedHostConfig = useMemo(
12
+ () => hostConfigFromProps || createDefaultAdaptiveCardHostConfig(styleOptions),
13
+ [hostConfigFromProps, styleOptions]
14
+ );
17
15
 
18
16
  return [patchedHostConfig];
19
17
  }
@@ -1,6 +1,7 @@
1
+ import AdaptiveCardsPackage from '../../types/AdaptiveCardsPackage';
1
2
  import useAdaptiveCardsContext from './internal/useAdaptiveCardsContext';
2
3
 
3
- export default function useAdaptiveCardsPackage() {
4
+ export default function useAdaptiveCardsPackage(): [AdaptiveCardsPackage] {
4
5
  const { adaptiveCardsPackage } = useAdaptiveCardsContext();
5
6
 
6
7
  return [adaptiveCardsPackage];