@botonic/react 0.34.0 → 0.35.0-alpha.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 (302) hide show
  1. package/lib/cjs/components/{button.d.ts → button/index.d.ts} +4 -5
  2. package/lib/cjs/components/{button.js → button/index.js} +26 -56
  3. package/lib/cjs/components/button/index.js.map +1 -0
  4. package/lib/cjs/components/button/styles.d.ts +2 -0
  5. package/lib/cjs/components/button/styles.js +40 -0
  6. package/lib/cjs/components/button/styles.js.map +1 -0
  7. package/lib/cjs/components/buttons-disabler.d.ts +20 -23
  8. package/lib/cjs/components/buttons-disabler.js +11 -26
  9. package/lib/cjs/components/buttons-disabler.js.map +1 -1
  10. package/lib/cjs/components/carousel.js +1 -1
  11. package/lib/cjs/components/carousel.js.map +1 -1
  12. package/lib/cjs/components/element.js +3 -3
  13. package/lib/cjs/components/element.js.map +1 -1
  14. package/lib/cjs/components/image.js +1 -1
  15. package/lib/cjs/components/image.js.map +1 -1
  16. package/lib/cjs/components/index-types.d.ts +1 -1
  17. package/lib/cjs/components/index.d.ts +1 -1
  18. package/lib/cjs/components/index.js +2 -2
  19. package/lib/cjs/components/index.js.map +1 -1
  20. package/lib/cjs/components/message/index.js +7 -7
  21. package/lib/cjs/components/message/index.js.map +1 -1
  22. package/lib/cjs/components/message/message-image.js +1 -1
  23. package/lib/cjs/components/message/message-image.js.map +1 -1
  24. package/lib/cjs/components/message/styles.d.ts +11 -11
  25. package/lib/cjs/components/message/timestamps.js +1 -1
  26. package/lib/cjs/components/message/timestamps.js.map +1 -1
  27. package/lib/cjs/components/multichannel/multichannel-button.js +4 -4
  28. package/lib/cjs/components/multichannel/multichannel-button.js.map +1 -1
  29. package/lib/cjs/components/multichannel/multichannel-carousel.js +2 -2
  30. package/lib/cjs/components/multichannel/multichannel-carousel.js.map +1 -1
  31. package/lib/cjs/components/multichannel/multichannel-utils.js +2 -2
  32. package/lib/cjs/components/multichannel/multichannel-utils.js.map +1 -1
  33. package/lib/cjs/components/reply.js +3 -1
  34. package/lib/cjs/components/reply.js.map +1 -1
  35. package/lib/cjs/components/webchat-settings.d.ts +6 -3
  36. package/lib/cjs/components/webchat-settings.js.map +1 -1
  37. package/lib/cjs/constants.d.ts +0 -12
  38. package/lib/cjs/constants.js +0 -12
  39. package/lib/cjs/constants.js.map +1 -1
  40. package/lib/cjs/contexts.d.ts +1 -5
  41. package/lib/cjs/contexts.js +10 -5
  42. package/lib/cjs/contexts.js.map +1 -1
  43. package/lib/cjs/dev-app.js +3 -11
  44. package/lib/cjs/dev-app.js.map +1 -1
  45. package/lib/cjs/index-types.d.ts +6 -28
  46. package/lib/cjs/index-types.js.map +1 -1
  47. package/lib/cjs/msg-to-botonic.js +2 -2
  48. package/lib/cjs/msg-to-botonic.js.map +1 -1
  49. package/lib/cjs/react-bot.d.ts +16 -6
  50. package/lib/cjs/react-bot.js +5 -6
  51. package/lib/cjs/react-bot.js.map +1 -1
  52. package/lib/cjs/shared/styles.d.ts +2 -2
  53. package/lib/cjs/time-zone-to-country-code.d.ts +1 -0
  54. package/lib/cjs/time-zone-to-country-code.js +108 -0
  55. package/lib/cjs/time-zone-to-country-code.js.map +1 -0
  56. package/lib/cjs/util/webchat.d.ts +11 -2
  57. package/lib/cjs/util/webchat.js +29 -1
  58. package/lib/cjs/util/webchat.js.map +1 -1
  59. package/lib/cjs/webchat/chat-area/styles.d.ts +1 -1
  60. package/lib/cjs/webchat/components/conditional-animation.js +1 -1
  61. package/lib/cjs/webchat/components/conditional-animation.js.map +1 -1
  62. package/lib/cjs/webchat/components/opened-persistent-menu.js +4 -4
  63. package/lib/cjs/webchat/components/opened-persistent-menu.js.map +1 -1
  64. package/lib/cjs/webchat/context/index.d.ts +1 -1
  65. package/lib/cjs/webchat/context/index.js +4 -7
  66. package/lib/cjs/webchat/context/index.js.map +1 -1
  67. package/lib/cjs/webchat/context/types.d.ts +16 -9
  68. package/lib/cjs/webchat/context/use-webchat.d.ts +3 -4
  69. package/lib/cjs/webchat/context/use-webchat.js +35 -43
  70. package/lib/cjs/webchat/context/use-webchat.js.map +1 -1
  71. package/lib/cjs/webchat/header/default-header.js +5 -5
  72. package/lib/cjs/webchat/header/default-header.js.map +1 -1
  73. package/lib/cjs/webchat/header/styles.d.ts +7 -7
  74. package/lib/cjs/webchat/header/styles.js +5 -1
  75. package/lib/cjs/webchat/header/styles.js.map +1 -1
  76. package/lib/cjs/webchat/index-types.d.ts +0 -11
  77. package/lib/cjs/webchat/input-panel/attachment.d.ts +1 -2
  78. package/lib/cjs/webchat/input-panel/attachment.js +6 -5
  79. package/lib/cjs/webchat/input-panel/attachment.js.map +1 -1
  80. package/lib/cjs/webchat/input-panel/emoji-picker.d.ts +1 -2
  81. package/lib/cjs/webchat/input-panel/emoji-picker.js +6 -5
  82. package/lib/cjs/webchat/input-panel/emoji-picker.js.map +1 -1
  83. package/lib/cjs/webchat/input-panel/index.d.ts +1 -4
  84. package/lib/cjs/webchat/input-panel/index.js +2 -2
  85. package/lib/cjs/webchat/input-panel/index.js.map +1 -1
  86. package/lib/cjs/webchat/input-panel/persistent-menu.d.ts +1 -2
  87. package/lib/cjs/webchat/input-panel/persistent-menu.js +5 -4
  88. package/lib/cjs/webchat/input-panel/persistent-menu.js.map +1 -1
  89. package/lib/cjs/webchat/input-panel/send-button.js +4 -3
  90. package/lib/cjs/webchat/input-panel/send-button.js.map +1 -1
  91. package/lib/cjs/webchat/input-panel/styles.d.ts +3 -3
  92. package/lib/cjs/webchat/input-panel/textarea.d.ts +1 -3
  93. package/lib/cjs/webchat/input-panel/textarea.js +7 -5
  94. package/lib/cjs/webchat/input-panel/textarea.js.map +1 -1
  95. package/lib/cjs/webchat/message-list/intro-message.js +1 -1
  96. package/lib/cjs/webchat/message-list/intro-message.js.map +1 -1
  97. package/lib/cjs/webchat/message-list/styles.d.ts +5 -5
  98. package/lib/cjs/webchat/message-list/use-notifications.js +4 -4
  99. package/lib/cjs/webchat/message-list/use-notifications.js.map +1 -1
  100. package/lib/cjs/webchat/replies/styles.d.ts +3 -3
  101. package/lib/cjs/webchat/styles.d.ts +4 -9
  102. package/lib/cjs/webchat/styles.js +18 -7
  103. package/lib/cjs/webchat/styles.js.map +1 -1
  104. package/lib/cjs/webchat/theme/default-theme.d.ts +2 -0
  105. package/lib/cjs/webchat/theme/default-theme.js +104 -0
  106. package/lib/cjs/webchat/theme/default-theme.js.map +1 -0
  107. package/lib/cjs/webchat/theme/types.d.ts +59 -12
  108. package/lib/cjs/webchat/trigger-button/index.js +3 -3
  109. package/lib/cjs/webchat/trigger-button/index.js.map +1 -1
  110. package/lib/cjs/webchat/trigger-button/styles.d.ts +3 -3
  111. package/lib/cjs/webchat/typing-indicator/styles.d.ts +3 -3
  112. package/lib/cjs/webchat/webchat-dev.d.ts +1 -1
  113. package/lib/cjs/webchat/webchat.js +26 -34
  114. package/lib/cjs/webchat/webchat.js.map +1 -1
  115. package/lib/cjs/webchat/webview/index.js +1 -14
  116. package/lib/cjs/webchat/webview/index.js.map +1 -1
  117. package/lib/cjs/webchat/webview/styles.d.ts +6 -6
  118. package/lib/cjs/webchat/webview/styles.js +16 -2
  119. package/lib/cjs/webchat/webview/styles.js.map +1 -1
  120. package/lib/cjs/webchat-app.d.ts +35 -2
  121. package/lib/cjs/webchat-app.js +45 -17
  122. package/lib/cjs/webchat-app.js.map +1 -1
  123. package/lib/cjs/webview-app.js +0 -1
  124. package/lib/cjs/webview-app.js.map +1 -1
  125. package/lib/esm/components/{button.d.ts → button/index.d.ts} +4 -5
  126. package/lib/esm/components/{button.js → button/index.js} +26 -55
  127. package/lib/esm/components/button/index.js.map +1 -0
  128. package/lib/esm/components/button/styles.d.ts +2 -0
  129. package/lib/esm/components/button/styles.js +36 -0
  130. package/lib/esm/components/button/styles.js.map +1 -0
  131. package/lib/esm/components/buttons-disabler.d.ts +20 -23
  132. package/lib/esm/components/buttons-disabler.js +11 -26
  133. package/lib/esm/components/buttons-disabler.js.map +1 -1
  134. package/lib/esm/components/carousel.js +1 -1
  135. package/lib/esm/components/carousel.js.map +1 -1
  136. package/lib/esm/components/element.js +1 -1
  137. package/lib/esm/components/element.js.map +1 -1
  138. package/lib/esm/components/image.js +1 -1
  139. package/lib/esm/components/image.js.map +1 -1
  140. package/lib/esm/components/index-types.d.ts +1 -1
  141. package/lib/esm/components/index.d.ts +1 -1
  142. package/lib/esm/components/index.js +1 -1
  143. package/lib/esm/components/index.js.map +1 -1
  144. package/lib/esm/components/message/index.js +5 -5
  145. package/lib/esm/components/message/index.js.map +1 -1
  146. package/lib/esm/components/message/message-image.js +1 -1
  147. package/lib/esm/components/message/message-image.js.map +1 -1
  148. package/lib/esm/components/message/styles.d.ts +11 -11
  149. package/lib/esm/components/message/timestamps.js +1 -1
  150. package/lib/esm/components/message/timestamps.js.map +1 -1
  151. package/lib/esm/components/multichannel/multichannel-button.js +1 -1
  152. package/lib/esm/components/multichannel/multichannel-button.js.map +1 -1
  153. package/lib/esm/components/multichannel/multichannel-carousel.js +1 -1
  154. package/lib/esm/components/multichannel/multichannel-carousel.js.map +1 -1
  155. package/lib/esm/components/multichannel/multichannel-utils.js +1 -1
  156. package/lib/esm/components/multichannel/multichannel-utils.js.map +1 -1
  157. package/lib/esm/components/reply.js +4 -2
  158. package/lib/esm/components/reply.js.map +1 -1
  159. package/lib/esm/components/webchat-settings.d.ts +6 -3
  160. package/lib/esm/components/webchat-settings.js.map +1 -1
  161. package/lib/esm/constants.d.ts +0 -12
  162. package/lib/esm/constants.js +0 -12
  163. package/lib/esm/constants.js.map +1 -1
  164. package/lib/esm/contexts.d.ts +1 -5
  165. package/lib/esm/contexts.js +10 -5
  166. package/lib/esm/contexts.js.map +1 -1
  167. package/lib/esm/dev-app.js +3 -11
  168. package/lib/esm/dev-app.js.map +1 -1
  169. package/lib/esm/index-types.d.ts +6 -28
  170. package/lib/esm/index-types.js.map +1 -1
  171. package/lib/esm/msg-to-botonic.js +1 -1
  172. package/lib/esm/msg-to-botonic.js.map +1 -1
  173. package/lib/esm/react-bot.d.ts +16 -6
  174. package/lib/esm/react-bot.js +5 -6
  175. package/lib/esm/react-bot.js.map +1 -1
  176. package/lib/esm/shared/styles.d.ts +2 -2
  177. package/lib/esm/time-zone-to-country-code.d.ts +1 -0
  178. package/lib/esm/time-zone-to-country-code.js +105 -0
  179. package/lib/esm/time-zone-to-country-code.js.map +1 -0
  180. package/lib/esm/util/webchat.d.ts +11 -2
  181. package/lib/esm/util/webchat.js +27 -0
  182. package/lib/esm/util/webchat.js.map +1 -1
  183. package/lib/esm/webchat/chat-area/styles.d.ts +1 -1
  184. package/lib/esm/webchat/components/conditional-animation.js +1 -1
  185. package/lib/esm/webchat/components/conditional-animation.js.map +1 -1
  186. package/lib/esm/webchat/components/opened-persistent-menu.js +2 -2
  187. package/lib/esm/webchat/components/opened-persistent-menu.js.map +1 -1
  188. package/lib/esm/webchat/context/index.d.ts +1 -1
  189. package/lib/esm/webchat/context/index.js +2 -4
  190. package/lib/esm/webchat/context/index.js.map +1 -1
  191. package/lib/esm/webchat/context/types.d.ts +16 -9
  192. package/lib/esm/webchat/context/use-webchat.d.ts +3 -4
  193. package/lib/esm/webchat/context/use-webchat.js +33 -41
  194. package/lib/esm/webchat/context/use-webchat.js.map +1 -1
  195. package/lib/esm/webchat/header/default-header.js +6 -6
  196. package/lib/esm/webchat/header/default-header.js.map +1 -1
  197. package/lib/esm/webchat/header/styles.d.ts +7 -7
  198. package/lib/esm/webchat/header/styles.js +6 -2
  199. package/lib/esm/webchat/header/styles.js.map +1 -1
  200. package/lib/esm/webchat/index-types.d.ts +0 -11
  201. package/lib/esm/webchat/input-panel/attachment.d.ts +1 -2
  202. package/lib/esm/webchat/input-panel/attachment.js +7 -6
  203. package/lib/esm/webchat/input-panel/attachment.js.map +1 -1
  204. package/lib/esm/webchat/input-panel/emoji-picker.d.ts +1 -2
  205. package/lib/esm/webchat/input-panel/emoji-picker.js +7 -6
  206. package/lib/esm/webchat/input-panel/emoji-picker.js.map +1 -1
  207. package/lib/esm/webchat/input-panel/index.d.ts +1 -4
  208. package/lib/esm/webchat/input-panel/index.js +2 -2
  209. package/lib/esm/webchat/input-panel/index.js.map +1 -1
  210. package/lib/esm/webchat/input-panel/persistent-menu.d.ts +1 -2
  211. package/lib/esm/webchat/input-panel/persistent-menu.js +6 -5
  212. package/lib/esm/webchat/input-panel/persistent-menu.js.map +1 -1
  213. package/lib/esm/webchat/input-panel/send-button.js +5 -4
  214. package/lib/esm/webchat/input-panel/send-button.js.map +1 -1
  215. package/lib/esm/webchat/input-panel/styles.d.ts +3 -3
  216. package/lib/esm/webchat/input-panel/textarea.d.ts +1 -3
  217. package/lib/esm/webchat/input-panel/textarea.js +7 -5
  218. package/lib/esm/webchat/input-panel/textarea.js.map +1 -1
  219. package/lib/esm/webchat/message-list/intro-message.js +1 -1
  220. package/lib/esm/webchat/message-list/intro-message.js.map +1 -1
  221. package/lib/esm/webchat/message-list/styles.d.ts +5 -5
  222. package/lib/esm/webchat/message-list/use-notifications.js +4 -4
  223. package/lib/esm/webchat/message-list/use-notifications.js.map +1 -1
  224. package/lib/esm/webchat/replies/styles.d.ts +3 -3
  225. package/lib/esm/webchat/styles.d.ts +4 -9
  226. package/lib/esm/webchat/styles.js +19 -8
  227. package/lib/esm/webchat/styles.js.map +1 -1
  228. package/lib/esm/webchat/theme/default-theme.d.ts +2 -0
  229. package/lib/esm/webchat/theme/default-theme.js +101 -0
  230. package/lib/esm/webchat/theme/default-theme.js.map +1 -0
  231. package/lib/esm/webchat/theme/types.d.ts +59 -12
  232. package/lib/esm/webchat/trigger-button/index.js +3 -3
  233. package/lib/esm/webchat/trigger-button/index.js.map +1 -1
  234. package/lib/esm/webchat/trigger-button/styles.d.ts +3 -3
  235. package/lib/esm/webchat/typing-indicator/styles.d.ts +3 -3
  236. package/lib/esm/webchat/webchat-dev.d.ts +1 -1
  237. package/lib/esm/webchat/webchat.js +29 -37
  238. package/lib/esm/webchat/webchat.js.map +1 -1
  239. package/lib/esm/webchat/webview/index.js +1 -14
  240. package/lib/esm/webchat/webview/index.js.map +1 -1
  241. package/lib/esm/webchat/webview/styles.d.ts +6 -6
  242. package/lib/esm/webchat/webview/styles.js +17 -3
  243. package/lib/esm/webchat/webview/styles.js.map +1 -1
  244. package/lib/esm/webchat-app.d.ts +35 -2
  245. package/lib/esm/webchat-app.js +45 -17
  246. package/lib/esm/webchat-app.js.map +1 -1
  247. package/lib/esm/webview-app.js +1 -2
  248. package/lib/esm/webview-app.js.map +1 -1
  249. package/package.json +4 -2
  250. package/src/components/{button.tsx → button/index.tsx} +26 -102
  251. package/src/components/button/styles.ts +38 -0
  252. package/src/components/{buttons-disabler.js → buttons-disabler.ts} +35 -39
  253. package/src/components/carousel.tsx +1 -2
  254. package/src/components/element.tsx +1 -1
  255. package/src/components/image.tsx +3 -2
  256. package/src/components/index-types.ts +1 -1
  257. package/src/components/index.ts +1 -1
  258. package/src/components/message/index.jsx +5 -9
  259. package/src/components/message/message-image.tsx +1 -4
  260. package/src/components/message/timestamps.tsx +1 -2
  261. package/src/components/multichannel/multichannel-button.jsx +1 -1
  262. package/src/components/multichannel/multichannel-carousel.jsx +1 -1
  263. package/src/components/multichannel/multichannel-utils.js +1 -1
  264. package/src/components/reply.tsx +2 -8
  265. package/src/components/webchat-settings.tsx +11 -3
  266. package/src/constants.js +0 -12
  267. package/src/contexts.tsx +11 -12
  268. package/src/dev-app.jsx +1 -25
  269. package/src/index-types.ts +8 -26
  270. package/src/msg-to-botonic.jsx +1 -1
  271. package/src/react-bot.tsx +51 -0
  272. package/src/time-zone-to-country-code.ts +104 -0
  273. package/src/util/webchat.ts +38 -2
  274. package/src/webchat/components/conditional-animation.jsx +2 -2
  275. package/src/webchat/components/opened-persistent-menu.jsx +2 -3
  276. package/src/webchat/context/index.tsx +3 -5
  277. package/src/webchat/context/types.ts +18 -13
  278. package/src/webchat/context/use-webchat.ts +36 -43
  279. package/src/webchat/header/default-header.tsx +6 -17
  280. package/src/webchat/header/styles.ts +6 -2
  281. package/src/webchat/index-types.ts +0 -12
  282. package/src/webchat/input-panel/attachment.tsx +5 -16
  283. package/src/webchat/input-panel/emoji-picker.tsx +5 -15
  284. package/src/webchat/input-panel/index.tsx +2 -13
  285. package/src/webchat/input-panel/persistent-menu.tsx +5 -15
  286. package/src/webchat/input-panel/send-button.tsx +3 -9
  287. package/src/webchat/input-panel/textarea.tsx +8 -14
  288. package/src/webchat/message-list/intro-message.tsx +1 -2
  289. package/src/webchat/message-list/use-notifications.ts +4 -8
  290. package/src/webchat/styles.ts +20 -14
  291. package/src/webchat/theme/default-theme.ts +102 -0
  292. package/src/webchat/theme/theme.d.ts +8 -0
  293. package/src/webchat/theme/types.ts +111 -24
  294. package/src/webchat/trigger-button/index.tsx +3 -5
  295. package/src/webchat/webchat.tsx +79 -102
  296. package/src/webchat/webview/index.tsx +16 -30
  297. package/src/webchat/webview/styles.ts +16 -2
  298. package/src/webchat-app.tsx +88 -35
  299. package/src/webview-app.tsx +1 -3
  300. package/lib/cjs/components/button.js.map +0 -1
  301. package/lib/esm/components/button.js.map +0 -1
  302. package/src/react-bot.jsx +0 -38
@@ -1,9 +1,4 @@
1
- import {
2
- BotonicAction,
3
- INPUT,
4
- isMobile,
5
- params2queryString,
6
- } from '@botonic/core'
1
+ import { BotonicAction, INPUT, params2queryString } from '@botonic/core'
7
2
  import merge from 'lodash.merge'
8
3
  import React, {
9
4
  forwardRef,
@@ -12,7 +7,7 @@ import React, {
12
7
  useRef,
13
8
  useState,
14
9
  } from 'react'
15
- import { StyleSheetManager } from 'styled-components'
10
+ import { StyleSheetManager, ThemeProvider } from 'styled-components'
16
11
  import { v7 as uuidv7 } from 'uuid'
17
12
 
18
13
  import {
@@ -47,6 +42,7 @@ import {
47
42
  getServerErrorMessage,
48
43
  initSession,
49
44
  shouldKeepSessionOnReload,
45
+ updateUserLocaleAndCountry,
50
46
  } from '../util/webchat'
51
47
  import { ChatArea } from './chat-area'
52
48
  import { OpenedPersistentMenu } from './components/opened-persistent-menu'
@@ -67,6 +63,7 @@ import {
67
63
  ErrorMessageContainer,
68
64
  StyledWebchat,
69
65
  } from './styles'
66
+ import { WebchatTheme } from './theme/types'
70
67
  import { TriggerButton } from './trigger-button'
71
68
  import { useStorageState } from './use-storage-state-hook'
72
69
  import { getParsedAction } from './utils'
@@ -110,7 +107,7 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
110
107
  repliesRef,
111
108
  scrollableMessagesListRef,
112
109
  // eslint-disable-next-line react-hooks/rules-of-hooks
113
- } = props.webchatHooks || useWebchat()
110
+ } = props.webchatHooks || useWebchat(props.theme)
114
111
 
115
112
  const firstUpdate = useRef(true)
116
113
  const isOnline = () => webchatState.online
@@ -227,7 +224,7 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
227
224
  addMessage(message)
228
225
  const newMessageComponent = msgToBotonic(
229
226
  { ...message, delay: 0, typing: 0 },
230
- props.theme?.message?.customTypes || props.theme?.customMessageTypes
227
+ props.theme?.message?.customTypes
231
228
  )
232
229
  //@ts-ignore
233
230
  if (newMessageComponent) addMessageComponent(newMessageComponent)
@@ -248,7 +245,13 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
248
245
  }
249
246
 
250
247
  if (props.onInit) {
251
- setTimeout(() => props.onInit && props.onInit(), 100)
248
+ setTimeout(() => {
249
+ if (typeof props.onInit === 'function') {
250
+ props.onInit()
251
+ const user = updateUserLocaleAndCountry(session.user)
252
+ updateSession({ ...session, user })
253
+ }
254
+ }, 100)
252
255
  }
253
256
  }, [])
254
257
 
@@ -313,8 +316,7 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
313
316
  }
314
317
 
315
318
  const persistentMenuOptions = getThemeProperty(
316
- WEBCHAT.CUSTOM_PROPERTIES.persistentMenu,
317
- props.persistentMenu
319
+ WEBCHAT.CUSTOM_PROPERTIES.persistentMenu
318
320
  )
319
321
 
320
322
  const darkBackgroundMenu = getThemeProperty(
@@ -334,10 +336,7 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
334
336
 
335
337
  const checkBlockInput = input => {
336
338
  // if is a text we check if it is a serialized RE
337
- const blockInputs = getThemeProperty(
338
- WEBCHAT.CUSTOM_PROPERTIES.blockInputs,
339
- props.blockInputs
340
- )
339
+ const blockInputs = webchatState.theme.userInput?.blockInputs
341
340
  if (!Array.isArray(blockInputs)) return false
342
341
  for (const rule of blockInputs) {
343
342
  if (getBlockInputs(rule, input.data)) {
@@ -379,15 +378,8 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
379
378
  )
380
379
  }
381
380
 
382
- const getCoverComponent = () => {
383
- return getThemeProperty(
384
- WEBCHAT.CUSTOM_PROPERTIES.coverComponent,
385
- props.coverComponent &&
386
- (props.coverComponent.component || props.coverComponent)
387
- )
388
- }
389
- const coverComponent = getCoverComponent()
390
- const coverComponentProps = props.coverComponent?.props
381
+ const coverComponent = webchatState.theme.coverComponent
382
+ const coverComponentProps = webchatState.theme.coverComponent?.props
391
383
 
392
384
  useEffect(() => {
393
385
  if (!coverComponent) return
@@ -417,7 +409,7 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
417
409
  )
418
410
  } else if (isMedia(input)) {
419
411
  const temporaryDisplayUrl = URL.createObjectURL(input.data)
420
- // TODO: We sould use URL.revokeObjectURL(temporaryDisplayUrl) when the component is unmounted
412
+ // TODO: We should use URL.revokeObjectURL(temporaryDisplayUrl) when the component is unmounted
421
413
  // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static#memory_management
422
414
  const mediaProps: {
423
415
  id: string
@@ -460,8 +452,9 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
460
452
  https://stackoverflow.com/questions/37949981/call-child-method-from-parent
461
453
  */
462
454
 
463
- const updateSessionWithUser = (userToUpdate: any) =>
455
+ const updateSessionWithUser = (userToUpdate: any) => {
464
456
  updateSession(merge(webchatState.session, { user: userToUpdate }))
457
+ }
465
458
 
466
459
  useImperativeHandle(ref, () => ({
467
460
  addBotResponse: ({ response, session, lastRoutePath }) => {
@@ -529,7 +522,10 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
529
522
  updateSessionWithUser(settings.user)
530
523
  }
531
524
  const themeUpdates = normalizeWebchatSettings(settings)
532
- updateTheme(merge(webchatState.theme, themeUpdates), themeUpdates)
525
+ updateTheme(
526
+ merge(webchatState.theme, themeUpdates),
527
+ themeUpdates as WebchatTheme
528
+ )
533
529
  updateTyping(false)
534
530
  },
535
531
  closeWebview: async (options?: CloseWebviewOptions) =>
@@ -592,26 +588,13 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
592
588
 
593
589
  const isUserInputEnabled = () => {
594
590
  const isUserInputEnabled = getThemeProperty(
595
- WEBCHAT.CUSTOM_PROPERTIES.enableUserInput,
596
- props.enableUserInput !== undefined ? props.enableUserInput : true
591
+ WEBCHAT.CUSTOM_PROPERTIES.enableUserInput
597
592
  )
598
593
  return isUserInputEnabled && !webchatState.isCoverComponentOpen
599
594
  }
600
595
 
601
596
  const userInputEnabled = isUserInputEnabled()
602
597
 
603
- // TODO: Create a default theme that include mobileStyle
604
- let mobileStyle = {}
605
- if (isMobile(getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.mobileBreakpoint))) {
606
- mobileStyle = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.mobileStyle) || {
607
- width: '100%',
608
- height: '100%',
609
- right: 0,
610
- bottom: 0,
611
- borderRadius: 0,
612
- }
613
- }
614
-
615
598
  useEffect(() => {
616
599
  // Prod mode
617
600
  saveWebchatState(webchatState)
@@ -622,7 +605,10 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
622
605
  // eslint-disable-next-line react-hooks/rules-of-hooks
623
606
  useEffect(() => {
624
607
  const themeUpdates = normalizeWebchatSettings(settings)
625
- updateTheme(merge(webchatState.theme, themeUpdates), themeUpdates)
608
+ updateTheme(
609
+ merge(webchatState.theme, themeUpdates),
610
+ themeUpdates as WebchatTheme
611
+ )
626
612
  }, [webchatState.messagesJSON])
627
613
  }
628
614
 
@@ -672,8 +658,6 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
672
658
  updateWebchatDevSettings: updateWebchatDevSettings,
673
659
  trackEvent: props.onTrackEvent,
674
660
  webchatState,
675
- // TODO: Review if need theme inside Context, already exist inside webchatState
676
- theme,
677
661
  webchatContainerRef,
678
662
  chatAreaRef,
679
663
  inputPanelRef,
@@ -682,63 +666,56 @@ const Webchat = forwardRef<WebchatRef | null, WebchatProps>((props, ref) => {
682
666
  scrollableMessagesListRef,
683
667
  }}
684
668
  >
685
- {!webchatState.isWebchatOpen && <TriggerButton />}
686
-
687
- {webchatState.isWebchatOpen && (
688
- <StyledWebchat
689
- id={BotonicContainerId.Webchat}
690
- ref={webchatContainerRef}
691
- // TODO: Distinguish between multiple instances of webchat, e.g. `${uniqueId}-botonic-webchat`
692
- role={ROLES.WEBCHAT}
693
- width={webchatState.width}
694
- height={webchatState.height}
695
- style={{
696
- ...webchatState.theme.style,
697
- ...mobileStyle,
698
- }}
699
- >
700
- <WebchatHeader ref={headerRef} />
701
-
702
- {webchatState.isCoverComponentOpen ? (
703
- <CoverComponent
704
- component={coverComponent}
705
- componentProps={coverComponentProps}
706
- />
707
- ) : (
708
- <>
709
- {webchatState.error.message && (
710
- <ErrorMessageContainer>
711
- <ErrorMessage>{webchatState.error.message}</ErrorMessage>
712
- </ErrorMessageContainer>
713
- )}
714
-
715
- <ChatArea />
716
-
717
- {webchatState.isPersistentMenuOpen && (
718
- <DarkenBackground component={persistentMenu()} />
719
- )}
720
-
721
- {!webchatState.handoff && userInputEnabled && (
722
- <InputPanel
723
- persistentMenu={props.persistentMenu}
724
- enableEmojiPicker={props.enableEmojiPicker}
725
- enableAttachments={props.enableAttachments}
726
- handleAttachment={handleAttachment}
727
- textareaRef={textareaRef}
728
- host={host}
729
- onUserInput={props.onUserInput}
730
- />
731
- )}
732
-
733
- {webchatState.webview && <WebviewContainer />}
734
-
735
- {webchatState.isCustomComponentRendered &&
736
- customComponent &&
737
- _renderCustomComponent()}
738
- </>
739
- )}
740
- </StyledWebchat>
741
- )}
669
+ <ThemeProvider theme={webchatState.theme}>
670
+ {!webchatState.isWebchatOpen && <TriggerButton />}
671
+
672
+ {webchatState.isWebchatOpen && (
673
+ <StyledWebchat
674
+ id={BotonicContainerId.Webchat}
675
+ ref={webchatContainerRef}
676
+ // TODO: Distinguish between multiple instances of webchat, e.g. `${uniqueId}-botonic-webchat`
677
+ role={ROLES.WEBCHAT}
678
+ >
679
+ <WebchatHeader ref={headerRef} />
680
+
681
+ {webchatState.isCoverComponentOpen ? (
682
+ <CoverComponent
683
+ component={coverComponent}
684
+ componentProps={coverComponentProps}
685
+ />
686
+ ) : (
687
+ <>
688
+ {webchatState.error.message && (
689
+ <ErrorMessageContainer>
690
+ <ErrorMessage>{webchatState.error.message}</ErrorMessage>
691
+ </ErrorMessageContainer>
692
+ )}
693
+
694
+ <ChatArea />
695
+
696
+ {webchatState.isPersistentMenuOpen && (
697
+ <DarkenBackground component={persistentMenu()} />
698
+ )}
699
+
700
+ {!webchatState.handoff && userInputEnabled && (
701
+ <InputPanel
702
+ handleAttachment={handleAttachment}
703
+ textareaRef={textareaRef}
704
+ host={host}
705
+ onUserInput={props.onUserInput}
706
+ />
707
+ )}
708
+
709
+ {webchatState.webview && <WebviewContainer />}
710
+
711
+ {webchatState.isCustomComponentRendered &&
712
+ customComponent &&
713
+ _renderCustomComponent()}
714
+ </>
715
+ )}
716
+ </StyledWebchat>
717
+ )}
718
+ </ThemeProvider>
742
719
  </WebchatContext.Provider>
743
720
  )
744
721
 
@@ -23,19 +23,6 @@ export const WebviewContainer = () => {
23
23
  session: webchatState.session || ({} as Partial<CoreSession>),
24
24
  }
25
25
 
26
- // TODO: Remove this code and use theme or webchatState.theme from the context,
27
- // this code is duplicated from webchat.tsx
28
- let mobileStyle = {}
29
- if (isMobile(getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.mobileBreakpoint))) {
30
- mobileStyle = getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.mobileStyle) || {
31
- width: '100%',
32
- height: '100%',
33
- right: 0,
34
- bottom: 0,
35
- borderRadius: 0,
36
- }
37
- }
38
-
39
26
  const Webview = webchatState.webview as string | React.ComponentType
40
27
 
41
28
  const close = async (e: any) => {
@@ -56,25 +43,24 @@ export const WebviewContainer = () => {
56
43
  const isUrlToWebview = typeof Webview === 'string'
57
44
 
58
45
  return (
59
- <StyledWebview
60
- role={ROLES.WEBVIEW}
61
- style={{
62
- ...getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.webviewStyle),
63
- ...mobileStyle,
64
- }}
65
- >
66
- <WebviewHeader />
67
- <StyledWebviewContent>
68
- {isUrlToWebview ? (
69
- <StyledFrame src={Webview} />
70
- ) : (
71
- <WebviewRequestContext.Provider value={webviewRequestContext}>
46
+ <WebviewRequestContext.Provider value={webviewRequestContext}>
47
+ <StyledWebview
48
+ role={ROLES.WEBVIEW}
49
+ style={{
50
+ ...getThemeProperty(WEBCHAT.CUSTOM_PROPERTIES.webviewStyle),
51
+ }}
52
+ >
53
+ <WebviewHeader />
54
+ <StyledWebviewContent>
55
+ {isUrlToWebview ? (
56
+ <StyledFrame src={Webview} />
57
+ ) : (
72
58
  <StyledFrameAsDiv>
73
59
  <Webview />
74
60
  </StyledFrameAsDiv>
75
- </WebviewRequestContext.Provider>
76
- )}
77
- </StyledWebviewContent>
78
- </StyledWebview>
61
+ )}
62
+ </StyledWebviewContent>
63
+ </StyledWebview>
64
+ </WebviewRequestContext.Provider>
79
65
  )
80
66
  }
@@ -11,7 +11,17 @@ export const StyledWebview = styled.div`
11
11
  height: 100%;
12
12
  background-color: ${COLORS.SOLID_WHITE};
13
13
  z-index: 2;
14
- border-radius: ${WEBCHAT.DEFAULTS.BORDER_RADIUS_TOP_CORNERS};
14
+ border-radius: ${props => props.theme.style.borderRadius};
15
+
16
+ @media (max-width: ${props => props.theme.mobileBreakpoint}px) {
17
+ position: ${props => props.theme.mobileStyle.position};
18
+ right: ${props => props.theme.mobileStyle.right};
19
+ bottom: ${props => props.theme.mobileStyle.bottom};
20
+ width: ${props => props.theme.mobileStyle.width};
21
+ height: ${props => props.theme.mobileStyle.height};
22
+ border-radius: ${props => props.theme.mobileStyle.borderRadius};
23
+ font-size: ${props => props.theme.mobileStyle.fontSize};
24
+ }
15
25
  `
16
26
 
17
27
  export const StyledWebviewHeader = styled.div`
@@ -20,7 +30,11 @@ export const StyledWebviewHeader = styled.div`
20
30
  background-color: ${COLORS.WILD_SAND_WHITE};
21
31
  border-top: 1px solid ${COLORS.SOLID_BLACK_ALPHA_0_2};
22
32
  border-bottom: 1px solid ${COLORS.SOLID_BLACK_ALPHA_0_2};
23
- border-radius: ${WEBCHAT.DEFAULTS.BORDER_RADIUS_TOP_CORNERS};
33
+ border-radius: ${props => props.theme.header?.style?.borderRadius};
34
+
35
+ @media (max-width: ${props => props.theme.mobileBreakpoint}px) {
36
+ border-radius: 0px;
37
+ }
24
38
  `
25
39
  export const StyledCloseHeader = styled.div`
26
40
  display: inline-block;
@@ -20,15 +20,16 @@ import {
20
20
  } from './index-types'
21
21
  import { msgToBotonic } from './msg-to-botonic'
22
22
  import { isShadowDOMSupported, onDOMLoaded } from './util/dom'
23
+ import { defaultTheme } from './webchat/theme/default-theme'
23
24
  import {
24
25
  CoverComponentOptions,
25
26
  PersistentMenuOptionsTheme,
26
- ThemeProps,
27
+ WebchatTheme,
27
28
  } from './webchat/theme/types'
28
29
  import { Webchat } from './webchat/webchat'
29
30
 
30
31
  export class WebchatApp {
31
- public theme?: ThemeProps
32
+ public theme?: Partial<WebchatTheme>
32
33
  public persistentMenu?: PersistentMenuOptionsTheme
33
34
  public coverComponent?: CoverComponentOptions
34
35
  public blockInputs?: BlockInputOption[]
@@ -62,7 +63,7 @@ export class WebchatApp {
62
63
  private hubtypeService: HubtypeService
63
64
 
64
65
  constructor({
65
- theme = {},
66
+ theme,
66
67
  persistentMenu,
67
68
  coverComponent,
68
69
  blockInputs,
@@ -70,7 +71,7 @@ export class WebchatApp {
70
71
  enableAttachments,
71
72
  enableUserInput,
72
73
  enableAnimations,
73
- hostId = 'root',
74
+ hostId = WEBCHAT.DEFAULTS.HOST_ID,
74
75
  shadowDOM = false,
75
76
  defaultDelay,
76
77
  defaultTyping,
@@ -272,16 +273,24 @@ export class WebchatApp {
272
273
  this.webchatRef.current?.updateUser(user)
273
274
  }
274
275
 
276
+ setSystemLocale(locale: string) {
277
+ this.webchatRef.current?.updateUser({ system_locale: locale })
278
+ }
279
+
280
+ setUserLocale(locale: string) {
281
+ this.webchatRef.current?.updateUser({ locale })
282
+ }
283
+
284
+ setUserCountry(country: string) {
285
+ this.webchatRef.current?.updateUser({ country })
286
+ }
287
+
275
288
  addBotMessage(message: any) {
276
289
  message.ack = 0
277
290
  message.isUnread = true
278
291
  message.sentBy = message.sent_by?.split('message_sent_by_')[1]
279
292
  delete message.sent_by
280
- const response = msgToBotonic(
281
- message,
282
- // TODO: Review if is needed allow declar customTypes inside and outside theme
283
- this.theme?.message?.customTypes || this.theme?.customMessageTypes
284
- )
293
+ const response = msgToBotonic(message, this.theme?.message?.customTypes)
285
294
 
286
295
  this.webchatRef.current?.addBotResponse({
287
296
  response,
@@ -373,17 +382,75 @@ export class WebchatApp {
373
382
  return this.webchatRef.current?.updateWebchatSettings(settings)
374
383
  }
375
384
 
376
- // eslint-disable-next-line complexity
385
+ createInitialTheme(optionsAtRuntime: WebchatArgs = {}) {
386
+ const theme = merge(defaultTheme, this.theme, optionsAtRuntime.theme)
387
+
388
+ if (theme.animations === undefined) {
389
+ theme.animations = {}
390
+ }
391
+
392
+ theme.animations.enable =
393
+ theme.animations.enable ??
394
+ optionsAtRuntime.enableAnimations ??
395
+ this.enableAnimations
396
+
397
+ theme.coverComponent =
398
+ theme.coverComponent ??
399
+ optionsAtRuntime.coverComponent ??
400
+ this.coverComponent
401
+
402
+ theme.userInput = this.createInitialThemeUserInput(theme, optionsAtRuntime)
403
+
404
+ return theme
405
+ }
406
+
407
+ createInitialThemeUserInput(
408
+ theme: WebchatTheme,
409
+ optionsAtRuntime: WebchatArgs = {}
410
+ ) {
411
+ if (!theme.userInput) theme.userInput = {}
412
+
413
+ // Set main userInput properties
414
+ theme.userInput = {
415
+ ...theme.userInput,
416
+ enable:
417
+ theme.userInput.enable ??
418
+ optionsAtRuntime.enableUserInput ??
419
+ this.enableUserInput,
420
+ persistentMenu:
421
+ theme.userInput.persistentMenu ??
422
+ optionsAtRuntime.persistentMenu ??
423
+ this.persistentMenu,
424
+ blockInputs:
425
+ theme.userInput.blockInputs ??
426
+ optionsAtRuntime.blockInputs ??
427
+ this.blockInputs,
428
+ }
429
+
430
+ // Set emoji picker properties
431
+ theme.userInput.emojiPicker = {
432
+ ...(theme.userInput.emojiPicker || {}),
433
+ enable:
434
+ theme.userInput.emojiPicker?.enable ??
435
+ optionsAtRuntime.enableEmojiPicker ??
436
+ this.enableEmojiPicker,
437
+ }
438
+
439
+ // Set attachments properties
440
+ theme.userInput.attachments = {
441
+ ...(theme.userInput.attachments || {}),
442
+ enable:
443
+ theme.userInput.attachments?.enable ??
444
+ optionsAtRuntime.enableAttachments ??
445
+ this.enableAttachments,
446
+ }
447
+
448
+ return theme.userInput
449
+ }
450
+
377
451
  getComponent(host: HTMLDivElement, optionsAtRuntime: WebchatArgs = {}) {
378
452
  let {
379
453
  theme = {},
380
- persistentMenu,
381
- coverComponent,
382
- blockInputs,
383
- enableAttachments,
384
- enableUserInput,
385
- enableAnimations,
386
- enableEmojiPicker,
387
454
  defaultDelay,
388
455
  defaultTyping,
389
456
  storage,
@@ -400,14 +467,7 @@ export class WebchatApp {
400
467
  hostId,
401
468
  ...webchatOptions
402
469
  } = optionsAtRuntime
403
- theme = merge(this.theme, theme)
404
- persistentMenu = persistentMenu || this.persistentMenu
405
- coverComponent = coverComponent || this.coverComponent
406
- blockInputs = blockInputs || this.blockInputs
407
- enableEmojiPicker = enableEmojiPicker || this.enableEmojiPicker
408
- enableAttachments = enableAttachments || this.enableAttachments
409
- enableUserInput = enableUserInput || this.enableUserInput
410
- enableAnimations = enableAnimations || this.enableAnimations
470
+ theme = this.createInitialTheme(optionsAtRuntime)
411
471
  defaultDelay = defaultDelay || this.defaultDelay
412
472
  defaultTyping = defaultTyping || this.defaultTyping
413
473
  server = server || this.server
@@ -430,14 +490,7 @@ export class WebchatApp {
430
490
  ref={this.webchatRef}
431
491
  host={this.host}
432
492
  shadowDOM={this.shadowDOM}
433
- theme={theme}
434
- persistentMenu={persistentMenu}
435
- coverComponent={coverComponent}
436
- blockInputs={blockInputs}
437
- enableEmojiPicker={enableEmojiPicker}
438
- enableAttachments={enableAttachments}
439
- enableUserInput={enableUserInput}
440
- enableAnimations={enableAnimations}
493
+ theme={theme as WebchatTheme}
441
494
  storage={this.storage}
442
495
  storageKey={this.storageKey}
443
496
  defaultDelay={defaultDelay}
@@ -445,7 +498,7 @@ export class WebchatApp {
445
498
  onInit={(...args: [any]) => this.onInitWebchat(...args)}
446
499
  onOpen={(...args: [any]) => this.onOpenWebchat(...args)}
447
500
  onClose={(...args: [any]) => this.onCloseWebchat(...args)}
448
- onUserInput={(...args: [any]) => this.onUserInput(...args)} // TODO: Review this function, and his params
501
+ onUserInput={(...args: [any]) => this.onUserInput(...args)}
449
502
  onStateChange={(args: OnStateChangeArgs) => {
450
503
  this.onStateChange(args)
451
504
  }}
@@ -453,7 +506,7 @@ export class WebchatApp {
453
506
  request: ActionRequest,
454
507
  eventName: string,
455
508
  args?: EventArgs
456
- ) => this.onTrackEventWebchat(request, eventName, args)} //TODO: Review if this implementation is correct
509
+ ) => this.onTrackEventWebchat(request, eventName, args)}
457
510
  server={server}
458
511
  />
459
512
  )
@@ -1,5 +1,5 @@
1
1
  // @ts-nocheck
2
- import { getString, params2queryString, PROVIDER } from '@botonic/core'
2
+ import { params2queryString, PROVIDER } from '@botonic/core'
3
3
  import axios from 'axios'
4
4
  import React from 'react'
5
5
  import { createRoot } from 'react-dom/client'
@@ -86,8 +86,6 @@ class App extends React.Component {
86
86
 
87
87
  render() {
88
88
  const webviewRequestContext = {
89
- getString: (stringId: string) =>
90
- getString(this.props.locales, this.state.session.__locale, stringId),
91
89
  session: this.state.session || {},
92
90
  params: this.state.params || {},
93
91
  closeWebview: this.close.bind(this),
@@ -1 +0,0 @@
1
- {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/components/button.tsx"],"names":[],"mappings":";;;;;AAAA,wCAAqC;AACrC,iCAAmD;AACnD,kFAAsC;AAEtC,4CAA8C;AAC9C,qDAAkD;AAClD,yCAA+C;AAC/C,+CAA+D;AAC/D,gDAAmD;AACnD,yDAAoD;AAGpD,MAAM,YAAY,GAAG,2BAAM,CAAC,MAAM,CAAA;;;;;;;;;;;;sBAYZ,kBAAM,CAAC,cAAc;;;;;;;;CAQ1C,CAAA;AAEY,QAAA,cAAc,GAAG,2BAAM,CAAC,GAAG,CAAA;;CAEvC,CAAA;AAEM,MAAM,MAAM,GAAG,CAAC,KAAkB,EAAE,EAAE;IAC3C,MAAM,EACJ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,aAAa,GACd,GAAG,IAAA,kBAAU,EAAC,wBAAc,CAAC,CAAA;IAC9B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAA;IACzC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,kCAAe,CAAC,gBAAgB,CACrE,YAAY,CAAC,KAAK,EAClB,KAAK,CACN,CAAA;IAED,MAAM,WAAW,GAAG,KAAK,CAAC,EAAE;QAC1B,KAAK,CAAC,cAAc,EAAE,CAAA;QAEtB,MAAM,IAAI,GAAG,gBAAgB,CAC3B,mBAAO,CAAC,iBAAiB,CAAC,iBAAiB,EAC3C,YAAK,CAAC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AAC,CAAA"}
package/src/react-bot.jsx DELETED
@@ -1,38 +0,0 @@
1
- import { CoreBot } from '@botonic/core'
2
- import React from 'react'
3
-
4
- import { Text } from './components/text'
5
- import { RequestContext } from './contexts'
6
-
7
- export class ReactBot extends CoreBot {
8
- constructor(options) {
9
- super({
10
- defaultRoutes: [
11
- {
12
- path: '404',
13
- action: () => <Text>I don't understand you</Text>, // eslint-disable-line
14
- },
15
- ],
16
- renderer: args => this.renderReactActions(args),
17
- ...options,
18
- })
19
- }
20
-
21
- async renderReactActions({ request, actions }) {
22
- const renderedActions = []
23
- let props
24
- let renderedAction
25
- for (const Action of actions) {
26
- if (Action) {
27
- props = Action.botonicInit ? await Action.botonicInit(request) : {}
28
- renderedAction = (
29
- <RequestContext.Provider value={request}>
30
- <Action {...props} />
31
- </RequestContext.Provider>
32
- )
33
- renderedActions.push(renderedAction)
34
- }
35
- }
36
- return renderedActions
37
- }
38
- }