@sendbird/uikit-react 3.12.1 → 3.13.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 (877) hide show
  1. package/App.js +79 -75
  2. package/App.js.map +1 -1
  3. package/CHANGELOG.md +56 -0
  4. package/Channel/components/ChannelHeader.js +29 -29
  5. package/Channel/components/ChannelUI.js +67 -63
  6. package/Channel/components/ChannelUI.js.map +1 -1
  7. package/Channel/components/FileViewer.js +28 -28
  8. package/Channel/components/FrozenNotification.js +5 -5
  9. package/Channel/components/Message.js +62 -56
  10. package/Channel/components/Message.js.map +1 -1
  11. package/Channel/components/MessageFeedbackModal.js +9 -9
  12. package/Channel/components/MessageInput.js +41 -41
  13. package/Channel/components/MessageInputWrapper.js +41 -41
  14. package/Channel/components/MessageList.js +63 -59
  15. package/Channel/components/MessageList.js.map +1 -1
  16. package/Channel/components/RemoveMessageModal.js +27 -27
  17. package/Channel/components/SuggestedMentionList.js +27 -27
  18. package/Channel/components/TypingIndicator.js +6 -6
  19. package/Channel/components/UnreadCount.js +7 -7
  20. package/Channel/context.js +20 -20
  21. package/Channel/hooks/useHandleUploadFiles.js +13 -13
  22. package/Channel/hooks/useInitialMessagesFetch.js +6 -6
  23. package/Channel/utils/compareMessagesForGrouping.js +5 -5
  24. package/Channel/utils/getMessagePartsInfo.js +6 -6
  25. package/Channel.js +67 -63
  26. package/Channel.js.map +1 -1
  27. package/ChannelList/components/AddChannel.js +20 -20
  28. package/ChannelList/components/ChannelListHeader.js +8 -8
  29. package/ChannelList/components/ChannelListUI.js +34 -34
  30. package/ChannelList/components/ChannelPreview.js +27 -27
  31. package/ChannelList/components/ChannelPreviewAction.js +11 -11
  32. package/ChannelList/context.js +10 -10
  33. package/ChannelList.js +34 -34
  34. package/ChannelSettings/components/ChannelProfile.js +14 -14
  35. package/ChannelSettings/components/ChannelSettingsUI.js +23 -23
  36. package/ChannelSettings/components/EditDetailsModal.js +14 -14
  37. package/ChannelSettings/components/LeaveChannel.js +11 -11
  38. package/ChannelSettings/components/ModerationPanel.js +21 -21
  39. package/ChannelSettings/components/UserListItem.js +13 -13
  40. package/ChannelSettings/components/UserPanel.js +20 -20
  41. package/ChannelSettings/context.js +43 -22
  42. package/ChannelSettings/context.js.map +1 -1
  43. package/ChannelSettings.js +23 -23
  44. package/CreateChannel/components/CreateChannelUI.js +16 -16
  45. package/CreateChannel/components/InviteUsers.js +16 -16
  46. package/CreateChannel/components/SelectChannelType.js +10 -10
  47. package/CreateChannel/context.js +4 -4
  48. package/CreateChannel.js +16 -16
  49. package/CreateOpenChannel/components/CreateOpenChannelUI.js +11 -11
  50. package/CreateOpenChannel/context.js +1 -1
  51. package/CreateOpenChannel.js +11 -11
  52. package/EditUserProfile/components/EditUserProfileUI.js +12 -12
  53. package/EditUserProfile.js +12 -12
  54. package/GroupChannel/components/FileViewer.js +23 -23
  55. package/GroupChannel/components/FrozenNotification.js +5 -5
  56. package/GroupChannel/components/GroupChannelHeader.js +22 -22
  57. package/GroupChannel/components/GroupChannelUI.js +61 -57
  58. package/GroupChannel/components/GroupChannelUI.js.map +1 -1
  59. package/GroupChannel/components/Message.js +61 -52
  60. package/GroupChannel/components/Message.js.map +1 -1
  61. package/GroupChannel/components/MessageInputWrapper.js +38 -38
  62. package/GroupChannel/components/MessageList.js +56 -51
  63. package/GroupChannel/components/MessageList.js.map +1 -1
  64. package/GroupChannel/components/RemoveMessageModal.js +22 -22
  65. package/GroupChannel/components/SuggestedMentionList.js +12 -12
  66. package/GroupChannel/components/SuggestedReplies.js +1 -1
  67. package/GroupChannel/components/TypingIndicator.js +6 -6
  68. package/GroupChannel/components/UnreadCount.js +7 -7
  69. package/GroupChannel/context.js +15 -15
  70. package/GroupChannel.js +61 -57
  71. package/GroupChannel.js.map +1 -1
  72. package/GroupChannelList/components/AddGroupChannel.js +18 -18
  73. package/GroupChannelList/components/GroupChannelListHeader.js +8 -8
  74. package/GroupChannelList/components/GroupChannelListItem.js +24 -24
  75. package/GroupChannelList/components/GroupChannelListUI.js +33 -33
  76. package/GroupChannelList/components/GroupChannelPreviewAction.js +11 -11
  77. package/GroupChannelList/context.js +5 -5
  78. package/GroupChannelList.js +33 -33
  79. package/MessageSearch/components/MessageSearchUI.js +14 -14
  80. package/MessageSearch/context.js +1 -1
  81. package/MessageSearch.js +14 -14
  82. package/OpenChannel/components/FrozenChannelNotification.js +5 -5
  83. package/OpenChannel/components/OpenChannelHeader.js +18 -18
  84. package/OpenChannel/components/OpenChannelInput.js +25 -25
  85. package/OpenChannel/components/OpenChannelMessage.js +35 -35
  86. package/OpenChannel/components/OpenChannelMessageList.js +39 -39
  87. package/OpenChannel/components/OpenChannelUI.js +39 -39
  88. package/OpenChannel/context.js +17 -17
  89. package/OpenChannel.js +39 -39
  90. package/OpenChannelList/components/OpenChannelListUI.js +14 -14
  91. package/OpenChannelList/components/OpenChannelPreview.js +6 -6
  92. package/OpenChannelList/context.js +3 -3
  93. package/OpenChannelList.js +14 -14
  94. package/OpenChannelSettings/components/EditDetailsModal.js +15 -15
  95. package/OpenChannelSettings/components/OpenChannelProfile.js +15 -15
  96. package/OpenChannelSettings/components/OpenChannelSettingsUI.js +19 -19
  97. package/OpenChannelSettings/components/OperatorUI.js +19 -19
  98. package/OpenChannelSettings/components/ParticipantUI.js +17 -17
  99. package/OpenChannelSettings/context.js +3 -3
  100. package/OpenChannelSettings.js +19 -19
  101. package/SendbirdProvider.js +360 -83
  102. package/SendbirdProvider.js.map +1 -1
  103. package/Thread/components/ParentMessageInfo.js +42 -42
  104. package/Thread/components/ParentMessageInfoItem.js +28 -28
  105. package/Thread/components/ThreadHeader.js +7 -7
  106. package/Thread/components/ThreadList.js +46 -46
  107. package/Thread/components/ThreadListItem.js +46 -46
  108. package/Thread/components/ThreadMessageInput.js +42 -42
  109. package/Thread/components/ThreadUI.js +56 -56
  110. package/Thread/context.js +9 -9
  111. package/Thread.js +56 -56
  112. package/VoicePlayer/context.js +3 -3
  113. package/VoicePlayer/useVoicePlayer.js +10 -10
  114. package/VoiceRecorder/context.js +10 -10
  115. package/VoiceRecorder/useVoiceRecorder.js +9 -9
  116. package/chunks/{bundle-pJmhSBAn.js → bundle--GxLwo7q.js} +4 -4
  117. package/chunks/{bundle-pJmhSBAn.js.map → bundle--GxLwo7q.js.map} +1 -1
  118. package/chunks/{bundle-BLt9vn5B.js → bundle--WETJA_c.js} +6 -6
  119. package/chunks/bundle--WETJA_c.js.map +1 -0
  120. package/chunks/{bundle-TzTFcIfJ.js → bundle-0DTNrbOf.js} +1 -1
  121. package/chunks/bundle-0DTNrbOf.js.map +1 -0
  122. package/chunks/{bundle-5fPKUbCn.js → bundle-0QDb7-Y_.js} +1 -1
  123. package/chunks/{bundle-5fPKUbCn.js.map → bundle-0QDb7-Y_.js.map} +1 -1
  124. package/chunks/{bundle-014pCrux.js → bundle-0Vur_TKy.js} +1 -1
  125. package/chunks/bundle-0Vur_TKy.js.map +1 -0
  126. package/chunks/{bundle-F_qWVzaf.js → bundle-2194oWZc.js} +1 -1
  127. package/chunks/bundle-2194oWZc.js.map +1 -0
  128. package/chunks/{bundle-6hgn3L9Y.js → bundle-22Jw6ztq.js} +6 -6
  129. package/chunks/bundle-22Jw6ztq.js.map +1 -0
  130. package/chunks/{bundle-A8dpIXKJ.js → bundle-2AR3a1T9.js} +3 -3
  131. package/chunks/bundle-2AR3a1T9.js.map +1 -0
  132. package/chunks/{bundle-a2TolYYj.js → bundle-39Y3yv8j.js} +1 -1
  133. package/chunks/bundle-39Y3yv8j.js.map +1 -0
  134. package/chunks/{bundle--q7ObKwF.js → bundle-3E-IANjq.js} +1 -1
  135. package/chunks/bundle-3E-IANjq.js.map +1 -0
  136. package/chunks/{bundle-tPOBtJjA.js → bundle-4gcxTdvH.js} +1 -1
  137. package/chunks/bundle-4gcxTdvH.js.map +1 -0
  138. package/chunks/bundle-6KFri-1A.js +1689 -0
  139. package/chunks/bundle-6KFri-1A.js.map +1 -0
  140. package/chunks/{bundle-cJYfaBvk.js → bundle-6_zAh1Y3.js} +10 -10
  141. package/chunks/bundle-6_zAh1Y3.js.map +1 -0
  142. package/chunks/{bundle-ibeQnj0V.js → bundle-6ruK1Zgw.js} +2 -2
  143. package/chunks/bundle-6ruK1Zgw.js.map +1 -0
  144. package/chunks/{bundle-ZlvXkXrU.js → bundle-6yzuMtzi.js} +1 -1
  145. package/chunks/bundle-6yzuMtzi.js.map +1 -0
  146. package/chunks/{bundle-DS8eBDjC.js → bundle-6zdlkf2J.js} +1 -1
  147. package/chunks/bundle-6zdlkf2J.js.map +1 -0
  148. package/chunks/{bundle-r1f2uym4.js → bundle-7Mx2MtAL.js} +2 -2
  149. package/chunks/bundle-7Mx2MtAL.js.map +1 -0
  150. package/chunks/{bundle-J6qXeThU.js → bundle-85rk09Bx.js} +1 -1
  151. package/chunks/bundle-85rk09Bx.js.map +1 -0
  152. package/chunks/{bundle-9JkrMUIl.js → bundle-9C7b_-hs.js} +1 -1
  153. package/chunks/bundle-9C7b_-hs.js.map +1 -0
  154. package/chunks/{bundle-taqbMkQe.js → bundle-9QigDxkR.js} +1 -1
  155. package/chunks/{bundle-taqbMkQe.js.map → bundle-9QigDxkR.js.map} +1 -1
  156. package/chunks/{bundle-52hs7-M-.js → bundle-9c5vLDe9.js} +7 -3
  157. package/chunks/bundle-9c5vLDe9.js.map +1 -0
  158. package/chunks/{bundle-YpfSm9dM.js → bundle-AaDwp4eU.js} +1 -1
  159. package/chunks/bundle-AaDwp4eU.js.map +1 -0
  160. package/chunks/{bundle-6mWCjL2G.js → bundle-Aqr_4BjO.js} +6 -6
  161. package/chunks/bundle-Aqr_4BjO.js.map +1 -0
  162. package/chunks/{bundle-e1b64xud.js → bundle-BMZkoBS_.js} +1 -1
  163. package/chunks/bundle-BMZkoBS_.js.map +1 -0
  164. package/chunks/{bundle-LG3hn4TL.js → bundle-BiPw1Sub.js} +4 -4
  165. package/chunks/bundle-BiPw1Sub.js.map +1 -0
  166. package/chunks/{bundle-UxyhnVkY.js → bundle-C-Q3OKQW.js} +1 -1
  167. package/chunks/bundle-C-Q3OKQW.js.map +1 -0
  168. package/chunks/{bundle-TovLF3ih.js → bundle-DHw1C5gJ.js} +1 -1
  169. package/chunks/bundle-DHw1C5gJ.js.map +1 -0
  170. package/chunks/{bundle-OAC6aJ8X.js → bundle-DbZW44FD.js} +14 -14
  171. package/chunks/{bundle-OAC6aJ8X.js.map → bundle-DbZW44FD.js.map} +1 -1
  172. package/chunks/{bundle-oLg6CIrN.js → bundle-Drmg8_dh.js} +1 -1
  173. package/chunks/bundle-Drmg8_dh.js.map +1 -0
  174. package/chunks/{bundle-f9AOpkiS.js → bundle-IH2e-Hbm.js} +1 -1
  175. package/chunks/bundle-IH2e-Hbm.js.map +1 -0
  176. package/chunks/{bundle-qafY5nY6.js → bundle-JyjLgYxl.js} +2 -2
  177. package/chunks/{bundle-qafY5nY6.js.map → bundle-JyjLgYxl.js.map} +1 -1
  178. package/chunks/{bundle-yoFO4gJM.js → bundle-KIf79auh.js} +1 -1
  179. package/chunks/{bundle-yoFO4gJM.js.map → bundle-KIf79auh.js.map} +1 -1
  180. package/chunks/{bundle-qfOg3sUU.js → bundle-LQlIikHo.js} +11 -11
  181. package/chunks/{bundle-qfOg3sUU.js.map → bundle-LQlIikHo.js.map} +1 -1
  182. package/chunks/{bundle-TYsOyvS5.js → bundle-LTiCF37t.js} +8 -4
  183. package/chunks/{bundle-TYsOyvS5.js.map → bundle-LTiCF37t.js.map} +1 -1
  184. package/chunks/{bundle-cIHCEDKb.js → bundle-LjoHDFFW.js} +1 -1
  185. package/chunks/bundle-LjoHDFFW.js.map +1 -0
  186. package/chunks/{bundle-GCno1s5H.js → bundle-MSFA1dPT.js} +10 -10
  187. package/chunks/{bundle-GCno1s5H.js.map → bundle-MSFA1dPT.js.map} +1 -1
  188. package/chunks/{bundle-pwwvkK5L.js → bundle-NQDEdVJA.js} +2 -2
  189. package/chunks/{bundle-pwwvkK5L.js.map → bundle-NQDEdVJA.js.map} +1 -1
  190. package/chunks/{bundle-BF1Rr3vo.js → bundle-NntyZyeL.js} +8 -8
  191. package/chunks/{bundle-BF1Rr3vo.js.map → bundle-NntyZyeL.js.map} +1 -1
  192. package/chunks/{bundle-BTLUIJqA.js → bundle-NwEKq2eQ.js} +4 -4
  193. package/chunks/{bundle-BTLUIJqA.js.map → bundle-NwEKq2eQ.js.map} +1 -1
  194. package/chunks/{bundle-Y-ZHrlZJ.js → bundle-O7xTFAHP.js} +8 -8
  195. package/chunks/{bundle-Y-ZHrlZJ.js.map → bundle-O7xTFAHP.js.map} +1 -1
  196. package/chunks/{bundle-6cTGHg9E.js → bundle-PTiTVbcu.js} +3 -3
  197. package/chunks/{bundle-6cTGHg9E.js.map → bundle-PTiTVbcu.js.map} +1 -1
  198. package/chunks/{bundle-U7_j21Ss.js → bundle-PYv4lPO3.js} +2 -2
  199. package/chunks/{bundle-U7_j21Ss.js.map → bundle-PYv4lPO3.js.map} +1 -1
  200. package/chunks/{bundle-PrsPGxuw.js → bundle-PdtvfqJT.js} +1 -1
  201. package/chunks/bundle-PdtvfqJT.js.map +1 -0
  202. package/chunks/{bundle-Jun66RyD.js → bundle-Sl-oiala.js} +1 -1
  203. package/chunks/bundle-Sl-oiala.js.map +1 -0
  204. package/chunks/{bundle-W_nWubt-.js → bundle-Sm0-7tTm.js} +2 -2
  205. package/chunks/{bundle-W_nWubt-.js.map → bundle-Sm0-7tTm.js.map} +1 -1
  206. package/chunks/{bundle-BGFDI87G.js → bundle-Ueye8-sz.js} +4 -4
  207. package/chunks/bundle-Ueye8-sz.js.map +1 -0
  208. package/chunks/{bundle-_o_iMme_.js → bundle-X7gl5vNX.js} +1 -1
  209. package/chunks/bundle-X7gl5vNX.js.map +1 -0
  210. package/chunks/{bundle-yPhMS1LV.js → bundle-XDy3Cf54.js} +4 -1
  211. package/chunks/{bundle-yPhMS1LV.js.map → bundle-XDy3Cf54.js.map} +1 -1
  212. package/chunks/{bundle--pOSeu9W.js → bundle-XjJUjhN1.js} +3 -3
  213. package/chunks/bundle-XjJUjhN1.js.map +1 -0
  214. package/chunks/{bundle-fMkcL8C8.js → bundle-Y3ZVN9yF.js} +1 -1
  215. package/chunks/bundle-Y3ZVN9yF.js.map +1 -0
  216. package/chunks/{bundle-bazn-ENb.js → bundle-_hGurAcC.js} +1 -1
  217. package/chunks/bundle-_hGurAcC.js.map +1 -0
  218. package/chunks/{bundle-yQgn6JfU.js → bundle-a73hFmUC.js} +25 -44
  219. package/chunks/bundle-a73hFmUC.js.map +1 -0
  220. package/chunks/{bundle-f1tjVRSh.js → bundle-b2jLXyrm.js} +3 -3
  221. package/chunks/bundle-b2jLXyrm.js.map +1 -0
  222. package/chunks/{bundle-wKSIzWUl.js → bundle-bg3dRlK7.js} +3 -3
  223. package/chunks/{bundle-wKSIzWUl.js.map → bundle-bg3dRlK7.js.map} +1 -1
  224. package/chunks/{bundle-ykuyabqF.js → bundle-bgVMRm8v.js} +4 -4
  225. package/chunks/{bundle-ykuyabqF.js.map → bundle-bgVMRm8v.js.map} +1 -1
  226. package/chunks/{bundle-jHpuKuA-.js → bundle-cilkeUXQ.js} +5 -5
  227. package/chunks/bundle-cilkeUXQ.js.map +1 -0
  228. package/chunks/{bundle-IFrmy9_C.js → bundle-dUPYt-qi.js} +2 -2
  229. package/chunks/bundle-dUPYt-qi.js.map +1 -0
  230. package/chunks/{bundle-gSFYF-34.js → bundle-da60Z7l5.js} +5 -5
  231. package/chunks/bundle-da60Z7l5.js.map +1 -0
  232. package/chunks/{bundle-is3QkoNv.js → bundle-eC1SRuX3.js} +2 -2
  233. package/chunks/{bundle-is3QkoNv.js.map → bundle-eC1SRuX3.js.map} +1 -1
  234. package/chunks/{bundle-3cwcm2Rk.js → bundle-fgpwMbpA.js} +10 -10
  235. package/chunks/bundle-fgpwMbpA.js.map +1 -0
  236. package/chunks/{bundle-XEjzWAwL.js → bundle-gMH6Z6oi.js} +2 -2
  237. package/chunks/{bundle-XEjzWAwL.js.map → bundle-gMH6Z6oi.js.map} +1 -1
  238. package/chunks/{bundle-IOegLdFC.js → bundle-gQwzebOn.js} +3 -3
  239. package/chunks/bundle-gQwzebOn.js.map +1 -0
  240. package/chunks/{bundle-rwixBUpF.js → bundle-hAyHXo9f.js} +4 -4
  241. package/chunks/bundle-hAyHXo9f.js.map +1 -0
  242. package/chunks/{bundle-wdUAfmoS.js → bundle-hjFxrcMW.js} +1 -1
  243. package/chunks/bundle-hjFxrcMW.js.map +1 -0
  244. package/chunks/{bundle-SXGL8fBv.js → bundle-jqQY8n8G.js} +1 -1
  245. package/chunks/bundle-jqQY8n8G.js.map +1 -0
  246. package/chunks/{bundle-UDnO8-Dp.js → bundle-jzjtmtps.js} +2 -2
  247. package/chunks/bundle-jzjtmtps.js.map +1 -0
  248. package/chunks/{bundle-k0q5mJF1.js → bundle-kLlb2TJ8.js} +3 -3
  249. package/chunks/{bundle-k0q5mJF1.js.map → bundle-kLlb2TJ8.js.map} +1 -1
  250. package/chunks/{bundle-rW70z6Ho.js → bundle-lZq_XDzb.js} +3 -3
  251. package/chunks/bundle-lZq_XDzb.js.map +1 -0
  252. package/chunks/{bundle-2BKREX4m.js → bundle-n2BmCgGV.js} +1 -1
  253. package/chunks/bundle-n2BmCgGV.js.map +1 -0
  254. package/chunks/{bundle-rXKTCCVw.js → bundle-nXMckOlK.js} +5 -5
  255. package/chunks/{bundle-rXKTCCVw.js.map → bundle-nXMckOlK.js.map} +1 -1
  256. package/chunks/{bundle-Q3UquQ_i.js → bundle-npMrmwG6.js} +1 -1
  257. package/chunks/bundle-npMrmwG6.js.map +1 -0
  258. package/chunks/{bundle-1pgLpH_4.js → bundle-qouYngqR.js} +10 -7
  259. package/chunks/bundle-qouYngqR.js.map +1 -0
  260. package/chunks/{bundle-VfTA9EY8.js → bundle-rjBwVkDc.js} +10 -10
  261. package/chunks/{bundle-VfTA9EY8.js.map → bundle-rjBwVkDc.js.map} +1 -1
  262. package/chunks/{bundle-6ivjnK_C.js → bundle-ubVU4exZ.js} +3 -3
  263. package/chunks/{bundle-6ivjnK_C.js.map → bundle-ubVU4exZ.js.map} +1 -1
  264. package/chunks/{bundle-SMgyl32k.js → bundle-v3VMB7al.js} +1 -1
  265. package/chunks/bundle-v3VMB7al.js.map +1 -0
  266. package/chunks/{bundle-wO0wz3br.js → bundle-wWnN6K3w.js} +1 -1
  267. package/chunks/{bundle-wO0wz3br.js.map → bundle-wWnN6K3w.js.map} +1 -1
  268. package/chunks/{bundle-_xgfKjN0.js → bundle-wpc1Fted.js} +3 -3
  269. package/chunks/bundle-wpc1Fted.js.map +1 -0
  270. package/chunks/{bundle-S-mn30SU.js → bundle-xC7o7NLR.js} +7 -3
  271. package/chunks/bundle-xC7o7NLR.js.map +1 -0
  272. package/chunks/{bundle-24By8B6B.js → bundle-y909vBn9.js} +3 -3
  273. package/chunks/{bundle-24By8B6B.js.map → bundle-y909vBn9.js.map} +1 -1
  274. package/chunks/{bundle-xLjEyoT0.js → bundle-y9VJsc3H.js} +5 -5
  275. package/chunks/bundle-y9VJsc3H.js.map +1 -0
  276. package/chunks/{bundle-WImaBVSO.js → bundle-yIputEl7.js} +1 -1
  277. package/chunks/bundle-yIputEl7.js.map +1 -0
  278. package/chunks/{bundle-B_WSWypW.js → bundle-zy69cX9t.js} +7 -7
  279. package/chunks/{bundle-B_WSWypW.js.map → bundle-zy69cX9t.js.map} +1 -1
  280. package/cjs/App.js +79 -75
  281. package/cjs/App.js.map +1 -1
  282. package/cjs/Channel/components/ChannelHeader.js +29 -29
  283. package/cjs/Channel/components/ChannelUI.js +67 -63
  284. package/cjs/Channel/components/ChannelUI.js.map +1 -1
  285. package/cjs/Channel/components/FileViewer.js +28 -28
  286. package/cjs/Channel/components/FrozenNotification.js +5 -5
  287. package/cjs/Channel/components/Message.js +62 -56
  288. package/cjs/Channel/components/Message.js.map +1 -1
  289. package/cjs/Channel/components/MessageFeedbackModal.js +9 -9
  290. package/cjs/Channel/components/MessageInput.js +41 -41
  291. package/cjs/Channel/components/MessageInputWrapper.js +41 -41
  292. package/cjs/Channel/components/MessageList.js +63 -59
  293. package/cjs/Channel/components/MessageList.js.map +1 -1
  294. package/cjs/Channel/components/RemoveMessageModal.js +27 -27
  295. package/cjs/Channel/components/SuggestedMentionList.js +27 -27
  296. package/cjs/Channel/components/TypingIndicator.js +6 -6
  297. package/cjs/Channel/components/UnreadCount.js +7 -7
  298. package/cjs/Channel/context.js +20 -20
  299. package/cjs/Channel/hooks/useHandleUploadFiles.js +13 -13
  300. package/cjs/Channel/hooks/useInitialMessagesFetch.js +6 -6
  301. package/cjs/Channel/utils/compareMessagesForGrouping.js +5 -5
  302. package/cjs/Channel/utils/getMessagePartsInfo.js +6 -6
  303. package/cjs/Channel.js +67 -63
  304. package/cjs/Channel.js.map +1 -1
  305. package/cjs/ChannelList/components/AddChannel.js +20 -20
  306. package/cjs/ChannelList/components/ChannelListHeader.js +8 -8
  307. package/cjs/ChannelList/components/ChannelListUI.js +34 -34
  308. package/cjs/ChannelList/components/ChannelPreview.js +27 -27
  309. package/cjs/ChannelList/components/ChannelPreviewAction.js +11 -11
  310. package/cjs/ChannelList/context.js +10 -10
  311. package/cjs/ChannelList.js +34 -34
  312. package/cjs/ChannelSettings/components/ChannelProfile.js +14 -14
  313. package/cjs/ChannelSettings/components/ChannelSettingsUI.js +23 -23
  314. package/cjs/ChannelSettings/components/EditDetailsModal.js +14 -14
  315. package/cjs/ChannelSettings/components/LeaveChannel.js +11 -11
  316. package/cjs/ChannelSettings/components/ModerationPanel.js +21 -21
  317. package/cjs/ChannelSettings/components/UserListItem.js +13 -13
  318. package/cjs/ChannelSettings/components/UserPanel.js +20 -20
  319. package/cjs/ChannelSettings/context.js +43 -22
  320. package/cjs/ChannelSettings/context.js.map +1 -1
  321. package/cjs/ChannelSettings.js +23 -23
  322. package/cjs/CreateChannel/components/CreateChannelUI.js +16 -16
  323. package/cjs/CreateChannel/components/InviteUsers.js +16 -16
  324. package/cjs/CreateChannel/components/SelectChannelType.js +10 -10
  325. package/cjs/CreateChannel/context.js +4 -4
  326. package/cjs/CreateChannel.js +16 -16
  327. package/cjs/CreateOpenChannel/components/CreateOpenChannelUI.js +11 -11
  328. package/cjs/CreateOpenChannel/context.js +1 -1
  329. package/cjs/CreateOpenChannel.js +11 -11
  330. package/cjs/EditUserProfile/components/EditUserProfileUI.js +12 -12
  331. package/cjs/EditUserProfile.js +12 -12
  332. package/cjs/GroupChannel/components/FileViewer.js +23 -23
  333. package/cjs/GroupChannel/components/FrozenNotification.js +5 -5
  334. package/cjs/GroupChannel/components/GroupChannelHeader.js +22 -22
  335. package/cjs/GroupChannel/components/GroupChannelUI.js +61 -57
  336. package/cjs/GroupChannel/components/GroupChannelUI.js.map +1 -1
  337. package/cjs/GroupChannel/components/Message.js +61 -52
  338. package/cjs/GroupChannel/components/Message.js.map +1 -1
  339. package/cjs/GroupChannel/components/MessageInputWrapper.js +37 -37
  340. package/cjs/GroupChannel/components/MessageList.js +56 -51
  341. package/cjs/GroupChannel/components/MessageList.js.map +1 -1
  342. package/cjs/GroupChannel/components/RemoveMessageModal.js +22 -22
  343. package/cjs/GroupChannel/components/SuggestedMentionList.js +12 -12
  344. package/cjs/GroupChannel/components/SuggestedReplies.js +1 -4
  345. package/cjs/GroupChannel/components/SuggestedReplies.js.map +1 -1
  346. package/cjs/GroupChannel/components/TypingIndicator.js +6 -6
  347. package/cjs/GroupChannel/components/UnreadCount.js +7 -7
  348. package/cjs/GroupChannel/context.js +15 -15
  349. package/cjs/GroupChannel.js +61 -57
  350. package/cjs/GroupChannel.js.map +1 -1
  351. package/cjs/GroupChannelList/components/AddGroupChannel.js +18 -18
  352. package/cjs/GroupChannelList/components/GroupChannelListHeader.js +8 -8
  353. package/cjs/GroupChannelList/components/GroupChannelListItem.js +24 -24
  354. package/cjs/GroupChannelList/components/GroupChannelListUI.js +33 -33
  355. package/cjs/GroupChannelList/components/GroupChannelPreviewAction.js +11 -11
  356. package/cjs/GroupChannelList/context.js +5 -5
  357. package/cjs/GroupChannelList.js +33 -33
  358. package/cjs/MessageSearch/components/MessageSearchUI.js +14 -14
  359. package/cjs/MessageSearch/context.js +1 -1
  360. package/cjs/MessageSearch.js +14 -14
  361. package/cjs/OpenChannel/components/FrozenChannelNotification.js +5 -5
  362. package/cjs/OpenChannel/components/OpenChannelHeader.js +18 -18
  363. package/cjs/OpenChannel/components/OpenChannelInput.js +25 -25
  364. package/cjs/OpenChannel/components/OpenChannelMessage.js +35 -35
  365. package/cjs/OpenChannel/components/OpenChannelMessageList.js +39 -39
  366. package/cjs/OpenChannel/components/OpenChannelUI.js +39 -39
  367. package/cjs/OpenChannel/context.js +17 -17
  368. package/cjs/OpenChannel.js +39 -39
  369. package/cjs/OpenChannelList/components/OpenChannelListUI.js +14 -14
  370. package/cjs/OpenChannelList/components/OpenChannelPreview.js +6 -6
  371. package/cjs/OpenChannelList/context.js +3 -3
  372. package/cjs/OpenChannelList.js +14 -14
  373. package/cjs/OpenChannelSettings/components/EditDetailsModal.js +15 -15
  374. package/cjs/OpenChannelSettings/components/OpenChannelProfile.js +15 -15
  375. package/cjs/OpenChannelSettings/components/OpenChannelSettingsUI.js +19 -19
  376. package/cjs/OpenChannelSettings/components/OperatorUI.js +19 -19
  377. package/cjs/OpenChannelSettings/components/ParticipantUI.js +17 -17
  378. package/cjs/OpenChannelSettings/context.js +3 -3
  379. package/cjs/OpenChannelSettings.js +19 -19
  380. package/cjs/SendbirdProvider.js +360 -83
  381. package/cjs/SendbirdProvider.js.map +1 -1
  382. package/cjs/Thread/components/ParentMessageInfo.js +42 -42
  383. package/cjs/Thread/components/ParentMessageInfoItem.js +28 -28
  384. package/cjs/Thread/components/ThreadHeader.js +7 -7
  385. package/cjs/Thread/components/ThreadList.js +46 -46
  386. package/cjs/Thread/components/ThreadListItem.js +46 -46
  387. package/cjs/Thread/components/ThreadMessageInput.js +42 -42
  388. package/cjs/Thread/components/ThreadUI.js +56 -56
  389. package/cjs/Thread/context.js +9 -9
  390. package/cjs/Thread.js +56 -56
  391. package/cjs/VoicePlayer/context.js +3 -3
  392. package/cjs/VoicePlayer/useVoicePlayer.js +10 -10
  393. package/cjs/VoiceRecorder/context.js +10 -10
  394. package/cjs/VoiceRecorder/useVoiceRecorder.js +9 -9
  395. package/cjs/chunks/{bundle-VOIBVZ8K.js → bundle-0FJbDLYK.js} +1 -1
  396. package/cjs/chunks/bundle-0FJbDLYK.js.map +1 -0
  397. package/cjs/chunks/{bundle-9uUg_zKI.js → bundle-0Io7rZH6.js} +3 -3
  398. package/cjs/chunks/bundle-0Io7rZH6.js.map +1 -0
  399. package/cjs/chunks/{bundle-DAwfoiZz.js → bundle-0RoC5AKT.js} +4 -4
  400. package/cjs/chunks/bundle-0RoC5AKT.js.map +1 -0
  401. package/cjs/chunks/{bundle-zvM7ls7A.js → bundle-0SKvTM5F.js} +1 -1
  402. package/cjs/chunks/bundle-0SKvTM5F.js.map +1 -0
  403. package/cjs/chunks/{bundle-vzrDnUV2.js → bundle-0X7q6NtR.js} +5 -5
  404. package/cjs/chunks/bundle-0X7q6NtR.js.map +1 -0
  405. package/cjs/chunks/{bundle-Ktg9Of7w.js → bundle-1BET8ZYY.js} +1 -1
  406. package/cjs/chunks/bundle-1BET8ZYY.js.map +1 -0
  407. package/cjs/chunks/{bundle-uIj1z0m8.js → bundle-2-AYfw-C.js} +10 -7
  408. package/cjs/chunks/bundle-2-AYfw-C.js.map +1 -0
  409. package/cjs/chunks/{bundle-rGYP82Yc.js → bundle-2dTv415Y.js} +3 -3
  410. package/cjs/chunks/bundle-2dTv415Y.js.map +1 -0
  411. package/cjs/chunks/{bundle-hYAxN2fG.js → bundle-3uSGqV8n.js} +1 -1
  412. package/cjs/chunks/bundle-3uSGqV8n.js.map +1 -0
  413. package/cjs/chunks/{bundle-634wsixh.js → bundle-4jhVxof3.js} +10 -10
  414. package/cjs/chunks/{bundle-634wsixh.js.map → bundle-4jhVxof3.js.map} +1 -1
  415. package/cjs/chunks/{bundle-SM64BUgE.js → bundle-5_1l38DN.js} +2 -2
  416. package/cjs/chunks/bundle-5_1l38DN.js.map +1 -0
  417. package/cjs/chunks/{bundle-12iJO39c.js → bundle-5i9-ntZ5.js} +7 -3
  418. package/cjs/chunks/bundle-5i9-ntZ5.js.map +1 -0
  419. package/cjs/chunks/{bundle-BAZMzxRI.js → bundle-5zZ25-q8.js} +1 -1
  420. package/cjs/chunks/bundle-5zZ25-q8.js.map +1 -0
  421. package/cjs/chunks/{bundle-rY_4WHYR.js → bundle-8JrMDacP.js} +3 -3
  422. package/cjs/chunks/bundle-8JrMDacP.js.map +1 -0
  423. package/cjs/chunks/{bundle-QauQilHV.js → bundle-9l41IWgC.js} +1 -1
  424. package/cjs/chunks/bundle-9l41IWgC.js.map +1 -0
  425. package/cjs/chunks/{bundle-h1-4ko51.js → bundle-9oVHmbyo.js} +5 -5
  426. package/cjs/chunks/bundle-9oVHmbyo.js.map +1 -0
  427. package/cjs/chunks/{bundle-sPQAW6hW.js → bundle-A45IMFSi.js} +1 -1
  428. package/cjs/chunks/bundle-A45IMFSi.js.map +1 -0
  429. package/cjs/chunks/{bundle-SyUPzsOv.js → bundle-AjEjAHAy.js} +4 -4
  430. package/cjs/chunks/{bundle-SyUPzsOv.js.map → bundle-AjEjAHAy.js.map} +1 -1
  431. package/cjs/chunks/{bundle-DGXRqeiH.js → bundle-BdWL3kB4.js} +1 -1
  432. package/cjs/chunks/bundle-BdWL3kB4.js.map +1 -0
  433. package/cjs/chunks/{bundle-TPt6Ukqk.js → bundle-DKAurwqI.js} +4 -4
  434. package/cjs/chunks/{bundle-TPt6Ukqk.js.map → bundle-DKAurwqI.js.map} +1 -1
  435. package/cjs/chunks/{bundle-JbsZLrne.js → bundle-DsdDiOQc.js} +2 -2
  436. package/cjs/chunks/{bundle-JbsZLrne.js.map → bundle-DsdDiOQc.js.map} +1 -1
  437. package/cjs/chunks/{bundle-WjU125ds.js → bundle-EIBGC5ds.js} +3 -3
  438. package/cjs/chunks/bundle-EIBGC5ds.js.map +1 -0
  439. package/cjs/chunks/{bundle-rIjHxu2P.js → bundle-EPgJPeP5.js} +2 -2
  440. package/cjs/chunks/bundle-EPgJPeP5.js.map +1 -0
  441. package/cjs/chunks/{bundle-cp4Mr7IE.js → bundle-FYiANS7I.js} +1 -1
  442. package/cjs/chunks/bundle-FYiANS7I.js.map +1 -0
  443. package/cjs/chunks/{bundle-opmIFrXg.js → bundle-Gw-7KmmG.js} +8 -3
  444. package/cjs/chunks/{bundle-opmIFrXg.js.map → bundle-Gw-7KmmG.js.map} +1 -1
  445. package/cjs/chunks/{bundle-9Ms65KWQ.js → bundle-HdAqAQmQ.js} +2 -2
  446. package/cjs/chunks/bundle-HdAqAQmQ.js.map +1 -0
  447. package/cjs/chunks/{bundle-juIULvxr.js → bundle-JuSRYTO4.js} +1 -1
  448. package/cjs/chunks/bundle-JuSRYTO4.js.map +1 -0
  449. package/cjs/chunks/{bundle-2jwRnSd8.js → bundle-KEItFRlq.js} +8 -8
  450. package/cjs/chunks/{bundle-2jwRnSd8.js.map → bundle-KEItFRlq.js.map} +1 -1
  451. package/cjs/chunks/{bundle-yzcXd9DQ.js → bundle-M7S2ba5_.js} +10 -10
  452. package/cjs/chunks/bundle-M7S2ba5_.js.map +1 -0
  453. package/cjs/chunks/{bundle-3eINsVVm.js → bundle-Myh0hGtf.js} +6 -6
  454. package/cjs/chunks/bundle-Myh0hGtf.js.map +1 -0
  455. package/cjs/chunks/{bundle-Rd2d2a3j.js → bundle-NSfuzonk.js} +8 -8
  456. package/cjs/chunks/{bundle-Rd2d2a3j.js.map → bundle-NSfuzonk.js.map} +1 -1
  457. package/cjs/chunks/{bundle-cbIBIuxw.js → bundle-OypRlCX4.js} +1 -1
  458. package/cjs/chunks/bundle-OypRlCX4.js.map +1 -0
  459. package/cjs/chunks/{bundle-eb9lfgWx.js → bundle-PXqEjKnZ.js} +1 -1
  460. package/cjs/chunks/bundle-PXqEjKnZ.js.map +1 -0
  461. package/cjs/chunks/{bundle-rm245WXS.js → bundle-QvRptclZ.js} +2 -2
  462. package/cjs/chunks/bundle-QvRptclZ.js.map +1 -0
  463. package/cjs/chunks/{bundle-vtbEyMlh.js → bundle-RK7_ZCh1.js} +1 -1
  464. package/cjs/chunks/bundle-RK7_ZCh1.js.map +1 -0
  465. package/cjs/chunks/{bundle-mMBwJT3x.js → bundle-RceCnDam.js} +4 -4
  466. package/cjs/chunks/{bundle-mMBwJT3x.js.map → bundle-RceCnDam.js.map} +1 -1
  467. package/cjs/chunks/{bundle-UDa2UXB2.js → bundle-RngV4SHM.js} +3 -3
  468. package/cjs/chunks/{bundle-UDa2UXB2.js.map → bundle-RngV4SHM.js.map} +1 -1
  469. package/cjs/chunks/{bundle-7pGAEUaG.js → bundle-SWOq3kxG.js} +1 -1
  470. package/cjs/chunks/{bundle-7pGAEUaG.js.map → bundle-SWOq3kxG.js.map} +1 -1
  471. package/cjs/chunks/{bundle-EvM8f38k.js → bundle-Sk9Qqzuj.js} +2 -2
  472. package/cjs/chunks/bundle-Sk9Qqzuj.js.map +1 -0
  473. package/cjs/chunks/{bundle-BujsZjS_.js → bundle-Sxjv83JD.js} +3 -3
  474. package/cjs/chunks/bundle-Sxjv83JD.js.map +1 -0
  475. package/cjs/chunks/{bundle-xTAz4Z91.js → bundle-UOOPIGjG.js} +1 -1
  476. package/cjs/chunks/bundle-UOOPIGjG.js.map +1 -0
  477. package/cjs/chunks/{bundle-fNnK4ZX1.js → bundle-VBjH2Gyx.js} +2 -2
  478. package/cjs/chunks/{bundle-fNnK4ZX1.js.map → bundle-VBjH2Gyx.js.map} +1 -1
  479. package/cjs/chunks/{bundle-5_SjuoV5.js → bundle-Vsy2G1YZ.js} +1 -1
  480. package/cjs/chunks/bundle-Vsy2G1YZ.js.map +1 -0
  481. package/cjs/chunks/{bundle-XqQ_cljg.js → bundle-W4lK9aC2.js} +1 -1
  482. package/cjs/chunks/bundle-W4lK9aC2.js.map +1 -0
  483. package/cjs/chunks/{bundle-YGVhXIfU.js → bundle-WALfBkn-.js} +2 -2
  484. package/cjs/chunks/bundle-WALfBkn-.js.map +1 -0
  485. package/cjs/chunks/{bundle-KHlebcMh.js → bundle-ZFhZ9UyN.js} +3 -3
  486. package/cjs/chunks/{bundle-KHlebcMh.js.map → bundle-ZFhZ9UyN.js.map} +1 -1
  487. package/cjs/chunks/{bundle-SR43QM50.js → bundle-_1OqWxYy.js} +4 -4
  488. package/cjs/chunks/bundle-_1OqWxYy.js.map +1 -0
  489. package/cjs/chunks/{bundle-yJYTZhFC.js → bundle-_Hwf9prH.js} +1 -1
  490. package/cjs/chunks/bundle-_Hwf9prH.js.map +1 -0
  491. package/cjs/chunks/{bundle-pNtkOzhO.js → bundle-aCCpTlSC.js} +10 -10
  492. package/cjs/chunks/bundle-aCCpTlSC.js.map +1 -0
  493. package/cjs/chunks/{bundle-8fHhsSkO.js → bundle-aggH3_MP.js} +1 -1
  494. package/cjs/chunks/bundle-aggH3_MP.js.map +1 -0
  495. package/cjs/chunks/{bundle-oGyWTIOJ.js → bundle-b3QK79hX.js} +4 -4
  496. package/cjs/chunks/bundle-b3QK79hX.js.map +1 -0
  497. package/cjs/chunks/{bundle-o2GWKL_d.js → bundle-bOij3dXU.js} +1 -1
  498. package/cjs/chunks/bundle-bOij3dXU.js.map +1 -0
  499. package/cjs/chunks/bundle-csbD2FCX.js +1692 -0
  500. package/cjs/chunks/bundle-csbD2FCX.js.map +1 -0
  501. package/cjs/chunks/{bundle-mpZAARbu.js → bundle-ctM9C4Ol.js} +1 -1
  502. package/cjs/chunks/bundle-ctM9C4Ol.js.map +1 -0
  503. package/cjs/chunks/{bundle-0vl1G6aF.js → bundle-eVmdXbX4.js} +3 -3
  504. package/cjs/chunks/bundle-eVmdXbX4.js.map +1 -0
  505. package/cjs/chunks/{bundle-fzWbmzou.js → bundle-gaTYF6lz.js} +3 -3
  506. package/cjs/chunks/bundle-gaTYF6lz.js.map +1 -0
  507. package/cjs/chunks/{bundle-J790CoNK.js → bundle-hfoBchbF.js} +1 -1
  508. package/cjs/chunks/bundle-hfoBchbF.js.map +1 -0
  509. package/cjs/chunks/{bundle-cv4uM9fB.js → bundle-infYodZG.js} +10 -10
  510. package/{chunks/bundle-yQgn6JfU.js.map → cjs/chunks/bundle-infYodZG.js.map} +1 -1
  511. package/cjs/chunks/{bundle-hNdySo7A.js → bundle-lREr-1Hy.js} +24 -43
  512. package/cjs/chunks/bundle-lREr-1Hy.js.map +1 -0
  513. package/cjs/chunks/{bundle-cIL4aJSh.js → bundle-nNgkSlET.js} +1 -1
  514. package/cjs/chunks/bundle-nNgkSlET.js.map +1 -0
  515. package/cjs/chunks/{bundle-zMBWGCQM.js → bundle-nR3C0oIw.js} +2 -2
  516. package/cjs/chunks/bundle-nR3C0oIw.js.map +1 -0
  517. package/cjs/chunks/{bundle-gUU1zXtu.js → bundle-nTv4XhjL.js} +1 -1
  518. package/cjs/chunks/bundle-nTv4XhjL.js.map +1 -0
  519. package/cjs/chunks/{bundle-jh0UjnOb.js → bundle-nvUhM4Jt.js} +1 -1
  520. package/cjs/chunks/bundle-nvUhM4Jt.js.map +1 -0
  521. package/cjs/chunks/{bundle-OmPnU_OI.js → bundle-pc4CZYj5.js} +3 -3
  522. package/cjs/chunks/{bundle-OmPnU_OI.js.map → bundle-pc4CZYj5.js.map} +1 -1
  523. package/cjs/chunks/{bundle-Oq2WwdJI.js → bundle-qD5w2tyR.js} +8 -2
  524. package/cjs/chunks/bundle-qD5w2tyR.js.map +1 -0
  525. package/cjs/chunks/{bundle-6uWmKzjA.js → bundle-qYN98FNj.js} +1 -1
  526. package/cjs/chunks/{bundle-6uWmKzjA.js.map → bundle-qYN98FNj.js.map} +1 -1
  527. package/cjs/chunks/{bundle-VySxn-bM.js → bundle-rdAhtJum.js} +7 -7
  528. package/cjs/chunks/bundle-rdAhtJum.js.map +1 -0
  529. package/cjs/chunks/{bundle-m6R8TnWy.js → bundle-sYYqa58y.js} +14 -14
  530. package/cjs/chunks/{bundle-m6R8TnWy.js.map → bundle-sYYqa58y.js.map} +1 -1
  531. package/cjs/chunks/{bundle-4jX5eqYW.js → bundle-tBuSzzHI.js} +2 -2
  532. package/{chunks/bundle-1pgLpH_4.js.map → cjs/chunks/bundle-tBuSzzHI.js.map} +1 -1
  533. package/cjs/chunks/{bundle-Jy-utJ8j.js → bundle-tMR11mG8.js} +1 -1
  534. package/cjs/chunks/bundle-tMR11mG8.js.map +1 -0
  535. package/cjs/chunks/{bundle-Gj3FCN-l.js → bundle-unTPt0Np.js} +1 -1
  536. package/cjs/chunks/bundle-unTPt0Np.js.map +1 -0
  537. package/cjs/chunks/{bundle-6k9JvMoA.js → bundle-uyvcZB8I.js} +1 -1
  538. package/cjs/chunks/bundle-uyvcZB8I.js.map +1 -0
  539. package/cjs/chunks/{bundle-MIY8NRxo.js → bundle-vj7Nj0B0.js} +6 -6
  540. package/cjs/chunks/bundle-vj7Nj0B0.js.map +1 -0
  541. package/cjs/chunks/{bundle-YZRXvkp-.js → bundle-wbFvXCMi.js} +1 -1
  542. package/cjs/chunks/bundle-wbFvXCMi.js.map +1 -0
  543. package/cjs/chunks/{bundle-xHh0P-Hz.js → bundle-xNnngzve.js} +5 -5
  544. package/cjs/chunks/bundle-xNnngzve.js.map +1 -0
  545. package/cjs/chunks/{bundle-hR3vnZG1.js → bundle-xbuS1NJI.js} +1 -1
  546. package/cjs/chunks/bundle-xbuS1NJI.js.map +1 -0
  547. package/cjs/chunks/{bundle-sSkyvCgN.js → bundle-xe1wuNko.js} +3 -3
  548. package/cjs/chunks/bundle-xe1wuNko.js.map +1 -0
  549. package/cjs/chunks/{bundle-IKnblThp.js → bundle-xhP3_T1A.js} +6 -6
  550. package/cjs/chunks/bundle-xhP3_T1A.js.map +1 -0
  551. package/cjs/chunks/{bundle-JfUvL0pn.js → bundle-xtUT3duD.js} +4 -1
  552. package/cjs/chunks/bundle-xtUT3duD.js.map +1 -0
  553. package/cjs/chunks/{bundle-q15q65dt.js → bundle-yQR_oAnV.js} +1 -1
  554. package/cjs/chunks/bundle-yQR_oAnV.js.map +1 -0
  555. package/cjs/chunks/{bundle-jkZbYCwb.js → bundle-zhrtSnPT.js} +11 -11
  556. package/cjs/chunks/{bundle-jkZbYCwb.js.map → bundle-zhrtSnPT.js.map} +1 -1
  557. package/cjs/chunks/{bundle-3SJwqpkk.js → bundle-zkMvSSgq.js} +5 -5
  558. package/cjs/chunks/bundle-zkMvSSgq.js.map +1 -0
  559. package/cjs/hooks/useModal.js +9 -9
  560. package/cjs/index.js +83 -79
  561. package/cjs/index.js.map +1 -1
  562. package/cjs/pubSub/topics.js +1 -1
  563. package/cjs/sendbirdSelectors.js +2 -2
  564. package/cjs/ui/Accordion.js +3 -3
  565. package/cjs/ui/AccordionGroup.js +2 -2
  566. package/cjs/ui/AdminMessage.js +3 -3
  567. package/cjs/ui/Avatar.js +4 -4
  568. package/cjs/ui/Badge.js +5 -5
  569. package/cjs/ui/BottomSheet.js +9 -9
  570. package/cjs/ui/Button.js +3 -3
  571. package/cjs/ui/ChannelAvatar.js +5 -5
  572. package/cjs/ui/ConnectionStatus.js +6 -6
  573. package/cjs/ui/ContextMenu.js +6 -6
  574. package/cjs/ui/DateSeparator.js +4 -4
  575. package/cjs/ui/EmojiReactions.js +16 -16
  576. package/cjs/ui/FallbackTemplateMessageItemBody.tsx.js +34 -0
  577. package/cjs/ui/FallbackTemplateMessageItemBody.tsx.js.map +1 -0
  578. package/cjs/ui/FileMessageItemBody.js +8 -8
  579. package/cjs/ui/FileViewer.js +15 -15
  580. package/cjs/ui/Icon.js +4 -2
  581. package/cjs/ui/Icon.js.map +1 -1
  582. package/cjs/ui/IconButton.js +1 -1
  583. package/cjs/ui/ImageRenderer.js +2 -2
  584. package/cjs/ui/Input.js +3 -3
  585. package/cjs/ui/Label.js +3 -3
  586. package/cjs/ui/LinkLabel.js +3 -3
  587. package/cjs/ui/Loader.js +2 -2
  588. package/cjs/ui/LoadingTemplateMessageItemBody.tsx.js +29 -0
  589. package/cjs/ui/LoadingTemplateMessageItemBody.tsx.js.map +1 -0
  590. package/cjs/ui/MentionLabel.js +13 -13
  591. package/cjs/ui/MentionUserLabel.js +1 -1
  592. package/cjs/ui/MessageContent.js +93 -50
  593. package/cjs/ui/MessageContent.js.map +1 -1
  594. package/cjs/ui/MessageInput/hooks/usePaste.js +7 -7
  595. package/cjs/ui/MessageInput.js +15 -15
  596. package/cjs/ui/MessageItemMenu.js +10 -10
  597. package/cjs/ui/MessageItemReactionMenu.js +9 -9
  598. package/cjs/ui/MessageSearchFileItem.js +14 -14
  599. package/cjs/ui/MessageSearchItem.js +11 -11
  600. package/cjs/ui/MessageStatus.js +12 -12
  601. package/cjs/ui/MessageTemplate.js +12 -0
  602. package/cjs/ui/MessageTemplate.js.map +1 -0
  603. package/cjs/ui/MobileFeedbackMenu.js +9 -9
  604. package/cjs/ui/Modal.js +8 -8
  605. package/cjs/ui/MutedAvatarOverlay.js +2 -2
  606. package/cjs/ui/OGMessageItemBody.js +16 -16
  607. package/cjs/ui/OpenChannelAdminMessage.js +3 -3
  608. package/cjs/ui/OpenChannelAvatar.js +8 -8
  609. package/cjs/ui/OpenchannelConversationHeader.js +8 -8
  610. package/cjs/ui/OpenchannelFileMessage.js +18 -18
  611. package/cjs/ui/OpenchannelOGMessage.js +20 -20
  612. package/cjs/ui/OpenchannelThumbnailMessage.js +17 -17
  613. package/cjs/ui/OpenchannelUserMessage.js +18 -18
  614. package/cjs/ui/PlaceHolder.js +6 -6
  615. package/cjs/ui/PlaybackTime.js +3 -3
  616. package/cjs/ui/QuoteMessage.js +9 -9
  617. package/cjs/ui/QuoteMessageInput.js +9 -9
  618. package/cjs/ui/ReactionBadge.js +3 -3
  619. package/cjs/ui/ReactionButton.js +4 -4
  620. package/cjs/ui/SortByRow.js +2 -2
  621. package/cjs/ui/TemplateMessageItemBody.js +245 -0
  622. package/cjs/ui/TemplateMessageItemBody.js.map +1 -0
  623. package/cjs/ui/TextButton.js +2 -2
  624. package/cjs/ui/TextMessageItemBody.js +16 -16
  625. package/cjs/ui/ThreadReplies.js +8 -8
  626. package/cjs/ui/ThumbnailMessageItemBody.js +7 -7
  627. package/cjs/ui/Toggle.js +1 -1
  628. package/cjs/ui/Tooltip.js +3 -3
  629. package/cjs/ui/TooltipWrapper.js +1 -1
  630. package/cjs/ui/TypingIndicatorBubble.js +4 -4
  631. package/cjs/ui/UnknownMessageItemBody.js +7 -7
  632. package/cjs/ui/UserListItem.js +13 -13
  633. package/cjs/ui/UserProfile.js +10 -10
  634. package/cjs/ui/VoiceMessageInput.js +9 -9
  635. package/cjs/ui/VoiceMessageItemBody.js +10 -10
  636. package/cjs/ui/Word.js +13 -13
  637. package/cjs/useSendbirdStateContext.js +1 -1
  638. package/cjs/utils/message/isVoiceMessage.js +3 -3
  639. package/cjs/withSendbird.js +1 -1
  640. package/dist/index.css +207 -62
  641. package/dist/index.css.map +1 -1
  642. package/hooks/useModal.js +10 -10
  643. package/index.js +83 -79
  644. package/index.js.map +1 -1
  645. package/package.json +40 -3
  646. package/pubSub/topics.js +1 -1
  647. package/sendbirdSelectors.js +2 -2
  648. package/types/hooks/useAsyncRequest.d.ts +3 -0
  649. package/types/lib/dux/appInfo/actionTypes.d.ts +25 -0
  650. package/types/lib/dux/appInfo/initialState.d.ts +22 -0
  651. package/types/lib/dux/appInfo/reducers.d.ts +3 -0
  652. package/types/lib/dux/appInfo/utils.d.ts +7 -0
  653. package/types/lib/hooks/useConnect/__test__/data.mocks.d.ts +3 -2
  654. package/types/lib/hooks/useConnect/connect.d.ts +1 -1
  655. package/types/lib/hooks/useConnect/setupConnection.d.ts +1 -1
  656. package/types/lib/hooks/useConnect/types.d.ts +6 -3
  657. package/types/lib/hooks/useMessageTemplateUtils.d.ts +18 -0
  658. package/types/lib/types.d.ts +14 -0
  659. package/types/modules/Channel/components/MessageList/index.d.ts +1 -1
  660. package/types/modules/GroupChannel/components/GroupChannelUI/GroupChannelUIView.d.ts +5 -0
  661. package/types/modules/GroupChannel/components/Message/MessageView.d.ts +5 -0
  662. package/types/modules/GroupChannel/components/MessageList/index.d.ts +5 -1
  663. package/types/modules/GroupChannel/components/MessageTemplateWrapper/index.d.ts +8 -0
  664. package/types/modules/GroupChannel/components/SuggestedReplies/index.d.ts +4 -2
  665. package/types/modules/GroupChannel/context/GroupChannelProvider.d.ts +1 -1
  666. package/types/types.d.ts +1 -0
  667. package/types/ui/Icon/colors.d.ts +2 -0
  668. package/types/ui/Icon/index.d.ts +1 -0
  669. package/types/ui/Label/index.d.ts +2 -0
  670. package/types/ui/Label/stringSet.d.ts +3 -0
  671. package/types/ui/Label/types.d.ts +2 -0
  672. package/types/ui/Label/utils.d.ts +1 -1
  673. package/types/ui/LinkLabel/index.d.ts +2 -0
  674. package/types/ui/MessageContent/index.d.ts +3 -1
  675. package/types/ui/MessageTemplate/index.d.ts +8 -0
  676. package/types/ui/TemplateMessageItemBody/FallbackTemplateMessageItemBody.d.ts +9 -0
  677. package/types/ui/TemplateMessageItemBody/LoadingTemplateMessageItemBody.d.ts +7 -0
  678. package/types/ui/TemplateMessageItemBody/index.d.ts +12 -0
  679. package/types/ui/TemplateMessageItemBody/types.d.ts +96 -0
  680. package/types/ui/TemplateMessageItemBody/utils/flattenObject.d.ts +7 -0
  681. package/types/ui/TemplateMessageItemBody/utils/mapData.d.ts +7 -0
  682. package/types/ui/TemplateMessageItemBody/utils/restoreNumbersFromMessageTemplateObject.d.ts +1 -0
  683. package/types/ui/TemplateMessageItemBody/utils/selectColorVariablesByTheme.d.ts +6 -0
  684. package/types/utils/consts.d.ts +2 -0
  685. package/types/utils/index.d.ts +1 -0
  686. package/ui/Accordion.js +3 -3
  687. package/ui/AccordionGroup.js +2 -2
  688. package/ui/AdminMessage.js +3 -3
  689. package/ui/Avatar.js +4 -4
  690. package/ui/Badge.js +5 -5
  691. package/ui/BottomSheet.js +9 -9
  692. package/ui/Button.js +3 -3
  693. package/ui/ChannelAvatar.js +5 -5
  694. package/ui/ConnectionStatus.js +6 -6
  695. package/ui/ContextMenu.js +6 -6
  696. package/ui/DateSeparator.js +4 -4
  697. package/ui/EmojiReactions.js +16 -16
  698. package/ui/FallbackTemplateMessageItemBody.tsx.js +29 -0
  699. package/ui/FallbackTemplateMessageItemBody.tsx.js.map +1 -0
  700. package/ui/FileMessageItemBody.js +8 -8
  701. package/ui/FileViewer.js +15 -15
  702. package/ui/Icon.js +4 -2
  703. package/ui/Icon.js.map +1 -1
  704. package/ui/IconButton.js +1 -1
  705. package/ui/ImageRenderer.js +2 -2
  706. package/ui/Input.js +3 -3
  707. package/ui/Label.js +3 -3
  708. package/ui/LinkLabel.js +3 -3
  709. package/ui/Loader.js +2 -2
  710. package/ui/LoadingTemplateMessageItemBody.tsx.js +24 -0
  711. package/ui/LoadingTemplateMessageItemBody.tsx.js.map +1 -0
  712. package/ui/MentionLabel.js +13 -13
  713. package/ui/MentionUserLabel.js +1 -1
  714. package/ui/MessageContent.js +93 -50
  715. package/ui/MessageContent.js.map +1 -1
  716. package/ui/MessageInput/hooks/usePaste.js +7 -7
  717. package/ui/MessageInput.js +15 -15
  718. package/ui/MessageItemMenu.js +10 -10
  719. package/ui/MessageItemReactionMenu.js +9 -9
  720. package/ui/MessageSearchFileItem.js +14 -14
  721. package/ui/MessageSearchItem.js +11 -11
  722. package/ui/MessageStatus.js +12 -12
  723. package/ui/MessageTemplate.js +3 -0
  724. package/ui/MessageTemplate.js.map +1 -0
  725. package/ui/MobileFeedbackMenu.js +9 -9
  726. package/ui/Modal.js +8 -8
  727. package/ui/MutedAvatarOverlay.js +2 -2
  728. package/ui/OGMessageItemBody.js +16 -16
  729. package/ui/OpenChannelAdminMessage.js +3 -3
  730. package/ui/OpenChannelAvatar.js +8 -8
  731. package/ui/OpenchannelConversationHeader.js +8 -8
  732. package/ui/OpenchannelFileMessage.js +18 -18
  733. package/ui/OpenchannelOGMessage.js +20 -20
  734. package/ui/OpenchannelThumbnailMessage.js +17 -17
  735. package/ui/OpenchannelUserMessage.js +18 -18
  736. package/ui/PlaceHolder.js +6 -6
  737. package/ui/PlaybackTime.js +3 -3
  738. package/ui/QuoteMessage.js +9 -9
  739. package/ui/QuoteMessageInput.js +9 -9
  740. package/ui/ReactionBadge.js +3 -3
  741. package/ui/ReactionButton.js +4 -4
  742. package/ui/SortByRow.js +2 -2
  743. package/ui/TemplateMessageItemBody.js +240 -0
  744. package/ui/TemplateMessageItemBody.js.map +1 -0
  745. package/ui/TextButton.js +2 -2
  746. package/ui/TextMessageItemBody.js +16 -16
  747. package/ui/ThreadReplies.js +8 -8
  748. package/ui/ThumbnailMessageItemBody.js +7 -7
  749. package/ui/Toggle.js +1 -1
  750. package/ui/Tooltip.js +3 -3
  751. package/ui/TooltipWrapper.js +1 -1
  752. package/ui/TypingIndicatorBubble.js +4 -4
  753. package/ui/UnknownMessageItemBody.js +7 -7
  754. package/ui/UserListItem.js +13 -13
  755. package/ui/UserProfile.js +10 -10
  756. package/ui/VoiceMessageInput.js +9 -9
  757. package/ui/VoiceMessageItemBody.js +10 -10
  758. package/ui/Word.js +13 -13
  759. package/useSendbirdStateContext.js +1 -1
  760. package/utils/message/isVoiceMessage.js +3 -3
  761. package/withSendbird.js +1 -1
  762. package/chunks/bundle--pOSeu9W.js.map +0 -1
  763. package/chunks/bundle--q7ObKwF.js.map +0 -1
  764. package/chunks/bundle-014pCrux.js.map +0 -1
  765. package/chunks/bundle-2BKREX4m.js.map +0 -1
  766. package/chunks/bundle-3cwcm2Rk.js.map +0 -1
  767. package/chunks/bundle-52hs7-M-.js.map +0 -1
  768. package/chunks/bundle-6hgn3L9Y.js.map +0 -1
  769. package/chunks/bundle-6mWCjL2G.js.map +0 -1
  770. package/chunks/bundle-9JkrMUIl.js.map +0 -1
  771. package/chunks/bundle-A8dpIXKJ.js.map +0 -1
  772. package/chunks/bundle-BGFDI87G.js.map +0 -1
  773. package/chunks/bundle-BLt9vn5B.js.map +0 -1
  774. package/chunks/bundle-DS8eBDjC.js.map +0 -1
  775. package/chunks/bundle-F_qWVzaf.js.map +0 -1
  776. package/chunks/bundle-IFrmy9_C.js.map +0 -1
  777. package/chunks/bundle-IOegLdFC.js.map +0 -1
  778. package/chunks/bundle-J6qXeThU.js.map +0 -1
  779. package/chunks/bundle-Jun66RyD.js.map +0 -1
  780. package/chunks/bundle-LG3hn4TL.js.map +0 -1
  781. package/chunks/bundle-PrsPGxuw.js.map +0 -1
  782. package/chunks/bundle-Q3UquQ_i.js.map +0 -1
  783. package/chunks/bundle-S-mn30SU.js.map +0 -1
  784. package/chunks/bundle-SMgyl32k.js.map +0 -1
  785. package/chunks/bundle-SXGL8fBv.js.map +0 -1
  786. package/chunks/bundle-TovLF3ih.js.map +0 -1
  787. package/chunks/bundle-TzTFcIfJ.js.map +0 -1
  788. package/chunks/bundle-UDnO8-Dp.js.map +0 -1
  789. package/chunks/bundle-UxyhnVkY.js.map +0 -1
  790. package/chunks/bundle-WImaBVSO.js.map +0 -1
  791. package/chunks/bundle-YpfSm9dM.js.map +0 -1
  792. package/chunks/bundle-ZlvXkXrU.js.map +0 -1
  793. package/chunks/bundle-_o_iMme_.js.map +0 -1
  794. package/chunks/bundle-_xgfKjN0.js.map +0 -1
  795. package/chunks/bundle-a2TolYYj.js.map +0 -1
  796. package/chunks/bundle-bazn-ENb.js.map +0 -1
  797. package/chunks/bundle-cIHCEDKb.js.map +0 -1
  798. package/chunks/bundle-cJYfaBvk.js.map +0 -1
  799. package/chunks/bundle-e1b64xud.js.map +0 -1
  800. package/chunks/bundle-f1tjVRSh.js.map +0 -1
  801. package/chunks/bundle-f9AOpkiS.js.map +0 -1
  802. package/chunks/bundle-fMkcL8C8.js.map +0 -1
  803. package/chunks/bundle-gSFYF-34.js.map +0 -1
  804. package/chunks/bundle-ibeQnj0V.js.map +0 -1
  805. package/chunks/bundle-jHpuKuA-.js.map +0 -1
  806. package/chunks/bundle-oLg6CIrN.js.map +0 -1
  807. package/chunks/bundle-r1f2uym4.js.map +0 -1
  808. package/chunks/bundle-rW70z6Ho.js.map +0 -1
  809. package/chunks/bundle-rwixBUpF.js.map +0 -1
  810. package/chunks/bundle-tPOBtJjA.js.map +0 -1
  811. package/chunks/bundle-wdUAfmoS.js.map +0 -1
  812. package/chunks/bundle-xLjEyoT0.js.map +0 -1
  813. package/cjs/chunks/bundle-0vl1G6aF.js.map +0 -1
  814. package/cjs/chunks/bundle-12iJO39c.js.map +0 -1
  815. package/cjs/chunks/bundle-3SJwqpkk.js.map +0 -1
  816. package/cjs/chunks/bundle-3eINsVVm.js.map +0 -1
  817. package/cjs/chunks/bundle-4jX5eqYW.js.map +0 -1
  818. package/cjs/chunks/bundle-5_SjuoV5.js.map +0 -1
  819. package/cjs/chunks/bundle-6k9JvMoA.js.map +0 -1
  820. package/cjs/chunks/bundle-8fHhsSkO.js.map +0 -1
  821. package/cjs/chunks/bundle-9Ms65KWQ.js.map +0 -1
  822. package/cjs/chunks/bundle-9uUg_zKI.js.map +0 -1
  823. package/cjs/chunks/bundle-BAZMzxRI.js.map +0 -1
  824. package/cjs/chunks/bundle-BujsZjS_.js.map +0 -1
  825. package/cjs/chunks/bundle-DAwfoiZz.js.map +0 -1
  826. package/cjs/chunks/bundle-DGXRqeiH.js.map +0 -1
  827. package/cjs/chunks/bundle-EvM8f38k.js.map +0 -1
  828. package/cjs/chunks/bundle-Gj3FCN-l.js.map +0 -1
  829. package/cjs/chunks/bundle-IKnblThp.js.map +0 -1
  830. package/cjs/chunks/bundle-J790CoNK.js.map +0 -1
  831. package/cjs/chunks/bundle-JfUvL0pn.js.map +0 -1
  832. package/cjs/chunks/bundle-Jy-utJ8j.js.map +0 -1
  833. package/cjs/chunks/bundle-Ktg9Of7w.js.map +0 -1
  834. package/cjs/chunks/bundle-MIY8NRxo.js.map +0 -1
  835. package/cjs/chunks/bundle-Oq2WwdJI.js.map +0 -1
  836. package/cjs/chunks/bundle-QauQilHV.js.map +0 -1
  837. package/cjs/chunks/bundle-SM64BUgE.js.map +0 -1
  838. package/cjs/chunks/bundle-SR43QM50.js.map +0 -1
  839. package/cjs/chunks/bundle-VOIBVZ8K.js.map +0 -1
  840. package/cjs/chunks/bundle-VySxn-bM.js.map +0 -1
  841. package/cjs/chunks/bundle-WjU125ds.js.map +0 -1
  842. package/cjs/chunks/bundle-XqQ_cljg.js.map +0 -1
  843. package/cjs/chunks/bundle-YGVhXIfU.js.map +0 -1
  844. package/cjs/chunks/bundle-YZRXvkp-.js.map +0 -1
  845. package/cjs/chunks/bundle-cIL4aJSh.js.map +0 -1
  846. package/cjs/chunks/bundle-cbIBIuxw.js.map +0 -1
  847. package/cjs/chunks/bundle-cp4Mr7IE.js.map +0 -1
  848. package/cjs/chunks/bundle-cv4uM9fB.js.map +0 -1
  849. package/cjs/chunks/bundle-eb9lfgWx.js.map +0 -1
  850. package/cjs/chunks/bundle-fzWbmzou.js.map +0 -1
  851. package/cjs/chunks/bundle-gUU1zXtu.js.map +0 -1
  852. package/cjs/chunks/bundle-h1-4ko51.js.map +0 -1
  853. package/cjs/chunks/bundle-hNdySo7A.js.map +0 -1
  854. package/cjs/chunks/bundle-hR3vnZG1.js.map +0 -1
  855. package/cjs/chunks/bundle-hYAxN2fG.js.map +0 -1
  856. package/cjs/chunks/bundle-jh0UjnOb.js.map +0 -1
  857. package/cjs/chunks/bundle-juIULvxr.js.map +0 -1
  858. package/cjs/chunks/bundle-mpZAARbu.js.map +0 -1
  859. package/cjs/chunks/bundle-o2GWKL_d.js.map +0 -1
  860. package/cjs/chunks/bundle-oGyWTIOJ.js.map +0 -1
  861. package/cjs/chunks/bundle-pNtkOzhO.js.map +0 -1
  862. package/cjs/chunks/bundle-q15q65dt.js.map +0 -1
  863. package/cjs/chunks/bundle-rGYP82Yc.js.map +0 -1
  864. package/cjs/chunks/bundle-rIjHxu2P.js.map +0 -1
  865. package/cjs/chunks/bundle-rY_4WHYR.js.map +0 -1
  866. package/cjs/chunks/bundle-rm245WXS.js.map +0 -1
  867. package/cjs/chunks/bundle-sPQAW6hW.js.map +0 -1
  868. package/cjs/chunks/bundle-sSkyvCgN.js.map +0 -1
  869. package/cjs/chunks/bundle-uIj1z0m8.js.map +0 -1
  870. package/cjs/chunks/bundle-vtbEyMlh.js.map +0 -1
  871. package/cjs/chunks/bundle-vzrDnUV2.js.map +0 -1
  872. package/cjs/chunks/bundle-xHh0P-Hz.js.map +0 -1
  873. package/cjs/chunks/bundle-xTAz4Z91.js.map +0 -1
  874. package/cjs/chunks/bundle-yJYTZhFC.js.map +0 -1
  875. package/cjs/chunks/bundle-yzcXd9DQ.js.map +0 -1
  876. package/cjs/chunks/bundle-zMBWGCQM.js.map +0 -1
  877. package/cjs/chunks/bundle-zvM7ls7A.js.map +0 -1
@@ -0,0 +1,1689 @@
1
+ import React__default, { createContext, useState, useCallback, useContext, useRef, useMemo, useEffect } from 'react';
2
+
3
+ var ComponentType;
4
+ (function (ComponentType) {
5
+ ComponentType["Box"] = "box";
6
+ ComponentType["Text"] = "text";
7
+ ComponentType["Image"] = "image";
8
+ ComponentType["TextButton"] = "textButton";
9
+ ComponentType["ImageButton"] = "imageButton";
10
+ })(ComponentType || (ComponentType = {}));
11
+
12
+ // -------- Set property mapper
13
+ const MAPPER = () => undefined;
14
+ const createParser = (params) => {
15
+ const defaultMapper = (params === null || params === void 0 ? void 0 : params.defaultMapper) || MAPPER;
16
+ const mapper = {
17
+ defaultMapper,
18
+ mapBoxProps: (params === null || params === void 0 ? void 0 : params.mapBoxProps) || defaultMapper,
19
+ mapTextProps: (params === null || params === void 0 ? void 0 : params.mapTextProps) || defaultMapper,
20
+ mapImageProps: (params === null || params === void 0 ? void 0 : params.mapImageProps) || defaultMapper,
21
+ mapTextButtonProps: (params === null || params === void 0 ? void 0 : params.mapTextButtonProps) || defaultMapper,
22
+ mapImageButtonProps: (params === null || params === void 0 ? void 0 : params.mapImageButtonProps) || defaultMapper,
23
+ };
24
+ return {
25
+ parse(item, options) {
26
+ switch (item.type) {
27
+ case ComponentType.Box: {
28
+ return { properties: mapper.mapBoxProps(item, options) };
29
+ }
30
+ case ComponentType.Text: {
31
+ return { properties: mapper.mapTextProps(item, options) };
32
+ }
33
+ case ComponentType.Image: {
34
+ return { properties: mapper.mapImageProps(item, options) };
35
+ }
36
+ case ComponentType.TextButton: {
37
+ return { properties: mapper.mapTextButtonProps(item, options) };
38
+ }
39
+ case ComponentType.ImageButton: {
40
+ return { properties: mapper.mapImageButtonProps(item, options) };
41
+ }
42
+ default:
43
+ return { properties: undefined };
44
+ }
45
+ },
46
+ };
47
+ };
48
+
49
+ const FRAGMENT = ({ children }) => React__default.createElement(React__default.Fragment, null, children);
50
+ function createRenderer(params) {
51
+ var _a, _b, _c, _d, _e;
52
+ return {
53
+ box: ((_a = params === null || params === void 0 ? void 0 : params.views) === null || _a === void 0 ? void 0 : _a.box) || FRAGMENT,
54
+ text: ((_b = params === null || params === void 0 ? void 0 : params.views) === null || _b === void 0 ? void 0 : _b.text) || FRAGMENT,
55
+ image: ((_c = params === null || params === void 0 ? void 0 : params.views) === null || _c === void 0 ? void 0 : _c.image) || FRAGMENT,
56
+ imageButton: ((_d = params === null || params === void 0 ? void 0 : params.views) === null || _d === void 0 ? void 0 : _d.imageButton) || FRAGMENT,
57
+ textButton: ((_e = params === null || params === void 0 ? void 0 : params.views) === null || _e === void 0 ? void 0 : _e.textButton) || FRAGMENT,
58
+ };
59
+ }
60
+
61
+ var __rest$4 = (undefined && undefined.__rest) || function (s, e) {
62
+ var t = {};
63
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
64
+ t[p] = s[p];
65
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
66
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
67
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
68
+ t[p[i]] = s[p[i]];
69
+ }
70
+ return t;
71
+ };
72
+ const SizeContext = createContext({
73
+ sizes: {},
74
+ updateSize: () => { },
75
+ });
76
+ const SizeContextProvider = ({ children }) => {
77
+ const [sizes, setSizes] = useState({});
78
+ const updateSize = useCallback((_a) => {
79
+ var { id } = _a, rest = __rest$4(_a, ["id"]);
80
+ if (id) {
81
+ setSizes((prevSizes) => (Object.assign(Object.assign({}, prevSizes), { [id]: rest })));
82
+ }
83
+ }, []);
84
+ return React__default.createElement(SizeContext.Provider, { value: { sizes, updateSize } }, children);
85
+ };
86
+ const useSizeContext = () => useContext(SizeContext);
87
+
88
+ const memoize = (fn) => {
89
+ const cache = new Map();
90
+ const cached = function (val) {
91
+ return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val);
92
+ };
93
+ cached.cache = cache;
94
+ return cached;
95
+ };
96
+ /**
97
+ * Generate each item's id by each item's array depth
98
+ */
99
+ const setTemplateItemId = memoize((data) => {
100
+ const addIdRecursively = (item, id) => {
101
+ if ('items' in item && (item === null || item === void 0 ? void 0 : item.items) != null) {
102
+ item.items.forEach((subItem, subIdx) => {
103
+ const subId = `${id}-${subIdx}`;
104
+ subItem.id = subId;
105
+ addIdRecursively(subItem, subId);
106
+ });
107
+ }
108
+ };
109
+ data.forEach((item, idx) => {
110
+ const id = `${idx}`;
111
+ item.id = id;
112
+ addIdRecursively(item, id);
113
+ });
114
+ return data;
115
+ });
116
+
117
+ var Layout;
118
+ (function (Layout) {
119
+ Layout["Row"] = "row";
120
+ Layout["Column"] = "column";
121
+ })(Layout || (Layout = {}));
122
+ var AlignValue;
123
+ (function (AlignValue) {
124
+ AlignValue["Center"] = "center";
125
+ AlignValue["Left"] = "left";
126
+ AlignValue["Right"] = "right";
127
+ AlignValue["Top"] = "top";
128
+ AlignValue["Bottom"] = "bottom";
129
+ })(AlignValue || (AlignValue = {}));
130
+ /**
131
+ * @description
132
+ * Caution: Numbers are passed as string types in the message template builder.
133
+ * Use `==` comparison instead of `===` comparison when using a regular enum instead of a string enum.
134
+ */
135
+ var FlexSizeSpecValue;
136
+ (function (FlexSizeSpecValue) {
137
+ FlexSizeSpecValue[FlexSizeSpecValue["FillParent"] = 0] = "FillParent";
138
+ FlexSizeSpecValue[FlexSizeSpecValue["WrapContent"] = 1] = "WrapContent";
139
+ })(FlexSizeSpecValue || (FlexSizeSpecValue = {}));
140
+ var FontWeight;
141
+ (function (FontWeight) {
142
+ FontWeight["Normal"] = "normal";
143
+ FontWeight["Bold"] = "bold";
144
+ })(FontWeight || (FontWeight = {}));
145
+ var MediaContentMode;
146
+ (function (MediaContentMode) {
147
+ MediaContentMode["AspectFit"] = "aspectFit";
148
+ MediaContentMode["AspectFill"] = "aspectFill";
149
+ MediaContentMode["ScalesToFill"] = "scalesToFill";
150
+ })(MediaContentMode || (MediaContentMode = {}));
151
+
152
+ const defaultProperties = {
153
+ rootLayout: Layout.Column,
154
+ view: {
155
+ size: {
156
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
157
+ height: { type: 'flex', value: FlexSizeSpecValue.WrapContent },
158
+ },
159
+ },
160
+ box: {
161
+ layout: Layout.Row,
162
+ align: { vertical: AlignValue.Top, horizontal: AlignValue.Left },
163
+ },
164
+ };
165
+
166
+ const createMessageTemplate = (opts) => {
167
+ const Container = opts.Container || React__default.Fragment;
168
+ const UnknownMessage = opts.UnknownMessage || (() => null);
169
+ const parser = opts.parser || createParser();
170
+ const renderer = opts.renderer || createRenderer();
171
+ const MessageTemplateBase = (props) => {
172
+ var _a;
173
+ const renderItems = props.templateItems;
174
+ const parentLayout = (_a = props.parentLayout) !== null && _a !== void 0 ? _a : defaultProperties.box.layout;
175
+ return (React__default.createElement(React__default.Fragment, null, renderItems.map((item, index, siblings) => {
176
+ const { properties } = parser.parse(item, { parentLayout, elemIdx: index, siblings });
177
+ const props = {
178
+ key: index,
179
+ parentLayout,
180
+ parsedProperties: properties,
181
+ siblings,
182
+ };
183
+ switch (item.type) {
184
+ case ComponentType.Box: {
185
+ return (React__default.createElement(renderer.box, Object.assign({}, item, props),
186
+ React__default.createElement(MessageTemplateBase, { templateItems: item.items || [], parentLayout: item.layout })));
187
+ }
188
+ case ComponentType.Text: {
189
+ return React__default.createElement(renderer.text, Object.assign({}, item, props));
190
+ }
191
+ case ComponentType.Image: {
192
+ return React__default.createElement(renderer.image, Object.assign({}, item, props));
193
+ }
194
+ case ComponentType.TextButton: {
195
+ return React__default.createElement(renderer.textButton, Object.assign({}, item, props));
196
+ }
197
+ case ComponentType.ImageButton: {
198
+ return React__default.createElement(renderer.imageButton, Object.assign({}, item, props));
199
+ }
200
+ default: {
201
+ // or throw new Error('Cannot parse template item')
202
+ return React__default.createElement(UnknownMessage, { item: item });
203
+ }
204
+ }
205
+ })));
206
+ };
207
+ return {
208
+ MessageTemplate: ({ parentLayout = defaultProperties.rootLayout, templateItems }) => {
209
+ const items = setTemplateItemId(templateItems);
210
+ return (React__default.createElement(SizeContextProvider, null,
211
+ React__default.createElement(Container, null,
212
+ React__default.createElement(MessageTemplateBase, { parentLayout: parentLayout, templateItems: items }))));
213
+ },
214
+ MessageTemplateBase,
215
+ };
216
+ };
217
+
218
+ var ActionType;
219
+ (function (ActionType) {
220
+ ActionType["Web"] = "web";
221
+ ActionType["Custom"] = "custom";
222
+ ActionType["UIKit"] = "uikit";
223
+ })(ActionType || (ActionType = {}));
224
+
225
+ const alignInFlex = (align) => {
226
+ switch (align) {
227
+ case AlignValue.Right:
228
+ case AlignValue.Bottom:
229
+ return 'flex-end';
230
+ case AlignValue.Center:
231
+ return 'center';
232
+ case AlignValue.Left:
233
+ case AlignValue.Top:
234
+ default:
235
+ return 'flex-start';
236
+ }
237
+ };
238
+
239
+ ({
240
+ version: 1,
241
+ body: {
242
+ items: [
243
+ {
244
+ type: ComponentType.Image,
245
+ action: { type: ActionType.Web, data: 'https://docs.sendbird.com' },
246
+ height: { type: 'fixed', value: 236 },
247
+ viewStyle: {
248
+ padding: {
249
+ left: 4,
250
+ right: 4,
251
+ top: 4,
252
+ bottom: 4,
253
+ },
254
+ },
255
+ imageUrl: 'https://cdn.pixabay.com/photo/2022/10/12/10/45/bird-7516219_1280.jpg',
256
+ imageStyle: { contentMode: MediaContentMode.AspectFill },
257
+ },
258
+ {
259
+ type: ComponentType.Box,
260
+ layout: Layout.Column,
261
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
262
+ height: { type: 'fixed', value: 200 },
263
+ items: [
264
+ {
265
+ type: ComponentType.Box,
266
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
267
+ height: { type: 'flex', value: FlexSizeSpecValue.FillParent },
268
+ viewStyle: { backgroundColor: '#fa6464' },
269
+ },
270
+ {
271
+ type: ComponentType.Box,
272
+ layout: Layout.Column,
273
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
274
+ height: { type: 'flex', value: FlexSizeSpecValue.WrapContent },
275
+ viewStyle: { backgroundColor: '#ffaf5c' },
276
+ items: [
277
+ {
278
+ type: ComponentType.Text,
279
+ text: 'Message',
280
+ align: { horizontal: AlignValue.Center, vertical: AlignValue.Center },
281
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
282
+ height: { type: 'fixed', value: 50 },
283
+ },
284
+ {
285
+ type: ComponentType.Image,
286
+ action: { type: ActionType.Web, data: 'https://docs.sendbird.com' },
287
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
288
+ height: { type: 'fixed', value: 50 },
289
+ imageUrl: 'https://cdn.pixabay.com/photo/2022/10/12/10/45/bird-7516219_1280.jpg',
290
+ imageStyle: { contentMode: MediaContentMode.AspectFill },
291
+ },
292
+ ],
293
+ },
294
+ {
295
+ type: ComponentType.Box,
296
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
297
+ height: { type: 'fixed', value: 20 },
298
+ viewStyle: { backgroundColor: '#ffe450' },
299
+ },
300
+ {
301
+ type: ComponentType.Box,
302
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
303
+ height: { type: 'flex', value: FlexSizeSpecValue.FillParent },
304
+ viewStyle: { backgroundColor: '#329a1b' },
305
+ },
306
+ ],
307
+ },
308
+ {
309
+ type: ComponentType.Box,
310
+ viewStyle: { padding: { top: 12, bottom: 12, left: 12, right: 12 } },
311
+ layout: Layout.Column,
312
+ items: [
313
+ {
314
+ type: ComponentType.Box,
315
+ align: { horizontal: AlignValue.Left, vertical: AlignValue.Center },
316
+ layout: Layout.Row,
317
+ viewStyle: {
318
+ borderWidth: 1,
319
+ borderColor: '#72723f',
320
+ },
321
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
322
+ height: { type: 'fixed', value: 150 },
323
+ items: [
324
+ {
325
+ type: ComponentType.Text,
326
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
327
+ height: { type: 'fixed', value: 50 },
328
+ text: 'Sample1 text',
329
+ maxTextLines: 1,
330
+ align: { vertical: AlignValue.Center, horizontal: AlignValue.Left },
331
+ viewStyle: {
332
+ backgroundColor: '#cc4400',
333
+ },
334
+ textStyle: {
335
+ size: 16,
336
+ color: '#f8f8f8',
337
+ weight: FontWeight.Bold,
338
+ },
339
+ },
340
+ {
341
+ type: ComponentType.ImageButton,
342
+ action: { type: ActionType.UIKit, data: 'uikit://delete' },
343
+ width: { type: 'fixed', value: 20 },
344
+ height: { type: 'fixed', value: 20 },
345
+ imageUrl: 'https://file-ap-1.sendbird.com/5b5379aa73fd460da22ffaf9a61d0d7f.png',
346
+ imageStyle: { contentMode: MediaContentMode.AspectFit },
347
+ },
348
+ ],
349
+ },
350
+ {
351
+ type: ComponentType.Text,
352
+ viewStyle: { padding: { top: 6, bottom: 12, left: 0, right: 0 } },
353
+ text: 'Esse eu esse duis ipsum et dolor eu ut sit amet consectetur cillum velit officia. Ex adipisicing elit quis ea sit. Occaecat in eu aliqua nulla magna id ut excepteur minim.',
354
+ maxTextLines: 2,
355
+ textStyle: { size: 14, color: '#e10000' },
356
+ width: { type: 'fixed', value: 200 },
357
+ height: { type: 'fixed', value: 50 },
358
+ },
359
+ {
360
+ type: ComponentType.TextButton,
361
+ action: { type: ActionType.Web, data: 'https://www.daum.net' },
362
+ text: 'Button 3',
363
+ textStyle: { size: 14, color: '#742ddd', weight: FontWeight.Bold },
364
+ },
365
+ ],
366
+ },
367
+ ],
368
+ },
369
+ });
370
+ ({
371
+ 'version': 1,
372
+ 'body': {
373
+ 'items': [
374
+ {
375
+ 'type': ComponentType.Image,
376
+ 'action': { 'type': ActionType.Web, 'data': 'https://www.naver.com/' },
377
+ 'height': { 'type': 'fixed', 'value': 136 },
378
+ 'imageUrl': 'https://cdn.pixabay.com/photo/2022/10/12/10/45/bird-7516219_1280.jpg',
379
+ 'imageStyle': { 'contentMode': MediaContentMode.AspectFill },
380
+ },
381
+ {
382
+ 'type': ComponentType.Box,
383
+ 'viewStyle': { 'padding': { 'top': 12, 'bottom': 12, 'left': 12, 'right': 12 }, backgroundColor: '#cccccc' },
384
+ 'layout': Layout.Column,
385
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
386
+ 'items': [
387
+ {
388
+ 'type': ComponentType.Box,
389
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
390
+ 'layout': Layout.Row,
391
+ 'items': [
392
+ {
393
+ 'type': ComponentType.TextButton,
394
+ 'action': { 'type': ActionType.Web, 'data': 'https://www.daum.net' },
395
+ width: { type: 'fixed', value: 150 },
396
+ 'viewStyle': { 'margin': { 'top': 0, 'bottom': 0, 'left': 0, 'right': 4 } },
397
+ 'text': 'Button 2',
398
+ 'textStyle': { 'size': 14, 'weight': FontWeight.Bold },
399
+ },
400
+ {
401
+ 'type': ComponentType.TextButton,
402
+ 'action': { 'type': ActionType.Web, 'data': 'https://www.daum.net' },
403
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
404
+ 'viewStyle': { 'margin': { 'top': 0, 'bottom': 0, 'left': 4, 'right': 0 } },
405
+ 'text': 'Button 3',
406
+ 'textStyle': { 'size': 14, 'weight': FontWeight.Bold },
407
+ },
408
+ ],
409
+ },
410
+ {
411
+ 'type': ComponentType.Box,
412
+ width: { type: 'flex', value: FlexSizeSpecValue.FillParent },
413
+ 'layout': Layout.Row,
414
+ 'items': [
415
+ {
416
+ 'type': ComponentType.Text,
417
+ 'text': 'Sample2 text',
418
+ 'width': { 'type': 'flex', 'value': FlexSizeSpecValue.FillParent },
419
+ 'maxTextLines': 1,
420
+ 'textStyle': { 'size': 16, 'weight': FontWeight.Bold },
421
+ },
422
+ {
423
+ 'type': ComponentType.ImageButton,
424
+ 'action': { 'type': ActionType.UIKit, 'data': 'uikit://delete' },
425
+ 'width': { 'type': 'fixed', 'value': 20 },
426
+ 'height': { 'type': 'fixed', 'value': 20 },
427
+ 'imageUrl': 'https://file-ap-1.sendbird.com/5b5379aa73fd460da22ffaf9a61d0d7f.png',
428
+ 'imageStyle': { 'contentMode': MediaContentMode.AspectFit },
429
+ },
430
+ ],
431
+ },
432
+ {
433
+ 'type': ComponentType.Text,
434
+ 'viewStyle': { 'padding': { 'top': 6, 'bottom': 12, 'left': 0, 'right': 0 } },
435
+ 'text': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aui',
436
+ 'textStyle': { 'size': 14 },
437
+ },
438
+ ],
439
+ },
440
+ ],
441
+ },
442
+ });
443
+ ({
444
+ 'version': 1,
445
+ 'body': {
446
+ 'items': [
447
+ {
448
+ 'type': ComponentType.Box,
449
+ 'viewStyle': { 'backgroundColor': '#ffffff', 'borderWidth': 1, 'borderColor': '#eeeeee', 'radius': 16 },
450
+ 'layout': Layout.Column,
451
+ 'items': [
452
+ {
453
+ 'type': ComponentType.Image,
454
+ 'height': { 'type': 'fixed', 'value': 200 },
455
+ 'imageUrl': 'https://img.freepik.com/free-vector/cartoon-happy-hours-background_52683-81243.jpg?w=2000&t=st=1666689198~exp=1666689798~hmac=23109d44ba03deee7aee069cbeebfcb48fa27f85e53c1cafc5d5d7345f1a2041',
456
+ 'imageStyle': { 'contentMode': MediaContentMode.AspectFill },
457
+ },
458
+ {
459
+ 'type': ComponentType.Box,
460
+ 'viewStyle': { 'padding': { 'top': 15, 'bottom': 15, 'left': 15, 'right': 15 } },
461
+ 'layout': Layout.Column,
462
+ 'items': [
463
+ {
464
+ 'type': ComponentType.Text,
465
+ 'text': "Don't miss these deals today",
466
+ 'maxTextLines': 1,
467
+ 'textStyle': { 'size': 20, 'color': '#e10000', 'weight': FontWeight.Bold },
468
+ },
469
+ {
470
+ 'type': ComponentType.Text,
471
+ 'viewStyle': { 'margin': { 'top': 5, 'bottom': 0, 'left': 0, 'right': 0 } },
472
+ 'text': 'Pay with Maya and get cashback!',
473
+ 'maxTextLines': 1,
474
+ 'textStyle': { 'size': 14, 'color': '#e10000' },
475
+ },
476
+ {
477
+ 'type': ComponentType.Box,
478
+ 'align': { 'horizontal': AlignValue.Left, 'vertical': AlignValue.Center },
479
+ 'viewStyle': { 'margin': { 'top': 10, 'bottom': 0, 'left': 0, 'right': 0 } },
480
+ 'layout': Layout.Row,
481
+ 'items': [
482
+ {
483
+ 'type': ComponentType.Image,
484
+ 'width': { 'type': 'fixed', 'value': 50 },
485
+ 'height': { 'type': 'fixed', 'value': 50 },
486
+ 'viewStyle': {
487
+ 'backgroundColor': '#ffffff',
488
+ 'borderWidth': 1,
489
+ 'borderColor': '#eeeeee',
490
+ 'radius': 25,
491
+ },
492
+ 'imageUrl': 'https://yt3.ggpht.com/ytc/AMLnZu8Kg89ymE7qt5bsS9vMqi9h2aHiN6m9ID-IgxR6-Q=s900-c-k-c0x00ffffff-no-rj',
493
+ 'imageStyle': { 'contentMode': MediaContentMode.AspectFill },
494
+ },
495
+ {
496
+ 'type': ComponentType.Box,
497
+ 'align': { 'horizontal': AlignValue.Left, 'vertical': AlignValue.Center },
498
+ 'viewStyle': { 'margin': { 'top': 0, 'bottom': 0, 'left': 15, 'right': 0 } },
499
+ 'layout': Layout.Column,
500
+ 'items': [
501
+ {
502
+ 'type': ComponentType.Text,
503
+ 'text': 'Meralco',
504
+ 'maxTextLines': 1,
505
+ 'textStyle': { 'size': 16, 'color': '#e10000', 'weight': FontWeight.Bold },
506
+ },
507
+ {
508
+ 'type': ComponentType.Text,
509
+ 'viewStyle': { 'margin': { 'top': 3, 'bottom': 0, 'left': 0, 'right': 0 } },
510
+ 'text': '30% cashback, P300 min spend',
511
+ 'maxTextLines': 1,
512
+ 'textStyle': { 'size': 12, 'color': '#610000', 'weight': FontWeight.Bold },
513
+ },
514
+ ],
515
+ },
516
+ ],
517
+ },
518
+ {
519
+ 'type': ComponentType.Box,
520
+ 'align': { 'horizontal': AlignValue.Left, 'vertical': AlignValue.Center },
521
+ 'viewStyle': { 'margin': { 'top': 10, 'bottom': 0, 'left': 0, 'right': 0 } },
522
+ 'layout': Layout.Row,
523
+ 'items': [
524
+ {
525
+ 'type': ComponentType.Image,
526
+ 'width': { 'type': 'fixed', 'value': 50 },
527
+ 'height': { 'type': 'fixed', 'value': 50 },
528
+ 'viewStyle': {
529
+ 'backgroundColor': '#ffffff',
530
+ 'borderWidth': 1,
531
+ 'borderColor': '#eeeeee',
532
+ 'radius': 25,
533
+ },
534
+ 'imageUrl': 'https://1000logos.net/wp-content/uploads/2021/12/Globe-Telecom-logo.png',
535
+ 'imageStyle': { 'contentMode': MediaContentMode.AspectFill, tintColor: '#a49a9a' },
536
+ },
537
+ {
538
+ 'type': ComponentType.Box,
539
+ 'align': { 'horizontal': AlignValue.Left, 'vertical': AlignValue.Center },
540
+ 'viewStyle': { 'margin': { 'top': 0, 'bottom': 0, 'left': 15, 'right': 0 } },
541
+ 'layout': Layout.Column,
542
+ 'items': [
543
+ {
544
+ 'type': ComponentType.Text,
545
+ 'text': 'Globe',
546
+ 'maxTextLines': 1,
547
+ 'textStyle': { 'size': 16, 'color': '#e10000', 'weight': FontWeight.Bold },
548
+ },
549
+ {
550
+ 'type': ComponentType.Text,
551
+ 'viewStyle': { 'margin': { 'top': 3, 'bottom': 0, 'left': 0, 'right': 0 } },
552
+ 'text': '30% cashback, P300 min spend',
553
+ 'maxTextLines': 1,
554
+ 'textStyle': { 'size': 12, 'color': '#610000', 'weight': FontWeight.Bold },
555
+ },
556
+ ],
557
+ },
558
+ ],
559
+ },
560
+ {
561
+ 'type': ComponentType.Box,
562
+ 'align': { 'horizontal': AlignValue.Left, 'vertical': AlignValue.Center },
563
+ 'viewStyle': { 'margin': { 'top': 10, 'bottom': 0, 'left': 0, 'right': 0 } },
564
+ 'layout': Layout.Row,
565
+ 'items': [
566
+ {
567
+ 'type': ComponentType.Image,
568
+ 'width': { 'type': 'fixed', 'value': 50 },
569
+ 'height': { 'type': 'fixed', 'value': 50 },
570
+ 'viewStyle': {
571
+ 'backgroundColor': '#ffffff',
572
+ 'borderWidth': 1,
573
+ 'borderColor': '#eeeeee',
574
+ 'radius': 25,
575
+ },
576
+ 'imageUrl': 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Cignal.svg/640px-Cignal.svg.png',
577
+ 'imageStyle': { 'contentMode': MediaContentMode.AspectFill },
578
+ },
579
+ {
580
+ 'type': ComponentType.Box,
581
+ 'align': { 'horizontal': AlignValue.Left, 'vertical': AlignValue.Center },
582
+ 'viewStyle': { 'margin': { 'top': 0, 'bottom': 0, 'left': 15, 'right': 0 } },
583
+ 'layout': Layout.Column,
584
+ 'items': [
585
+ {
586
+ 'type': ComponentType.Text,
587
+ 'text': 'Cignal',
588
+ 'maxTextLines': 1,
589
+ 'textStyle': { 'size': 16, 'color': '#e10000', 'weight': FontWeight.Bold },
590
+ },
591
+ {
592
+ 'type': ComponentType.Text,
593
+ 'viewStyle': { 'margin': { 'top': 3, 'bottom': 0, 'left': 0, 'right': 0 } },
594
+ 'text': '30% cashback, P300 min spend',
595
+ 'maxTextLines': 1,
596
+ 'textStyle': { 'size': 12, 'color': '#610000', 'weight': FontWeight.Bold },
597
+ },
598
+ ],
599
+ },
600
+ ],
601
+ },
602
+ {
603
+ 'type': ComponentType.Box,
604
+ 'align': { 'horizontal': AlignValue.Left, 'vertical': AlignValue.Center },
605
+ 'viewStyle': { 'margin': { 'top': 10, 'bottom': 0, 'left': 0, 'right': 0 } },
606
+ 'layout': Layout.Row,
607
+ 'items': [
608
+ {
609
+ 'type': ComponentType.TextButton,
610
+ 'action': { 'type': ActionType.Web, 'data': 'https://www.daum.net' },
611
+ 'viewStyle': {
612
+ 'backgroundColor': '#e0e0e0',
613
+ 'radius': 16,
614
+ 'margin': { 'top': 0, 'bottom': 0, 'left': 0, 'right': 4 },
615
+ 'padding': { 'top': 12, 'bottom': 12, 'left': 12, 'right': 12 },
616
+ },
617
+ 'text': 'Learn more',
618
+ 'textStyle': { 'size': 15, 'color': '#e10000', 'weight': FontWeight.Bold },
619
+ },
620
+ {
621
+ 'type': ComponentType.TextButton,
622
+ 'action': { 'type': ActionType.Web, 'data': 'https://www.daum.net' },
623
+ 'viewStyle': {
624
+ 'backgroundColor': '#e10000',
625
+ 'radius': 16,
626
+ 'margin': { 'top': 0, 'bottom': 0, 'left': 4, 'right': 0 },
627
+ 'padding': { 'top': 12, 'bottom': 12, 'left': 12, 'right': 12 },
628
+ },
629
+ 'text': 'Pay now',
630
+ 'textStyle': { 'size': 15, 'color': '#ffffff', 'weight': FontWeight.Bold },
631
+ },
632
+ ],
633
+ },
634
+ ],
635
+ },
636
+ ],
637
+ },
638
+ ],
639
+ },
640
+ });
641
+ ({
642
+ 'version': 1,
643
+ 'body': {
644
+ 'items': [
645
+ {
646
+ 'type': ComponentType.Box,
647
+ 'layout': Layout.Column,
648
+ 'items': [
649
+ {
650
+ 'type': ComponentType.Image,
651
+ 'imageUrl': 'https://static.sendbird.com/sample/profiles/profile_40_512px.png',
652
+ 'metaData': {
653
+ 'pixelWidth': 512,
654
+ 'pixelHeight': 512,
655
+ },
656
+ 'imageStyle': {
657
+ 'tintColor': '#44ff1188',
658
+ },
659
+ viewStyle: {
660
+ 'padding': {
661
+ 'top': 12,
662
+ 'right': 12,
663
+ 'bottom': 12,
664
+ 'left': 12,
665
+ },
666
+ },
667
+ },
668
+ {
669
+ 'type': ComponentType.Box,
670
+ 'viewStyle': {
671
+ 'padding': {
672
+ 'top': 12,
673
+ 'right': 12,
674
+ 'bottom': 12,
675
+ 'left': 12,
676
+ },
677
+ },
678
+ 'layout': Layout.Column,
679
+ 'items': [
680
+ {
681
+ 'type': ComponentType.Box,
682
+ 'layout': Layout.Row,
683
+ 'items': [
684
+ {
685
+ 'type': ComponentType.Box,
686
+ 'layout': Layout.Column,
687
+ 'items': [
688
+ {
689
+ 'type': ComponentType.Text,
690
+ 'text': 'hi',
691
+ 'maxTextLines': 3,
692
+ 'viewStyle': {
693
+ 'padding': {
694
+ 'top': 0,
695
+ 'bottom': 6,
696
+ 'left': 0,
697
+ 'right': 0,
698
+ },
699
+ },
700
+ 'textStyle': {
701
+ 'size': 16,
702
+ 'weight': FontWeight.Bold,
703
+ },
704
+ },
705
+ {
706
+ 'type': ComponentType.Text,
707
+ 'text': 'bye',
708
+ 'maxTextLines': 10,
709
+ 'textStyle': {
710
+ 'size': 14,
711
+ },
712
+ },
713
+ ],
714
+ },
715
+ {
716
+ 'type': ComponentType.ImageButton,
717
+ 'action': {
718
+ 'type': ActionType.UIKit,
719
+ 'data': 'sendbirduikit://delete',
720
+ },
721
+ 'width': {
722
+ 'type': 'fixed',
723
+ 'value': 20,
724
+ },
725
+ 'height': {
726
+ 'type': 'fixed',
727
+ 'value': 20,
728
+ },
729
+ 'metaData': {
730
+ 'pixelWidth': 60,
731
+ 'pixelHeight': 60,
732
+ },
733
+ 'imageUrl': 'https://dxstmhyqfqr1o.cloudfront.net/sendbird-message-builder/icon-more.png',
734
+ 'imageStyle': {
735
+ 'tintColor': '#ff8d5a',
736
+ },
737
+ },
738
+ ],
739
+ },
740
+ {
741
+ 'type': ComponentType.Box,
742
+ 'layout': Layout.Column,
743
+ 'items': [
744
+ {
745
+ 'type': ComponentType.Box,
746
+ 'viewStyle': {
747
+ 'margin': {
748
+ 'top': 16,
749
+ 'bottom': 0,
750
+ 'left': 0,
751
+ 'right': 0,
752
+ },
753
+ },
754
+ 'align': {
755
+ 'horizontal': AlignValue.Left,
756
+ 'vertical': AlignValue.Center,
757
+ },
758
+ 'layout': Layout.Row,
759
+ 'items': [
760
+ {
761
+ 'type': ComponentType.Image,
762
+ 'imageUrl': 'https://ca.slack-edge.com/T0ADCTNEL-ULE240VNV-83fd5776e78e-512',
763
+ 'width': {
764
+ 'type': 'fixed',
765
+ 'value': 40,
766
+ },
767
+ 'height': {
768
+ 'type': 'fixed',
769
+ 'value': 40,
770
+ },
771
+ 'metaData': {
772
+ 'pixelWidth': 512,
773
+ 'pixelHeight': 512,
774
+ },
775
+ 'viewStyle': {
776
+ 'backgroundColor': '#BDBDBD',
777
+ 'radius': 20,
778
+ },
779
+ 'imageStyle': {
780
+ 'contentMode': MediaContentMode.AspectFill,
781
+ },
782
+ },
783
+ {
784
+ 'type': ComponentType.Box,
785
+ 'viewStyle': {
786
+ 'margin': {
787
+ 'top': 0,
788
+ 'bottom': 0,
789
+ 'left': 12,
790
+ 'right': 0,
791
+ },
792
+ },
793
+ 'layout': Layout.Column,
794
+ 'items': [
795
+ {
796
+ 'type': ComponentType.Text,
797
+ 'text': 'Chongbu',
798
+ 'maxTextLines': 1,
799
+ 'textStyle': {
800
+ 'size': 16,
801
+ 'weight': FontWeight.Bold,
802
+ },
803
+ },
804
+ {
805
+ 'type': ComponentType.Text,
806
+ 'viewStyle': {
807
+ 'margin': {
808
+ 'top': 4,
809
+ 'bottom': 0,
810
+ 'left': 0,
811
+ 'right': 0,
812
+ },
813
+ },
814
+ 'text': ' ',
815
+ 'maxTextLines': 1,
816
+ 'textStyle': {
817
+ 'size': 14,
818
+ },
819
+ },
820
+ ],
821
+ },
822
+ ],
823
+ },
824
+ {
825
+ 'type': ComponentType.Box,
826
+ 'viewStyle': {
827
+ 'margin': {
828
+ 'top': 16,
829
+ 'bottom': 0,
830
+ 'left': 0,
831
+ 'right': 0,
832
+ },
833
+ },
834
+ 'align': {
835
+ 'horizontal': AlignValue.Left,
836
+ 'vertical': AlignValue.Center,
837
+ },
838
+ 'layout': Layout.Row,
839
+ 'items': [
840
+ {
841
+ 'type': ComponentType.Image,
842
+ 'imageUrl': 'https://ca.slack-edge.com/T0ADCTNEL-U02LA25KY8J-d41a3e8c7554-512',
843
+ 'width': {
844
+ 'type': 'fixed',
845
+ 'value': 40,
846
+ },
847
+ 'height': {
848
+ 'type': 'fixed',
849
+ 'value': 40,
850
+ },
851
+ 'metaData': {
852
+ 'pixelWidth': 512,
853
+ 'pixelHeight': 512,
854
+ },
855
+ 'viewStyle': {
856
+ 'backgroundColor': '#BDBDBD',
857
+ 'radius': 20,
858
+ },
859
+ 'imageStyle': {
860
+ 'contentMode': MediaContentMode.AspectFill,
861
+ },
862
+ },
863
+ {
864
+ 'type': ComponentType.Box,
865
+ 'viewStyle': {
866
+ 'margin': {
867
+ 'top': 0,
868
+ 'bottom': 0,
869
+ 'left': 12,
870
+ 'right': 0,
871
+ },
872
+ },
873
+ 'layout': Layout.Column,
874
+ 'items': [
875
+ {
876
+ 'type': ComponentType.Text,
877
+ 'text': 'Amanda',
878
+ 'maxTextLines': 1,
879
+ 'textStyle': {
880
+ 'size': 16,
881
+ 'weight': FontWeight.Bold,
882
+ },
883
+ },
884
+ {
885
+ 'type': ComponentType.Text,
886
+ 'viewStyle': {
887
+ 'margin': {
888
+ 'top': 4,
889
+ 'bottom': 0,
890
+ 'left': 0,
891
+ 'right': 0,
892
+ },
893
+ },
894
+ 'text': 'This is title message',
895
+ 'maxTextLines': 1,
896
+ 'textStyle': {
897
+ 'size': 14,
898
+ },
899
+ },
900
+ ],
901
+ },
902
+ ],
903
+ },
904
+ ],
905
+ },
906
+ ],
907
+ },
908
+ ],
909
+ },
910
+ ],
911
+ },
912
+ });
913
+ ({
914
+ 'version': '1',
915
+ 'body': {
916
+ 'items': [
917
+ {
918
+ 'type': 'box',
919
+ 'layout': 'column',
920
+ height: { type: 'fixed', value: 600 },
921
+ 'items': [
922
+ {
923
+ 'type': 'box',
924
+ 'layout': 'column',
925
+ 'viewStyle': { 'radius': '8', 'padding': { 'top': '12', 'bottom': '12', 'left': '12', 'right': '12' } },
926
+ 'items': [
927
+ {
928
+ 'type': 'text',
929
+ 'text': 'Title text',
930
+ 'textStyle': { 'color': '#E0000000', 'size': '16', 'weight': 'bold' },
931
+ 'maxTextLines': '5',
932
+ 'viewStyle': {},
933
+ 'action': { 'data': 'www.naver.com' },
934
+ },
935
+ {
936
+ 'type': 'text',
937
+ 'viewStyle': { 'margin': { 'top': '8', 'right': '0', 'bottom': '0', 'left': '0' } },
938
+ 'text': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aui',
939
+ 'textStyle': { 'color': '#E0000000', 'size': '14', 'weight': 'normal' },
940
+ 'maxTextLines': '5',
941
+ 'action': { 'data': 'https://www.naver.com' },
942
+ },
943
+ {
944
+ 'type': 'box',
945
+ 'layout': 'row',
946
+ 'viewStyle': { 'margin': { 'top': '12', 'right': '0', 'bottom': '0', 'left': '0' } },
947
+ 'items': [
948
+ {
949
+ 'type': 'textButton',
950
+ 'viewStyle': {
951
+ 'backgroundColor': '#E0E0E0',
952
+ 'padding': { 'top': '10', 'bottom': '10', 'left': '20', 'right': '20' },
953
+ },
954
+ 'text': 'Button 1',
955
+ 'textStyle': { 'color': '#742DDD', 'size': '14', 'weight': 'bold' },
956
+ 'maxTextLines': '5',
957
+ 'action': { 'data': 'www.naver.com' },
958
+ },
959
+ {
960
+ 'type': 'textButton',
961
+ 'viewStyle': {
962
+ 'backgroundColor': '#E0E0E0',
963
+ 'padding': { 'top': '10', 'bottom': '10', 'left': '20', 'right': '20' },
964
+ 'margin': { 'left': '8', 'right': '0', 'top': '0', 'bottom': '0' },
965
+ },
966
+ 'text': 'Button 2',
967
+ 'textStyle': { 'color': '#742DDD', 'size': '14', 'weight': 'bold' },
968
+ 'maxTextLines': '5',
969
+ 'action': { 'data': 'https://www.naver.com' },
970
+ },
971
+ ],
972
+ },
973
+ ],
974
+ 'action': { 'data': 'https://www.naver.com' },
975
+ },
976
+ {
977
+ 'type': 'image',
978
+ 'viewStyle': {},
979
+ 'width': { 'type': 'flex', 'value': FlexSizeSpecValue.FillParent },
980
+ 'height': { 'type': 'flex', 'value': FlexSizeSpecValue.FillParent },
981
+ 'imageStyle': { 'contentMode': 'aspectFill' },
982
+ 'imageUrl': 'https://file-preprod.sendbird.com/d03c08bb3f9041a88c1207b6bbf15ab8.png',
983
+ 'metaData': { 'pixelWidth': '1062', 'pixelHeight': '1070' },
984
+ },
985
+ {
986
+ 'type': 'textButton',
987
+ 'viewStyle': {
988
+ 'backgroundColor': '#E0E0E0',
989
+ 'padding': { 'top': '10', 'bottom': '10', 'left': '20', 'right': '20' },
990
+ },
991
+ 'width': { 'type': 'flex', 'value': FlexSizeSpecValue.FillParent },
992
+ 'height': { 'type': 'flex', 'value': FlexSizeSpecValue.FillParent },
993
+ 'text': 'Button',
994
+ 'textStyle': { 'color': '#742DDD', 'size': '16', 'weight': 'normal' },
995
+ 'maxTextLines': '5',
996
+ 'action': { 'data': 'www.naver.com' },
997
+ },
998
+ {
999
+ 'type': 'imageButton',
1000
+ 'viewStyle': {},
1001
+ 'width': { 'type': 'flex', 'value': FlexSizeSpecValue.FillParent },
1002
+ 'height': { 'type': 'flex', 'value': FlexSizeSpecValue.FillParent },
1003
+ 'imageUrl': 'https://file-preprod.sendbird.com/38fdf5c1056f42b89a44b38155cc4b49.jpg',
1004
+ 'imageStyle': { 'contentMode': 'aspectFill' },
1005
+ 'metaData': { 'pixelWidth': '1080', 'pixelHeight': '2640' },
1006
+ 'action': { 'data': 'www.naver.com' },
1007
+ },
1008
+ ],
1009
+ 'viewStyle': {},
1010
+ },
1011
+ ],
1012
+ },
1013
+ });
1014
+
1015
+ var __rest$3 = (undefined && undefined.__rest) || function (s, e) {
1016
+ var t = {};
1017
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1018
+ t[p] = s[p];
1019
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
1020
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1021
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1022
+ t[p[i]] = s[p[i]];
1023
+ }
1024
+ return t;
1025
+ };
1026
+ const CanvasReactMessageTemplateImage = (props) => {
1027
+ const { imageSize, canvasRef, canvasProps } = useCanvasMessageTemplateImage(props);
1028
+ return (React__default.createElement("canvas", Object.assign({}, canvasProps, { ref: canvasRef, width: imageSize === null || imageSize === void 0 ? void 0 : imageSize.width, height: imageSize === null || imageSize === void 0 ? void 0 : imageSize.height, onError: props.onError })));
1029
+ };
1030
+ const useCanvasMessageTemplateImage = (_a) => {
1031
+ var { metaData, tintColor } = _a, props = __rest$3(_a, ["metaData", "tintColor"]);
1032
+ const canvasRef = useRef(null);
1033
+ const [fallbackImageSize, setFallbackImageSize] = useState();
1034
+ const imageSize = useMemo(() => {
1035
+ if ((metaData === null || metaData === void 0 ? void 0 : metaData.pixelHeight) && (metaData === null || metaData === void 0 ? void 0 : metaData.pixelWidth)) {
1036
+ return { width: metaData.pixelWidth, height: metaData.pixelHeight };
1037
+ }
1038
+ return fallbackImageSize;
1039
+ }, [fallbackImageSize, metaData === null || metaData === void 0 ? void 0 : metaData.pixelHeight, metaData === null || metaData === void 0 ? void 0 : metaData.pixelWidth]);
1040
+ useEffect(() => {
1041
+ if (imageSize == null) {
1042
+ console.log('Canvas_ReactMessageTemplateImage: no metaData, render fit to container');
1043
+ if (canvasRef.current) {
1044
+ canvasRef.current.style.width = '100%';
1045
+ canvasRef.current.style.height = '100%';
1046
+ const containerSize = canvasRef.current.getBoundingClientRect();
1047
+ setFallbackImageSize(containerSize);
1048
+ }
1049
+ }
1050
+ }, [imageSize]);
1051
+ useEffect(() => {
1052
+ if (props.src) {
1053
+ const img = new Image();
1054
+ const onImageLoad = () => {
1055
+ if (canvasRef.current && tintColor && imageSize) {
1056
+ const ctx = canvasRef.current.getContext('2d');
1057
+ if (ctx) {
1058
+ const { width: imageWidth, height: imageHeight } = imageSize;
1059
+ // reset context before draw, consider `.save()` and `.restore()` api
1060
+ ctx.clearRect(0, 0, imageWidth, imageHeight);
1061
+ ctx.beginPath();
1062
+ ctx.globalCompositeOperation = 'source-over';
1063
+ ctx.fillStyle = '#000';
1064
+ // draw
1065
+ ctx.drawImage(img, 0, 0, imageWidth, imageHeight);
1066
+ ctx.globalCompositeOperation = 'source-atop';
1067
+ ctx.fillStyle = tintColor;
1068
+ ctx.fillRect(0, 0, imageWidth, imageHeight);
1069
+ }
1070
+ }
1071
+ };
1072
+ const onImageError = (event) => {
1073
+ var _a;
1074
+ // @ts-ignore
1075
+ (_a = props.onError) === null || _a === void 0 ? void 0 : _a.call(props, event);
1076
+ };
1077
+ img.addEventListener('load', onImageLoad);
1078
+ img.addEventListener('error', onImageError);
1079
+ img.src = props.src;
1080
+ return () => {
1081
+ img.removeEventListener('load', onImageLoad);
1082
+ img.removeEventListener('error', onImageError);
1083
+ };
1084
+ }
1085
+ return;
1086
+ }, [props.src, imageSize, tintColor]);
1087
+ return {
1088
+ canvasRef,
1089
+ canvasProps: props,
1090
+ imageSize,
1091
+ };
1092
+ };
1093
+
1094
+ const ImgReactMessageTemplateImage = (props) => {
1095
+ return React__default.createElement("img", Object.assign({}, props, { onError: props.onError, referrerPolicy: "no-referrer" }));
1096
+ };
1097
+
1098
+ const PlaceholderReactMessageTemplateImage = (props) => {
1099
+ return React__default.createElement("div", { style: Object.assign(Object.assign({}, props.style), { backgroundColor: 'transparent' }) });
1100
+ };
1101
+
1102
+ var __rest$2 = (undefined && undefined.__rest) || function (s, e) {
1103
+ var t = {};
1104
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1105
+ t[p] = s[p];
1106
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
1107
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1108
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1109
+ t[p[i]] = s[p[i]];
1110
+ }
1111
+ return t;
1112
+ };
1113
+ const ReactMessageTemplateImage = (_a) => {
1114
+ var { tintColor, metaData } = _a, props = __rest$2(_a, ["tintColor", "metaData"]);
1115
+ const { hasError, onError } = useImageLoadError(props.src);
1116
+ if (props.onError)
1117
+ console.warn('`onError` is intercepted and not executed in the ReactMessageTemplateImage.');
1118
+ if (hasError) {
1119
+ return React__default.createElement(PlaceholderReactMessageTemplateImage, Object.assign({}, props));
1120
+ }
1121
+ else if (tintColor) {
1122
+ return React__default.createElement(CanvasReactMessageTemplateImage, Object.assign({}, props, { onError: onError, tintColor: tintColor, metaData: metaData }));
1123
+ }
1124
+ else {
1125
+ return React__default.createElement(ImgReactMessageTemplateImage, Object.assign({}, props, { onError: onError }));
1126
+ }
1127
+ };
1128
+ const useImageLoadError = (source) => {
1129
+ const [hasError, setHasError] = useState(false);
1130
+ useEffect(() => setHasError(false), [source]);
1131
+ return {
1132
+ hasError,
1133
+ onError: useCallback(() => setHasError(true), []),
1134
+ };
1135
+ };
1136
+
1137
+ // create a context provider for MessageComponent
1138
+ // - this is a wrapper for MessageComponent
1139
+ const MessageContext = React__default.createContext(null);
1140
+ const MessageProvider = (props) => {
1141
+ const { message, handleWebAction, handleCustomAction, handlePredefinedAction, children } = props;
1142
+ const value = React__default.useMemo(() => ({
1143
+ message,
1144
+ handleWebAction,
1145
+ handleCustomAction,
1146
+ handlePredefinedAction,
1147
+ }), [message === null || message === void 0 ? void 0 : message.updatedAt]);
1148
+ return React__default.createElement(MessageContext.Provider, { value: value }, children);
1149
+ };
1150
+ const useMessageContext = () => React__default.useContext(MessageContext);
1151
+
1152
+ function isWrappedText(view) {
1153
+ var _a;
1154
+ return view.type === ComponentType.Text && ((_a = view.width) === null || _a === void 0 ? void 0 : _a.value) == FlexSizeSpecValue.WrapContent;
1155
+ }
1156
+ // Compares the size spec to the option and returns whether they are equal or not.
1157
+ const isSizeCompatibleWithOption = ({ size, option, }) => {
1158
+ if (option === 'wrap') {
1159
+ return size.type === 'flex' && size.value == FlexSizeSpecValue.WrapContent;
1160
+ }
1161
+ if (option === 'fill') {
1162
+ return size.type === 'flex' && size.value == FlexSizeSpecValue.FillParent;
1163
+ }
1164
+ return size.type === 'fixed';
1165
+ };
1166
+
1167
+ /**
1168
+ * Preserves a reference to the given callback function as an argument while the component is mounted.
1169
+ * Wraps the given callback in React's Ref to preserve the reference.
1170
+ * @param callback want to be preserved
1171
+ */
1172
+ function usePreservedCallback(callback) {
1173
+ const callbackRef = useRef(callback);
1174
+ useEffect(() => {
1175
+ callbackRef.current = callback;
1176
+ }, [callback]);
1177
+ return useCallback((...args) => {
1178
+ return callbackRef.current(...args);
1179
+ }, [callbackRef]);
1180
+ }
1181
+
1182
+ /**
1183
+ * This hook can be used when you want to safely effect the value stored in useRef
1184
+ * Got this idea from https://github.com/facebook/react/issues/15176
1185
+ * @param callback
1186
+ * @param deps
1187
+ * @returns effect callback
1188
+ */
1189
+ function useRefEffect(callback, deps) {
1190
+ const preservedCallback = usePreservedCallback(callback);
1191
+ const disposeRef = useRef(noop);
1192
+ const effect = useCallback((element) => {
1193
+ disposeRef.current();
1194
+ disposeRef.current = noop;
1195
+ if (element != null) {
1196
+ const cleanup = callback(element);
1197
+ if (typeof cleanup === 'function') {
1198
+ disposeRef.current = cleanup;
1199
+ }
1200
+ }
1201
+ }, [preservedCallback, ...deps]);
1202
+ return effect;
1203
+ }
1204
+ function noop() { }
1205
+
1206
+ /**
1207
+ * Subscribes to ResizeObserver on the component exposing the Ref,
1208
+ * to detect changes in the size of DOM elements.
1209
+ * The ResizeObserver API is required.
1210
+ * If you are targeting browsers that do not support that API, probably need to add appropriate polyfill too.
1211
+ * @param onResize
1212
+ * @returns ref
1213
+ */
1214
+ function useResizeObserver(onResize) {
1215
+ const resizeCallback = usePreservedCallback(onResize);
1216
+ const ref = useRefEffect((elem) => {
1217
+ const observer = new ResizeObserver((entries) => {
1218
+ if (entries[0] != null) {
1219
+ resizeCallback(entries[0]);
1220
+ }
1221
+ });
1222
+ observer.observe(elem);
1223
+ return () => {
1224
+ observer.unobserve(elem);
1225
+ };
1226
+ }, [resizeCallback]);
1227
+ return ref;
1228
+ }
1229
+
1230
+ /**
1231
+ * @returns an element's width / height observed by IntersectionObserver,
1232
+ * and ref to detect its resize event
1233
+ */
1234
+ function useElementSize() {
1235
+ const [width, setWidth] = useState(-1);
1236
+ const [height, setHeight] = useState(-1);
1237
+ const [contentWidth, setContentWidth] = useState(-1);
1238
+ const [contentHeight, setContentHeight] = useState(-1);
1239
+ const [paddingWidth, setPaddingWidth] = useState(-1);
1240
+ const [paddingHeight, setPaddingHeight] = useState(-1);
1241
+ const ref = useResizeObserver((entry) => {
1242
+ // contentRect: content size only
1243
+ const { width: contentWidth, height: contentHeight } = entry.contentRect;
1244
+ // target: content + padding + border size
1245
+ const target = entry.target;
1246
+ const { width, height } = target.getBoundingClientRect();
1247
+ setWidth(width);
1248
+ setHeight(height);
1249
+ setContentWidth(contentWidth);
1250
+ setContentHeight(contentHeight);
1251
+ setPaddingWidth(width - contentWidth);
1252
+ setPaddingHeight(height - contentHeight);
1253
+ });
1254
+ return { ref, width, height, contentWidth, contentHeight, paddingWidth, paddingHeight };
1255
+ }
1256
+
1257
+ var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
1258
+ var t = {};
1259
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1260
+ t[p] = s[p];
1261
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
1262
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1263
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1264
+ t[p[i]] = s[p[i]];
1265
+ }
1266
+ return t;
1267
+ };
1268
+ function isViewCompatibleWithSizeOption({ width = defaultProperties.view.size.width, height = defaultProperties.view.size.height, parentLayout = defaultProperties.box.layout, option, }) {
1269
+ if (parentLayout === Layout.Row) {
1270
+ return isSizeCompatibleWithOption({
1271
+ size: width,
1272
+ option,
1273
+ });
1274
+ }
1275
+ return isSizeCompatibleWithOption({
1276
+ size: height,
1277
+ option,
1278
+ });
1279
+ }
1280
+ function useRecalculateWidth(params) {
1281
+ const { style, props } = params;
1282
+ const _a = useElementSize(), { ref: elemRef } = _a, size = __rest$1(_a, ["ref"]);
1283
+ const { updateSize, sizes } = useSizeContext();
1284
+ const { id, siblings, parentLayout } = props;
1285
+ const { width, height, paddingWidth, paddingHeight, contentWidth, contentHeight } = size;
1286
+ useEffect(() => {
1287
+ updateSize({
1288
+ id: props.id,
1289
+ width,
1290
+ height,
1291
+ paddingWidth,
1292
+ paddingHeight,
1293
+ contentWidth,
1294
+ contentHeight,
1295
+ });
1296
+ }, [props.id, width, height, paddingWidth, paddingHeight, contentWidth, contentHeight, updateSize]);
1297
+ const currentStyle = useMemo(() => {
1298
+ const sumViewSize = (acc = 0, view) => {
1299
+ var _a, _b, _c, _d;
1300
+ if (parentLayout === Layout.Row) {
1301
+ return acc + ((_b = (_a = sizes[view.id]) === null || _a === void 0 ? void 0 : _a.contentWidth) !== null && _b !== void 0 ? _b : 0);
1302
+ }
1303
+ return acc + ((_d = (_c = sizes[view.id]) === null || _c === void 0 ? void 0 : _c.contentHeight) !== null && _d !== void 0 ? _d : 0);
1304
+ };
1305
+ const hasFillOption = isViewCompatibleWithSizeOption({
1306
+ width: props.width,
1307
+ height: props.height,
1308
+ parentLayout,
1309
+ option: 'fill',
1310
+ });
1311
+ if (hasFillOption) {
1312
+ const wrapSiblingsSize = siblings
1313
+ .filter(({ width, height }) => !isViewCompatibleWithSizeOption({
1314
+ width: width,
1315
+ height: height,
1316
+ parentLayout,
1317
+ option: 'fill',
1318
+ }))
1319
+ .reduce(sumViewSize, 0);
1320
+ const fillSiblingCount = siblings.filter(({ width, height }) => isViewCompatibleWithSizeOption({
1321
+ width: width,
1322
+ height: height,
1323
+ parentLayout,
1324
+ option: 'fill',
1325
+ })).length;
1326
+ const maxSizeOption = (() => {
1327
+ if (parentLayout === Layout.Row) {
1328
+ return {
1329
+ maxWidth: `calc((100% - ${wrapSiblingsSize}px) / ${fillSiblingCount})`,
1330
+ };
1331
+ }
1332
+ return {
1333
+ maxHeight: `calc((100% - ${wrapSiblingsSize}px) / ${fillSiblingCount})`,
1334
+ };
1335
+ })();
1336
+ return Object.assign(Object.assign(Object.assign({}, style), maxSizeOption), (width == 0 && { height: 0 }));
1337
+ }
1338
+ else {
1339
+ const currentElemIdx = siblings.findIndex((sibling) => sibling.id === id);
1340
+ const forwardSiblingsSize = siblings
1341
+ .slice(0, currentElemIdx)
1342
+ .filter(({ width, height }) => isViewCompatibleWithSizeOption({
1343
+ width: width,
1344
+ height: height,
1345
+ parentLayout,
1346
+ option: 'wrap',
1347
+ }))
1348
+ .reduce(sumViewSize, 0);
1349
+ return Object.assign(Object.assign(Object.assign({}, style), (width === 0 && { height: 0 })), (parentLayout === Layout.Row
1350
+ ? {
1351
+ maxWidth: `calc(100% - ${forwardSiblingsSize}px)`,
1352
+ }
1353
+ : {
1354
+ maxHeight: `calc(100% - ${forwardSiblingsSize}px)`,
1355
+ }));
1356
+ }
1357
+ }, [props.width, props.height, parentLayout, sizes, siblings, style, width, id]);
1358
+ return { recalculatedStyle: currentStyle, elemRef };
1359
+ }
1360
+
1361
+ function getDefaultStyles(overrides) {
1362
+ return Object.assign({ display: 'flex', overflow: 'hidden', boxSizing: 'border-box' }, overrides);
1363
+ }
1364
+ function setViewProps(styles, props, options) {
1365
+ setViewSize(styles, props, options);
1366
+ setViewStyle(styles, props);
1367
+ }
1368
+ function setBorderStyle(styles, borderWidth, borderColor, radius) {
1369
+ if (borderWidth) {
1370
+ styles['--border-width'] = `${borderWidth}px`;
1371
+ styles['--border-color'] = borderColor || 'transparent';
1372
+ }
1373
+ if (radius) {
1374
+ styles['borderRadius'] = Number(radius);
1375
+ styles['--border-radius'] = `${radius}px`;
1376
+ }
1377
+ }
1378
+ function setViewStyle(styles, props) {
1379
+ var _a, _b, _c, _d;
1380
+ const { viewStyle } = props;
1381
+ if ((_a = viewStyle === null || viewStyle === void 0 ? void 0 : viewStyle.margin) === null || _a === void 0 ? void 0 : _a.top)
1382
+ styles['marginTop'] = Number(viewStyle.margin.top);
1383
+ if ((_b = viewStyle === null || viewStyle === void 0 ? void 0 : viewStyle.margin) === null || _b === void 0 ? void 0 : _b.bottom)
1384
+ styles['marginBottom'] = Number(viewStyle.margin.bottom);
1385
+ if ((_c = viewStyle === null || viewStyle === void 0 ? void 0 : viewStyle.margin) === null || _c === void 0 ? void 0 : _c.left)
1386
+ styles['marginLeft'] = Number(viewStyle.margin.left);
1387
+ if ((_d = viewStyle === null || viewStyle === void 0 ? void 0 : viewStyle.margin) === null || _d === void 0 ? void 0 : _d.right)
1388
+ styles['marginRight'] = Number(viewStyle.margin.right);
1389
+ if (viewStyle === null || viewStyle === void 0 ? void 0 : viewStyle.backgroundColor)
1390
+ styles['backgroundColor'] = viewStyle.backgroundColor;
1391
+ // use JSON.stringify to escape special characters in image URL
1392
+ if (viewStyle === null || viewStyle === void 0 ? void 0 : viewStyle.backgroundImageUrl)
1393
+ styles['backgroundImage'] = `url(${JSON.stringify(viewStyle.backgroundImageUrl)})`;
1394
+ setBorderStyle(styles, viewStyle === null || viewStyle === void 0 ? void 0 : viewStyle.borderWidth, viewStyle === null || viewStyle === void 0 ? void 0 : viewStyle.borderColor, viewStyle === null || viewStyle === void 0 ? void 0 : viewStyle.radius);
1395
+ }
1396
+ function getViewSizeStyle(width, height, parentLayout) {
1397
+ const style = {};
1398
+ if (width.type === 'flex' && width.value == FlexSizeSpecValue.FillParent) {
1399
+ style['width'] = '100%';
1400
+ if (parentLayout === Layout.Row) {
1401
+ style['flex'] = 1;
1402
+ }
1403
+ }
1404
+ else if (width.type === 'fixed' && width.value >= 0) {
1405
+ style['width'] = Number(width.value);
1406
+ }
1407
+ if (height.type === 'flex' && height.value == FlexSizeSpecValue.FillParent) {
1408
+ style['height'] = '100%';
1409
+ if (parentLayout === Layout.Column) {
1410
+ style['flex'] = 1;
1411
+ }
1412
+ }
1413
+ else if (height.type === 'fixed' && height.value >= 0) {
1414
+ style['height'] = Number(height.value);
1415
+ }
1416
+ return style;
1417
+ }
1418
+ function setViewSize(styles, props, options) {
1419
+ var _a, _b;
1420
+ const { width: defaultWidth, height: defaultHeight } = defaultProperties.view.size;
1421
+ const { parentLayout } = options;
1422
+ const sizeStyle = getViewSizeStyle((_a = props.width) !== null && _a !== void 0 ? _a : defaultWidth, (_b = props.height) !== null && _b !== void 0 ? _b : defaultHeight, parentLayout);
1423
+ Object.assign(styles, sizeStyle);
1424
+ }
1425
+ function setAlign(styles, layout = defaultProperties.box.layout, align = defaultProperties.box.align) {
1426
+ if (layout === Layout.Row) {
1427
+ styles['flexDirection'] = 'row';
1428
+ styles['alignItems'] = alignInFlex(align.vertical);
1429
+ styles['justifyContent'] = alignInFlex(align.horizontal);
1430
+ }
1431
+ if (layout === Layout.Column) {
1432
+ styles['flexDirection'] = 'column';
1433
+ styles['alignItems'] = alignInFlex(align.horizontal);
1434
+ styles['justifyContent'] = alignInFlex(align.vertical);
1435
+ }
1436
+ }
1437
+ function setTextAlign(styles, align = defaultProperties.box.align.horizontal) {
1438
+ styles.textAlign = align;
1439
+ }
1440
+ function setImageStyle(styles, imageStyle) {
1441
+ const { contentMode = MediaContentMode.AspectFit } = imageStyle || {};
1442
+ if (contentMode) {
1443
+ switch (contentMode) {
1444
+ case MediaContentMode.AspectFill:
1445
+ styles['objectFit'] = 'cover';
1446
+ break;
1447
+ case MediaContentMode.AspectFit:
1448
+ styles['objectFit'] = 'contain';
1449
+ break;
1450
+ case MediaContentMode.ScalesToFill:
1451
+ styles['objectFit'] = 'fill';
1452
+ break;
1453
+ }
1454
+ }
1455
+ }
1456
+ // uses image meta-data to render images that doesn't break the UI
1457
+ // https://sendbird.atlassian.net/wiki/spaces/UK/pages/2008220608/Message+template+-+Image+policy
1458
+ function setImageAspectRatio(styles, props) {
1459
+ var _a, _b, _c, _d;
1460
+ const imageMetaData = props === null || props === void 0 ? void 0 : props.metaData;
1461
+ if (!(imageMetaData === null || imageMetaData === void 0 ? void 0 : imageMetaData.pixelHeight) || !(imageMetaData === null || imageMetaData === void 0 ? void 0 : imageMetaData.pixelWidth)) {
1462
+ return;
1463
+ }
1464
+ if (((_a = props === null || props === void 0 ? void 0 : props.width) === null || _a === void 0 ? void 0 : _a.type) === 'fixed' || ((_b = props === null || props === void 0 ? void 0 : props.height) === null || _b === void 0 ? void 0 : _b.type) === 'fixed') {
1465
+ return;
1466
+ }
1467
+ styles['aspectRatio'] = `${(_c = props === null || props === void 0 ? void 0 : props.metaData) === null || _c === void 0 ? void 0 : _c.pixelWidth} / ${(_d = props === null || props === void 0 ? void 0 : props.metaData) === null || _d === void 0 ? void 0 : _d.pixelHeight}`;
1468
+ }
1469
+ function webkitLineClampStyles(numberOfLines) {
1470
+ return {
1471
+ WebkitLineClamp: numberOfLines,
1472
+ WebkitBoxOrient: 'vertical',
1473
+ display: '-webkit-box',
1474
+ overflow: 'hidden',
1475
+ overflowWrap: 'anywhere',
1476
+ flex: 1,
1477
+ };
1478
+ }
1479
+ function setTextStyle(styles, props, options) {
1480
+ const { textStyle, width } = props;
1481
+ // TODO: Change default as design
1482
+ const { size, color, weight = 'normal' } = textStyle || {};
1483
+ if (size)
1484
+ styles['fontSize'] = Number(size);
1485
+ if (color)
1486
+ styles['color'] = color;
1487
+ if (weight)
1488
+ styles['fontWeight'] = weight;
1489
+ if ((width === null || width === void 0 ? void 0 : width.value) == FlexSizeSpecValue.WrapContent) {
1490
+ styles['maxWidth'] = '100%';
1491
+ }
1492
+ if (props.type === ComponentType.Text) {
1493
+ const { siblings, elemIdx } = options;
1494
+ // To push out any subsequent components from the container,
1495
+ // if a prior one is long enough to occupy an entire line
1496
+ // @link https://sendbird.atlassian.net/browse/NOTI-709
1497
+ if (siblings != null && siblings.length >= 2 && siblings.every(isWrappedText)) {
1498
+ styles.flexShrink = siblings.length - 1 === elemIdx ? 1 : 0;
1499
+ }
1500
+ }
1501
+ }
1502
+
1503
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
1504
+ var t = {};
1505
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1506
+ t[p] = s[p];
1507
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
1508
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1509
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1510
+ t[p[i]] = s[p[i]];
1511
+ }
1512
+ return t;
1513
+ };
1514
+ const hasValidUrlProtocol = (url = '') => ['http://', 'https://', 'ftp://'].some((protocol) => url.startsWith(protocol));
1515
+ /**
1516
+ * @param url - url to be checked
1517
+ * @returns url with http:// protocol if it doesn't have any protocol
1518
+ * @example
1519
+ * returnUrl('www.sendbird.com') // returns 'http://www.sendbird.com'
1520
+ * returnUrl('https://www.sendbird.com') // returns 'https://www.sendbird.com'
1521
+ * returnUrl('ftp://www.sendbird.com') // returns 'ftp://www.sendbird.com'
1522
+ * returnUrl('sendbird.com') // returns 'https://sendbird.com'
1523
+ **/
1524
+ const returnUrl = (url = '') => {
1525
+ if (hasValidUrlProtocol(url)) {
1526
+ return url;
1527
+ }
1528
+ return `https://${url}`;
1529
+ };
1530
+ // todo: semantic html here is not perfect, need to revisit. Same for Button
1531
+ const ActionHandler = ({ className = '', style, children, props }) => {
1532
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
1533
+ const { recalculatedStyle, elemRef } = useRecalculateWidth({ style, props });
1534
+ const { message, handleWebAction, handleCustomAction, handlePredefinedAction } = useMessageContext();
1535
+ const onClick = (e) => {
1536
+ var _a, _b, _c, _d, _e;
1537
+ if (((_a = props === null || props === void 0 ? void 0 : props.action) === null || _a === void 0 ? void 0 : _a.type) === 'web') {
1538
+ if (handleWebAction) {
1539
+ handleWebAction === null || handleWebAction === void 0 ? void 0 : handleWebAction(e, props.action, message);
1540
+ }
1541
+ else {
1542
+ (_c = window === null || window === void 0 ? void 0 : window.open(returnUrl((_b = props === null || props === void 0 ? void 0 : props.action) === null || _b === void 0 ? void 0 : _b.data), '_blank', 'noopener noreferrer')) === null || _c === void 0 ? void 0 : _c.focus();
1543
+ }
1544
+ }
1545
+ if (((_d = props === null || props === void 0 ? void 0 : props.action) === null || _d === void 0 ? void 0 : _d.type) === 'custom') {
1546
+ handleCustomAction === null || handleCustomAction === void 0 ? void 0 : handleCustomAction(e, props.action, message);
1547
+ }
1548
+ if (((_e = props === null || props === void 0 ? void 0 : props.action) === null || _e === void 0 ? void 0 : _e.type) === 'uikit') {
1549
+ handlePredefinedAction === null || handlePredefinedAction === void 0 ? void 0 : handlePredefinedAction(e, props.action, message);
1550
+ }
1551
+ };
1552
+ const borderClass = ((_a = props.viewStyle) === null || _a === void 0 ? void 0 : _a.borderWidth) ? ' sb-message-template__border' : '';
1553
+ if (className === 'sb-message-template__text-button') {
1554
+ return (React__default.createElement("button", { className: `${className}${borderClass}`, "data-sb-template-id": props.elementId, style: Object.assign(Object.assign({}, style), { paddingTop: (_c = (_b = props.viewStyle) === null || _b === void 0 ? void 0 : _b.padding) === null || _c === void 0 ? void 0 : _c.top, paddingRight: (_e = (_d = props.viewStyle) === null || _d === void 0 ? void 0 : _d.padding) === null || _e === void 0 ? void 0 : _e.right, paddingBottom: (_g = (_f = props.viewStyle) === null || _f === void 0 ? void 0 : _f.padding) === null || _g === void 0 ? void 0 : _g.bottom, paddingLeft: (_j = (_h = props.viewStyle) === null || _h === void 0 ? void 0 : _h.padding) === null || _j === void 0 ? void 0 : _j.left }), onClick: onClick }, children));
1555
+ }
1556
+ const { display, flexDirection, justifyContent, alignItems, objectFit } = recalculatedStyle, wrapperStyles = __rest(recalculatedStyle, ["display", "flexDirection", "justifyContent", "alignItems", "objectFit"]);
1557
+ return (React__default.createElement("div", { ref: elemRef, className: `${className}${borderClass} ${(props === null || props === void 0 ? void 0 : props.action) ? 'sb-message-template__action' : ''}`, "data-sb-template-id": props.elementId, style: wrapperStyles, onClick: onClick },
1558
+ React__default.createElement("div", { style: {
1559
+ display,
1560
+ flexDirection,
1561
+ justifyContent,
1562
+ alignItems,
1563
+ objectFit,
1564
+ width: '100%',
1565
+ height: '100%',
1566
+ paddingTop: (_l = (_k = props.viewStyle) === null || _k === void 0 ? void 0 : _k.padding) === null || _l === void 0 ? void 0 : _l.top,
1567
+ paddingRight: (_o = (_m = props.viewStyle) === null || _m === void 0 ? void 0 : _m.padding) === null || _o === void 0 ? void 0 : _o.right,
1568
+ paddingBottom: (_q = (_p = props.viewStyle) === null || _p === void 0 ? void 0 : _p.padding) === null || _q === void 0 ? void 0 : _q.bottom,
1569
+ paddingLeft: (_s = (_r = props.viewStyle) === null || _r === void 0 ? void 0 : _r.padding) === null || _s === void 0 ? void 0 : _s.left,
1570
+ } }, children)));
1571
+ };
1572
+ /**
1573
+ * Text that is fixed or fill parent should be wrapped in a div with max-width: 100% and max-height: 100%
1574
+ * This is to prevent text from overflowing the padding of the container
1575
+ */
1576
+ function isFixedOrFill(view) {
1577
+ var _a, _b, _c, _d;
1578
+ const heightType = (_a = view === null || view === void 0 ? void 0 : view.height) === null || _a === void 0 ? void 0 : _a.type;
1579
+ const widthType = (_b = view === null || view === void 0 ? void 0 : view.width) === null || _b === void 0 ? void 0 : _b.type;
1580
+ const isFixedDiamension = heightType === 'fixed' || widthType === 'fixed';
1581
+ const isFill = (heightType === 'flex' && ((_c = view === null || view === void 0 ? void 0 : view.height) === null || _c === void 0 ? void 0 : _c.value) === FlexSizeSpecValue.FillParent) ||
1582
+ (widthType === 'flex' && ((_d = view === null || view === void 0 ? void 0 : view.width) === null || _d === void 0 ? void 0 : _d.value) === FlexSizeSpecValue.FillParent);
1583
+ return isFixedDiamension || isFill;
1584
+ }
1585
+ function renderText(view) {
1586
+ const { text, maxTextLines } = view;
1587
+ const isToBeWrapped = isFixedOrFill(view);
1588
+ const isMultiLine = maxTextLines != null && maxTextLines > 0;
1589
+ if (isMultiLine || isToBeWrapped) {
1590
+ const wrapperStyling = Object.assign(Object.assign({}, ((isMultiLine || isToBeWrapped) && { maxWidth: '100%' })), (isToBeWrapped && { maxHeight: '100%', overflow: 'hidden' }));
1591
+ return (React__default.createElement("div", { style: wrapperStyling }, isMultiLine ? React__default.createElement("div", { style: webkitLineClampStyles(maxTextLines) }, text) : text));
1592
+ }
1593
+ return text;
1594
+ }
1595
+ const renderer = createRenderer({
1596
+ views: {
1597
+ box(props) {
1598
+ return (React__default.createElement(ActionHandler, { className: "sb-message-template__box", elementId: props.elementId, style: props.parsedProperties, props: props }, props.children));
1599
+ },
1600
+ text(props) {
1601
+ return (React__default.createElement(ActionHandler, { className: "sb-message-template__text", elementId: props.elementId, style: props.parsedProperties, props: props }, renderText(props)));
1602
+ },
1603
+ image(props) {
1604
+ var _a;
1605
+ // todo: add image backup
1606
+ return (React__default.createElement(ActionHandler, { className: "sb-message-template__image-container", elementId: props.elementId, style: props.parsedProperties, props: props },
1607
+ React__default.createElement(ReactMessageTemplateImage, { className: "sb-message-template__image", alt: "image", src: props.imageUrl, style: { width: '100%', height: '100%', aspectRatio: 'inherit', objectFit: 'inherit' }, tintColor: (_a = props.imageStyle) === null || _a === void 0 ? void 0 : _a.tintColor, metaData: props.metaData })));
1608
+ },
1609
+ textButton(props) {
1610
+ return (React__default.createElement(ActionHandler, { className: "sb-message-template__text-button", elementId: props.elementId, style: props.parsedProperties, props: props }, renderText(props)));
1611
+ },
1612
+ imageButton(props) {
1613
+ var _a;
1614
+ return (React__default.createElement(ActionHandler, { className: "sb-message-template__image-container sb-message-template__image-button", elementId: props.elementId, style: props.parsedProperties, props: props },
1615
+ React__default.createElement(ReactMessageTemplateImage, { className: "sb-message-template__image", alt: "image-button", src: props.imageUrl, style: { width: '100%', height: '100%', aspectRatio: 'inherit', objectFit: 'inherit' }, tintColor: (_a = props.imageStyle) === null || _a === void 0 ? void 0 : _a.tintColor, metaData: props.metaData })));
1616
+ },
1617
+ },
1618
+ });
1619
+ const parser = createParser({
1620
+ mapBoxProps(props, options) {
1621
+ const styles = getDefaultStyles();
1622
+ setViewProps(styles, props, options);
1623
+ setAlign(styles, props.layout, props.align);
1624
+ return styles;
1625
+ },
1626
+ mapTextProps(props, options) {
1627
+ var _a;
1628
+ const styles = getDefaultStyles({ whiteSpace: 'pre-line' });
1629
+ // Better not set flex 1 to text
1630
+ setViewProps(styles, props, options);
1631
+ setTextStyle(styles, props, options);
1632
+ setAlign(styles, Layout.Row, props.align);
1633
+ setTextAlign(styles, (_a = props.align) === null || _a === void 0 ? void 0 : _a.horizontal);
1634
+ return styles;
1635
+ },
1636
+ mapImageProps(props, options) {
1637
+ const styles = getDefaultStyles();
1638
+ setViewProps(styles, props, options);
1639
+ setImageStyle(styles, props.imageStyle);
1640
+ setImageAspectRatio(styles, props);
1641
+ return styles;
1642
+ },
1643
+ mapTextButtonProps(props, options) {
1644
+ const styles = getDefaultStyles({ whiteSpace: 'pre-line', alignItems: 'center', justifyContent: 'center' });
1645
+ setViewProps(styles, props, options);
1646
+ setTextStyle(styles, Object.assign(Object.assign({}, props), { textStyle: Object.assign({ weight: 500 }, props.textStyle) }), options);
1647
+ return styles;
1648
+ },
1649
+ mapImageButtonProps(props, options) {
1650
+ const styles = getDefaultStyles();
1651
+ setViewProps(styles, props, options);
1652
+ setImageStyle(styles, props.imageStyle);
1653
+ setImageAspectRatio(styles, props);
1654
+ return styles;
1655
+ },
1656
+ });
1657
+ createMessageTemplate({
1658
+ renderer,
1659
+ parser,
1660
+ Container: ({ children }) => {
1661
+ return (React__default.createElement("div", { className: "sb-message-template__parent", style: {
1662
+ display: 'flex',
1663
+ flexDirection: 'column',
1664
+ maxWidth: 400,
1665
+ backgroundColor: '#cecece',
1666
+ marginBottom: 24,
1667
+ borderRadius: '8px',
1668
+ } }, children));
1669
+ },
1670
+ });
1671
+
1672
+ var CustomTemplate = createMessageTemplate({
1673
+ parser: parser,
1674
+ renderer: renderer,
1675
+ Container: function (_a) {
1676
+ var children = _a.children;
1677
+ return (React__default.createElement("div", { className: [
1678
+ 'sb-message-template__parent',
1679
+ 'sendbird-message-template__root',
1680
+ ].join(' ') }, children));
1681
+ },
1682
+ }).MessageTemplate;
1683
+ function MessageTemplate(_a) {
1684
+ var templateItems = _a.templateItems;
1685
+ return React__default.createElement(CustomTemplate, { templateItems: templateItems });
1686
+ }
1687
+
1688
+ export { MessageProvider as M, MessageTemplate as a };
1689
+ //# sourceMappingURL=bundle-6KFri-1A.js.map