stream-chat-react-native-core 4.6.0 → 4.7.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 (206) hide show
  1. package/lib/commonjs/components/Attachment/Attachment.js +22 -13
  2. package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
  3. package/lib/commonjs/components/Attachment/Gallery.js +72 -37
  4. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/VideoThumbnail.js +83 -0
  6. package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -0
  7. package/lib/commonjs/components/Attachment/hooks/useGoToURL.js +1 -1
  8. package/lib/commonjs/components/Attachment/hooks/useGoToURL.js.map +1 -1
  9. package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js +1 -0
  10. package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
  11. package/lib/commonjs/components/Attachment/utils/getAspectRatio.js +5 -5
  12. package/lib/commonjs/components/Attachment/utils/getAspectRatio.js.map +1 -1
  13. package/lib/commonjs/components/Channel/Channel.js +19 -14
  14. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  15. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -2
  16. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  17. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +43 -28
  18. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
  19. package/lib/commonjs/components/ImageGallery/ImageGallery.js +167 -345
  20. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  21. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +4 -4
  22. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  23. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +225 -0
  24. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -0
  25. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +102 -40
  26. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  27. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +145 -0
  28. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -0
  29. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +31 -34
  30. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
  31. package/lib/commonjs/components/ImageGallery/components/ProgressControl.js +153 -0
  32. package/lib/commonjs/components/ImageGallery/components/ProgressControl.js.map +1 -0
  33. package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js +373 -0
  34. package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -0
  35. package/lib/commonjs/components/Message/Message.js +23 -13
  36. package/lib/commonjs/components/Message/Message.js.map +1 -1
  37. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +58 -33
  38. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
  39. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +4 -2
  40. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  41. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +25 -23
  42. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
  43. package/lib/commonjs/components/Reply/Reply.js +32 -12
  44. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  45. package/lib/commonjs/components/Spinner/Spinner.js +12 -4
  46. package/lib/commonjs/components/Spinner/Spinner.js.map +1 -1
  47. package/lib/commonjs/components/index.js +26 -0
  48. package/lib/commonjs/components/index.js.map +1 -1
  49. package/lib/commonjs/contexts/messageContext/MessageContext.js +2 -2
  50. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  51. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
  52. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  53. package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
  54. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  55. package/lib/commonjs/contexts/themeContext/utils/theme.js +10 -1
  56. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  57. package/lib/commonjs/icons/Pause.js +61 -0
  58. package/lib/commonjs/icons/Pause.js.map +1 -0
  59. package/lib/commonjs/icons/Play.js +42 -0
  60. package/lib/commonjs/icons/Play.js.map +1 -0
  61. package/lib/commonjs/icons/index.js +26 -0
  62. package/lib/commonjs/icons/index.js.map +1 -1
  63. package/lib/commonjs/mock-builders/api/queryMembers.js +98 -1
  64. package/lib/commonjs/mock-builders/api/queryMembers.js.map +1 -1
  65. package/lib/commonjs/native.js +7 -1
  66. package/lib/commonjs/native.js.map +1 -1
  67. package/lib/commonjs/utils/getUrlOfImageAttachment.js +1 -1
  68. package/lib/commonjs/utils/getUrlOfImageAttachment.js.map +1 -1
  69. package/lib/commonjs/version.json +1 -1
  70. package/lib/module/components/Attachment/Attachment.js +22 -13
  71. package/lib/module/components/Attachment/Attachment.js.map +1 -1
  72. package/lib/module/components/Attachment/Gallery.js +72 -37
  73. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  74. package/lib/module/components/Attachment/VideoThumbnail.js +83 -0
  75. package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -0
  76. package/lib/module/components/Attachment/hooks/useGoToURL.js +1 -1
  77. package/lib/module/components/Attachment/hooks/useGoToURL.js.map +1 -1
  78. package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js +1 -0
  79. package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
  80. package/lib/module/components/Attachment/utils/getAspectRatio.js +5 -5
  81. package/lib/module/components/Attachment/utils/getAspectRatio.js.map +1 -1
  82. package/lib/module/components/Channel/Channel.js +19 -14
  83. package/lib/module/components/Channel/Channel.js.map +1 -1
  84. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -2
  85. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  86. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +43 -28
  87. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
  88. package/lib/module/components/ImageGallery/ImageGallery.js +167 -345
  89. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  90. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +4 -4
  91. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  92. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +225 -0
  93. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -0
  94. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +102 -40
  95. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  96. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +145 -0
  97. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -0
  98. package/lib/module/components/ImageGallery/components/ImageGrid.js +31 -34
  99. package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
  100. package/lib/module/components/ImageGallery/components/ProgressControl.js +153 -0
  101. package/lib/module/components/ImageGallery/components/ProgressControl.js.map +1 -0
  102. package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js +373 -0
  103. package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -0
  104. package/lib/module/components/Message/Message.js +23 -13
  105. package/lib/module/components/Message/Message.js.map +1 -1
  106. package/lib/module/components/Message/MessageSimple/MessageContent.js +58 -33
  107. package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
  108. package/lib/module/components/Message/hooks/useCreateMessageContext.js +4 -2
  109. package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  110. package/lib/module/components/MessageOverlay/MessageOverlay.js +25 -23
  111. package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
  112. package/lib/module/components/Reply/Reply.js +32 -12
  113. package/lib/module/components/Reply/Reply.js.map +1 -1
  114. package/lib/module/components/Spinner/Spinner.js +12 -4
  115. package/lib/module/components/Spinner/Spinner.js.map +1 -1
  116. package/lib/module/components/index.js +26 -0
  117. package/lib/module/components/index.js.map +1 -1
  118. package/lib/module/contexts/messageContext/MessageContext.js +2 -2
  119. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  120. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
  121. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  122. package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
  123. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  124. package/lib/module/contexts/themeContext/utils/theme.js +10 -1
  125. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  126. package/lib/module/icons/Pause.js +61 -0
  127. package/lib/module/icons/Pause.js.map +1 -0
  128. package/lib/module/icons/Play.js +42 -0
  129. package/lib/module/icons/Play.js.map +1 -0
  130. package/lib/module/icons/index.js +26 -0
  131. package/lib/module/icons/index.js.map +1 -1
  132. package/lib/module/mock-builders/api/queryMembers.js +98 -1
  133. package/lib/module/mock-builders/api/queryMembers.js.map +1 -1
  134. package/lib/module/native.js +7 -1
  135. package/lib/module/native.js.map +1 -1
  136. package/lib/module/utils/getUrlOfImageAttachment.js +1 -1
  137. package/lib/module/utils/getUrlOfImageAttachment.js.map +1 -1
  138. package/lib/module/version.json +1 -1
  139. package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
  140. package/lib/typescript/components/Attachment/VideoThumbnail.d.ts +4 -0
  141. package/lib/typescript/components/Attachment/utils/buildGallery/types.d.ts +1 -0
  142. package/lib/typescript/components/Attachment/utils/getAspectRatio.d.ts +1 -1
  143. package/lib/typescript/components/Channel/Channel.d.ts +1 -1
  144. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
  145. package/lib/typescript/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.d.ts +1 -0
  146. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewDisplayName.d.ts +4 -4
  147. package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +2 -0
  148. package/lib/typescript/components/ImageGallery/components/AnimatedGalleryVideo.d.ts +27 -0
  149. package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +18 -2
  150. package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts +3 -0
  151. package/lib/typescript/components/ImageGallery/components/ProgressControl.d.ts +5 -0
  152. package/lib/typescript/components/ImageGallery/hooks/useImageGalleryGestures.d.ts +36 -0
  153. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
  154. package/lib/typescript/components/Spinner/Spinner.d.ts +7 -1
  155. package/lib/typescript/components/index.d.ts +2 -0
  156. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +3 -1
  157. package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +1 -0
  158. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +2 -0
  159. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +9 -0
  160. package/lib/typescript/icons/Pause.d.ts +3 -0
  161. package/lib/typescript/icons/Play.d.ts +3 -0
  162. package/lib/typescript/icons/index.d.ts +2 -0
  163. package/lib/typescript/mock-builders/api/queryMembers.d.ts +161 -0
  164. package/lib/typescript/mock-builders/api/utils.d.ts +7 -0
  165. package/lib/typescript/mock-builders/generator/user.d.ts +30 -0
  166. package/lib/typescript/mock-builders/mock.d.ts +3 -0
  167. package/lib/typescript/native.d.ts +66 -1
  168. package/package.json +1 -1
  169. package/src/components/Attachment/Attachment.tsx +11 -7
  170. package/src/components/Attachment/Gallery.tsx +75 -36
  171. package/src/components/Attachment/VideoThumbnail.tsx +45 -0
  172. package/src/components/Attachment/hooks/useGoToURL.ts +1 -1
  173. package/src/components/Attachment/utils/buildGallery/buildThumbnail.ts +1 -0
  174. package/src/components/Attachment/utils/buildGallery/types.ts +1 -0
  175. package/src/components/Attachment/utils/getAspectRatio.ts +7 -5
  176. package/src/components/Channel/Channel.tsx +4 -0
  177. package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
  178. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.tsx +83 -0
  179. package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.ts +43 -26
  180. package/src/components/ImageGallery/ImageGallery.tsx +145 -667
  181. package/src/components/ImageGallery/components/AnimatedGalleryImage.tsx +4 -4
  182. package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +224 -0
  183. package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +114 -19
  184. package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +103 -0
  185. package/src/components/ImageGallery/components/ImageGrid.tsx +12 -25
  186. package/src/components/ImageGallery/components/ProgressControl.tsx +107 -0
  187. package/src/components/ImageGallery/hooks/useImageGalleryGestures.tsx +722 -0
  188. package/src/components/Message/Message.tsx +10 -3
  189. package/src/components/Message/MessageSimple/MessageContent.tsx +50 -16
  190. package/src/components/Message/hooks/useCreateMessageContext.ts +2 -0
  191. package/src/components/MessageOverlay/MessageOverlay.tsx +2 -0
  192. package/src/components/Reply/Reply.tsx +36 -23
  193. package/src/components/Spinner/Spinner.tsx +11 -4
  194. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +0 -12
  195. package/src/components/index.ts +2 -0
  196. package/src/contexts/messageContext/MessageContext.tsx +2 -0
  197. package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +1 -0
  198. package/src/contexts/messagesContext/MessagesContext.tsx +2 -0
  199. package/src/contexts/themeContext/utils/theme.ts +18 -0
  200. package/src/icons/Pause.tsx +14 -0
  201. package/src/icons/Play.tsx +17 -0
  202. package/src/icons/index.ts +2 -0
  203. package/src/mock-builders/api/queryMembers.js +98 -0
  204. package/src/native.ts +59 -1
  205. package/src/utils/getUrlOfImageAttachment.ts +1 -1
  206. package/src/version.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["useGoToURL.ts"],"names":["useGoToURL","url","error","setError","finalUrl","pattern","RegExp","test","openURL","Linking","canOpenURL","then","supported","console","log"],"mappings":";;;;;;;;;AAAA;;AACA;;AAIO,IAAMA,UAA0B,GAAG,SAA7BA,UAA6B,CAACC,GAAD,EAAkB;AAC1D,kBAA0B,qBAAkB,KAAlB,CAA1B;AAAA;AAAA,MAAOC,KAAP;AAAA,MAAcC,QAAd;;AAEA,MAAIC,QAAQ,GAAGH,GAAf;AACA,MAAMI,OAAO,GAAG,IAAIC,MAAJ,CAAW,WAAX,CAAhB;;AAEA,MAAI,CAACD,OAAO,CAACE,IAAR,CAAaH,QAAb,CAAL,EAA6B;AAC3BA,IAAAA,QAAQ,GAAG,YAAYH,GAAvB;AACD;;AAED,MAAMO,OAAO,GAAG,SAAVA,OAAU;AAAA,WACdC,qBAAQC,UAAR,CAAmBN,QAAnB,EAA6BO,IAA7B,CAAkC,UAACC,SAAD,EAAe;AAC/C,UAAIA,SAAJ,EAAe;AACbH,6BAAQD,OAAR,CAAgBJ,QAAhB;AACD,OAFD,MAEO;AACLD,QAAAA,QAAQ,CAAC,IAAD,CAAR;AACAU,QAAAA,OAAO,CAACC,GAAR,kCAA2CV,QAA3C;AACD;AACF,KAPD,CADc;AAAA,GAAhB;;AAUA,SAAO,CAACF,KAAD,EAAQM,OAAR,CAAP;AACD,CArBM","sourcesContent":["import { useState } from 'react';\nimport { Linking } from 'react-native';\n\nexport type UseGoToURLType = (url?: string) => [boolean, () => Promise<void>];\n\nexport const useGoToURL: UseGoToURLType = (url?: string) => {\n const [error, setError] = useState<boolean>(false);\n\n let finalUrl = url as string;\n const pattern = new RegExp(/^\\S+:\\/\\//);\n\n if (!pattern.test(finalUrl)) {\n finalUrl = 'http://' + url;\n }\n\n const openURL = () =>\n Linking.canOpenURL(finalUrl).then((supported) => {\n if (supported) {\n Linking.openURL(finalUrl);\n } else {\n setError(true);\n console.log(`Don't know how to open URI: ${finalUrl}`);\n }\n });\n\n return [error, openURL];\n};\n"]}
1
+ {"version":3,"sources":["useGoToURL.ts"],"names":["useGoToURL","url","error","setError","finalUrl","pattern","RegExp","test","openURL","Linking","canOpenURL","then","supported","console","warn"],"mappings":";;;;;;;;;AAAA;;AACA;;AAIO,IAAMA,UAA0B,GAAG,SAA7BA,UAA6B,CAACC,GAAD,EAAkB;AAC1D,kBAA0B,qBAAkB,KAAlB,CAA1B;AAAA;AAAA,MAAOC,KAAP;AAAA,MAAcC,QAAd;;AAEA,MAAIC,QAAQ,GAAGH,GAAf;AACA,MAAMI,OAAO,GAAG,IAAIC,MAAJ,CAAW,WAAX,CAAhB;;AAEA,MAAI,CAACD,OAAO,CAACE,IAAR,CAAaH,QAAb,CAAL,EAA6B;AAC3BA,IAAAA,QAAQ,GAAG,YAAYH,GAAvB;AACD;;AAED,MAAMO,OAAO,GAAG,SAAVA,OAAU;AAAA,WACdC,qBAAQC,UAAR,CAAmBN,QAAnB,EAA6BO,IAA7B,CAAkC,UAACC,SAAD,EAAe;AAC/C,UAAIA,SAAJ,EAAe;AACbH,6BAAQD,OAAR,CAAgBJ,QAAhB;AACD,OAFD,MAEO;AACLD,QAAAA,QAAQ,CAAC,IAAD,CAAR;AACAU,QAAAA,OAAO,CAACC,IAAR,kCAA4CV,QAA5C;AACD;AACF,KAPD,CADc;AAAA,GAAhB;;AAUA,SAAO,CAACF,KAAD,EAAQM,OAAR,CAAP;AACD,CArBM","sourcesContent":["import { useState } from 'react';\nimport { Linking } from 'react-native';\n\nexport type UseGoToURLType = (url?: string) => [boolean, () => Promise<void>];\n\nexport const useGoToURL: UseGoToURLType = (url?: string) => {\n const [error, setError] = useState<boolean>(false);\n\n let finalUrl = url as string;\n const pattern = new RegExp(/^\\S+:\\/\\//);\n\n if (!pattern.test(finalUrl)) {\n finalUrl = 'http://' + url;\n }\n\n const openURL = () =>\n Linking.canOpenURL(finalUrl).then((supported) => {\n if (supported) {\n Linking.openURL(finalUrl);\n } else {\n setError(true);\n console.warn(`Don't know how to open URI: ${finalUrl}`);\n }\n });\n\n return [error, openURL];\n};\n"]}
@@ -19,6 +19,7 @@ function buildThumbnail(_ref) {
19
19
  return {
20
20
  height: height,
21
21
  resizeMode: resizeMode ? resizeMode : image.original_height && image.original_width ? 'contain' : 'cover',
22
+ type: image.type,
22
23
  url: shouldResize ? (0, _getResizedImageUrl.getResizedImageUrl)({
23
24
  height: height,
24
25
  url: imageUrl,
@@ -1 +1 @@
1
- {"version":3,"sources":["buildThumbnail.ts"],"names":["buildThumbnail","height","image","resizeMode","width","originalImageHeight","original_height","originalImageWidth","original_width","shouldResize","imageUrl","url"],"mappings":";;;;;AAQA;;AACA;;AAEO,SAASA,cAAT,OAYO;AAAA,MATZC,MASY,QATZA,MASY;AAAA,MARZC,KAQY,QARZA,KAQY;AAAA,MAPZC,UAOY,QAPZA,UAOY;AAAA,MANZC,KAMY,QANZA,KAMY;AACZ,MAAyBC,mBAAzB,GAAqFH,KAArF,CAAQI,eAAR;AAAA,MAA8DC,kBAA9D,GAAqFL,KAArF,CAA8CM,cAA9C;AAGA,MAAMC,YAAY,GAChBJ,mBAAmB,IAAIE,kBAAvB,GACIF,mBAAmB,GAAGE,kBAAtB,GAA2CN,MAAM,GAAGG,KADxD,GAEI,IAHN;AAIA,MAAMM,QAAQ,GAAG,sDAAwBR,KAAxB,CAAjB;AAEA,SAAO;AACLD,IAAAA,MAAM,EAANA,MADK;AAELE,IAAAA,UAAU,EAAEA,UAAU,GAClBA,UADkB,GAEhBD,KAAK,CAACI,eAAN,IAAyBJ,KAAK,CAACM,cAA/B,GAAgD,SAAhD,GAA4D,OAJ7D;AAKLG,IAAAA,GAAG,EAAEF,YAAY,GACb,4CAAmB;AACjBR,MAAAA,MAAM,EAANA,MADiB;AAEjBU,MAAAA,GAAG,EAAED,QAFY;AAGjBN,MAAAA,KAAK,EAALA;AAHiB,KAAnB,CADa,GAMbM,QAXC;AAYLN,IAAAA,KAAK,EAALA;AAZK,GAAP;AAcD","sourcesContent":["import type { ImageResizeMode } from 'react-native';\n\nimport type { Attachment } from 'stream-chat';\n\nimport type { Thumbnail } from './types';\n\nimport type { DefaultStreamChatGenerics } from '../../../../types/types';\n\nimport { getResizedImageUrl } from '../../../../utils/getResizedImageUrl';\nimport { getUrlOfImageAttachment } from '../../../../utils/getUrlOfImageAttachment';\n\nexport function buildThumbnail<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n height,\n image,\n resizeMode,\n width,\n}: {\n height: number;\n image: Attachment<StreamChatGenerics>;\n width: number;\n resizeMode?: ImageResizeMode;\n}): Thumbnail {\n const { original_height: originalImageHeight, original_width: originalImageWidth } = image;\n\n // Only resize if the original image is larger than the thumbnail container size.\n const shouldResize =\n originalImageHeight && originalImageWidth\n ? originalImageHeight + originalImageWidth > height + width\n : true;\n const imageUrl = getUrlOfImageAttachment(image) as string;\n\n return {\n height,\n resizeMode: resizeMode\n ? resizeMode\n : ((image.original_height && image.original_width ? 'contain' : 'cover') as ImageResizeMode),\n url: shouldResize\n ? getResizedImageUrl({\n height,\n url: imageUrl,\n width,\n })\n : imageUrl,\n width,\n };\n}\n"]}
1
+ {"version":3,"sources":["buildThumbnail.ts"],"names":["buildThumbnail","height","image","resizeMode","width","originalImageHeight","original_height","originalImageWidth","original_width","shouldResize","imageUrl","type","url"],"mappings":";;;;;AAQA;;AACA;;AAEO,SAASA,cAAT,OAYO;AAAA,MATZC,MASY,QATZA,MASY;AAAA,MARZC,KAQY,QARZA,KAQY;AAAA,MAPZC,UAOY,QAPZA,UAOY;AAAA,MANZC,KAMY,QANZA,KAMY;AACZ,MAAyBC,mBAAzB,GAAqFH,KAArF,CAAQI,eAAR;AAAA,MAA8DC,kBAA9D,GAAqFL,KAArF,CAA8CM,cAA9C;AAGA,MAAMC,YAAY,GAChBJ,mBAAmB,IAAIE,kBAAvB,GACIF,mBAAmB,GAAGE,kBAAtB,GAA2CN,MAAM,GAAGG,KADxD,GAEI,IAHN;AAIA,MAAMM,QAAQ,GAAG,sDAAwBR,KAAxB,CAAjB;AAEA,SAAO;AACLD,IAAAA,MAAM,EAANA,MADK;AAELE,IAAAA,UAAU,EAAEA,UAAU,GAClBA,UADkB,GAEhBD,KAAK,CAACI,eAAN,IAAyBJ,KAAK,CAACM,cAA/B,GAAgD,SAAhD,GAA4D,OAJ7D;AAKLG,IAAAA,IAAI,EAAET,KAAK,CAACS,IALP;AAMLC,IAAAA,GAAG,EAAEH,YAAY,GACb,4CAAmB;AACjBR,MAAAA,MAAM,EAANA,MADiB;AAEjBW,MAAAA,GAAG,EAAEF,QAFY;AAGjBN,MAAAA,KAAK,EAALA;AAHiB,KAAnB,CADa,GAMbM,QAZC;AAaLN,IAAAA,KAAK,EAALA;AAbK,GAAP;AAeD","sourcesContent":["import type { ImageResizeMode } from 'react-native';\n\nimport type { Attachment } from 'stream-chat';\n\nimport type { Thumbnail } from './types';\n\nimport type { DefaultStreamChatGenerics } from '../../../../types/types';\n\nimport { getResizedImageUrl } from '../../../../utils/getResizedImageUrl';\nimport { getUrlOfImageAttachment } from '../../../../utils/getUrlOfImageAttachment';\n\nexport function buildThumbnail<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n height,\n image,\n resizeMode,\n width,\n}: {\n height: number;\n image: Attachment<StreamChatGenerics>;\n width: number;\n resizeMode?: ImageResizeMode;\n}): Thumbnail {\n const { original_height: originalImageHeight, original_width: originalImageWidth } = image;\n\n // Only resize if the original image is larger than the thumbnail container size.\n const shouldResize =\n originalImageHeight && originalImageWidth\n ? originalImageHeight + originalImageWidth > height + width\n : true;\n const imageUrl = getUrlOfImageAttachment(image) as string;\n\n return {\n height,\n resizeMode: resizeMode\n ? resizeMode\n : ((image.original_height && image.original_width ? 'contain' : 'cover') as ImageResizeMode),\n type: image.type,\n url: shouldResize\n ? getResizedImageUrl({\n height,\n url: imageUrl,\n width,\n })\n : imageUrl,\n width,\n };\n}\n"]}
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", {
3
3
  });
4
4
  exports.getAspectRatio = getAspectRatio;
5
5
 
6
- function getAspectRatio(image) {
7
- if (image.type !== 'image') {
8
- throw new Error('getAspectRatio() can only be called on an image attachment');
6
+ function getAspectRatio(attachment) {
7
+ if (!(attachment.type === 'image' || attachment.type === 'video')) {
8
+ throw new Error('getAspectRatio() can only be called on an image attachment or video thumbnail');
9
9
  }
10
10
 
11
- if (!image.original_width || !image.original_height) return 1;
12
- return image.original_width / image.original_height;
11
+ if (!attachment.original_width || !attachment.original_height) return 1;
12
+ return attachment.original_width / attachment.original_height;
13
13
  }
14
14
  //# sourceMappingURL=getAspectRatio.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["getAspectRatio.ts"],"names":["getAspectRatio","image","type","Error","original_width","original_height"],"mappings":";;;;;AAUO,SAASA,cAAT,CAELC,KAFK,EAEkC;AACvC,MAAIA,KAAK,CAACC,IAAN,KAAe,OAAnB,EAA4B;AAC1B,UAAM,IAAIC,KAAJ,CAAU,4DAAV,CAAN;AACD;;AAED,MAAI,CAACF,KAAK,CAACG,cAAP,IAAyB,CAACH,KAAK,CAACI,eAApC,EAAqD,OAAO,CAAP;AAErD,SAAOJ,KAAK,CAACG,cAAN,GAAuBH,KAAK,CAACI,eAApC;AACD","sourcesContent":["import type { Attachment } from 'stream-chat';\n\nimport type { DefaultStreamChatGenerics } from '../../../types/types';\n\n/**\n * Returns the aspect ratio of an image attachment.\n *\n * @param image Image attachment.\n * @returns {number}\n */\nexport function getAspectRatio<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(image: Attachment<StreamChatGenerics>) {\n if (image.type !== 'image') {\n throw new Error('getAspectRatio() can only be called on an image attachment');\n }\n\n if (!image.original_width || !image.original_height) return 1;\n\n return image.original_width / image.original_height;\n}\n"]}
1
+ {"version":3,"sources":["getAspectRatio.ts"],"names":["getAspectRatio","attachment","type","Error","original_width","original_height"],"mappings":";;;;;AAUO,SAASA,cAAT,CAELC,UAFK,EAEuC;AAC5C,MAAI,EAAEA,UAAU,CAACC,IAAX,KAAoB,OAApB,IAA+BD,UAAU,CAACC,IAAX,KAAoB,OAArD,CAAJ,EAAmE;AACjE,UAAM,IAAIC,KAAJ,CACJ,+EADI,CAAN;AAGD;;AAED,MAAI,CAACF,UAAU,CAACG,cAAZ,IAA8B,CAACH,UAAU,CAACI,eAA9C,EAA+D,OAAO,CAAP;AAE/D,SAAOJ,UAAU,CAACG,cAAX,GAA4BH,UAAU,CAACI,eAA9C;AACD","sourcesContent":["import type { Attachment } from 'stream-chat';\n\nimport type { DefaultStreamChatGenerics } from '../../../types/types';\n\n/**\n * Returns the aspect ratio of an image attachment.\n *\n * @param image Image attachment.\n * @returns {number}\n */\nexport function getAspectRatio<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(attachment: Attachment<StreamChatGenerics>) {\n if (!(attachment.type === 'image' || attachment.type === 'video')) {\n throw new Error(\n 'getAspectRatio() can only be called on an image attachment or video thumbnail',\n );\n }\n\n if (!attachment.original_width || !attachment.original_height) return 1;\n\n return attachment.original_width / attachment.original_height;\n}\n"]}
@@ -93,6 +93,8 @@ var _Gallery = require("../Attachment/Gallery");
93
93
 
94
94
  var _Giphy = require("../Attachment/Giphy");
95
95
 
96
+ var _VideoThumbnail = require("../Attachment/VideoThumbnail");
97
+
96
98
  var _AutoCompleteSuggestionHeader = require("../AutoCompleteInput/AutoCompleteSuggestionHeader");
97
99
 
98
100
  var _AutoCompleteSuggestionItem = require("../AutoCompleteInput/AutoCompleteSuggestionItem");
@@ -455,6 +457,8 @@ var ChannelWithContext = function ChannelWithContext(props) {
455
457
  UploadProgressIndicator = _props$UploadProgress === void 0 ? _UploadProgressIndicator.UploadProgressIndicator : _props$UploadProgress,
456
458
  _props$UrlPreview = props.UrlPreview,
457
459
  UrlPreview = _props$UrlPreview === void 0 ? _Card.Card : _props$UrlPreview,
460
+ _props$VideoThumbnail = props.VideoThumbnail,
461
+ VideoThumbnail = _props$VideoThumbnail === void 0 ? _VideoThumbnail.VideoThumbnail : _props$VideoThumbnail,
458
462
  watcherCount = props.watcherCount,
459
463
  watchers = props.watchers;
460
464
 
@@ -2014,7 +2018,8 @@ var ChannelWithContext = function ChannelWithContext(props) {
2014
2018
  TypingIndicator: TypingIndicator,
2015
2019
  TypingIndicatorContainer: TypingIndicatorContainer,
2016
2020
  updateMessage: updateMessage,
2017
- UrlPreview: UrlPreview
2021
+ UrlPreview: UrlPreview,
2022
+ VideoThumbnail: VideoThumbnail
2018
2023
  });
2019
2024
  var suggestionsContext = {
2020
2025
  AutoCompleteSuggestionHeader: AutoCompleteSuggestionHeader,
@@ -2046,7 +2051,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2046
2051
  __self: _this,
2047
2052
  __source: {
2048
2053
  fileName: _jsxFileName,
2049
- lineNumber: 1770,
2054
+ lineNumber: 1774,
2050
2055
  columnNumber: 12
2051
2056
  }
2052
2057
  });
@@ -2061,7 +2066,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2061
2066
  __self: _this,
2062
2067
  __source: {
2063
2068
  fileName: _jsxFileName,
2064
- lineNumber: 1775,
2069
+ lineNumber: 1779,
2065
2070
  columnNumber: 7
2066
2071
  }
2067
2072
  }, t('Please select a channel first'));
@@ -2075,7 +2080,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2075
2080
  __self: _this,
2076
2081
  __source: {
2077
2082
  fileName: _jsxFileName,
2078
- lineNumber: 1782,
2083
+ lineNumber: 1786,
2079
2084
  columnNumber: 5
2080
2085
  }
2081
2086
  }), _react["default"].createElement(_ChannelContext.ChannelProvider, {
@@ -2083,7 +2088,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2083
2088
  __self: _this,
2084
2089
  __source: {
2085
2090
  fileName: _jsxFileName,
2086
- lineNumber: 1788,
2091
+ lineNumber: 1792,
2087
2092
  columnNumber: 7
2088
2093
  }
2089
2094
  }, _react["default"].createElement(_OwnCapabilitiesContext.OwnCapabilitiesProvider, {
@@ -2091,7 +2096,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2091
2096
  __self: _this,
2092
2097
  __source: {
2093
2098
  fileName: _jsxFileName,
2094
- lineNumber: 1789,
2099
+ lineNumber: 1793,
2095
2100
  columnNumber: 9
2096
2101
  }
2097
2102
  }, _react["default"].createElement(_TypingContext.TypingProvider, {
@@ -2099,7 +2104,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2099
2104
  __self: _this,
2100
2105
  __source: {
2101
2106
  fileName: _jsxFileName,
2102
- lineNumber: 1790,
2107
+ lineNumber: 1794,
2103
2108
  columnNumber: 11
2104
2109
  }
2105
2110
  }, _react["default"].createElement(_PaginatedMessageListContext.PaginatedMessageListProvider, {
@@ -2107,7 +2112,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2107
2112
  __self: _this,
2108
2113
  __source: {
2109
2114
  fileName: _jsxFileName,
2110
- lineNumber: 1791,
2115
+ lineNumber: 1795,
2111
2116
  columnNumber: 13
2112
2117
  }
2113
2118
  }, _react["default"].createElement(_MessagesContext.MessagesProvider, {
@@ -2115,7 +2120,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2115
2120
  __self: _this,
2116
2121
  __source: {
2117
2122
  fileName: _jsxFileName,
2118
- lineNumber: 1792,
2123
+ lineNumber: 1796,
2119
2124
  columnNumber: 15
2120
2125
  }
2121
2126
  }, _react["default"].createElement(_ThreadContext.ThreadProvider, {
@@ -2123,7 +2128,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2123
2128
  __self: _this,
2124
2129
  __source: {
2125
2130
  fileName: _jsxFileName,
2126
- lineNumber: 1793,
2131
+ lineNumber: 1797,
2127
2132
  columnNumber: 17
2128
2133
  }
2129
2134
  }, _react["default"].createElement(_SuggestionsContext.SuggestionsProvider, {
@@ -2131,7 +2136,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2131
2136
  __self: _this,
2132
2137
  __source: {
2133
2138
  fileName: _jsxFileName,
2134
- lineNumber: 1794,
2139
+ lineNumber: 1798,
2135
2140
  columnNumber: 19
2136
2141
  }
2137
2142
  }, _react["default"].createElement(_MessageInputContext.MessageInputProvider, {
@@ -2139,7 +2144,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2139
2144
  __self: _this,
2140
2145
  __source: {
2141
2146
  fileName: _jsxFileName,
2142
- lineNumber: 1795,
2147
+ lineNumber: 1799,
2143
2148
  columnNumber: 21
2144
2149
  }
2145
2150
  }, _react["default"].createElement(_reactNative.View, {
@@ -2149,7 +2154,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2149
2154
  __self: _this,
2150
2155
  __source: {
2151
2156
  fileName: _jsxFileName,
2152
- lineNumber: 1796,
2157
+ lineNumber: 1800,
2153
2158
  columnNumber: 23
2154
2159
  }
2155
2160
  }, children))))))))));
@@ -2204,7 +2209,7 @@ var Channel = function Channel(props) {
2204
2209
  __self: _this,
2205
2210
  __source: {
2206
2211
  fileName: _jsxFileName,
2207
- lineNumber: 1853,
2212
+ lineNumber: 1857,
2208
2213
  columnNumber: 5
2209
2214
  }
2210
2215
  }));