stream-chat-react-native-core 9.0.2-beta.1 → 9.1.0-beta.1

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 (280) hide show
  1. package/lib/commonjs/components/Attachment/Attachment.js +38 -10
  2. package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
  3. package/lib/commonjs/components/Attachment/AttachmentFileUploadProgressIndicator.js +97 -0
  4. package/lib/commonjs/components/Attachment/AttachmentFileUploadProgressIndicator.js.map +1 -0
  5. package/lib/commonjs/components/Attachment/AttachmentUploadIndicator.js +97 -0
  6. package/lib/commonjs/components/Attachment/AttachmentUploadIndicator.js.map +1 -0
  7. package/lib/commonjs/components/Attachment/CircularProgressIndicator.js +141 -0
  8. package/lib/commonjs/components/Attachment/CircularProgressIndicator.js.map +1 -0
  9. package/lib/commonjs/components/Attachment/FileAttachment.js +18 -4
  10. package/lib/commonjs/components/Attachment/FileAttachment.js.map +1 -1
  11. package/lib/commonjs/components/Attachment/Gallery.js +7 -1
  12. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  13. package/lib/commonjs/components/Attachment/MediaUploadProgressOverlay.js +59 -0
  14. package/lib/commonjs/components/Attachment/MediaUploadProgressOverlay.js.map +1 -0
  15. package/lib/commonjs/components/Attachment/VideoThumbnail.js +18 -8
  16. package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -1
  17. package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js +2 -0
  18. package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
  19. package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +6 -2
  20. package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
  21. package/lib/commonjs/components/Channel/Channel.js +94 -92
  22. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  23. package/lib/commonjs/components/Chat/Chat.js +10 -1
  24. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  25. package/lib/commonjs/components/Indicators/EmptyStateIndicator.js +1 -1
  26. package/lib/commonjs/components/Indicators/EmptyStateIndicator.js.map +1 -1
  27. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.js +50 -57
  28. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.js.map +1 -1
  29. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.js +10 -6
  30. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.js.map +1 -1
  31. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.js +12 -6
  32. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.js.map +1 -1
  33. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js +13 -7
  34. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js.map +1 -1
  35. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.js +6 -2
  36. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.js.map +1 -1
  37. package/lib/commonjs/components/Poll/CreatePollContent.js +3 -3
  38. package/lib/commonjs/components/Poll/CreatePollContent.js.map +1 -1
  39. package/lib/commonjs/components/index.js +33 -0
  40. package/lib/commonjs/components/index.js.map +1 -1
  41. package/lib/commonjs/contexts/componentsContext/defaultComponents.js +6 -0
  42. package/lib/commonjs/contexts/componentsContext/defaultComponents.js.map +1 -1
  43. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +3 -1
  44. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  45. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.js +4 -1
  46. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.js.map +1 -1
  47. package/lib/commonjs/contexts/themeContext/utils/theme.js +5 -0
  48. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  49. package/lib/commonjs/hooks/index.js +11 -0
  50. package/lib/commonjs/hooks/index.js.map +1 -1
  51. package/lib/commonjs/hooks/usePendingAttachmentUpload.js +106 -0
  52. package/lib/commonjs/hooks/usePendingAttachmentUpload.js.map +1 -0
  53. package/lib/commonjs/i18n/en.json +8 -0
  54. package/lib/commonjs/i18n/es.json +8 -0
  55. package/lib/commonjs/i18n/fr.json +8 -0
  56. package/lib/commonjs/i18n/he.json +8 -0
  57. package/lib/commonjs/i18n/hi.json +8 -0
  58. package/lib/commonjs/i18n/it.json +8 -0
  59. package/lib/commonjs/i18n/ja.json +8 -0
  60. package/lib/commonjs/i18n/ko.json +8 -0
  61. package/lib/commonjs/i18n/nl.json +8 -0
  62. package/lib/commonjs/i18n/pt-br.json +8 -0
  63. package/lib/commonjs/i18n/ru.json +8 -0
  64. package/lib/commonjs/i18n/tr.json +8 -0
  65. package/lib/commonjs/index.js +12 -0
  66. package/lib/commonjs/index.js.map +1 -1
  67. package/lib/commonjs/middlewares/attachments.js +2 -0
  68. package/lib/commonjs/middlewares/attachments.js.map +1 -1
  69. package/lib/commonjs/native.js +8 -1
  70. package/lib/commonjs/native.js.map +1 -1
  71. package/lib/commonjs/nativeMultipartUpload.js +237 -0
  72. package/lib/commonjs/nativeMultipartUpload.js.map +1 -0
  73. package/lib/commonjs/types/types.js.map +1 -1
  74. package/lib/commonjs/utils/installNativeMultipartAdapter.js +223 -0
  75. package/lib/commonjs/utils/installNativeMultipartAdapter.js.map +1 -0
  76. package/lib/commonjs/utils/utils.js +2 -2
  77. package/lib/commonjs/utils/utils.js.map +1 -1
  78. package/lib/commonjs/version.json +1 -1
  79. package/lib/module/components/Attachment/Attachment.js +38 -10
  80. package/lib/module/components/Attachment/Attachment.js.map +1 -1
  81. package/lib/module/components/Attachment/AttachmentFileUploadProgressIndicator.js +97 -0
  82. package/lib/module/components/Attachment/AttachmentFileUploadProgressIndicator.js.map +1 -0
  83. package/lib/module/components/Attachment/AttachmentUploadIndicator.js +97 -0
  84. package/lib/module/components/Attachment/AttachmentUploadIndicator.js.map +1 -0
  85. package/lib/module/components/Attachment/CircularProgressIndicator.js +141 -0
  86. package/lib/module/components/Attachment/CircularProgressIndicator.js.map +1 -0
  87. package/lib/module/components/Attachment/FileAttachment.js +18 -4
  88. package/lib/module/components/Attachment/FileAttachment.js.map +1 -1
  89. package/lib/module/components/Attachment/Gallery.js +7 -1
  90. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  91. package/lib/module/components/Attachment/MediaUploadProgressOverlay.js +59 -0
  92. package/lib/module/components/Attachment/MediaUploadProgressOverlay.js.map +1 -0
  93. package/lib/module/components/Attachment/VideoThumbnail.js +18 -8
  94. package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -1
  95. package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js +2 -0
  96. package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
  97. package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +6 -2
  98. package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
  99. package/lib/module/components/Channel/Channel.js +94 -92
  100. package/lib/module/components/Channel/Channel.js.map +1 -1
  101. package/lib/module/components/Chat/Chat.js +10 -1
  102. package/lib/module/components/Chat/Chat.js.map +1 -1
  103. package/lib/module/components/Indicators/EmptyStateIndicator.js +1 -1
  104. package/lib/module/components/Indicators/EmptyStateIndicator.js.map +1 -1
  105. package/lib/module/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.js +50 -57
  106. package/lib/module/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.js.map +1 -1
  107. package/lib/module/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.js +10 -6
  108. package/lib/module/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.js.map +1 -1
  109. package/lib/module/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.js +12 -6
  110. package/lib/module/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.js.map +1 -1
  111. package/lib/module/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js +13 -7
  112. package/lib/module/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js.map +1 -1
  113. package/lib/module/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.js +6 -2
  114. package/lib/module/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.js.map +1 -1
  115. package/lib/module/components/Poll/CreatePollContent.js +3 -3
  116. package/lib/module/components/Poll/CreatePollContent.js.map +1 -1
  117. package/lib/module/components/index.js +33 -0
  118. package/lib/module/components/index.js.map +1 -1
  119. package/lib/module/contexts/componentsContext/defaultComponents.js +6 -0
  120. package/lib/module/contexts/componentsContext/defaultComponents.js.map +1 -1
  121. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +3 -1
  122. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  123. package/lib/module/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.js +4 -1
  124. package/lib/module/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.js.map +1 -1
  125. package/lib/module/contexts/themeContext/utils/theme.js +5 -0
  126. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  127. package/lib/module/hooks/index.js +11 -0
  128. package/lib/module/hooks/index.js.map +1 -1
  129. package/lib/module/hooks/usePendingAttachmentUpload.js +106 -0
  130. package/lib/module/hooks/usePendingAttachmentUpload.js.map +1 -0
  131. package/lib/module/i18n/en.json +8 -0
  132. package/lib/module/i18n/es.json +8 -0
  133. package/lib/module/i18n/fr.json +8 -0
  134. package/lib/module/i18n/he.json +8 -0
  135. package/lib/module/i18n/hi.json +8 -0
  136. package/lib/module/i18n/it.json +8 -0
  137. package/lib/module/i18n/ja.json +8 -0
  138. package/lib/module/i18n/ko.json +8 -0
  139. package/lib/module/i18n/nl.json +8 -0
  140. package/lib/module/i18n/pt-br.json +8 -0
  141. package/lib/module/i18n/ru.json +8 -0
  142. package/lib/module/i18n/tr.json +8 -0
  143. package/lib/module/index.js +12 -0
  144. package/lib/module/index.js.map +1 -1
  145. package/lib/module/middlewares/attachments.js +2 -0
  146. package/lib/module/middlewares/attachments.js.map +1 -1
  147. package/lib/module/native.js +8 -1
  148. package/lib/module/native.js.map +1 -1
  149. package/lib/module/nativeMultipartUpload.js +237 -0
  150. package/lib/module/nativeMultipartUpload.js.map +1 -0
  151. package/lib/module/types/types.js.map +1 -1
  152. package/lib/module/utils/installNativeMultipartAdapter.js +223 -0
  153. package/lib/module/utils/installNativeMultipartAdapter.js.map +1 -0
  154. package/lib/module/utils/utils.js +2 -2
  155. package/lib/module/utils/utils.js.map +1 -1
  156. package/lib/module/version.json +1 -1
  157. package/lib/typescript/components/Attachment/Attachment.d.ts.map +1 -1
  158. package/lib/typescript/components/Attachment/AttachmentFileUploadProgressIndicator.d.ts +14 -0
  159. package/lib/typescript/components/Attachment/AttachmentFileUploadProgressIndicator.d.ts.map +1 -0
  160. package/lib/typescript/components/Attachment/AttachmentUploadIndicator.d.ts +18 -0
  161. package/lib/typescript/components/Attachment/AttachmentUploadIndicator.d.ts.map +1 -0
  162. package/lib/typescript/components/Attachment/CircularProgressIndicator.d.ts +18 -0
  163. package/lib/typescript/components/Attachment/CircularProgressIndicator.d.ts.map +1 -0
  164. package/lib/typescript/components/Attachment/FileAttachment.d.ts.map +1 -1
  165. package/lib/typescript/components/Attachment/Gallery.d.ts.map +1 -1
  166. package/lib/typescript/components/Attachment/MediaUploadProgressOverlay.d.ts +12 -0
  167. package/lib/typescript/components/Attachment/MediaUploadProgressOverlay.d.ts.map +1 -0
  168. package/lib/typescript/components/Attachment/VideoThumbnail.d.ts +4 -0
  169. package/lib/typescript/components/Attachment/VideoThumbnail.d.ts.map +1 -1
  170. package/lib/typescript/components/Attachment/utils/buildGallery/buildThumbnail.d.ts.map +1 -1
  171. package/lib/typescript/components/Attachment/utils/buildGallery/types.d.ts +2 -0
  172. package/lib/typescript/components/Attachment/utils/buildGallery/types.d.ts.map +1 -1
  173. package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.d.ts.map +1 -1
  174. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  175. package/lib/typescript/components/Chat/Chat.d.ts +10 -0
  176. package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
  177. package/lib/typescript/components/Indicators/EmptyStateIndicator.d.ts.map +1 -1
  178. package/lib/typescript/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.d.ts +7 -2
  179. package/lib/typescript/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.d.ts.map +1 -1
  180. package/lib/typescript/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.d.ts.map +1 -1
  181. package/lib/typescript/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.d.ts.map +1 -1
  182. package/lib/typescript/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.d.ts.map +1 -1
  183. package/lib/typescript/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.d.ts.map +1 -1
  184. package/lib/typescript/components/Poll/CreatePollContent.d.ts.map +1 -1
  185. package/lib/typescript/components/index.d.ts +3 -0
  186. package/lib/typescript/components/index.d.ts.map +1 -1
  187. package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts +5 -2
  188. package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts.map +1 -1
  189. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  190. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
  191. package/lib/typescript/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.d.ts.map +1 -1
  192. package/lib/typescript/contexts/themeContext/ThemeContext.d.ts +5 -0
  193. package/lib/typescript/contexts/themeContext/ThemeContext.d.ts.map +1 -1
  194. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +5 -0
  195. package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
  196. package/lib/typescript/hooks/index.d.ts +1 -0
  197. package/lib/typescript/hooks/index.d.ts.map +1 -1
  198. package/lib/typescript/hooks/usePendingAttachmentUpload.d.ts +14 -0
  199. package/lib/typescript/hooks/usePendingAttachmentUpload.d.ts.map +1 -0
  200. package/lib/typescript/i18n/en.json +8 -0
  201. package/lib/typescript/i18n/es.json +8 -0
  202. package/lib/typescript/i18n/fr.json +8 -0
  203. package/lib/typescript/i18n/he.json +8 -0
  204. package/lib/typescript/i18n/hi.json +8 -0
  205. package/lib/typescript/i18n/it.json +8 -0
  206. package/lib/typescript/i18n/ja.json +8 -0
  207. package/lib/typescript/i18n/ko.json +8 -0
  208. package/lib/typescript/i18n/nl.json +8 -0
  209. package/lib/typescript/i18n/pt-br.json +8 -0
  210. package/lib/typescript/i18n/ru.json +8 -0
  211. package/lib/typescript/i18n/tr.json +8 -0
  212. package/lib/typescript/index.d.ts +1 -0
  213. package/lib/typescript/index.d.ts.map +1 -1
  214. package/lib/typescript/middlewares/attachments.d.ts.map +1 -1
  215. package/lib/typescript/native.d.ts +5 -2
  216. package/lib/typescript/native.d.ts.map +1 -1
  217. package/lib/typescript/nativeMultipartUpload.d.ts +98 -0
  218. package/lib/typescript/nativeMultipartUpload.d.ts.map +1 -0
  219. package/lib/typescript/types/types.d.ts +2 -0
  220. package/lib/typescript/types/types.d.ts.map +1 -1
  221. package/lib/typescript/utils/i18n/Streami18n.d.ts +8 -0
  222. package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
  223. package/lib/typescript/utils/installNativeMultipartAdapter.d.ts +8 -0
  224. package/lib/typescript/utils/installNativeMultipartAdapter.d.ts.map +1 -0
  225. package/lib/typescript/utils/utils.d.ts +1 -1
  226. package/lib/typescript/utils/utils.d.ts.map +1 -1
  227. package/package.json +2 -2
  228. package/src/__tests__/nativeMultipartUpload.test.ts +267 -0
  229. package/src/components/Attachment/Attachment.tsx +54 -5
  230. package/src/components/Attachment/AttachmentFileUploadProgressIndicator.tsx +108 -0
  231. package/src/components/Attachment/AttachmentUploadIndicator.tsx +112 -0
  232. package/src/components/Attachment/CircularProgressIndicator.tsx +161 -0
  233. package/src/components/Attachment/FileAttachment.tsx +22 -6
  234. package/src/components/Attachment/Gallery.tsx +9 -1
  235. package/src/components/Attachment/MediaUploadProgressOverlay.tsx +77 -0
  236. package/src/components/Attachment/VideoThumbnail.tsx +17 -9
  237. package/src/components/Attachment/__tests__/Attachment.test.tsx +63 -16
  238. package/src/components/Attachment/utils/buildGallery/buildThumbnail.ts +3 -0
  239. package/src/components/Attachment/utils/buildGallery/types.ts +2 -0
  240. package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.tsx +4 -2
  241. package/src/components/Channel/Channel.tsx +65 -61
  242. package/src/components/Chat/Chat.tsx +20 -0
  243. package/src/components/Indicators/EmptyStateIndicator.tsx +3 -1
  244. package/src/components/MessageInput/__tests__/AttachmentUploadPreviewList.test.tsx +51 -6
  245. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreview.test.tsx +31 -1
  246. package/src/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.tsx +38 -47
  247. package/src/components/MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview.tsx +11 -5
  248. package/src/components/MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview.tsx +20 -5
  249. package/src/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.tsx +20 -9
  250. package/src/components/MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview.tsx +7 -1
  251. package/src/components/Poll/CreatePollContent.tsx +5 -3
  252. package/src/components/index.ts +3 -0
  253. package/src/contexts/componentsContext/defaultComponents.ts +6 -0
  254. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +3 -1
  255. package/src/contexts/messageInputContext/hooks/useMessageComposerHasSendableData.ts +5 -1
  256. package/src/contexts/themeContext/utils/theme.ts +10 -0
  257. package/src/hooks/__tests__/usePendingAttachmentUpload.test.tsx +106 -0
  258. package/src/hooks/index.ts +1 -0
  259. package/src/hooks/usePendingAttachmentUpload.ts +131 -0
  260. package/src/i18n/en.json +8 -0
  261. package/src/i18n/es.json +8 -0
  262. package/src/i18n/fr.json +8 -0
  263. package/src/i18n/he.json +8 -0
  264. package/src/i18n/hi.json +8 -0
  265. package/src/i18n/it.json +8 -0
  266. package/src/i18n/ja.json +8 -0
  267. package/src/i18n/ko.json +8 -0
  268. package/src/i18n/nl.json +8 -0
  269. package/src/i18n/pt-br.json +8 -0
  270. package/src/i18n/ru.json +8 -0
  271. package/src/i18n/tr.json +8 -0
  272. package/src/index.ts +1 -0
  273. package/src/middlewares/attachments.ts +2 -0
  274. package/src/native.ts +28 -0
  275. package/src/nativeMultipartUpload.ts +384 -0
  276. package/src/types/types.ts +2 -0
  277. package/src/utils/__tests__/installNativeMultipartAdapter.test.ts +437 -0
  278. package/src/utils/installNativeMultipartAdapter.ts +302 -0
  279. package/src/utils/utils.ts +3 -3
  280. package/src/version.json +1 -1
@@ -11,7 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
11
11
  var _reactNative = require("react-native");
12
12
  var _debounce = _interopRequireDefault(require("lodash/debounce"));
13
13
  var _throttle = _interopRequireDefault(require("lodash/throttle"));
14
- var _mimeTypes = require("mime-types");
15
14
  var _streamChat = require("stream-chat");
16
15
  var _useChannelDataState2 = require("./hooks/useChannelDataState");
17
16
  var _useCreateChannelContext = require("./hooks/useCreateChannelContext");
@@ -768,63 +767,66 @@ var ChannelWithContext = function ChannelWithContext(props) {
768
767
  var _ref15 = (0, _asyncToGenerator2.default)(function* (message) {
769
768
  var _updatedMessage$attac;
770
769
  var updatedMessage = Object.assign({}, message);
771
- if ((_updatedMessage$attac = updatedMessage.attachments) != null && _updatedMessage$attac.length) {
772
- for (var i = 0; i < ((_updatedMessage$attac2 = updatedMessage.attachments) == null ? void 0 : _updatedMessage$attac2.length); i++) {
773
- var _updatedMessage$attac2;
774
- var attachment = updatedMessage.attachments[i];
770
+ if (!((_updatedMessage$attac = updatedMessage.attachments) != null && _updatedMessage$attac.length) || !(channel != null && channel.cid)) {
771
+ return updatedMessage;
772
+ }
773
+ var uploadOne = function () {
774
+ var _ref16 = (0, _asyncToGenerator2.default)(function* (attachment) {
775
+ var _client$offlineDb;
775
776
  if (attachment.image_url && !(0, _utils.isLocalUrl)(attachment.image_url) || attachment.asset_url && !(0, _utils.isLocalUrl)(attachment.asset_url)) {
776
- continue;
777
+ return;
777
778
  }
778
- var image = attachment.originalFile;
779
- var file = attachment.originalFile;
780
- if (attachment.type === _types.FileTypes.Image && image != null && image.uri) {
781
- var _image$name, _client$offlineDb;
782
- var filename = (_image$name = image.name) != null ? _image$name : (0, _utils.getFileNameFromPath)(image.uri);
783
- var controller = uploadAbortControllerRef.current.get(filename);
784
- if (controller) {
785
- controller.abort();
786
- uploadAbortControllerRef.current.delete(filename);
787
- }
788
- var compressedUri = yield (0, _compressImage.compressedImageURI)(image, compressImageQuality);
789
- var contentType = (0, _mimeTypes.lookup)(filename) || 'multipart/form-data';
790
- var uploadResponse = doFileUploadRequest ? yield doFileUploadRequest(image) : yield channel.sendImage(compressedUri, filename, contentType);
791
- attachment.image_url = uploadResponse.file;
792
- delete attachment.originalFile;
793
- (_client$offlineDb = client.offlineDb) == null || _client$offlineDb.executeQuerySafely(function (db) {
794
- return db.updateMessage({
795
- message: Object.assign({}, updatedMessage, {
796
- cid: channel.cid
797
- })
798
- });
799
- }, {
800
- method: 'updateMessage'
779
+ var originalFile = attachment.originalFile;
780
+ if (!(originalFile != null && originalFile.uri)) {
781
+ return;
782
+ }
783
+ var localId = attachment.localId;
784
+ if (!localId) {
785
+ console.warn('uploadPendingAttachments: local attachment missing localId, skipping upload');
786
+ return;
787
+ }
788
+ var fileForUpload = originalFile;
789
+ if (attachment.type === _types.FileTypes.Image && !doFileUploadRequest) {
790
+ var _originalFile$name;
791
+ var filename = (_originalFile$name = originalFile.name) != null ? _originalFile$name : (0, _utils.getFileNameFromPath)(originalFile.uri);
792
+ var compressedUri = yield (0, _compressImage.compressedImageURI)(originalFile, compressImageQuality);
793
+ fileForUpload = Object.assign({}, originalFile, {
794
+ name: filename,
795
+ uri: compressedUri
801
796
  });
802
797
  }
803
- if (attachment.type !== _types.FileTypes.Image && file != null && file.uri) {
804
- var _client$offlineDb2;
805
- var _controller = uploadAbortControllerRef.current.get(file.name);
806
- if (_controller) {
807
- _controller.abort();
808
- uploadAbortControllerRef.current.delete(file.name);
809
- }
810
- var response = doFileUploadRequest ? yield doFileUploadRequest(file) : yield channel.sendFile(file.uri, file.name, file.type);
798
+ var response = yield client.uploadManager.upload({
799
+ channelCid: channel.cid,
800
+ file: fileForUpload,
801
+ id: localId
802
+ });
803
+ if (attachment.type === _types.FileTypes.Image) {
804
+ attachment.image_url = response.file;
805
+ } else {
811
806
  attachment.asset_url = response.file;
812
807
  if (response.thumb_url) {
813
808
  attachment.thumb_url = response.thumb_url;
814
809
  }
815
- delete attachment.originalFile;
816
- (_client$offlineDb2 = client.offlineDb) == null || _client$offlineDb2.executeQuerySafely(function (db) {
817
- return db.updateMessage({
818
- message: Object.assign({}, updatedMessage, {
819
- cid: channel.cid
820
- })
821
- });
822
- }, {
823
- method: 'updateMessage'
824
- });
825
810
  }
826
- }
827
- }
811
+ delete attachment.originalFile;
812
+ delete attachment.localId;
813
+ (_client$offlineDb = client.offlineDb) == null || _client$offlineDb.executeQuerySafely(function (db) {
814
+ return db.updateMessage({
815
+ message: Object.assign({}, updatedMessage, {
816
+ cid: channel.cid
817
+ })
818
+ });
819
+ }, {
820
+ method: 'updateMessage'
821
+ });
822
+ });
823
+ return function uploadOne(_x4) {
824
+ return _ref16.apply(this, arguments);
825
+ };
826
+ }();
827
+ yield Promise.all(updatedMessage.attachments.map(function (att) {
828
+ return uploadOne(att);
829
+ }));
828
830
  return updatedMessage;
829
831
  });
830
832
  return function (_x3) {
@@ -832,15 +834,15 @@ var ChannelWithContext = function ChannelWithContext(props) {
832
834
  };
833
835
  }());
834
836
  var sendMessageRequest = (0, _hooks.useStableCallback)(function () {
835
- var _ref17 = (0, _asyncToGenerator2.default)(function* (_ref16) {
836
- var localMessage = _ref16.localMessage,
837
- message = _ref16.message,
838
- options = _ref16.options,
839
- retrying = _ref16.retrying;
837
+ var _ref18 = (0, _asyncToGenerator2.default)(function* (_ref17) {
838
+ var localMessage = _ref17.localMessage,
839
+ message = _ref17.message,
840
+ options = _ref17.options,
841
+ retrying = _ref17.retrying;
840
842
  var failedMessageUpdated = false;
841
843
  var handleFailedMessage = function handleFailedMessage() {
842
844
  if (!failedMessageUpdated) {
843
- var _client$offlineDb3;
845
+ var _client$offlineDb2;
844
846
  var updatedMessage = Object.assign({}, localMessage, {
845
847
  cid: channel.cid,
846
848
  status: _utils.MessageStatusTypes.FAILED
@@ -850,7 +852,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
850
852
  message: updatedMessage
851
853
  });
852
854
  optimisticallyUpdatedNewMessages.delete(localMessage.id);
853
- (_client$offlineDb3 = client.offlineDb) == null || _client$offlineDb3.executeQuerySafely(function (db) {
855
+ (_client$offlineDb2 = client.offlineDb) == null || _client$offlineDb2.executeQuerySafely(function (db) {
854
856
  return db.updateMessage({
855
857
  message: updatedMessage
856
858
  });
@@ -884,11 +886,11 @@ var ChannelWithContext = function ChannelWithContext(props) {
884
886
  messageResponse = yield channel.sendMessage(messageData, options);
885
887
  }
886
888
  if ((_messageResponse = messageResponse) != null && _messageResponse.message) {
887
- var _client$offlineDb4;
889
+ var _client$offlineDb3;
888
890
  var newMessageResponse = Object.assign({}, messageResponse.message, {
889
891
  status: _utils.MessageStatusTypes.RECEIVED
890
892
  });
891
- (_client$offlineDb4 = client.offlineDb) == null || _client$offlineDb4.executeQuerySafely(function (db) {
893
+ (_client$offlineDb3 = client.offlineDb) == null || _client$offlineDb3.executeQuerySafely(function (db) {
892
894
  return db.updateMessage({
893
895
  message: Object.assign({}, newMessageResponse, {
894
896
  cid: channel.cid
@@ -908,16 +910,16 @@ var ChannelWithContext = function ChannelWithContext(props) {
908
910
  yield handleFailedMessage();
909
911
  }
910
912
  });
911
- return function (_x4) {
912
- return _ref17.apply(this, arguments);
913
+ return function (_x5) {
914
+ return _ref18.apply(this, arguments);
913
915
  };
914
916
  }());
915
917
  var sendMessage = (0, _hooks.useStableCallback)(function () {
916
- var _ref19 = (0, _asyncToGenerator2.default)(function* (_ref18) {
917
- var _channel$state, _client$offlineDb5;
918
- var localMessage = _ref18.localMessage,
919
- message = _ref18.message,
920
- options = _ref18.options;
918
+ var _ref20 = (0, _asyncToGenerator2.default)(function* (_ref19) {
919
+ var _channel$state, _client$offlineDb4;
920
+ var localMessage = _ref19.localMessage,
921
+ message = _ref19.message,
922
+ options = _ref19.options;
921
923
  if (channel != null && (_channel$state = channel.state) != null && _channel$state.filterErrorMessages) {
922
924
  channel.state.filterErrorMessages();
923
925
  }
@@ -926,7 +928,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
926
928
  message: localMessage
927
929
  });
928
930
  optimisticallyUpdatedNewMessages.add(localMessage.id);
929
- (_client$offlineDb5 = client.offlineDb) == null || _client$offlineDb5.executeQuerySafely(function (db) {
931
+ (_client$offlineDb4 = client.offlineDb) == null || _client$offlineDb4.executeQuerySafely(function (db) {
930
932
  return db.upsertMessages({
931
933
  messages: [Object.assign({}, localMessage, {
932
934
  cid: channel.cid,
@@ -949,12 +951,12 @@ var ChannelWithContext = function ChannelWithContext(props) {
949
951
  options: options
950
952
  });
951
953
  });
952
- return function (_x5) {
953
- return _ref19.apply(this, arguments);
954
+ return function (_x6) {
955
+ return _ref20.apply(this, arguments);
954
956
  };
955
957
  }());
956
958
  var retrySendMessage = (0, _hooks.useStableCallback)(function () {
957
- var _ref20 = (0, _asyncToGenerator2.default)(function* (localMessage) {
959
+ var _ref21 = (0, _asyncToGenerator2.default)(function* (localMessage) {
958
960
  var statusPendingMessage = Object.assign({}, localMessage, {
959
961
  status: _utils.MessageStatusTypes.SENDING
960
962
  });
@@ -968,15 +970,15 @@ var ChannelWithContext = function ChannelWithContext(props) {
968
970
  retrying: true
969
971
  });
970
972
  });
971
- return function (_x6) {
972
- return _ref20.apply(this, arguments);
973
+ return function (_x7) {
974
+ return _ref21.apply(this, arguments);
973
975
  };
974
976
  }());
975
977
  var editMessage = (0, _hooks.useStableCallback)(function () {
976
- var _ref22 = (0, _asyncToGenerator2.default)(function* (_ref21) {
977
- var _client$offlineDb6;
978
- var localMessage = _ref21.localMessage,
979
- options = _ref21.options;
978
+ var _ref23 = (0, _asyncToGenerator2.default)(function* (_ref22) {
979
+ var _client$offlineDb5;
980
+ var localMessage = _ref22.localMessage,
981
+ options = _ref22.options;
980
982
  if (!channel) {
981
983
  throw new Error('Channel has not been initialized');
982
984
  }
@@ -992,7 +994,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
992
994
  });
993
995
  updateMessage(optimisticMessage);
994
996
  threadInstance == null || threadInstance.updateParentMessageOrReplyLocally(optimisticMessage);
995
- (_client$offlineDb6 = client.offlineDb) == null || _client$offlineDb6.executeQuerySafely(function (db) {
997
+ (_client$offlineDb5 = client.offlineDb) == null || _client$offlineDb5.executeQuerySafely(function (db) {
996
998
  return db.updateMessage({
997
999
  message: Object.assign({}, optimisticMessage, {
998
1000
  cid: cid
@@ -1003,10 +1005,10 @@ var ChannelWithContext = function ChannelWithContext(props) {
1003
1005
  });
1004
1006
  var response = doUpdateMessageRequest ? yield doUpdateMessageRequest(cid, localMessage, options) : yield client.updateMessage(localMessage, undefined, options);
1005
1007
  if (response != null && response.message) {
1006
- var _client$offlineDb7;
1008
+ var _client$offlineDb6;
1007
1009
  updateMessage(response.message);
1008
1010
  threadInstance == null || threadInstance.updateParentMessageOrReplyLocally(response.message);
1009
- (_client$offlineDb7 = client.offlineDb) == null || _client$offlineDb7.executeQuerySafely(function (db) {
1011
+ (_client$offlineDb6 = client.offlineDb) == null || _client$offlineDb6.executeQuerySafely(function (db) {
1010
1012
  return db.updateMessage({
1011
1013
  message: Object.assign({}, response.message, {
1012
1014
  cid: cid
@@ -1018,12 +1020,12 @@ var ChannelWithContext = function ChannelWithContext(props) {
1018
1020
  }
1019
1021
  return response;
1020
1022
  });
1021
- return function (_x7) {
1022
- return _ref22.apply(this, arguments);
1023
+ return function (_x8) {
1024
+ return _ref23.apply(this, arguments);
1023
1025
  };
1024
1026
  }());
1025
1027
  var removeMessage = (0, _hooks.useStableCallback)(function () {
1026
- var _ref23 = (0, _asyncToGenerator2.default)(function* (message) {
1028
+ var _ref24 = (0, _asyncToGenerator2.default)(function* (message) {
1027
1029
  if (channel) {
1028
1030
  channel.state.removeMessage(message);
1029
1031
  copyMessagesStateFromChannel(channel);
@@ -1037,12 +1039,12 @@ var ChannelWithContext = function ChannelWithContext(props) {
1037
1039
  });
1038
1040
  }
1039
1041
  });
1040
- return function (_x8) {
1041
- return _ref23.apply(this, arguments);
1042
+ return function (_x9) {
1043
+ return _ref24.apply(this, arguments);
1042
1044
  };
1043
1045
  }());
1044
1046
  var sendReaction = (0, _hooks.useStableCallback)(function () {
1045
- var _ref24 = (0, _asyncToGenerator2.default)(function* (type, messageId) {
1047
+ var _ref25 = (0, _asyncToGenerator2.default)(function* (type, messageId) {
1046
1048
  if (!(channel != null && channel.id) || !client.user) {
1047
1049
  throw new Error('Channel has not been initialized');
1048
1050
  }
@@ -1068,12 +1070,12 @@ var ChannelWithContext = function ChannelWithContext(props) {
1068
1070
  });
1069
1071
  }
1070
1072
  });
1071
- return function (_x9, _x10) {
1072
- return _ref24.apply(this, arguments);
1073
+ return function (_x10, _x11) {
1074
+ return _ref25.apply(this, arguments);
1073
1075
  };
1074
1076
  }());
1075
1077
  var deleteMessage = (0, _hooks.useStableCallback)(function () {
1076
- var _ref25 = (0, _asyncToGenerator2.default)(function* (message) {
1078
+ var _ref26 = (0, _asyncToGenerator2.default)(function* (message) {
1077
1079
  var optionsOrHardDelete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1078
1080
  var options = {};
1079
1081
  if (typeof optionsOrHardDelete === 'boolean') {
@@ -1110,12 +1112,12 @@ var ChannelWithContext = function ChannelWithContext(props) {
1110
1112
  updateMessage(Object.assign({}, data.message));
1111
1113
  }
1112
1114
  });
1113
- return function (_x11) {
1114
- return _ref25.apply(this, arguments);
1115
+ return function (_x12) {
1116
+ return _ref26.apply(this, arguments);
1115
1117
  };
1116
1118
  }());
1117
1119
  var deleteReaction = (0, _hooks.useStableCallback)(function () {
1118
- var _ref26 = (0, _asyncToGenerator2.default)(function* (type, messageId) {
1120
+ var _ref27 = (0, _asyncToGenerator2.default)(function* (type, messageId) {
1119
1121
  if (!(channel != null && channel.id) || !client.user) {
1120
1122
  throw new Error('Channel has not been initialized');
1121
1123
  }
@@ -1131,8 +1133,8 @@ var ChannelWithContext = function ChannelWithContext(props) {
1131
1133
  }
1132
1134
  yield channel.deleteReaction.apply(channel, payload);
1133
1135
  });
1134
- return function (_x12, _x13) {
1135
- return _ref26.apply(this, arguments);
1136
+ return function (_x13, _x14) {
1137
+ return _ref27.apply(this, arguments);
1136
1138
  };
1137
1139
  }());
1138
1140
  var openThread = (0, _react.useCallback)(function (message) {