stream-chat-react-native-core 5.27.0-beta.1 → 5.27.0-beta.3

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 (63) hide show
  1. package/lib/commonjs/components/Chat/Chat.js +25 -16
  2. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  3. package/lib/commonjs/components/Chat/hooks/useAppSettings.js +18 -12
  4. package/lib/commonjs/components/Chat/hooks/useAppSettings.js.map +1 -1
  5. package/lib/commonjs/i18n/es.json +29 -29
  6. package/lib/commonjs/i18n/fr.json +29 -29
  7. package/lib/commonjs/i18n/he.json +29 -29
  8. package/lib/commonjs/i18n/hi.json +30 -30
  9. package/lib/commonjs/i18n/it.json +30 -30
  10. package/lib/commonjs/i18n/ja.json +30 -30
  11. package/lib/commonjs/i18n/ko.json +30 -30
  12. package/lib/commonjs/i18n/nl.json +30 -30
  13. package/lib/commonjs/i18n/pt-BR.json +30 -30
  14. package/lib/commonjs/i18n/ru.json +30 -30
  15. package/lib/commonjs/i18n/tr.json +30 -30
  16. package/lib/commonjs/utils/addReactionToLocalState.js +3 -2
  17. package/lib/commonjs/utils/addReactionToLocalState.js.map +1 -1
  18. package/lib/commonjs/version.json +1 -1
  19. package/lib/module/components/Chat/Chat.js +25 -16
  20. package/lib/module/components/Chat/Chat.js.map +1 -1
  21. package/lib/module/components/Chat/hooks/useAppSettings.js +18 -12
  22. package/lib/module/components/Chat/hooks/useAppSettings.js.map +1 -1
  23. package/lib/module/i18n/es.json +29 -29
  24. package/lib/module/i18n/fr.json +29 -29
  25. package/lib/module/i18n/he.json +29 -29
  26. package/lib/module/i18n/hi.json +30 -30
  27. package/lib/module/i18n/it.json +30 -30
  28. package/lib/module/i18n/ja.json +30 -30
  29. package/lib/module/i18n/ko.json +30 -30
  30. package/lib/module/i18n/nl.json +30 -30
  31. package/lib/module/i18n/pt-BR.json +30 -30
  32. package/lib/module/i18n/ru.json +30 -30
  33. package/lib/module/i18n/tr.json +30 -30
  34. package/lib/module/utils/addReactionToLocalState.js +3 -2
  35. package/lib/module/utils/addReactionToLocalState.js.map +1 -1
  36. package/lib/module/version.json +1 -1
  37. package/lib/typescript/i18n/es.json +29 -29
  38. package/lib/typescript/i18n/fr.json +29 -29
  39. package/lib/typescript/i18n/he.json +29 -29
  40. package/lib/typescript/i18n/hi.json +30 -30
  41. package/lib/typescript/i18n/it.json +30 -30
  42. package/lib/typescript/i18n/ja.json +30 -30
  43. package/lib/typescript/i18n/ko.json +30 -30
  44. package/lib/typescript/i18n/nl.json +30 -30
  45. package/lib/typescript/i18n/pt-BR.json +30 -30
  46. package/lib/typescript/i18n/ru.json +30 -30
  47. package/lib/typescript/i18n/tr.json +30 -30
  48. package/package.json +1 -1
  49. package/src/components/Chat/Chat.tsx +17 -6
  50. package/src/components/Chat/hooks/useAppSettings.ts +3 -1
  51. package/src/i18n/es.json +29 -29
  52. package/src/i18n/fr.json +29 -29
  53. package/src/i18n/he.json +29 -29
  54. package/src/i18n/hi.json +30 -30
  55. package/src/i18n/it.json +30 -30
  56. package/src/i18n/ja.json +30 -30
  57. package/src/i18n/ko.json +30 -30
  58. package/src/i18n/nl.json +30 -30
  59. package/src/i18n/pt-BR.json +30 -30
  60. package/src/i18n/ru.json +30 -30
  61. package/src/i18n/tr.json +30 -30
  62. package/src/utils/addReactionToLocalState.ts +7 -2
  63. package/src/version.json +1 -1
@@ -1,15 +1,15 @@
1
1
  {
2
- "1 Reply": "1 Resposta",
2
+ "1 Reply": "",
3
3
  "1 Thread Reply": "",
4
4
  "Allow access to your Gallery": "",
5
5
  "Allow camera access in device settings": "",
6
6
  "Also send to channel": "",
7
7
  "Are you sure you want to permanently delete this message?": "",
8
- "Are you sure?": "",
8
+ "Are you sure?": "Tem certeza?",
9
9
  "Block User": "",
10
10
  "Cancel": "",
11
11
  "Cannot Flag Message": "",
12
- "Consider how your comment might make others feel and be sure to follow our Community Guidelines": "",
12
+ "Consider how your comment might make others feel and be sure to follow our Community Guidelines": "Considere como seu comentário pode fazer os outros se sentirem e certifique-se de seguir nossas Diretrizes da Comunidade",
13
13
  "Copy Message": "",
14
14
  "Delete": "",
15
15
  "Delete Message": "",
@@ -18,62 +18,62 @@
18
18
  "Edit Message": "",
19
19
  "Editing Message": "",
20
20
  "Emoji matching": "",
21
- "Empty message...": "Mensagem vazia...",
22
- "Error loading": "Erro ao carregar",
23
- "Error loading channel list...": "Erro ao carregar lista de canais...",
24
- "Error loading messages for this channel...": "Erro ao carregar mensagens para este canal...",
25
- "Error while loading, please reload/refresh": "Erro ao carregar, por favor recarregue/atualize",
21
+ "Empty message...": "",
22
+ "Error loading": "",
23
+ "Error loading channel list...": "",
24
+ "Error loading messages for this channel...": "",
25
+ "Error while loading, please reload/refresh": "",
26
26
  "File type not supported": "Tipo de arquivo não suportado",
27
27
  "Flag": "",
28
28
  "Flag Message": "",
29
29
  "Flag action failed either due to a network issue or the message is already flagged": "",
30
- "How about sending your first message to a friend?": "Que tal enviar sua primeira mensagem para um amigo?",
30
+ "How about sending your first message to a friend?": "",
31
31
  "Instant Commands": "",
32
- "Let's start chatting!": "Vamos começar a conversar!",
33
- "Links are disabled": "",
32
+ "Let's start chatting!": "",
33
+ "Links are disabled": "Links estão desabilitados",
34
34
  "Loading channels...": "Carregando canais...",
35
35
  "Loading messages...": "Carregando mensagens...",
36
36
  "Loading...": "Carregando...",
37
- "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "",
38
- "Message Reactions": "Reações à Mensagem",
37
+ "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "Limite máximo de tamanho de arquivo atingido. Por favor, faça o upload de um arquivo abaixo de {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.",
38
+ "Message Reactions": "",
39
39
  "Message deleted": "Mensagem excluída",
40
40
  "Message flagged": "",
41
41
  "Mute User": "",
42
- "Not supported": "",
43
- "Nothing yet...": "Nada ainda...",
42
+ "Not supported": "Não suportado",
43
+ "Nothing yet...": "",
44
44
  "Ok": "",
45
45
  "Only visible to you": "Apenas visível para você",
46
46
  "Open Settings": "",
47
47
  "Photo": "Foto",
48
48
  "Photos and Videos": "",
49
49
  "Pin to Conversation": "",
50
- "Pinned by": "Fixado por",
50
+ "Pinned by": "",
51
51
  "Please enable access to your photos and videos so you can share them.": "",
52
- "Please select a channel first": "",
53
- "Reconnecting...": "Reconectando...",
52
+ "Please select a channel first": "Por favor, selecione um canal primeiro",
53
+ "Reconnecting...": "",
54
54
  "Reply": "",
55
- "Reply to Message": "Responder à Mensagem",
55
+ "Reply to Message": "",
56
56
  "Resend": "",
57
- "Search GIFs": "Pesquisar GIFs",
57
+ "Search GIFs": "",
58
58
  "Select More Photos": "",
59
- "Send Anyway": "",
60
- "Send a message": "Enviar uma mensagem",
61
- "Sending links is not allowed in this conversation": "",
62
- "Slow mode ON": "Modo Lento ATIVADO",
59
+ "Send Anyway": "Enviar de qualquer maneira",
60
+ "Send a message": "",
61
+ "Sending links is not allowed in this conversation": "Não é permitido enviar links nesta conversa",
62
+ "Slow mode ON": "",
63
63
  "The message has been reported to a moderator.": "",
64
64
  "Thread Reply": "",
65
65
  "Unblock User": "",
66
66
  "Unknown User": "",
67
67
  "Unmute User": "",
68
68
  "Unpin from Conversation": "",
69
- "Unread Messages": "Mensagens não lidas",
69
+ "Unread Messages": "",
70
70
  "Video": "Vídeo",
71
71
  "You": "Você",
72
- "You can't send messages in this channel": "Você não pode enviar mensagens neste canal",
73
- "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "{{ firstUser }} e mais {{ nonSelfUserLength }} pessoa(s) estão digitando",
72
+ "You can't send messages in this channel": "",
73
+ "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
74
74
  "{{ index }} of {{ photoLength }}": "",
75
- "{{ replyCount }} Replies": "{{ replyCount }} Respostas",
75
+ "{{ replyCount }} Replies": "",
76
76
  "{{ replyCount }} Thread Replies": "",
77
- "{{ user }} is typing": "{{ user }} está digitando",
78
- "🏙 Attachment...": "🏙 Anexo..."
77
+ "{{ user }} is typing": "",
78
+ "🏙 Attachment...": ""
79
79
  }
@@ -1,15 +1,15 @@
1
1
  {
2
- "1 Reply": "1 Ответ",
2
+ "1 Reply": "",
3
3
  "1 Thread Reply": "",
4
4
  "Allow access to your Gallery": "",
5
5
  "Allow camera access in device settings": "",
6
6
  "Also send to channel": "",
7
7
  "Are you sure you want to permanently delete this message?": "",
8
- "Are you sure?": "",
8
+ "Are you sure?": "Вы уверены?",
9
9
  "Block User": "",
10
10
  "Cancel": "",
11
11
  "Cannot Flag Message": "",
12
- "Consider how your comment might make others feel and be sure to follow our Community Guidelines": "",
12
+ "Consider how your comment might make others feel and be sure to follow our Community Guidelines": "Обдумайте, как ваш комментарий может повлиять на других, и убедитесь, что вы следуете нашим правилам сообщества",
13
13
  "Copy Message": "",
14
14
  "Delete": "",
15
15
  "Delete Message": "",
@@ -18,62 +18,62 @@
18
18
  "Edit Message": "",
19
19
  "Editing Message": "",
20
20
  "Emoji matching": "",
21
- "Empty message...": "Пустое сообщение...",
22
- "Error loading": "Ошибка при загрузке",
23
- "Error loading channel list...": "Ошибка загрузки списка каналов...",
24
- "Error loading messages for this channel...": "Ошибка загрузки сообщений для этого канала...",
25
- "Error while loading, please reload/refresh": "Ошибка загрузки, пожалуйста перезагрузите или обновите",
21
+ "Empty message...": "",
22
+ "Error loading": "",
23
+ "Error loading channel list...": "",
24
+ "Error loading messages for this channel...": "",
25
+ "Error while loading, please reload/refresh": "",
26
26
  "File type not supported": "Тип файла не поддерживается",
27
27
  "Flag": "",
28
28
  "Flag Message": "",
29
29
  "Flag action failed either due to a network issue or the message is already flagged": "",
30
- "How about sending your first message to a friend?": "Как насчет отправки первого сообщения другу?",
30
+ "How about sending your first message to a friend?": "",
31
31
  "Instant Commands": "",
32
- "Let's start chatting!": "Давайте начнем общаться!",
33
- "Links are disabled": "",
32
+ "Let's start chatting!": "",
33
+ "Links are disabled": "Ссылки отключены",
34
34
  "Loading channels...": "Загружаю каналы...",
35
35
  "Loading messages...": "Загружаю сообщения...",
36
36
  "Loading...": "Загружаю...",
37
- "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "",
38
- "Message Reactions": "Сообщения Реакции",
37
+ "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "Достигнут предел максимального размера файла для загрузки. Загрузите файл размером менее {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} МБ.",
38
+ "Message Reactions": "",
39
39
  "Message deleted": "Сообщение удалено",
40
40
  "Message flagged": "",
41
41
  "Mute User": "",
42
- "Not supported": "",
43
- "Nothing yet...": "Пока ничего нет...",
42
+ "Not supported": "не поддерживается",
43
+ "Nothing yet...": "",
44
44
  "Ok": "",
45
45
  "Only visible to you": "Видно только вам",
46
46
  "Open Settings": "",
47
47
  "Photo": "Фото",
48
48
  "Photos and Videos": "",
49
49
  "Pin to Conversation": "",
50
- "Pinned by": "Закреплено пользователем",
50
+ "Pinned by": "",
51
51
  "Please enable access to your photos and videos so you can share them.": "",
52
- "Please select a channel first": "",
53
- "Reconnecting...": "Переподключение...",
52
+ "Please select a channel first": "Пожалуйста, сначала выберите канал",
53
+ "Reconnecting...": "",
54
54
  "Reply": "",
55
- "Reply to Message": "Ответить на сообщение",
55
+ "Reply to Message": "",
56
56
  "Resend": "",
57
- "Search GIFs": "Поиск GIF",
57
+ "Search GIFs": "",
58
58
  "Select More Photos": "",
59
- "Send Anyway": "",
60
- "Send a message": "Отправить сообщение",
61
- "Sending links is not allowed in this conversation": "",
62
- "Slow mode ON": "Медленный режим включен",
59
+ "Send Anyway": "Всё равно отправить",
60
+ "Send a message": "",
61
+ "Sending links is not allowed in this conversation": "Отправка ссылок недоступна в этом чате",
62
+ "Slow mode ON": "",
63
63
  "The message has been reported to a moderator.": "",
64
64
  "Thread Reply": "",
65
65
  "Unblock User": "",
66
66
  "Unknown User": "",
67
67
  "Unmute User": "",
68
68
  "Unpin from Conversation": "",
69
- "Unread Messages": "Непрочитанные Сообщения",
69
+ "Unread Messages": "",
70
70
  "Video": "видео",
71
71
  "You": "Вы",
72
- "You can't send messages in this channel": "Вы не можете отправлять сообщения в этот канал",
73
- "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "{{ firstUser }} и еще {{ nonSelfUserLength }} пишут",
72
+ "You can't send messages in this channel": "",
73
+ "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
74
74
  "{{ index }} of {{ photoLength }}": "",
75
- "{{ replyCount }} Replies": "{{ replyCount }} Ответов",
75
+ "{{ replyCount }} Replies": "",
76
76
  "{{ replyCount }} Thread Replies": "",
77
- "{{ user }} is typing": "{{ user }} пишет",
78
- "🏙 Attachment...": "🏙 Вложение..."
77
+ "{{ user }} is typing": "",
78
+ "🏙 Attachment...": ""
79
79
  }
@@ -1,15 +1,15 @@
1
1
  {
2
- "1 Reply": "1 Cevap",
2
+ "1 Reply": "",
3
3
  "1 Thread Reply": "",
4
4
  "Allow access to your Gallery": "",
5
5
  "Allow camera access in device settings": "",
6
6
  "Also send to channel": "",
7
7
  "Are you sure you want to permanently delete this message?": "",
8
- "Are you sure?": "",
8
+ "Are you sure?": "Emin misiniz?",
9
9
  "Block User": "",
10
10
  "Cancel": "",
11
11
  "Cannot Flag Message": "",
12
- "Consider how your comment might make others feel and be sure to follow our Community Guidelines": "",
12
+ "Consider how your comment might make others feel and be sure to follow our Community Guidelines": "Yorumunuzun diğerlerini nasıl hissettirebileceğini düşünün ve topluluk kurallarımızı takip ettiğinizden emin olun",
13
13
  "Copy Message": "",
14
14
  "Delete": "",
15
15
  "Delete Message": "",
@@ -18,62 +18,62 @@
18
18
  "Edit Message": "",
19
19
  "Editing Message": "",
20
20
  "Emoji matching": "",
21
- "Empty message...": "Boş mesaj...",
22
- "Error loading": "Yükleme hatası",
23
- "Error loading channel list...": "Kanal listesi yüklenirken hata oluştu...",
24
- "Error loading messages for this channel...": "Bu kanal için mesajlar yüklenirken hata oluştu...",
25
- "Error while loading, please reload/refresh": "Yüklenirken hata oluştu, lütfen tekrar deneyiniz",
21
+ "Empty message...": "",
22
+ "Error loading": "",
23
+ "Error loading channel list...": "",
24
+ "Error loading messages for this channel...": "",
25
+ "Error while loading, please reload/refresh": "",
26
26
  "File type not supported": "Dosya türü desteklenmiyor",
27
27
  "Flag": "",
28
28
  "Flag Message": "",
29
29
  "Flag action failed either due to a network issue or the message is already flagged": "",
30
- "How about sending your first message to a friend?": "İlk mesajınızı bir arkadaşınıza göndermeye ne dersiniz?",
30
+ "How about sending your first message to a friend?": "",
31
31
  "Instant Commands": "",
32
- "Let's start chatting!": "Haydi sohbete başlayalım!",
33
- "Links are disabled": "",
32
+ "Let's start chatting!": "",
33
+ "Links are disabled": "Bağlantılar devre dışı",
34
34
  "Loading channels...": "Kanallar yükleniyor...",
35
35
  "Loading messages...": "Mesajlar yükleniyor...",
36
36
  "Loading...": "Yükleniyor...",
37
- "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "",
38
- "Message Reactions": "Mesaj Tepkileri",
37
+ "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "Maksimum dosya boyutu yükleme sınırına ulaşıldı. Lütfen {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB'ın altında bir dosya yükleyin.",
38
+ "Message Reactions": "",
39
39
  "Message deleted": "Mesaj silindi",
40
40
  "Message flagged": "",
41
41
  "Mute User": "",
42
- "Not supported": "",
43
- "Nothing yet...": "Henüz değil...",
42
+ "Not supported": "Desteklenmiyor",
43
+ "Nothing yet...": "",
44
44
  "Ok": "",
45
45
  "Only visible to you": "Sadece siz görebilirsiniz",
46
46
  "Open Settings": "",
47
47
  "Photo": "Fotoğraf",
48
48
  "Photos and Videos": "",
49
49
  "Pin to Conversation": "",
50
- "Pinned by": "Tarafından sabitlendi",
50
+ "Pinned by": "",
51
51
  "Please enable access to your photos and videos so you can share them.": "",
52
- "Please select a channel first": "",
53
- "Reconnecting...": "Yeniden Bağlanılıyor...",
52
+ "Please select a channel first": "Lütfen önce bir kanal seçiniz",
53
+ "Reconnecting...": "",
54
54
  "Reply": "",
55
- "Reply to Message": "Mesajı Yanıtla",
55
+ "Reply to Message": "",
56
56
  "Resend": "",
57
- "Search GIFs": "GIF Ara",
57
+ "Search GIFs": "",
58
58
  "Select More Photos": "",
59
- "Send Anyway": "",
60
- "Send a message": "Mesaj gönder",
61
- "Sending links is not allowed in this conversation": "",
62
- "Slow mode ON": "Yavaş Mod Açık",
59
+ "Send Anyway": "Yine de Gönder",
60
+ "Send a message": "",
61
+ "Sending links is not allowed in this conversation": "Bu konuşmada bağlantı göndermek desteklenmiyor",
62
+ "Slow mode ON": "",
63
63
  "The message has been reported to a moderator.": "",
64
64
  "Thread Reply": "",
65
65
  "Unblock User": "",
66
66
  "Unknown User": "",
67
67
  "Unmute User": "",
68
68
  "Unpin from Conversation": "",
69
- "Unread Messages": "Okunmamış Mesajlar",
69
+ "Unread Messages": "",
70
70
  "Video": "Video",
71
71
  "You": "Sen",
72
- "You can't send messages in this channel": "Bu konuşmaya mesaj gönderemezsiniz",
73
- "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "{{ firstUser }} ve {{ nonSelfUserLength }} kişi daha yazıyor",
72
+ "You can't send messages in this channel": "",
73
+ "{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "",
74
74
  "{{ index }} of {{ photoLength }}": "",
75
- "{{ replyCount }} Replies": "{{ replyCount }} Cevap",
75
+ "{{ replyCount }} Replies": "",
76
76
  "{{ replyCount }} Thread Replies": "",
77
- "{{ user }} is typing": "{{ user }} yazıyor",
78
- "🏙 Attachment...": "🏙 Ek..."
77
+ "{{ user }} is typing": "",
78
+ "🏙 Attachment...": ""
79
79
  }
@@ -42,7 +42,7 @@ var addReactionToLocalState = function addReactionToLocalState(_ref) {
42
42
  message.latest_reactions = message.latest_reactions.filter(function (r) {
43
43
  return r.user_id !== user.id;
44
44
  });
45
- if (currentReaction && message.reaction_counts) {
45
+ if (currentReaction && message.reaction_counts && message.reaction_counts[currentReaction.type] && message.reaction_counts[currentReaction.type] > 0) {
46
46
  message.reaction_counts[currentReaction.type] = message.reaction_counts[currentReaction.type] - 1;
47
47
  }
48
48
  if (!message.reaction_counts) {
@@ -55,7 +55,8 @@ var addReactionToLocalState = function addReactionToLocalState(_ref) {
55
55
  if (!message.reaction_counts) {
56
56
  message.reaction_counts = (0, _defineProperty2["default"])({}, reactionType, 1);
57
57
  } else {
58
- message.reaction_counts[reactionType] = message.reaction_counts[reactionType] + 1;
58
+ var _message$reaction_cou4;
59
+ message.reaction_counts[reactionType] = (((_message$reaction_cou4 = message.reaction_counts) == null ? void 0 : _message$reaction_cou4[reactionType]) || 0) + 1;
59
60
  }
60
61
  }
61
62
  message.own_reactions = [].concat((0, _toConsumableArray2["default"])(message.own_reactions), [reaction]);
@@ -1 +1 @@
1
- {"version":3,"names":["_apis","require","_insertReaction","addReactionToLocalState","_ref","channel","enforceUniqueReaction","messageId","reactionType","user","message","state","messages","find","_ref2","id","reaction","created_at","Date","toISOString","message_id","type","updated_at","user_id","hasOwnReaction","own_reactions","length","latest_reactions","currentReaction","filter","r","reaction_counts","_defineProperty2","_message$reaction_cou2","concat","_toConsumableArray2","updateReaction","insertReaction","exports"],"sources":["addReactionToLocalState.ts"],"sourcesContent":["import type { Channel, ReactionResponse, UserResponse } from 'stream-chat';\n\nimport { updateReaction } from '../store/apis';\nimport { insertReaction } from '../store/apis/insertReaction';\n\nimport type { DefaultStreamChatGenerics } from '../types/types';\n\nexport const addReactionToLocalState = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n channel,\n enforceUniqueReaction,\n messageId,\n reactionType,\n user,\n}: {\n channel: Channel<StreamChatGenerics>;\n enforceUniqueReaction: boolean;\n messageId: string;\n reactionType: string;\n user: UserResponse<StreamChatGenerics>;\n}) => {\n const message = channel.state.messages.find(({ id }) => id === messageId);\n\n if (!message) return;\n\n const reaction: ReactionResponse = {\n created_at: new Date().toISOString(),\n message_id: messageId,\n type: reactionType,\n updated_at: new Date().toISOString(),\n user,\n user_id: user?.id,\n };\n\n const hasOwnReaction = message.own_reactions && message.own_reactions.length > 0;\n if (!message.own_reactions) {\n message.own_reactions = [];\n }\n\n if (!message.latest_reactions) {\n message.latest_reactions = [];\n }\n\n if (enforceUniqueReaction) {\n const currentReaction = message.own_reactions[0];\n message.own_reactions = [];\n if (!message.latest_reactions) {\n message.latest_reactions = [];\n }\n message.latest_reactions = message.latest_reactions.filter((r) => r.user_id !== user.id);\n if (currentReaction && message.reaction_counts) {\n message.reaction_counts[currentReaction.type] =\n message.reaction_counts[currentReaction.type] - 1;\n }\n\n if (!message.reaction_counts) {\n message.reaction_counts = {\n [reactionType]: 1,\n };\n } else {\n message.reaction_counts[reactionType] = (message.reaction_counts?.[reactionType] || 0) + 1;\n }\n } else {\n if (!message.reaction_counts) {\n message.reaction_counts = {\n [reactionType]: 1,\n };\n } else {\n message.reaction_counts[reactionType] = message.reaction_counts[reactionType] + 1;\n }\n }\n\n message.own_reactions = [...message.own_reactions, reaction];\n message.latest_reactions = [...message.latest_reactions, reaction];\n\n if (enforceUniqueReaction && hasOwnReaction) {\n updateReaction({\n message,\n reaction,\n });\n } else {\n insertReaction({\n reaction,\n });\n }\n};\n"],"mappings":";;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAIO,IAAME,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,EAc9B;EAAA,IAXJC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,qBAAqB,GAAAF,IAAA,CAArBE,qBAAqB;IACrBC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,YAAY,GAAAJ,IAAA,CAAZI,YA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,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_apis","require","_insertReaction","addReactionToLocalState","_ref","channel","enforceUniqueReaction","messageId","reactionType","user","message","state","messages","find","_ref2","id","reaction","created_at","Date","toISOString","message_id","type","updated_at","user_id","hasOwnReaction","own_reactions","length","latest_reactions","currentReaction","filter","r","reaction_counts","_defineProperty2","_message$reaction_cou2","_message$reaction_cou4","concat","_toConsumableArray2","updateReaction","insertReaction","exports"],"sources":["addReactionToLocalState.ts"],"sourcesContent":["import type { Channel, ReactionResponse, UserResponse } from 'stream-chat';\n\nimport { updateReaction } from '../store/apis';\nimport { insertReaction } from '../store/apis/insertReaction';\n\nimport type { DefaultStreamChatGenerics } from '../types/types';\n\nexport const addReactionToLocalState = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n channel,\n enforceUniqueReaction,\n messageId,\n reactionType,\n user,\n}: {\n channel: Channel<StreamChatGenerics>;\n enforceUniqueReaction: boolean;\n messageId: string;\n reactionType: string;\n user: UserResponse<StreamChatGenerics>;\n}) => {\n const message = channel.state.messages.find(({ id }) => id === messageId);\n\n if (!message) return;\n\n const reaction: ReactionResponse = {\n created_at: new Date().toISOString(),\n message_id: messageId,\n type: reactionType,\n updated_at: new Date().toISOString(),\n user,\n user_id: user?.id,\n };\n\n const hasOwnReaction = message.own_reactions && message.own_reactions.length > 0;\n if (!message.own_reactions) {\n message.own_reactions = [];\n }\n\n if (!message.latest_reactions) {\n message.latest_reactions = [];\n }\n\n if (enforceUniqueReaction) {\n const currentReaction = message.own_reactions[0];\n message.own_reactions = [];\n if (!message.latest_reactions) {\n message.latest_reactions = [];\n }\n message.latest_reactions = message.latest_reactions.filter((r) => r.user_id !== user.id);\n if (\n currentReaction &&\n message.reaction_counts &&\n message.reaction_counts[currentReaction.type] &&\n message.reaction_counts[currentReaction.type] > 0\n ) {\n message.reaction_counts[currentReaction.type] =\n message.reaction_counts[currentReaction.type] - 1;\n }\n\n if (!message.reaction_counts) {\n message.reaction_counts = {\n [reactionType]: 1,\n };\n } else {\n message.reaction_counts[reactionType] = (message.reaction_counts?.[reactionType] || 0) + 1;\n }\n } else {\n if (!message.reaction_counts) {\n message.reaction_counts = {\n [reactionType]: 1,\n };\n } else {\n message.reaction_counts[reactionType] = (message.reaction_counts?.[reactionType] || 0) + 1;\n }\n }\n\n message.own_reactions = [...message.own_reactions, reaction];\n message.latest_reactions = [...message.latest_reactions, reaction];\n\n if (enforceUniqueReaction && hasOwnReaction) {\n updateReaction({\n message,\n reaction,\n });\n } else {\n insertReaction({\n reaction,\n });\n }\n};\n"],"mappings":";;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAIO,IAAME,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,EAc9B;EAAA,IAXJC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,qBAAqB,GAAAF,IAAA,CAArBE,qBAAqB;IACrBC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,IAAI,GAAAL,IAAA,CAAJK,IAAI;EAQJ,IAAMC,OAAO,GAAGL,OAAO,CAACM,KAAK,CAACC,QAAQ,CAACC,IAAI,CAAC,UAAAC,KAAA;IAAA,IAAGC,EAAE,GAAAD,KAAA,CAAFC,EAAE;IAAA,OAAOA,EAAE,KAAKR,SAAS;EAAA,EAAC;EAEzE,IAAI,CAACG,OAAO,EAAE;EAEd,IAAMM,QAA0B,GAAG;IACjCC,UAAU,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;IACpCC,UAAU,EAAEb,SAAS;IACrBc,IAAI,EAAEb,YAAY;IAClBc,UAAU,EAAE,IAAIJ,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;IACpCV,IAAI,EAAJA,IAAI;IACJc,OAAO,EAAEd,IAAI,oBAAJA,IAAI,CAAEM;EACj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qB,eAAe,qBAAvBE,sBAAA,CAA0BzB,YAAY,CAAC,KAAI,CAAC,IAAI,CAAC;IAC5F;EACF,CAAC,MAAM;IACL,IAAI,CAACE,OAAO,CAACqB,eAAe,EAAE;MAC5BrB,OAAO,CAACqB,eAAe,OAAAC,gBAAA,iBACpBxB,YAAY,EAAG,CAAC,CAClB;IACH,CAAC,MAAM;MAAA,IAAA0B,sBAAA;MACLxB,OAAO,CAACqB,eAAe,CAACvB,YAAY,CAAC,GAAG,CAAC,EAAA0B,sBAAA,GAAAxB,OAAO,CAACqB,eAAe,qBAAvBG,sBAAA,CAA0B1B,YAAY,CAAC,KAAI,CAAC,IAAI,CAAC;IAC5F;EACF;EAEAE,OAAO,CAACe,aAAa,MAAAU,MAAA,KAAAC,mBAAA,aAAO1B,OAAO,CAACe,aAAa,IAAET,QAAQ,EAAC;EAC5DN,OAAO,CAACiB,gBAAgB,MAAAQ,MAAA,KAAAC,mBAAA,aAAO1B,OAAO,CAACiB,gBAAgB,IAAEX,QAAQ,EAAC;EAElE,IAAIV,qBAAqB,IAAIkB,cAAc,EAAE;IAC3C,IAAAa,oBAAc,EAAC;MACb3B,OAAO,EAAPA,OAAO;MACPM,QAAQ,EAARA;IACF,CAAC,CAAC;EACJ,CAAC,MAAM;IACL,IAAAsB,8BAAc,EAAC;MACbtB,QAAQ,EAARA;IACF,CAAC,CAAC;EACJ;AACF,CAAC;AAACuB,OAAA,CAAApC,uBAAA,GAAAA,uBAAA"}
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "5.27.0-beta.1"
2
+ "version": "5.27.0-beta.3"
3
3
  }
@@ -32,7 +32,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
32
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
33
  (0, _init["default"])();
34
34
  var ChatWithContext = function ChatWithContext(props) {
35
- var _client$user2, _client$user3;
35
+ var _client$user;
36
36
  var children = props.children,
37
37
  client = props.client,
38
38
  _props$closeConnectio = props.closeConnectionOnBackground,
@@ -53,13 +53,16 @@ var ChatWithContext = function ChatWithContext(props) {
53
53
  var _useIsOnline = (0, _useIsOnline2.useIsOnline)(client, closeConnectionOnBackground),
54
54
  connectionRecovering = _useIsOnline.connectionRecovering,
55
55
  isOnline = _useIsOnline.isOnline;
56
- var _useState3 = (0, _react.useState)(false),
56
+ var _useState3 = (0, _react.useState)({
57
+ initialised: false
58
+ }),
57
59
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
58
- initialisedDatabase = _useState4[0],
59
- setInitialisedDatabase = _useState4[1];
60
+ initialisedDatabaseConfig = _useState4[0],
61
+ setInitialisedDatabaseConfig = _useState4[1];
60
62
  var mutedUsers = (0, _useMutedUsers.useMutedUsers)(client);
61
63
  var debugRef = (0, _DebugContext.useDebugContext)();
62
64
  var isDebugModeEnabled = __DEV__ && debugRef && debugRef.current;
65
+ var userID = client.userID;
63
66
  _StreamChatRN.StreamChatRN.setConfig({
64
67
  resizableCDNHosts: resizableCDNHosts
65
68
  });
@@ -81,14 +84,20 @@ var ChatWithContext = function ChatWithContext(props) {
81
84
  return setChannel(newChannel);
82
85
  };
83
86
  (0, _react.useEffect)(function () {
84
- var _client$user;
85
- if ((_client$user = client.user) != null && _client$user.id && enableOfflineSupport) {
86
- setInitialisedDatabase(false);
87
+ if (userID && enableOfflineSupport) {
88
+ setInitialisedDatabaseConfig({
89
+ initialised: false,
90
+ userID: userID
91
+ });
87
92
  _QuickSqliteClient.QuickSqliteClient.initializeDatabase();
88
93
  _DBSyncManager.DBSyncManager.init(client);
89
- setInitialisedDatabase(true);
94
+ setInitialisedDatabaseConfig({
95
+ initialised: true,
96
+ userID: userID
97
+ });
90
98
  }
91
- }, [client == null ? void 0 : (_client$user2 = client.user) == null ? void 0 : _client$user2.id, enableOfflineSupport]);
99
+ }, [userID, enableOfflineSupport]);
100
+ var initialisedDatabase = initialisedDatabaseConfig.initialised && userID === initialisedDatabaseConfig.userID;
92
101
  var appSettings = (0, _useAppSettings.useAppSettings)(client, isOnline, enableOfflineSupport, initialisedDatabase);
93
102
  var chatContext = (0, _useCreateChatContext.useCreateChatContext)({
94
103
  appSettings: appSettings,
@@ -107,7 +116,7 @@ var ChatWithContext = function ChatWithContext(props) {
107
116
  enableOfflineSupport: enableOfflineSupport,
108
117
  initialisedDatabase: initialisedDatabase
109
118
  });
110
- if (enableOfflineSupport && !initialisedDatabase) {
119
+ if (userID && enableOfflineSupport && !initialisedDatabase) {
111
120
  return null;
112
121
  }
113
122
  return _react["default"].createElement(_ChatContext.ChatProvider, {
@@ -115,17 +124,17 @@ var ChatWithContext = function ChatWithContext(props) {
115
124
  __self: _this,
116
125
  __source: {
117
126
  fileName: _jsxFileName,
118
- lineNumber: 232,
127
+ lineNumber: 243,
119
128
  columnNumber: 5
120
129
  }
121
130
  }, _react["default"].createElement(_TranslationContext.TranslationProvider, {
122
131
  value: (0, _extends2["default"])({}, translators, {
123
- userLanguage: ((_client$user3 = client.user) == null ? void 0 : _client$user3.language) || _TranslationContext.DEFAULT_USER_LANGUAGE
132
+ userLanguage: ((_client$user = client.user) == null ? void 0 : _client$user.language) || _TranslationContext.DEFAULT_USER_LANGUAGE
124
133
  }),
125
134
  __self: _this,
126
135
  __source: {
127
136
  fileName: _jsxFileName,
128
- lineNumber: 233,
137
+ lineNumber: 244,
129
138
  columnNumber: 7
130
139
  }
131
140
  }, _react["default"].createElement(_ThemeContext.ThemeProvider, {
@@ -133,14 +142,14 @@ var ChatWithContext = function ChatWithContext(props) {
133
142
  __self: _this,
134
143
  __source: {
135
144
  fileName: _jsxFileName,
136
- lineNumber: 236,
145
+ lineNumber: 247,
137
146
  columnNumber: 9
138
147
  }
139
148
  }, _react["default"].createElement(_ChannelsStateContext.ChannelsStateProvider, {
140
149
  __self: _this,
141
150
  __source: {
142
151
  fileName: _jsxFileName,
143
- lineNumber: 237,
152
+ lineNumber: 248,
144
153
  columnNumber: 11
145
154
  }
146
155
  }, children))));
@@ -154,7 +163,7 @@ var Chat = function Chat(props) {
154
163
  __self: _this,
155
164
  __source: {
156
165
  fileName: _jsxFileName,
157
- lineNumber: 272,
166
+ lineNumber: 283,
158
167
  columnNumber: 10
159
168
  }
160
169
  }));
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_useAppSettings","_useCreateChatContext","_useIsOnline2","_useMutedUsers","_useSyncDatabase","_ChannelsStateContext","_ChatContext","_DebugContext","_OverlayContext","_ThemeContext","_TranslationContext","_useStreami18n","_init","_interopRequireDefault","_native","_QuickSqliteClient","_DBSyncManager","_StreamChatRN","_version","_this","_jsxFileName","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","init","ChatWithContext","props","_client$user2","_client$user3","children","client","_props$closeConnectio","closeConnectionOnBackground","_props$enableOfflineS","enableOfflineSupport","i18nInstance","_props$ImageComponent","ImageComponent","Image","_props$resizableCDNHo","resizableCDNHosts","style","_useState","useState","_useState2","_slicedToArray2","channel","setChannel","translators","useStreami18n","_useIsOnline","useIsOnline","connectionRecovering","isOnline","_useState3","_useState4","initialisedDatabase","setInitialisedDatabase","mutedUsers","useMutedUsers","debugRef","useDebugContext","isDebugModeEnabled","__DEV__","current","StreamChatRN","setConfig","useEffect","setUserAgent","SDK","Platform","OS","version","recoverStateOnReconnect","persistUserOnConnectionFailure","setEventType","setSendEventParams","action","data","user","setActiveChannel","newChannel","_client$user","id","QuickSqliteClient","initializeDatabase","DBSyncManager","appSettings","useAppSettings","chatContext","useCreateChatContext","useSyncDatabase","createElement","ChatProvider","value","__self","__source","fileName","lineNumber","columnNumber","TranslationProvider","_extends2","userLanguage","language","DEFAULT_USER_LANGUAGE","ThemeProvider","ChannelsStateProvider","Chat","_useOverlayContext","useOverlayContext","exports"],"sources":["Chat.tsx"],"sourcesContent":["import React, { PropsWithChildren, useEffect, useState } from 'react';\nimport { Image, Platform } from 'react-native';\n\nimport type { Channel, StreamChat } from 'stream-chat';\n\nimport { useAppSettings } from './hooks/useAppSettings';\nimport { useCreateChatContext } from './hooks/useCreateChatContext';\nimport { useIsOnline } from './hooks/useIsOnline';\nimport { useMutedUsers } from './hooks/useMutedUsers';\n\nimport { useSyncDatabase } from './hooks/useSyncDatabase';\n\nimport { ChannelsStateProvider } from '../../contexts/channelsStateContext/ChannelsStateContext';\nimport { ChatContextValue, ChatProvider } from '../../contexts/chatContext/ChatContext';\nimport { useDebugContext } from '../../contexts/debugContext/DebugContext';\nimport { useOverlayContext } from '../../contexts/overlayContext/OverlayContext';\nimport { DeepPartial, ThemeProvider } from '../../contexts/themeContext/ThemeContext';\nimport type { Theme } from '../../contexts/themeContext/utils/theme';\nimport {\n DEFAULT_USER_LANGUAGE,\n TranslationProvider,\n} from '../../contexts/translationContext/TranslationContext';\nimport { useStreami18n } from '../../hooks/useStreami18n';\nimport init from '../../init';\n\nimport { SDK } from '../../native';\nimport { QuickSqliteClient } from '../../store/QuickSqliteClient';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { DBSyncManager } from '../../utils/DBSyncManager';\nimport { StreamChatRN } from '../../utils/StreamChatRN';\nimport type { Streami18n } from '../../utils/Streami18n';\nimport { version } from '../../version.json';\n\ninit();\n\nexport type ChatProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<ChatContextValue<StreamChatGenerics>, 'client'> &\n Partial<Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent' | 'resizableCDNHosts'>> & {\n /**\n * When false, ws connection won't be disconnection upon backgrounding the app.\n * To receive push notifications, its necessary that user doesn't have active\n * websocket connection. So by default, we disconnect websocket connection when\n * app goes to background, and reconnect when app comes to foreground.\n */\n closeConnectionOnBackground?: boolean;\n /**\n * Enables offline storage and loading for chat data.\n */\n enableOfflineSupport?: boolean;\n /**\n * Instance of Streami18n class should be provided to Chat component to enable internationalization.\n *\n * Stream provides following list of in-built translations:\n * 1. English (en)\n * 2. Dutch (nl)\n * 3. ...\n * 4. ...\n *\n * Simplest way to start using chat components in one of the in-built languages would be following:\n *\n * ```\n * const i18n = new Streami18n('nl');\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n *\n * If you would like to override certain keys in in-built translation.\n * UI will be automatically updated in this case.\n *\n * ```\n * const i18n = new Streami18n('nl');\n *\n * i18n.registerTranslation('nl', {\n * 'Nothing yet...': 'Nog Niet ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} en {{ secondUser }} zijn aan het typen...',\n * });\n *\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n *\n * You can use the same function to add whole new language.\n *\n * ```\n * const i18n = new Streami18n('it');\n *\n * i18n.registerTranslation('it', {\n * 'Nothing yet...': 'Non ancora ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} a {{ secondUser }} stanno scrivendo...',\n * });\n *\n * // Make sure to call setLanguage to reflect new language in UI.\n * i18n.setLanguage('it');\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n */\n i18nInstance?: Streami18n;\n /**\n * You can pass the theme object to customize the styles of Chat components. You can check the default theme in [theme.ts](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/contexts/themeContext/utils/theme.ts)\n *\n * Please check section about [themes in cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#theme) for details.\n *\n * ```\n * import type { DeepPartial, Theme } from 'stream-chat-react-native';\n *\n * const theme: DeepPartial<Theme> = {\n * messageSimple: {\n * file: {\n * container: {\n * backgroundColor: 'red',\n * },\n * icon: {\n * height: 16,\n * width: 16,\n * },\n * },\n * },\n * };\n *\n * <Chat style={theme}>\n * </Chat>\n * ```\n *\n * @overrideType object\n */\n style?: DeepPartial<Theme>;\n };\n\nconst ChatWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: PropsWithChildren<ChatProps<StreamChatGenerics>>,\n) => {\n const {\n children,\n client,\n closeConnectionOnBackground = true,\n enableOfflineSupport = false,\n i18nInstance,\n ImageComponent = Image,\n resizableCDNHosts = ['.stream-io-cdn.com'],\n style,\n } = props;\n\n const [channel, setChannel] = useState<Channel<StreamChatGenerics>>();\n\n // Setup translators\n const translators = useStreami18n(i18nInstance);\n\n /**\n * Setup connection event listeners\n */\n const { connectionRecovering, isOnline } = useIsOnline<StreamChatGenerics>(\n client,\n closeConnectionOnBackground,\n );\n\n const [initialisedDatabase, setInitialisedDatabase] = useState(false);\n\n /**\n * Setup muted user listener\n * TODO: reimplement\n */\n const mutedUsers = useMutedUsers<StreamChatGenerics>(client);\n\n const debugRef = useDebugContext();\n const isDebugModeEnabled = __DEV__ && debugRef && debugRef.current;\n\n // Set the `resizableCDNHosts` as per the prop.\n StreamChatRN.setConfig({ resizableCDNHosts });\n\n useEffect(() => {\n if (client) {\n client.setUserAgent(`${SDK}-${Platform.OS}-${version}`);\n // This is to disable recovery related logic in js client, since we handle it in this SDK\n client.recoverStateOnReconnect = false;\n client.persistUserOnConnectionFailure = enableOfflineSupport;\n }\n\n if (isDebugModeEnabled) {\n if (debugRef.current.setEventType) debugRef.current.setEventType('send');\n if (debugRef.current.setSendEventParams)\n debugRef.current.setSendEventParams({\n action: 'Client',\n data: client.user,\n });\n }\n }, [client, enableOfflineSupport]);\n\n const setActiveChannel = (newChannel?: Channel<StreamChatGenerics>) => setChannel(newChannel);\n\n useEffect(() => {\n if (client.user?.id && enableOfflineSupport) {\n setInitialisedDatabase(false);\n QuickSqliteClient.initializeDatabase();\n DBSyncManager.init(client as unknown as StreamChat);\n setInitialisedDatabase(true);\n }\n }, [client?.user?.id, enableOfflineSupport]);\n\n const appSettings = useAppSettings(client, isOnline, enableOfflineSupport, initialisedDatabase);\n\n const chatContext = useCreateChatContext({\n appSettings,\n channel,\n client,\n connectionRecovering,\n enableOfflineSupport,\n ImageComponent,\n isOnline,\n mutedUsers,\n resizableCDNHosts,\n setActiveChannel,\n });\n\n useSyncDatabase({\n client,\n enableOfflineSupport,\n initialisedDatabase,\n });\n\n if (enableOfflineSupport && !initialisedDatabase) {\n return null;\n }\n\n return (\n <ChatProvider<StreamChatGenerics> value={chatContext}>\n <TranslationProvider\n value={{ ...translators, userLanguage: client.user?.language || DEFAULT_USER_LANGUAGE }}\n >\n <ThemeProvider style={style}>\n <ChannelsStateProvider<StreamChatGenerics>>{children}</ChannelsStateProvider>\n </ThemeProvider>\n </TranslationProvider>\n </ChatProvider>\n );\n};\n\n/**\n * Chat - Wrapper component for Chat. The needs to be placed around any other chat components.\n * This Chat component provides the ChatContext to all other components.\n *\n * The ChatContext provides the following props:\n *\n * - channel - currently active channel\n * - client - client connection\n * - connectionRecovering - whether or not websocket is reconnecting\n * - isOnline - whether or not set user is active\n * - setActiveChannel - function to set the currently active channel\n *\n * The Chat Component takes the following generics in order:\n * - At (AttachmentType) - custom Attachment object extension\n * - Ct (ChannelType) - custom Channel object extension\n * - Co (CommandType) - custom Command string union extension\n * - Ev (EventType) - custom Event object extension\n * - Me (MessageType) - custom Message object extension\n * - Re (ReactionType) - custom Reaction object extension\n * - Us (UserType) - custom User object extension\n */\nexport const Chat = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: PropsWithChildren<ChatProps<StreamChatGenerics>>,\n) => {\n const { style } = useOverlayContext();\n\n return <ChatWithContext {...{ style }} {...props} />;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AAEA,IAAAM,gBAAA,GAAAN,OAAA;AAEA,IAAAO,qBAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,eAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAEA,IAAAY,mBAAA,GAAAZ,OAAA;AAIA,IAAAa,cAAA,GAAAb,OAAA;AACA,IAAAc,KAAA,GAAAC,sBAAA,CAAAf,OAAA;AAEA,IAAAgB,OAAA,GAAAhB,OAAA;AACA,IAAAiB,kBAAA,GAAAjB,OAAA;AAEA,IAAAkB,cAAA,GAAAlB,OAAA;AACA,IAAAmB,aAAA,GAAAnB,OAAA;AAEA,IAAAoB,QAAA,GAAApB,OAAA;AAA6C,IAAAqB,KAAA;EAAAC,YAAA;AAAA,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAzB,wBAAA6B,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,uCAAA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A;IAAA;EAAA,GAAsBtE,QAAgC,CAC/D,CACI,CACT,CAAC;AAEnB,CAAC;AAuBM,IAAM8E,IAAI,GAAG,SAAPA,IAAIA,CAGfjF,KAAuD,EACpD;EACH,IAAAkF,kBAAA,GAAkB,IAAAC,iCAAiB,EAAC,CAAC;IAA7BpE,KAAK,GAAAmE,kBAAA,CAALnE,KAAK;EAEb,OAAOhE,MAAA,YAAAmH,aAAA,CAACnE,eAAe,MAAA4E,SAAA;IAAO5D,KAAK,EAALA;EAAK,GAAQf,KAAK;IAAAqE,MAAA,EAAA/F,KAAA;IAAAgG,QAAA;MAAAC,QAAA,EAAAhG,YAAA;MAAAiG,UAAA;MAAAC,YAAA;IAAA;EAAA,EAAG,CAAC;AACtD,CAAC;AAACW,OAAA,CAAAH,IAAA,GAAAA,IAAA"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_useAppSettings","_useCreateChatContext","_useIsOnline2","_useMutedUsers","_useSyncDatabase","_ChannelsStateContext","_ChatContext","_DebugContext","_OverlayContext","_ThemeContext","_TranslationContext","_useStreami18n","_init","_interopRequireDefault","_native","_QuickSqliteClient","_DBSyncManager","_StreamChatRN","_version","_this","_jsxFileName","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","init","ChatWithContext","props","_client$user","children","client","_props$closeConnectio","closeConnectionOnBackground","_props$enableOfflineS","enableOfflineSupport","i18nInstance","_props$ImageComponent","ImageComponent","Image","_props$resizableCDNHo","resizableCDNHosts","style","_useState","useState","_useState2","_slicedToArray2","channel","setChannel","translators","useStreami18n","_useIsOnline","useIsOnline","connectionRecovering","isOnline","_useState3","initialised","_useState4","initialisedDatabaseConfig","setInitialisedDatabaseConfig","mutedUsers","useMutedUsers","debugRef","useDebugContext","isDebugModeEnabled","__DEV__","current","userID","StreamChatRN","setConfig","useEffect","setUserAgent","SDK","Platform","OS","version","recoverStateOnReconnect","persistUserOnConnectionFailure","setEventType","setSendEventParams","action","data","user","setActiveChannel","newChannel","QuickSqliteClient","initializeDatabase","DBSyncManager","initialisedDatabase","appSettings","useAppSettings","chatContext","useCreateChatContext","useSyncDatabase","createElement","ChatProvider","value","__self","__source","fileName","lineNumber","columnNumber","TranslationProvider","_extends2","userLanguage","language","DEFAULT_USER_LANGUAGE","ThemeProvider","ChannelsStateProvider","Chat","_useOverlayContext","useOverlayContext","exports"],"sources":["Chat.tsx"],"sourcesContent":["import React, { PropsWithChildren, useEffect, useState } from 'react';\nimport { Image, Platform } from 'react-native';\n\nimport type { Channel, StreamChat } from 'stream-chat';\n\nimport { useAppSettings } from './hooks/useAppSettings';\nimport { useCreateChatContext } from './hooks/useCreateChatContext';\nimport { useIsOnline } from './hooks/useIsOnline';\nimport { useMutedUsers } from './hooks/useMutedUsers';\n\nimport { useSyncDatabase } from './hooks/useSyncDatabase';\n\nimport { ChannelsStateProvider } from '../../contexts/channelsStateContext/ChannelsStateContext';\nimport { ChatContextValue, ChatProvider } from '../../contexts/chatContext/ChatContext';\nimport { useDebugContext } from '../../contexts/debugContext/DebugContext';\nimport { useOverlayContext } from '../../contexts/overlayContext/OverlayContext';\nimport { DeepPartial, ThemeProvider } from '../../contexts/themeContext/ThemeContext';\nimport type { Theme } from '../../contexts/themeContext/utils/theme';\nimport {\n DEFAULT_USER_LANGUAGE,\n TranslationProvider,\n} from '../../contexts/translationContext/TranslationContext';\nimport { useStreami18n } from '../../hooks/useStreami18n';\nimport init from '../../init';\n\nimport { SDK } from '../../native';\nimport { QuickSqliteClient } from '../../store/QuickSqliteClient';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { DBSyncManager } from '../../utils/DBSyncManager';\nimport { StreamChatRN } from '../../utils/StreamChatRN';\nimport type { Streami18n } from '../../utils/Streami18n';\nimport { version } from '../../version.json';\n\ninit();\n\nexport type ChatProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<ChatContextValue<StreamChatGenerics>, 'client'> &\n Partial<Pick<ChatContextValue<StreamChatGenerics>, 'ImageComponent' | 'resizableCDNHosts'>> & {\n /**\n * When false, ws connection won't be disconnection upon backgrounding the app.\n * To receive push notifications, its necessary that user doesn't have active\n * websocket connection. So by default, we disconnect websocket connection when\n * app goes to background, and reconnect when app comes to foreground.\n */\n closeConnectionOnBackground?: boolean;\n /**\n * Enables offline storage and loading for chat data.\n */\n enableOfflineSupport?: boolean;\n /**\n * Instance of Streami18n class should be provided to Chat component to enable internationalization.\n *\n * Stream provides following list of in-built translations:\n * 1. English (en)\n * 2. Dutch (nl)\n * 3. ...\n * 4. ...\n *\n * Simplest way to start using chat components in one of the in-built languages would be following:\n *\n * ```\n * const i18n = new Streami18n('nl');\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n *\n * If you would like to override certain keys in in-built translation.\n * UI will be automatically updated in this case.\n *\n * ```\n * const i18n = new Streami18n('nl');\n *\n * i18n.registerTranslation('nl', {\n * 'Nothing yet...': 'Nog Niet ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} en {{ secondUser }} zijn aan het typen...',\n * });\n *\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n *\n * You can use the same function to add whole new language.\n *\n * ```\n * const i18n = new Streami18n('it');\n *\n * i18n.registerTranslation('it', {\n * 'Nothing yet...': 'Non ancora ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} a {{ secondUser }} stanno scrivendo...',\n * });\n *\n * // Make sure to call setLanguage to reflect new language in UI.\n * i18n.setLanguage('it');\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n */\n i18nInstance?: Streami18n;\n /**\n * You can pass the theme object to customize the styles of Chat components. You can check the default theme in [theme.ts](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/contexts/themeContext/utils/theme.ts)\n *\n * Please check section about [themes in cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#theme) for details.\n *\n * ```\n * import type { DeepPartial, Theme } from 'stream-chat-react-native';\n *\n * const theme: DeepPartial<Theme> = {\n * messageSimple: {\n * file: {\n * container: {\n * backgroundColor: 'red',\n * },\n * icon: {\n * height: 16,\n * width: 16,\n * },\n * },\n * },\n * };\n *\n * <Chat style={theme}>\n * </Chat>\n * ```\n *\n * @overrideType object\n */\n style?: DeepPartial<Theme>;\n };\n\nconst ChatWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: PropsWithChildren<ChatProps<StreamChatGenerics>>,\n) => {\n const {\n children,\n client,\n closeConnectionOnBackground = true,\n enableOfflineSupport = false,\n i18nInstance,\n ImageComponent = Image,\n resizableCDNHosts = ['.stream-io-cdn.com'],\n style,\n } = props;\n\n const [channel, setChannel] = useState<Channel<StreamChatGenerics>>();\n\n // Setup translators\n const translators = useStreami18n(i18nInstance);\n\n /**\n * Setup connection event listeners\n */\n const { connectionRecovering, isOnline } = useIsOnline<StreamChatGenerics>(\n client,\n closeConnectionOnBackground,\n );\n\n const [initialisedDatabaseConfig, setInitialisedDatabaseConfig] = useState<{\n initialised: boolean;\n userID?: string;\n }>({\n initialised: false,\n });\n\n /**\n * Setup muted user listener\n * TODO: reimplement\n */\n const mutedUsers = useMutedUsers<StreamChatGenerics>(client);\n\n const debugRef = useDebugContext();\n const isDebugModeEnabled = __DEV__ && debugRef && debugRef.current;\n\n const userID = client.userID;\n\n // Set the `resizableCDNHosts` as per the prop.\n StreamChatRN.setConfig({ resizableCDNHosts });\n\n useEffect(() => {\n if (client) {\n client.setUserAgent(`${SDK}-${Platform.OS}-${version}`);\n // This is to disable recovery related logic in js client, since we handle it in this SDK\n client.recoverStateOnReconnect = false;\n client.persistUserOnConnectionFailure = enableOfflineSupport;\n }\n\n if (isDebugModeEnabled) {\n if (debugRef.current.setEventType) debugRef.current.setEventType('send');\n if (debugRef.current.setSendEventParams)\n debugRef.current.setSendEventParams({\n action: 'Client',\n data: client.user,\n });\n }\n }, [client, enableOfflineSupport]);\n\n const setActiveChannel = (newChannel?: Channel<StreamChatGenerics>) => setChannel(newChannel);\n\n useEffect(() => {\n if (userID && enableOfflineSupport) {\n setInitialisedDatabaseConfig({ initialised: false, userID });\n QuickSqliteClient.initializeDatabase();\n DBSyncManager.init(client as unknown as StreamChat);\n setInitialisedDatabaseConfig({ initialised: true, userID });\n }\n }, [userID, enableOfflineSupport]);\n\n const initialisedDatabase =\n initialisedDatabaseConfig.initialised && userID === initialisedDatabaseConfig.userID;\n\n const appSettings = useAppSettings(client, isOnline, enableOfflineSupport, initialisedDatabase);\n\n const chatContext = useCreateChatContext({\n appSettings,\n channel,\n client,\n connectionRecovering,\n enableOfflineSupport,\n ImageComponent,\n isOnline,\n mutedUsers,\n resizableCDNHosts,\n setActiveChannel,\n });\n\n useSyncDatabase({\n client,\n enableOfflineSupport,\n initialisedDatabase,\n });\n\n if (userID && enableOfflineSupport && !initialisedDatabase) {\n // if user id has been set and offline support is enabled, we need to wait for database to be initialised\n return null;\n }\n\n return (\n <ChatProvider<StreamChatGenerics> value={chatContext}>\n <TranslationProvider\n value={{ ...translators, userLanguage: client.user?.language || DEFAULT_USER_LANGUAGE }}\n >\n <ThemeProvider style={style}>\n <ChannelsStateProvider<StreamChatGenerics>>{children}</ChannelsStateProvider>\n </ThemeProvider>\n </TranslationProvider>\n </ChatProvider>\n );\n};\n\n/**\n * Chat - Wrapper component for Chat. The needs to be placed around any other chat components.\n * This Chat component provides the ChatContext to all other components.\n *\n * The ChatContext provides the following props:\n *\n * - channel - currently active channel\n * - client - client connection\n * - connectionRecovering - whether or not websocket is reconnecting\n * - isOnline - whether or not set user is active\n * - setActiveChannel - function to set the currently active channel\n *\n * The Chat Component takes the following generics in order:\n * - At (AttachmentType) - custom Attachment object extension\n * - Ct (ChannelType) - custom Channel object extension\n * - Co (CommandType) - custom Command string union extension\n * - Ev (EventType) - custom Event object extension\n * - Me (MessageType) - custom Message object extension\n * - Re (ReactionType) - custom Reaction object extension\n * - Us (UserType) - custom User object extension\n */\nexport const Chat = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: PropsWithChildren<ChatProps<StreamChatGenerics>>,\n) => {\n const { style } = useOverlayContext();\n\n return <ChatWithContext {...{ style }} {...props} />;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AAEA,IAAAM,gBAAA,GAAAN,OAAA;AAEA,IAAAO,qBAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,eAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAEA,IAAAY,mBAAA,GAAAZ,OAAA;AAIA,IAAAa,cAAA,GAAAb,OAAA;AACA,IAAAc,KAAA,GAAAC,sBAAA,CAAAf,OAAA;AAEA,IAAAgB,OAAA,GAAAhB,OAAA;AACA,IAAAiB,kBAAA,GAAAjB,OAAA;AAEA,IAAAkB,cAAA,GAAAlB,OAAA;AACA,IAAAmB,aAAA,GAAAnB,OAAA;AAEA,IAAAoB,QAAA,GAAApB,OAAA;AAA6C,IAAAqB,KAAA;EAAAC,YAAA;AAAA,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SA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