stream-chat-react-native-core 5.25.0-beta.5 → 5.25.0-beta.7
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.
- package/lib/commonjs/components/Channel/Channel.js +20 -15
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +3 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateOwnCapabilitiesContext.js +22 -5
- package/lib/commonjs/components/Channel/hooks/useCreateOwnCapabilitiesContext.js.map +1 -1
- package/lib/commonjs/components/Chat/Chat.js +10 -6
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useSyncDatabase.js +4 -3
- package/lib/commonjs/components/Chat/hooks/useSyncDatabase.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +5 -2
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +7 -3
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +7 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +5 -5
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +32 -30
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +3 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/i18n/en.json +1 -1
- package/lib/commonjs/i18n/es.json +57 -57
- package/lib/commonjs/i18n/fr.json +57 -57
- package/lib/commonjs/i18n/he.json +57 -57
- package/lib/commonjs/i18n/hi.json +57 -57
- package/lib/commonjs/i18n/it.json +57 -57
- package/lib/commonjs/i18n/ja.json +57 -57
- package/lib/commonjs/i18n/ko.json +57 -57
- package/lib/commonjs/i18n/nl.json +57 -57
- package/lib/commonjs/i18n/ru.json +54 -54
- package/lib/commonjs/i18n/tr.json +54 -54
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Channel/Channel.js +20 -15
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +3 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateOwnCapabilitiesContext.js +22 -5
- package/lib/module/components/Channel/hooks/useCreateOwnCapabilitiesContext.js.map +1 -1
- package/lib/module/components/Chat/Chat.js +10 -6
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/Chat/hooks/useSyncDatabase.js +4 -3
- package/lib/module/components/Chat/hooks/useSyncDatabase.js.map +1 -1
- package/lib/module/components/Message/Message.js +5 -2
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +7 -3
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +7 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +5 -5
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +32 -30
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +3 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/i18n/en.json +1 -1
- package/lib/module/i18n/es.json +57 -57
- package/lib/module/i18n/fr.json +57 -57
- package/lib/module/i18n/he.json +57 -57
- package/lib/module/i18n/hi.json +57 -57
- package/lib/module/i18n/it.json +57 -57
- package/lib/module/i18n/ja.json +57 -57
- package/lib/module/i18n/ko.json +57 -57
- package/lib/module/i18n/nl.json +57 -57
- package/lib/module/i18n/ru.json +54 -54
- package/lib/module/i18n/tr.json +54 -54
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +62 -1
- package/lib/typescript/components/Chat/hooks/useSyncDatabase.d.ts +2 -1
- package/lib/typescript/components/Message/MessageSimple/MessageSimple.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +2 -2
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/i18n/en.json +1 -1
- package/lib/typescript/i18n/es.json +57 -57
- package/lib/typescript/i18n/fr.json +57 -57
- package/lib/typescript/i18n/he.json +57 -57
- package/lib/typescript/i18n/hi.json +57 -57
- package/lib/typescript/i18n/it.json +57 -57
- package/lib/typescript/i18n/ja.json +57 -57
- package/lib/typescript/i18n/ko.json +57 -57
- package/lib/typescript/i18n/nl.json +57 -57
- package/lib/typescript/i18n/ru.json +54 -54
- package/lib/typescript/i18n/tr.json +54 -54
- package/package.json +2 -2
- package/src/components/Channel/Channel.tsx +8 -2
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +11 -1
- package/src/components/Channel/hooks/useCreateOwnCapabilitiesContext.ts +24 -6
- package/src/components/Chat/Chat.tsx +5 -0
- package/src/components/Chat/hooks/useSyncDatabase.ts +4 -2
- package/src/components/Message/Message.tsx +6 -1
- package/src/components/Message/MessageSimple/MessageContent.tsx +5 -0
- package/src/components/Message/MessageSimple/MessageSimple.tsx +8 -2
- package/src/components/MessageInput/MessageInput.tsx +3 -7
- package/src/components/MessageList/MessageList.tsx +3 -1
- package/src/contexts/messageInputContext/MessageInputContext.tsx +1 -1
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +3 -0
- package/src/i18n/en.json +1 -1
- package/src/i18n/es.json +57 -57
- package/src/i18n/fr.json +57 -57
- package/src/i18n/he.json +57 -57
- package/src/i18n/hi.json +57 -57
- package/src/i18n/it.json +57 -57
- package/src/i18n/ja.json +57 -57
- package/src/i18n/ko.json +57 -57
- package/src/i18n/nl.json +57 -57
- package/src/i18n/ru.json +54 -54
- package/src/i18n/tr.json +54 -54
- package/src/version.json +1 -1
|
@@ -14,6 +14,7 @@ var useCreateInputMessageInputContext = function useCreateInputMessageInputConte
|
|
|
14
14
|
CommandsButton = _ref.CommandsButton,
|
|
15
15
|
compressImageQuality = _ref.compressImageQuality,
|
|
16
16
|
CooldownTimer = _ref.CooldownTimer,
|
|
17
|
+
disabled = _ref.disabled,
|
|
17
18
|
doDocUploadRequest = _ref.doDocUploadRequest,
|
|
18
19
|
doImageUploadRequest = _ref.doImageUploadRequest,
|
|
19
20
|
editing = _ref.editing,
|
|
@@ -59,6 +60,7 @@ var useCreateInputMessageInputContext = function useCreateInputMessageInputConte
|
|
|
59
60
|
CommandsButton: CommandsButton,
|
|
60
61
|
compressImageQuality: compressImageQuality,
|
|
61
62
|
CooldownTimer: CooldownTimer,
|
|
63
|
+
disabled: disabled,
|
|
62
64
|
doDocUploadRequest: doDocUploadRequest,
|
|
63
65
|
doImageUploadRequest: doImageUploadRequest,
|
|
64
66
|
editing: editing,
|
|
@@ -92,7 +94,7 @@ var useCreateInputMessageInputContext = function useCreateInputMessageInputConte
|
|
|
92
94
|
ShowThreadMessageInChannelButton: ShowThreadMessageInChannelButton,
|
|
93
95
|
UploadProgressIndicator: UploadProgressIndicator
|
|
94
96
|
};
|
|
95
|
-
}, [compressImageQuality, channelId, editingDep, initialValue, maxMessageLength, quotedMessageId]);
|
|
97
|
+
}, [compressImageQuality, channelId, disabled, editingDep, initialValue, maxMessageLength, quotedMessageId]);
|
|
96
98
|
return inputMessageInputContext;
|
|
97
99
|
};
|
|
98
100
|
exports.useCreateInputMessageInputContext = useCreateInputMessageInputContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","useCreateInputMessageInputContext","_ref","additionalTextInputProps","AttachButton","autoCompleteSuggestionsLimit","autoCompleteTriggerSettings","channelId","clearEditingState","clearQuotedMessageState","CommandsButton","compressImageQuality","CooldownTimer","doDocUploadRequest","doImageUploadRequest","editing","editMessage","emojiSearchIndex","FileUploadPreview","hasCommands","hasFilePicker","hasImagePicker","ImageUploadPreview","initialValue","Input","InputButtons","InputEditingStateHeader","InputGiphySearch","InputReplyStateHeader","maxMessageLength","maxNumberOfFiles","mentionAllAppUsersEnabled","mentionAllAppUsersQuery","MoreOptionsButton","numberOfLines","onChangeText","quotedMessage","SendButton","sendImageAsync","sendMessage","SendMessageDisallowedIndicator","setInputRef","setQuotedMessageState","ShowThreadMessageInChannelButton","UploadProgressIndicator","editingDep","id","quotedMessageId","inputMessageInputContext","useMemo","exports"],"sources":["useCreateInputMessageInputContext.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport type { InputMessageInputContextValue } from '../../../contexts/messageInputContext/MessageInputContext';\nimport type { DefaultStreamChatGenerics } from '../../../types/types';\n\nexport const useCreateInputMessageInputContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n additionalTextInputProps,\n AttachButton,\n autoCompleteSuggestionsLimit,\n autoCompleteTriggerSettings,\n channelId,\n clearEditingState,\n clearQuotedMessageState,\n CommandsButton,\n compressImageQuality,\n CooldownTimer,\n doDocUploadRequest,\n doImageUploadRequest,\n editing,\n editMessage,\n emojiSearchIndex,\n FileUploadPreview,\n hasCommands,\n hasFilePicker,\n hasImagePicker,\n ImageUploadPreview,\n initialValue,\n Input,\n InputButtons,\n InputEditingStateHeader,\n InputGiphySearch,\n InputReplyStateHeader,\n maxMessageLength,\n maxNumberOfFiles,\n mentionAllAppUsersEnabled,\n mentionAllAppUsersQuery,\n MoreOptionsButton,\n numberOfLines,\n onChangeText,\n quotedMessage,\n SendButton,\n sendImageAsync,\n sendMessage,\n SendMessageDisallowedIndicator,\n setInputRef,\n setQuotedMessageState,\n ShowThreadMessageInChannelButton,\n UploadProgressIndicator,\n}: InputMessageInputContextValue<StreamChatGenerics> & {\n /**\n * To ensure we allow re-render, when channel is changed\n */\n channelId?: string;\n}) => {\n const editingDep = typeof editing === 'boolean' ? editing : editing?.id;\n const quotedMessageId = quotedMessage\n ? typeof quotedMessage === 'boolean'\n ? ''\n : quotedMessage.id\n : '';\n\n const inputMessageInputContext: InputMessageInputContextValue<StreamChatGenerics> = useMemo(\n () => ({\n additionalTextInputProps,\n AttachButton,\n autoCompleteSuggestionsLimit,\n autoCompleteTriggerSettings,\n clearEditingState,\n clearQuotedMessageState,\n CommandsButton,\n compressImageQuality,\n CooldownTimer,\n doDocUploadRequest,\n doImageUploadRequest,\n editing,\n editMessage,\n emojiSearchIndex,\n FileUploadPreview,\n hasCommands,\n hasFilePicker,\n hasImagePicker,\n ImageUploadPreview,\n initialValue,\n Input,\n InputButtons,\n InputEditingStateHeader,\n InputGiphySearch,\n InputReplyStateHeader,\n maxMessageLength,\n maxNumberOfFiles,\n mentionAllAppUsersEnabled,\n mentionAllAppUsersQuery,\n MoreOptionsButton,\n numberOfLines,\n onChangeText,\n quotedMessage,\n SendButton,\n sendImageAsync,\n sendMessage,\n SendMessageDisallowedIndicator,\n setInputRef,\n setQuotedMessageState,\n ShowThreadMessageInChannelButton,\n UploadProgressIndicator,\n }),\n [compressImageQuality
|
|
1
|
+
{"version":3,"names":["_react","require","useCreateInputMessageInputContext","_ref","additionalTextInputProps","AttachButton","autoCompleteSuggestionsLimit","autoCompleteTriggerSettings","channelId","clearEditingState","clearQuotedMessageState","CommandsButton","compressImageQuality","CooldownTimer","disabled","doDocUploadRequest","doImageUploadRequest","editing","editMessage","emojiSearchIndex","FileUploadPreview","hasCommands","hasFilePicker","hasImagePicker","ImageUploadPreview","initialValue","Input","InputButtons","InputEditingStateHeader","InputGiphySearch","InputReplyStateHeader","maxMessageLength","maxNumberOfFiles","mentionAllAppUsersEnabled","mentionAllAppUsersQuery","MoreOptionsButton","numberOfLines","onChangeText","quotedMessage","SendButton","sendImageAsync","sendMessage","SendMessageDisallowedIndicator","setInputRef","setQuotedMessageState","ShowThreadMessageInChannelButton","UploadProgressIndicator","editingDep","id","quotedMessageId","inputMessageInputContext","useMemo","exports"],"sources":["useCreateInputMessageInputContext.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport type { InputMessageInputContextValue } from '../../../contexts/messageInputContext/MessageInputContext';\nimport type { DefaultStreamChatGenerics } from '../../../types/types';\n\nexport const useCreateInputMessageInputContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n additionalTextInputProps,\n AttachButton,\n autoCompleteSuggestionsLimit,\n autoCompleteTriggerSettings,\n channelId,\n clearEditingState,\n clearQuotedMessageState,\n CommandsButton,\n compressImageQuality,\n CooldownTimer,\n disabled,\n doDocUploadRequest,\n doImageUploadRequest,\n editing,\n editMessage,\n emojiSearchIndex,\n FileUploadPreview,\n hasCommands,\n hasFilePicker,\n hasImagePicker,\n ImageUploadPreview,\n initialValue,\n Input,\n InputButtons,\n InputEditingStateHeader,\n InputGiphySearch,\n InputReplyStateHeader,\n maxMessageLength,\n maxNumberOfFiles,\n mentionAllAppUsersEnabled,\n mentionAllAppUsersQuery,\n MoreOptionsButton,\n numberOfLines,\n onChangeText,\n quotedMessage,\n SendButton,\n sendImageAsync,\n sendMessage,\n SendMessageDisallowedIndicator,\n setInputRef,\n setQuotedMessageState,\n ShowThreadMessageInChannelButton,\n UploadProgressIndicator,\n}: InputMessageInputContextValue<StreamChatGenerics> & {\n /**\n * To ensure we allow re-render, when channel is changed\n */\n channelId?: string;\n}) => {\n const editingDep = typeof editing === 'boolean' ? editing : editing?.id;\n const quotedMessageId = quotedMessage\n ? typeof quotedMessage === 'boolean'\n ? ''\n : quotedMessage.id\n : '';\n\n const inputMessageInputContext: InputMessageInputContextValue<StreamChatGenerics> = useMemo(\n () => ({\n additionalTextInputProps,\n AttachButton,\n autoCompleteSuggestionsLimit,\n autoCompleteTriggerSettings,\n clearEditingState,\n clearQuotedMessageState,\n CommandsButton,\n compressImageQuality,\n CooldownTimer,\n disabled,\n doDocUploadRequest,\n doImageUploadRequest,\n editing,\n editMessage,\n emojiSearchIndex,\n FileUploadPreview,\n hasCommands,\n hasFilePicker,\n hasImagePicker,\n ImageUploadPreview,\n initialValue,\n Input,\n InputButtons,\n InputEditingStateHeader,\n InputGiphySearch,\n InputReplyStateHeader,\n maxMessageLength,\n maxNumberOfFiles,\n mentionAllAppUsersEnabled,\n mentionAllAppUsersQuery,\n MoreOptionsButton,\n numberOfLines,\n onChangeText,\n quotedMessage,\n SendButton,\n sendImageAsync,\n sendMessage,\n SendMessageDisallowedIndicator,\n setInputRef,\n setQuotedMessageState,\n ShowThreadMessageInChannelButton,\n UploadProgressIndicator,\n }),\n [\n compressImageQuality,\n channelId,\n disabled,\n editingDep,\n initialValue,\n maxMessageLength,\n quotedMessageId,\n ],\n );\n\n return inputMessageInputContext;\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKO,IAAMC,iCAAiC,GAAG,SAApCA,iCAAiCA,CAAAC,IAAA,EAmDxC;EAAA,IAhDJC,wBAAwB,GAAAD,IAAA,CAAxBC,wBAAwB;IACxBC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IACZC,4BAA4B,GAAAH,IAAA,CAA5BG,4BAA4B;IAC5BC,2BAA2B,GAAAJ,IAAA,CAA3BI,2BAA2B;IAC3BC,SAAS,GAAAL,IAAA,CAATK,SAAS;IACTC,iBAAiB,GAAAN,IAAA,CAAjBM,iBAAiB;IACjBC,uBAAuB,GAAAP,IAAA,CAAvBO,uBAAuB;IACvBC,cAAc,GAAAR,IAAA,CAAdQ,cAAc;IACdC,oBAAoB,GAAAT,IAAA,CAApBS,oBAAoB;IACpBC,aAAa,GAAAV,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,gBAAgB;MAChBC,qBAAqB,EAArBA,qBAAqB;MACrBC,gBAAgB,EAAhBA,gBAAgB;MAChBC,gBAAgB,EAAhBA,gBAAgB;MAChBC,yBAAyB,EAAzBA,yBAAyB;MACzBC,uBAAuB,EAAvBA,uBAAuB;MACvBC,iBAAiB,EAAjBA,iBAAiB;MACjBC,aAAa,EAAbA,aAAa;MACbC,YAAY,EAAZA,YAAY;MACZC,aAAa,EAAbA,aAAa;MACbC,UAAU,EAAVA,UAAU;MACVC,cAAc,EAAdA,cAAc;MACdC,WAAW,EAAXA,WAAW;MACXC,8BAA8B,EAA9BA,8BAA8B;MAC9BC,WAAW,EAAXA,WAAW;MACXC,qBAAqB,EAArBA,qBAAqB;MACrBC,gCAAgC,EAAhCA,gCAAgC;MAChCC,uBAAuB,EAAvBA;IACF,CAAC;EAAA,CAAC,EACF,CACElC,oBAAoB,EACpBJ,SAAS,EACTM,QAAQ,EACRiC,UAAU,EACVtB,YAAY,EACZM,gBAAgB,EAChBkB,eAAe,CAEnB,CAAC;EAED,OAAOC,wBAAwB;AACjC,CAAC;AAACE,OAAA,CAAAlD,iCAAA,GAAAA,iCAAA"}
|
|
@@ -5,23 +5,40 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.useCreateOwnCapabilitiesContext = void 0;
|
|
6
6
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
7
|
var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
8
9
|
var _react = require("react");
|
|
9
10
|
var _OwnCapabilitiesContext = require("../../../contexts/ownCapabilitiesContext/OwnCapabilitiesContext");
|
|
10
11
|
var useCreateOwnCapabilitiesContext = function useCreateOwnCapabilitiesContext(_ref) {
|
|
11
|
-
var _channel$data, _channel$
|
|
12
|
+
var _channel$data, _channel$data3;
|
|
12
13
|
var channel = _ref.channel,
|
|
13
14
|
overrideCapabilities = _ref.overrideCapabilities;
|
|
15
|
+
var _useState = (0, _react.useState)(JSON.stringify((_channel$data = channel.data) == null ? void 0 : _channel$data.own_capabilities)),
|
|
16
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
17
|
+
own_capabilities = _useState2[0],
|
|
18
|
+
setOwnCapabilites = _useState2[1];
|
|
14
19
|
var overrideCapabilitiesStr = overrideCapabilities ? JSON.stringify(Object.values(overrideCapabilities)) : null;
|
|
15
|
-
|
|
20
|
+
(0, _react.useEffect)(function () {
|
|
21
|
+
var _channel$data2;
|
|
22
|
+
setOwnCapabilites(JSON.stringify((_channel$data2 = channel.data) == null ? void 0 : _channel$data2.own_capabilities));
|
|
23
|
+
}, [(_channel$data3 = channel.data) == null ? void 0 : _channel$data3.own_capabilities]);
|
|
24
|
+
(0, _react.useEffect)(function () {
|
|
25
|
+
var listener = channel.on('capabilities.changed', function (event) {
|
|
26
|
+
if (event.own_capabilities) {
|
|
27
|
+
setOwnCapabilites(JSON.stringify(event.own_capabilities));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return function () {
|
|
31
|
+
listener.unsubscribe();
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
16
34
|
var ownCapabilitiesContext = (0, _react.useMemo)(function () {
|
|
17
|
-
var
|
|
18
|
-
var capabilities = (channel == null ? void 0 : (_channel$data3 = channel.data) == null ? void 0 : _channel$data3.own_capabilities) || [];
|
|
35
|
+
var capabilities = own_capabilities || [];
|
|
19
36
|
var ownCapabilitiesContext = Object.keys(_OwnCapabilitiesContext.allOwnCapabilities).reduce(function (result, capability) {
|
|
20
37
|
var _overrideCapabilities;
|
|
21
38
|
return (0, _extends3["default"])({}, result, (0, _defineProperty2["default"])({}, capability, (_overrideCapabilities = overrideCapabilities == null ? void 0 : overrideCapabilities[capability]) != null ? _overrideCapabilities : !!capabilities.includes(_OwnCapabilitiesContext.allOwnCapabilities[capability])));
|
|
22
39
|
}, {});
|
|
23
40
|
return ownCapabilitiesContext;
|
|
24
|
-
}, [channel.id, overrideCapabilitiesStr,
|
|
41
|
+
}, [channel.id, overrideCapabilitiesStr, own_capabilities]);
|
|
25
42
|
return ownCapabilitiesContext;
|
|
26
43
|
};
|
|
27
44
|
exports.useCreateOwnCapabilitiesContext = useCreateOwnCapabilitiesContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_OwnCapabilitiesContext","useCreateOwnCapabilitiesContext","_ref","_channel$data","_channel$
|
|
1
|
+
{"version":3,"names":["_react","require","_OwnCapabilitiesContext","useCreateOwnCapabilitiesContext","_ref","_channel$data","_channel$data3","channel","overrideCapabilities","_useState","useState","JSON","stringify","data","own_capabilities","_useState2","_slicedToArray2","setOwnCapabilites","overrideCapabilitiesStr","Object","values","useEffect","_channel$data2","listener","on","event","unsubscribe","ownCapabilitiesContext","useMemo","capabilities","keys","allOwnCapabilities","reduce","result","capability","_overrideCapabilities","_extends3","_defineProperty2","includes","id","exports"],"sources":["useCreateOwnCapabilitiesContext.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport type { Channel } from 'stream-chat';\n\nimport {\n allOwnCapabilities,\n OwnCapabilitiesContextValue,\n OwnCapability,\n} from '../../../contexts/ownCapabilitiesContext/OwnCapabilitiesContext';\nimport type { DefaultStreamChatGenerics } from '../../../types/types';\n\nexport const useCreateOwnCapabilitiesContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n channel,\n overrideCapabilities,\n}: {\n channel: Channel<StreamChatGenerics>;\n overrideCapabilities?: Partial<OwnCapabilitiesContextValue>;\n}) => {\n const [own_capabilities, setOwnCapabilites] = useState(\n JSON.stringify(channel.data?.own_capabilities as Array<string>),\n );\n const overrideCapabilitiesStr = overrideCapabilities\n ? JSON.stringify(Object.values(overrideCapabilities))\n : null;\n\n // Effect to watch for changes in channel.data?.own_capabilities and update the own_capabilties state accordingly.\n useEffect(() => {\n setOwnCapabilites(JSON.stringify(channel.data?.own_capabilities as Array<string>));\n }, [channel.data?.own_capabilities]);\n\n // Effect to listen to the `capabilities.changed` event.\n useEffect(() => {\n const listener = channel.on('capabilities.changed', (event) => {\n if (event.own_capabilities) {\n setOwnCapabilites(JSON.stringify(event.own_capabilities as Array<string>));\n }\n });\n\n return () => {\n listener.unsubscribe();\n };\n }, []);\n\n const ownCapabilitiesContext: OwnCapabilitiesContextValue = useMemo(() => {\n const capabilities = (own_capabilities || []) as Array<string>;\n const ownCapabilitiesContext = Object.keys(allOwnCapabilities).reduce(\n (result, capability) => ({\n ...result,\n [capability]:\n overrideCapabilities?.[capability as OwnCapability] ??\n !!capabilities.includes(allOwnCapabilities[capability as OwnCapability]),\n }),\n {} as OwnCapabilitiesContextValue,\n );\n\n return ownCapabilitiesContext;\n }, [channel.id, overrideCapabilitiesStr, own_capabilities]);\n\n return ownCapabilitiesContext;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,uBAAA,GAAAD,OAAA;AAOO,IAAME,+BAA+B,GAAG,SAAlCA,+BAA+BA,CAAAC,IAAA,EAQtC;EAAA,IAAAC,aAAA,EAAAC,cAAA;EAAA,IALJC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,oBAAoB,GAAAJ,IAAA,CAApBI,oBAAoB;EAKpB,IAAAC,SAAA,GAA8C,IAAAC,eAAQ,EACpDC,IAAI,CAACC,SAAS,EAAAP,aAAA,GAACE,OAAO,CAACM,IAAI,qBAAZR,aAAA,CAAcS,gBAAiC,CAChE,CAAC;IAAAC,UAAA,OAAAC,eAAA,aAAAP,SAAA;IAFMK,gBAAgB,GAAAC,UAAA;IAAEE,iBAAiB,GAAAF,UAAA;EAG1C,IAAMG,uBAAuB,GAAGV,oBAAoB,GAChDG,IAAI,CAACC,SAAS,CAACO,MAAM,CAACC,MAAM,CAACZ,oBAAoB,CAAC,CAAC,GACnD,IAAI;EAGR,IAAAa,g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B;AAC/B,CAAC;AAACa,OAAA,CAAArC,+BAAA,GAAAA,+BAAA"}
|
|
@@ -97,14 +97,18 @@ var ChatWithContext = function ChatWithContext(props) {
|
|
|
97
97
|
});
|
|
98
98
|
(0, _useSyncDatabase.useSyncDatabase)({
|
|
99
99
|
client: client,
|
|
100
|
-
enableOfflineSupport: enableOfflineSupport
|
|
100
|
+
enableOfflineSupport: enableOfflineSupport,
|
|
101
|
+
initialisedDatabase: initialisedDatabase
|
|
101
102
|
});
|
|
103
|
+
if (enableOfflineSupport && !initialisedDatabase) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
102
106
|
return _react["default"].createElement(_ChatContext.ChatProvider, {
|
|
103
107
|
value: chatContext,
|
|
104
108
|
__self: _this,
|
|
105
109
|
__source: {
|
|
106
110
|
fileName: _jsxFileName,
|
|
107
|
-
lineNumber:
|
|
111
|
+
lineNumber: 226,
|
|
108
112
|
columnNumber: 5
|
|
109
113
|
}
|
|
110
114
|
}, _react["default"].createElement(_TranslationContext.TranslationProvider, {
|
|
@@ -114,7 +118,7 @@ var ChatWithContext = function ChatWithContext(props) {
|
|
|
114
118
|
__self: _this,
|
|
115
119
|
__source: {
|
|
116
120
|
fileName: _jsxFileName,
|
|
117
|
-
lineNumber:
|
|
121
|
+
lineNumber: 227,
|
|
118
122
|
columnNumber: 7
|
|
119
123
|
}
|
|
120
124
|
}, _react["default"].createElement(_ThemeContext.ThemeProvider, {
|
|
@@ -122,14 +126,14 @@ var ChatWithContext = function ChatWithContext(props) {
|
|
|
122
126
|
__self: _this,
|
|
123
127
|
__source: {
|
|
124
128
|
fileName: _jsxFileName,
|
|
125
|
-
lineNumber:
|
|
129
|
+
lineNumber: 230,
|
|
126
130
|
columnNumber: 9
|
|
127
131
|
}
|
|
128
132
|
}, _react["default"].createElement(_ChannelsStateContext.ChannelsStateProvider, {
|
|
129
133
|
__self: _this,
|
|
130
134
|
__source: {
|
|
131
135
|
fileName: _jsxFileName,
|
|
132
|
-
lineNumber:
|
|
136
|
+
lineNumber: 231,
|
|
133
137
|
columnNumber: 11
|
|
134
138
|
}
|
|
135
139
|
}, children))));
|
|
@@ -143,7 +147,7 @@ var Chat = function Chat(props) {
|
|
|
143
147
|
__self: _this,
|
|
144
148
|
__source: {
|
|
145
149
|
fileName: _jsxFileName,
|
|
146
|
-
lineNumber:
|
|
150
|
+
lineNumber: 266,
|
|
147
151
|
columnNumber: 10
|
|
148
152
|
}
|
|
149
153
|
}));
|
|
@@ -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","_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","style","_useState","useState","_useState2","_slicedToArray2","channel","setChannel","translators","useStreami18n","_useIsOnline","useIsOnline","connectionRecovering","isOnline","_useState3","_useState4","initialisedDatabase","setInitialisedDatabase","mutedUsers","useMutedUsers","debugRef","useDebugContext","isDebugModeEnabled","__DEV__","current","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 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'>> & {\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 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 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 setActiveChannel,\n });\n\n useSyncDatabase({\n client,\n enableOfflineSupport,\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;AAC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AA;IAAA;EAAA,GAExFrH,MAAA,YAAA8G,aAAA,CAACjG,aAAA,CAAA8G,aAAa;IAAC9D,KAAK,EAAEA,KAAM;IAAAoD,MAAA,EAAA3F,KAAA;IAAA4F,QAAA;MAAAC,QAAA,EAAA5F,YAAA;MAAA6F,UAAA;MAAAC,YAAA;IAAA;EAAA,GAC1BrH,MAAA,YAAA8G,aAAA,CAACrG,qBAAA,CAAAmH,qBAAqB;IAAAX,MAAA,EAAA3F,KAAA;IAAA4F,QAAA;MAAAC,QAAA,EAAA5F,YAAA;MAAA6F,UAAA;MAAAC,YAAA;IAAA;EAAA,GAAsBlE,QAAgC,CAC/D,CACI,CACT,CAAC;AAEnB,CAAC;AAuBM,IAAM0E,IAAI,GAAG,SAAPA,IAAIA,CAGf7E,KAAuD,EACpD;EACH,IAAA8E,kBAAA,GAAkB,IAAAC,iCAAiB,EAAC,CAAC;IAA7BlE,KAAK,GAAAiE,kBAAA,CAALjE,KAAK;EAEb,OAAO7D,MAAA,YAAA8G,aAAA,CAAC/D,eAAe,MAAAwE,SAAA;IAAO1D,KAAK,EAALA;EAAK,GAAQb,KAAK;IAAAiE,MAAA,EAAA3F,KAAA;IAAA4F,QAAA;MAAAC,QAAA,EAAA5F,YAAA;MAAA6F,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","_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","style","_useState","useState","_useState2","_slicedToArray2","channel","setChannel","translators","useStreami18n","_useIsOnline","useIsOnline","connectionRecovering","isOnline","_useState3","_useState4","initialisedDatabase","setInitialisedDatabase","mutedUsers","useMutedUsers","debugRef","useDebugContext","isDebugModeEnabled","__DEV__","current","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 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'>> & {\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 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 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 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;AAEA,IAAAmB,QAAA,GAAAnB,OAAA;AAA6C,IAAAoB,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,SAAAxB,wBAAA4B,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IA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,IAAA8E,kBAAA,GAAkB,IAAAC,iCAAiB,EAAC,CAAC;IAA7BlE,KAAK,GAAAiE,kBAAA,CAALjE,KAAK;EAEb,OAAO7D,MAAA,YAAA8G,aAAA,CAAC/D,eAAe,MAAAwE,SAAA;IAAO1D,KAAK,EAALA;EAAK,GAAQb,KAAK;IAAAiE,MAAA,EAAA3F,KAAA;IAAA4F,QAAA;MAAAC,QAAA,EAAA5F,YAAA;MAAA6F,UAAA;MAAAC,YAAA;IAAA;EAAA,EAAG,CAAC;AACtD,CAAC;AAACW,OAAA,CAAAH,IAAA,GAAAA,IAAA"}
|
|
@@ -6,17 +6,18 @@ var _react = require("react");
|
|
|
6
6
|
var _handleEventToSyncDB = require("./handleEventToSyncDB");
|
|
7
7
|
var useSyncDatabase = function useSyncDatabase(_ref) {
|
|
8
8
|
var client = _ref.client,
|
|
9
|
-
enableOfflineSupport = _ref.enableOfflineSupport
|
|
9
|
+
enableOfflineSupport = _ref.enableOfflineSupport,
|
|
10
|
+
initialisedDatabase = _ref.initialisedDatabase;
|
|
10
11
|
(0, _react.useEffect)(function () {
|
|
11
12
|
var listener;
|
|
12
|
-
if (enableOfflineSupport) {
|
|
13
|
+
if (enableOfflineSupport && initialisedDatabase) {
|
|
13
14
|
listener = client == null ? void 0 : client.on(_handleEventToSyncDB.handleEventToSyncDB);
|
|
14
15
|
}
|
|
15
16
|
return function () {
|
|
16
17
|
var _listener;
|
|
17
18
|
(_listener = listener) == null ? void 0 : _listener.unsubscribe();
|
|
18
19
|
};
|
|
19
|
-
}, [client]);
|
|
20
|
+
}, [client, initialisedDatabase]);
|
|
20
21
|
};
|
|
21
22
|
exports.useSyncDatabase = useSyncDatabase;
|
|
22
23
|
//# sourceMappingURL=useSyncDatabase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_handleEventToSyncDB","useSyncDatabase","_ref","client","enableOfflineSupport","useEffect","listener","on","handleEventToSyncDB","_listener","unsubscribe","exports"],"sources":["useSyncDatabase.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport type { StreamChat } from 'stream-chat';\n\nimport { handleEventToSyncDB } from './handleEventToSyncDB';\n\nimport type { DefaultStreamChatGenerics } from '../../../types/types';\n\ntype Params<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {\n client: StreamChat<StreamChatGenerics>;\n enableOfflineSupport: boolean;\n};\nexport const useSyncDatabase = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n client,\n enableOfflineSupport,\n}: Params<StreamChatGenerics>) => {\n useEffect(() => {\n let listener: ReturnType<StreamChat['on']> | undefined;\n\n if (enableOfflineSupport) {\n listener = client?.on(handleEventToSyncDB);\n }\n\n return () => {\n listener?.unsubscribe();\n };\n }, [client]);\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,oBAAA,GAAAD,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","require","_handleEventToSyncDB","useSyncDatabase","_ref","client","enableOfflineSupport","initialisedDatabase","useEffect","listener","on","handleEventToSyncDB","_listener","unsubscribe","exports"],"sources":["useSyncDatabase.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport type { StreamChat } from 'stream-chat';\n\nimport { handleEventToSyncDB } from './handleEventToSyncDB';\n\nimport type { DefaultStreamChatGenerics } from '../../../types/types';\n\ntype Params<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {\n client: StreamChat<StreamChatGenerics>;\n enableOfflineSupport: boolean;\n initialisedDatabase: boolean;\n};\nexport const useSyncDatabase = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n client,\n enableOfflineSupport,\n initialisedDatabase,\n}: Params<StreamChatGenerics>) => {\n useEffect(() => {\n let listener: ReturnType<StreamChat['on']> | undefined;\n\n if (enableOfflineSupport && initialisedDatabase) {\n listener = client?.on(handleEventToSyncDB);\n }\n\n return () => {\n listener?.unsubscribe();\n };\n }, [client, initialisedDatabase]);\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,oBAAA,GAAAD,OAAA;AASO,IAAME,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAMM;EAAA,IAHhCC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,oBAAoB,GAAAF,IAAA,CAApBE,oBAAoB;IACpBC,mBAAmB,GAAAH,IAAA,CAAnBG,mBAAmB;EAEnB,IAAAC,gBAAS,EAAC,YAAM;IACd,IAAIC,QAAkD;IAEtD,IAAIH,oBAAoB,IAAIC,mBAAmB,EAAE;MAC/CE,QAAQ,GAAGJ,MAAM,oBAANA,MAAM,CAAEK,EAAE,CAACC,wCAAmB,CAAC;IAC5C;IAEA,OAAO,YAAM;MAAA,IAAAC,SAAA;MACX,CAAAA,SAAA,GAAAH,QAAQ,qBAARG,SAAA,CAAUC,WAAW,CAAC,CAAC;IACzB,CAAC;EACH,CAAC,EAAE,CAACR,MAAM,EAAEE,mBAAmB,CAAC,CAAC;AACnC,CAAC;AAACO,OAAA,CAAAX,eAAA,GAAAA,eAAA"}
|
|
@@ -376,7 +376,6 @@ var MessageWithContext = function MessageWithContext(props) {
|
|
|
376
376
|
message: message,
|
|
377
377
|
messageActions: messageActions == null ? void 0 : messageActions.filter(Boolean),
|
|
378
378
|
messageContext: (0, _extends2["default"])({}, messageContext, {
|
|
379
|
-
disabled: true,
|
|
380
379
|
preventPress: true
|
|
381
380
|
}),
|
|
382
381
|
messageReactionTitle: !error && messageReactions ? t('Message Reactions') : undefined,
|
|
@@ -569,6 +568,7 @@ var MessageWithContext = function MessageWithContext(props) {
|
|
|
569
568
|
var areEqual = function areEqual(prevProps, nextProps) {
|
|
570
569
|
var _prevMessage$quoted_m, _nextMessage$quoted_m, _prevMessage$quoted_m2, _nextMessage$quoted_m2, _prevMessage$user, _nextMessage$user;
|
|
571
570
|
var prevMutedUsers = prevProps.chatContext.mutedUsers,
|
|
571
|
+
prevDisabled = prevProps.disabled,
|
|
572
572
|
prevGoToMessage = prevProps.goToMessage,
|
|
573
573
|
prevGroupStyles = prevProps.groupStyles,
|
|
574
574
|
isAttachmentEqual = prevProps.isAttachmentEqual,
|
|
@@ -580,6 +580,7 @@ var areEqual = function areEqual(prevProps, nextProps) {
|
|
|
580
580
|
prevShowUnreadUnderlay = prevProps.showUnreadUnderlay,
|
|
581
581
|
prevT = prevProps.t;
|
|
582
582
|
var nextMutedUsers = nextProps.chatContext.mutedUsers,
|
|
583
|
+
nextDisabled = nextProps.disabled,
|
|
583
584
|
nextGoToMessage = nextProps.goToMessage,
|
|
584
585
|
nextGroupStyles = nextProps.groupStyles,
|
|
585
586
|
nextIsTargetedMessage = nextProps.isTargetedMessage,
|
|
@@ -589,6 +590,8 @@ var areEqual = function areEqual(prevProps, nextProps) {
|
|
|
589
590
|
nextMessagesContext = nextProps.messagesContext,
|
|
590
591
|
nextShowUnreadUnderlay = nextProps.showUnreadUnderlay,
|
|
591
592
|
nextT = nextProps.t;
|
|
593
|
+
var disabledEqual = prevDisabled === nextDisabled;
|
|
594
|
+
if (!disabledEqual) return false;
|
|
592
595
|
var membersEqual = Object.keys(prevMembers).length === Object.keys(nextMembers).length;
|
|
593
596
|
if (!membersEqual) return false;
|
|
594
597
|
var repliesEqual = prevMessage.reply_count === nextMessage.reply_count;
|
|
@@ -678,7 +681,7 @@ var Message = function Message(props) {
|
|
|
678
681
|
__self: _this,
|
|
679
682
|
__source: {
|
|
680
683
|
fileName: _jsxFileName,
|
|
681
|
-
lineNumber:
|
|
684
|
+
lineNumber: 936,
|
|
682
685
|
columnNumber: 5
|
|
683
686
|
}
|
|
684
687
|
}));
|