stream-chat 10.0.0-rc.21 → 10.0.0-rc.23
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/dist/cjs/index.browser.js +2196 -3902
- package/dist/cjs/index.browser.js.map +3 -3
- package/dist/cjs/index.node.js +2197 -3902
- package/dist/cjs/index.node.js.map +3 -3
- package/dist/esm/index.mjs +2199 -3905
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +120 -233
- package/dist/types/CooldownTimer.d.ts +8 -23
- package/dist/types/EventHandlerPipeline.d.ts +17 -37
- package/dist/types/LiveLocationManager.d.ts +22 -50
- package/dist/types/api-client.d.ts +9 -14
- package/dist/types/channel.d.ts +253 -448
- package/dist/types/channel_state.d.ts +48 -95
- package/dist/types/client.d.ts +245 -370
- package/dist/types/client_state.d.ts +1 -3
- package/dist/types/configuration/ConfigController.d.ts +30 -124
- package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +31 -123
- package/dist/types/configuration/keys.d.ts +5 -19
- package/dist/types/configuration/shape.d.ts +12 -29
- package/dist/types/configuration/types.d.ts +59 -87
- package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +13 -35
- package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
- package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
- package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
- package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
- package/dist/types/connection/ConnectionIdManager.d.ts +18 -40
- package/dist/types/connection/ConnectionRecoveryManager.d.ts +29 -120
- package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +32 -103
- package/dist/types/connection/networkConnection/reporters.d.ts +9 -32
- package/dist/types/connection/networkConnection/types.d.ts +12 -27
- package/dist/types/connection/wsConnection/StableWSConnection.d.ts +37 -116
- package/dist/types/connection/wsConnection/WSConnection.d.ts +41 -104
- package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +8 -16
- package/dist/types/connection/wsConnection/config.d.ts +8 -28
- package/dist/types/connection/wsConnection/types.d.ts +17 -70
- package/dist/types/entityStore/EntityStore.d.ts +153 -113
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +13 -46
- package/dist/types/errors.d.ts +7 -19
- package/dist/types/gen/chat/ChannelApi.d.ts +2 -1
- package/dist/types/gen/chat/ChatApi.d.ts +28 -14
- package/dist/types/gen/models/index.d.ts +769 -86
- package/dist/types/gen/moderation/ModerationApi.d.ts +4 -4
- package/dist/types/index.d.ts +2 -4
- package/dist/types/languageNames.d.ts +9 -24
- package/dist/types/logger.d.ts +1 -3
- package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
- package/dist/types/messageComposer/attachmentIdentity.d.ts +1 -6
- package/dist/types/messageComposer/attachmentManager.d.ts +10 -32
- package/dist/types/messageComposer/attachmentUtils.d.ts +3 -14
- package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
- package/dist/types/messageComposer/configuration/types.d.ts +29 -56
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +6 -9
- package/dist/types/messageComposer/messageComposer.d.ts +30 -164
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +4 -14
- package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +2 -9
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
- package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +9 -0
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +11 -18
- package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
- package/dist/types/messageComposer/pollComposer.d.ts +8 -4
- package/dist/types/messageComposer/textComposer.d.ts +3 -9
- package/dist/types/messageComposer/types.d.ts +5 -8
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +25 -79
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +15 -82
- package/dist/types/messageOperations/FailedSendCache.d.ts +4 -9
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +10 -20
- package/dist/types/messageOperations/MessageOperations.d.ts +20 -40
- package/dist/types/messageOperations/applyReactionLocally.d.ts +5 -22
- package/dist/types/messageOperations/createMessageOperations.d.ts +3 -5
- package/dist/types/messageOperations/reflectReactionEvent.d.ts +5 -13
- package/dist/types/messageOperations/sendOrdering.d.ts +4 -7
- package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +7 -15
- package/dist/types/messageOperations/types.d.ts +15 -30
- package/dist/types/middleware.d.ts +7 -5
- package/dist/types/moderation.d.ts +21 -14
- package/dist/types/notifications/NotificationManager.d.ts +8 -31
- package/dist/types/notifications/types.d.ts +19 -59
- package/dist/types/offline-support/offline_support_api.d.ts +145 -539
- package/dist/types/offline-support/offline_sync_manager.d.ts +18 -42
- package/dist/types/offline-support/queueableOperations.d.ts +24 -52
- package/dist/types/offline-support/types.d.ts +24 -187
- package/dist/types/pagination/ItemIndex.d.ts +4 -12
- package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +2 -3
- package/dist/types/pagination/paginators/BasePaginator.d.ts +235 -622
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +67 -125
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +133 -292
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +69 -118
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +7 -26
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +2 -2
- package/dist/types/pagination/paginators/ThreadPaginator.d.ts +15 -23
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +2 -6
- package/dist/types/pagination/sortCompiler.d.ts +11 -22
- package/dist/types/pagination/utility.normalization.d.ts +5 -23
- package/dist/types/pagination/utility.search.d.ts +3 -8
- package/dist/types/poll.d.ts +14 -14
- package/dist/types/poll_manager.d.ts +11 -2
- package/dist/types/poll_optimistic_votes.d.ts +10 -14
- package/dist/types/reminders/Reminder.d.ts +4 -4
- package/dist/types/reminders/ReminderManager.d.ts +7 -20
- package/dist/types/search/BaseSearchSource.d.ts +7 -12
- package/dist/types/search/ChannelSearchSource.d.ts +7 -7
- package/dist/types/search/MessageSearchSource.d.ts +7 -9
- package/dist/types/search/SearchController.d.ts +17 -22
- package/dist/types/search/types.d.ts +6 -10
- package/dist/types/signing.d.ts +12 -3
- package/dist/types/thread.d.ts +23 -71
- package/dist/types/thread_manager.d.ts +45 -70
- package/dist/types/token_manager.d.ts +8 -13
- package/dist/types/types.d.ts +64 -125
- package/dist/types/types.utility.d.ts +3 -3
- package/dist/types/upload-utils.d.ts +5 -10
- package/dist/types/uploadManager.d.ts +17 -45
- package/dist/types/utils/FixedSizeQueueCache.d.ts +6 -11
- package/dist/types/utils/WithSubscriptions.d.ts +5 -15
- package/dist/types/utils/concurrency.d.ts +11 -19
- package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
- package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
- package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
- package/dist/types/utils/objectPath.d.ts +6 -41
- package/dist/types/utils/retryable.d.ts +8 -12
- package/dist/types/utils/throttling/throttle.d.ts +8 -23
- package/dist/types/utils/time.d.ts +24 -64
- package/dist/types/utils.d.ts +40 -86
- package/package.json +7 -2
- package/src/ChannelManager.ts +159 -300
- package/src/CooldownTimer.ts +11 -29
- package/src/EventHandlerPipeline.ts +21 -44
- package/src/LiveLocationManager.ts +35 -74
- package/src/api-client.ts +43 -61
- package/src/campaign.ts +1 -1
- package/src/channel.ts +396 -749
- package/src/channel_batch_updater.ts +1 -1
- package/src/channel_state.ts +50 -105
- package/src/client.ts +360 -588
- package/src/client_state.ts +1 -6
- package/src/configuration/ConfigController.ts +41 -157
- package/src/configuration/InstanceConfigurationRegistry.ts +42 -171
- package/src/configuration/index.ts +1 -1
- package/src/configuration/keys.ts +13 -32
- package/src/configuration/shape.ts +67 -70
- package/src/configuration/types.ts +60 -100
- package/src/configuration/utils/applyInstanceConfiguration.ts +21 -53
- package/src/configuration/utils/copyConfigPatch.ts +11 -32
- package/src/configuration/utils/declarativeSlices.ts +9 -39
- package/src/configuration/utils/deepFreezeConfig.ts +3 -17
- package/src/configuration/utils/index.ts +2 -4
- package/src/configuration/utils/serverAuthority.ts +20 -68
- package/src/connection/ConnectionIdManager.ts +20 -49
- package/src/connection/ConnectionRecoveryManager.ts +51 -178
- package/src/connection/networkConnection/NetworkConnectionObserver.ts +37 -114
- package/src/connection/networkConnection/reporters.ts +9 -36
- package/src/connection/networkConnection/types.ts +12 -27
- package/src/connection/wsConnection/StableWSConnection.ts +73 -193
- package/src/connection/wsConnection/WSConnection.ts +56 -131
- package/src/connection/wsConnection/WSConnectionFallback.ts +22 -31
- package/src/connection/wsConnection/config.ts +13 -48
- package/src/connection/wsConnection/types.ts +17 -70
- package/src/constants.ts +4 -4
- package/src/entityStore/EntityStore.ts +162 -167
- package/src/entityStore/StoreBackedItemIndex.ts +14 -47
- package/src/errors.ts +7 -19
- package/src/formatMessageMemo.ts +3 -9
- package/src/gen/chat/ChannelApi.ts +19 -0
- package/src/gen/chat/ChatApi.ts +87 -13
- package/src/gen/models/index.ts +793 -71
- package/src/gen/moderation/ModerationApi.ts +0 -4
- package/src/index.ts +10 -14
- package/src/languageNames.ts +9 -24
- package/src/logger.ts +1 -3
- package/src/messageComposer/LocationComposer.ts +7 -23
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
- package/src/messageComposer/attachmentIdentity.ts +2 -13
- package/src/messageComposer/attachmentManager.ts +17 -63
- package/src/messageComposer/attachmentUtils.ts +3 -17
- package/src/messageComposer/configuration/configuration.ts +5 -8
- package/src/messageComposer/configuration/types.ts +29 -56
- package/src/messageComposer/fileUtils.ts +1 -1
- package/src/messageComposer/linkPreviewsManager.ts +8 -20
- package/src/messageComposer/messageComposer.ts +54 -222
- package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +4 -16
- package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +1 -2
- package/src/messageComposer/middleware/messageComposer/attachments.ts +14 -40
- package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +3 -4
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +4 -11
- package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
- package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
- package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
- package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +1 -6
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +1 -2
- package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
- package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
- package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
- package/src/messageComposer/middleware/textComposer/types.ts +1 -6
- package/src/messageComposer/pollComposer.ts +11 -8
- package/src/messageComposer/textComposer.ts +9 -59
- package/src/messageComposer/types.ts +9 -12
- package/src/messageDelivery/MessageDeliveryReporter.ts +60 -113
- package/src/messageDelivery/MessageReceiptsTracker.ts +21 -105
- package/src/messageOperations/FailedSendCache.ts +4 -9
- package/src/messageOperations/MessageOperationStatePolicy.ts +40 -67
- package/src/messageOperations/MessageOperations.ts +33 -62
- package/src/messageOperations/applyReactionLocally.ts +9 -28
- package/src/messageOperations/createMessageOperations.ts +17 -33
- package/src/messageOperations/reflectReactionEvent.ts +5 -13
- package/src/messageOperations/sendOrdering.ts +4 -7
- package/src/messageOperations/settlePendingAttachmentUploads.ts +10 -21
- package/src/messageOperations/types.ts +15 -30
- package/src/middleware.ts +7 -10
- package/src/moderation.ts +25 -21
- package/src/notifications/NotificationManager.ts +11 -35
- package/src/notifications/types.ts +19 -59
- package/src/offline-support/offline_support_api.ts +178 -608
- package/src/offline-support/offline_sync_manager.ts +25 -69
- package/src/offline-support/queueableOperations.ts +31 -84
- package/src/offline-support/types.ts +25 -188
- package/src/pagination/ItemIndex.ts +4 -12
- package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +13 -62
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +4 -6
- package/src/pagination/filterCompiler.ts +11 -25
- package/src/pagination/paginators/BasePaginator.ts +422 -976
- package/src/pagination/paginators/ChannelPaginator.ts +130 -190
- package/src/pagination/paginators/MessageIntervalPaginator.ts +226 -457
- package/src/pagination/paginators/MessagePaginator.ts +135 -175
- package/src/pagination/paginators/PinnedMessagePaginator.ts +13 -38
- package/src/pagination/paginators/ReminderPaginator.ts +12 -15
- package/src/pagination/paginators/ThreadPaginator.ts +16 -26
- package/src/pagination/paginators/UserGroupPaginator.ts +6 -17
- package/src/pagination/paginators/stateThrottling.ts +5 -10
- package/src/pagination/sortCompiler.ts +23 -50
- package/src/pagination/utility.normalization.ts +8 -30
- package/src/pagination/utility.search.ts +4 -11
- package/src/poll.ts +19 -19
- package/src/poll_manager.ts +16 -20
- package/src/poll_optimistic_votes.ts +17 -22
- package/src/reminders/Reminder.ts +5 -6
- package/src/reminders/ReminderManager.ts +9 -34
- package/src/reminders/ReminderTimer.ts +1 -2
- package/src/search/BaseSearchSource.ts +14 -29
- package/src/search/ChannelSearchSource.ts +8 -8
- package/src/search/MessageSearchSource.ts +19 -25
- package/src/search/SearchController.ts +18 -24
- package/src/search/types.ts +6 -10
- package/src/segment.ts +1 -1
- package/src/signing.ts +23 -3
- package/src/thread.ts +72 -173
- package/src/thread_manager.ts +59 -76
- package/src/token_manager.ts +11 -21
- package/src/types.ts +78 -126
- package/src/types.utility.ts +3 -3
- package/src/upload-utils.ts +5 -10
- package/src/uploadManager.ts +22 -54
- package/src/utils/FixedSizeQueueCache.ts +13 -21
- package/src/utils/WithSubscriptions.ts +5 -15
- package/src/utils/concurrency.ts +16 -55
- package/src/utils/mergeWith/mergeWith.ts +10 -13
- package/src/utils/mergeWith/mergeWithCore.ts +24 -81
- package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
- package/src/utils/objectPath.ts +6 -41
- package/src/utils/retryable.ts +10 -14
- package/src/utils/throttling/throttle.ts +9 -25
- package/src/utils/time.ts +26 -66
- package/src/utils.ts +72 -128
|
@@ -24,11 +24,7 @@ import type { PollComposerSnapshot } from './pollComposer';
|
|
|
24
24
|
import type { TextComposerSnapshot } from './textComposer';
|
|
25
25
|
import type { DeepPartial } from '../types.utility';
|
|
26
26
|
type UnregisterSubscriptions = Unsubscribe;
|
|
27
|
-
/**
|
|
28
|
-
* Composer edit-audit clock. Both values are unix nanoseconds, so a locally stamped change and a
|
|
29
|
-
* server-derived `created_at` / `updated_at` are directly comparable — which is the whole point of
|
|
30
|
-
* this state.
|
|
31
|
-
*/
|
|
27
|
+
/** Unix nanoseconds, directly comparable with server `created_at` / `updated_at`. */
|
|
32
28
|
export type LastComposerChange = {
|
|
33
29
|
draftUpdate: TimestampNS | null;
|
|
34
30
|
stateUpdate: TimestampNS;
|
|
@@ -54,18 +50,12 @@ export type MessageComposerSnapshot = {
|
|
|
54
50
|
};
|
|
55
51
|
export type CompositionContext = Channel | Thread | LocalMessage;
|
|
56
52
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* - `
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* `client.notifications`.
|
|
64
|
-
* - `failed` - the request failed. **The composer has been released**; the content is in the
|
|
65
|
-
* message list marked `failed`, where the user retries it.
|
|
66
|
-
*
|
|
67
|
-
* The distinction matters because the last two leave the composer in opposite states, so a caller
|
|
68
|
-
* that reopens or restores UI has to tell them apart.
|
|
53
|
+
* Outcome of `send()` and `update()`:
|
|
54
|
+
* - `sent`: the message or edit went out.
|
|
55
|
+
* - `nothing-to-send`: nothing to compose, or a middleware discarded the composition (reported through
|
|
56
|
+
* `client.notifications`). **The composer keeps its contents.**
|
|
57
|
+
* - `failed`: the request failed. **The composer is released**; the content is in the message list
|
|
58
|
+
* marked `failed`, where the user retries it.
|
|
69
59
|
*/
|
|
70
60
|
export type MessageComposerSubmitResult = 'sent' | 'nothing-to-send' | 'failed';
|
|
71
61
|
export type MessageComposerState = {
|
|
@@ -74,10 +64,7 @@ export type MessageComposerState = {
|
|
|
74
64
|
pollId: string | null;
|
|
75
65
|
quotedMessage: LocalMessage | null;
|
|
76
66
|
showReplyInChannel: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Baseline snapshot of the message being edited (if any).
|
|
79
|
-
* This is intentionally immutable with respect to the editing session and can be used for restore/cancel.
|
|
80
|
-
*/
|
|
67
|
+
/** Baseline of the message being edited, unchanged during the session (for restore or cancel). */
|
|
81
68
|
editedMessage: LocalMessage | null;
|
|
82
69
|
};
|
|
83
70
|
export type MessageComposerOptions = {
|
|
@@ -90,11 +77,6 @@ export declare class MessageComposer extends WithSubscriptions {
|
|
|
90
77
|
readonly channel: Channel;
|
|
91
78
|
readonly state: StateStore<MessageComposerState>;
|
|
92
79
|
readonly editingAuditState: StateStore<EditingAuditState>;
|
|
93
|
-
/**
|
|
94
|
-
* Resolved configuration, as a store — the shape every configurable class exposes
|
|
95
|
-
* (`configState` / `config` / `updateConfig`). Delegates rather than holding a copy, so the field and
|
|
96
|
-
* the controller's store cannot drift.
|
|
97
|
-
*/
|
|
98
80
|
get configState(): StateStore<MessageComposerConfig>;
|
|
99
81
|
readonly compositionContext: CompositionContext;
|
|
100
82
|
readonly compositionMiddlewareExecutor: MessageComposerMiddlewareExecutor;
|
|
@@ -107,29 +89,11 @@ export declare class MessageComposer extends WithSubscriptions {
|
|
|
107
89
|
customDataManager: CustomDataManager;
|
|
108
90
|
private snapshots;
|
|
109
91
|
private effectHandlers;
|
|
110
|
-
/**
|
|
111
|
-
* The shared configuration machinery, with the three hooks this entity is the only one to need:
|
|
112
|
-
* `retainPatches` so an `updateConfig` request is *retained* and re-applied rather than written
|
|
113
|
-
* into the result (**DV-18**), and `applyAuthority` for the server's last word.
|
|
114
|
-
*
|
|
115
|
-
* A third hook, `finalizeRequest`, was added here for `commands.sendValidator` and then removed: the
|
|
116
|
-
* deep merge assigns function values directly and skips `undefined`, so the override it called reached
|
|
117
|
-
* the same answer on every layer shape — a later layer that stays silent cannot erase an earlier
|
|
118
|
-
* choice, because a merge only writes keys that are present.
|
|
119
|
-
*/
|
|
120
92
|
private readonly configController;
|
|
121
93
|
constructor({ composition, config, compositionContext, client, }: MessageComposerOptions);
|
|
122
94
|
static evaluateContextType(compositionContext: CompositionContext): "message" | "channel" | "thread";
|
|
123
95
|
static constructTag(compositionContext: CompositionContext): `${ReturnType<typeof MessageComposer.evaluateContextType>}_${string}`;
|
|
124
96
|
static generateId: typeof generateUUIDv4;
|
|
125
|
-
/**
|
|
126
|
-
* The current resolved configuration.
|
|
127
|
-
*
|
|
128
|
-
* `Readonly` for the same reason every other configurable class's getter is: the value is the store's
|
|
129
|
-
* live object, so assigning to a field would change state while notifying nobody. Use
|
|
130
|
-
* {@link updateConfig}. `Readonly` is shallow, so nested writes are caught at runtime instead — the
|
|
131
|
-
* whole resolution is deep-frozen by {@link resolvedConfig}, not only the untouched defaults.
|
|
132
|
-
*/
|
|
133
97
|
get config(): Readonly<MessageComposerConfig>;
|
|
134
98
|
get editedMessage(): LocalMessage | undefined;
|
|
135
99
|
set editedMessage(editedMessage: LocalMessage | undefined);
|
|
@@ -148,120 +112,46 @@ export declare class MessageComposer extends WithSubscriptions {
|
|
|
148
112
|
isCommandDisabled: (command: Command) => boolean;
|
|
149
113
|
validateCommandSendability: (command: Command, text?: string) => CommandSendability;
|
|
150
114
|
get isCommandSendable(): boolean;
|
|
151
|
-
/**
|
|
152
|
-
* Whether a message may be sent while its attachments are still uploading — see
|
|
153
|
-
* {@link AttachmentManagerConfig.pendingUploadsEnabled}.
|
|
154
|
-
*/
|
|
115
|
+
/** See {@link AttachmentManagerConfig.pendingUploadsEnabled}. */
|
|
155
116
|
get allowsPendingUploads(): boolean;
|
|
156
117
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* Thread replies live in `thread.messagePaginator`, which is independent of the channel's, so
|
|
161
|
-
* dispatching to the wrong one leaves the reply invisible where it was written. An edit composer
|
|
162
|
-
* is built from the message rather than from its thread, so it finds the thread only when
|
|
163
|
-
* `client.threads` has it registered — listed, or active (open somewhere).
|
|
118
|
+
* The thread when this composer belongs to one, else the channel. An edit composer finds its thread
|
|
119
|
+
* only if `client.threads` has it registered (listed or active).
|
|
164
120
|
*/
|
|
165
121
|
get defaultSubmitTarget(): Channel | Thread;
|
|
166
122
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* Read by the attachments composition step too: content the composer keeps must not also ride
|
|
171
|
-
* along on the submitted message, or one `localMetadata.id` ends up owned in two places.
|
|
123
|
+
* See {@link MessageComposerConfig.retainCompositionOnSubmit}. The attachments composition step reads
|
|
124
|
+
* it too, so retained content is not also sent on the message.
|
|
172
125
|
*/
|
|
173
126
|
get retainsCompositionOnSubmit(): boolean;
|
|
174
127
|
get hasSendableData(): boolean;
|
|
175
128
|
get compositionIsEmpty(): boolean;
|
|
176
129
|
get contentIsEmpty(): boolean;
|
|
177
130
|
get lastChangeOriginIsLocal(): boolean;
|
|
178
|
-
/**
|
|
179
|
-
* Records a configuration change as something *you* asked for, then republishes.
|
|
180
|
-
*
|
|
181
|
-
* The patch is kept — see {@link imperativeConfig} — rather than merged into the published result and
|
|
182
|
-
* forgotten. That is what makes the request survive a later re-resolution, including one triggered by
|
|
183
|
-
* the server changing its mind.
|
|
184
|
-
*/
|
|
131
|
+
/** The patch is retained, so it survives later re-resolutions (e.g. a server change). */
|
|
185
132
|
updateConfig(config: DeepPartial<MessageComposerConfig>): void;
|
|
186
|
-
/**
|
|
187
|
-
* What this composer has been **asked** for, before the server has any say — stages 1 to 5 of
|
|
188
|
-
* `docs/instance-configuration.md` §3.
|
|
189
|
-
*
|
|
190
|
-
* Available on every entity that retains its patches, not just this one: it is the controller's, and
|
|
191
|
-
* the split it exposes is what **FU-35** would extend elsewhere by switching on `retainPatches`.
|
|
192
|
-
*/
|
|
133
|
+
/** The config as requested, before server restrictions (`docs/instance-configuration.md` §3). */
|
|
193
134
|
get requestedConfig(): Readonly<MessageComposerConfig>;
|
|
194
135
|
/** The declarative slice for this composer, re-read live so a change is picked up. */
|
|
195
136
|
private get declarativeConfig();
|
|
196
137
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* `location.enabled` is gated on `shared_locations`, and only an existing composer has a channel to
|
|
201
|
-
* ask. `serverConfig` is re-read on every call, so a restriction that changes mid-session is picked up
|
|
202
|
-
* rather than captured once.
|
|
203
|
-
*
|
|
204
|
-
* Every entry here is a boolean gate, so `mergeServerRestrictions` ANDs it with what was requested and
|
|
205
|
-
* either side may switch the feature off — a client asking for less than the server grants is always
|
|
206
|
-
* legitimate. That is the whole point of mirroring these flags into configuration rather than leaving
|
|
207
|
-
* consumers to read `serverConfig` themselves: a raw server flag answers only the server's half, so a UI
|
|
208
|
-
* reading it offers features the composer has already disabled and would refuse to compose.
|
|
209
|
-
*
|
|
210
|
-
* `commands` is deliberately absent. The server sends a *list* of commands rather than a gate, so there
|
|
211
|
-
* is nothing to AND and no integrator intent to mirror; consumers read it from the channel's config.
|
|
212
|
-
*
|
|
213
|
-
* Takes the requested configuration because one restriction is conditional — see `uploads` below.
|
|
138
|
+
* Server-side gates from the channel config, re-read on every call. Each is a boolean that
|
|
139
|
+
* `mergeServerRestrictions` ANDs with the request. `commands` is absent (the server sends a list,
|
|
140
|
+
* not a gate).
|
|
214
141
|
*/
|
|
215
142
|
private serverRestrictionsFor;
|
|
216
|
-
/**
|
|
217
|
-
* Ceilings this composer's channel imposes server-side.
|
|
218
|
-
*
|
|
219
|
-
* `max_message_length` caps both length limits rather than setting them: a composer asking for something
|
|
220
|
-
* shorter keeps its own number, and one asking for nothing at all inherits the server's — which is the
|
|
221
|
-
* default, and the case worth having. Left unlimited, the composer happily accepts text the send endpoint
|
|
222
|
-
* then rejects, so the limit is enforced late and as an API error instead of in the editor.
|
|
223
|
-
*/
|
|
143
|
+
/** `max_message_length` caps both length limits: a smaller requested value wins, unset inherits it. */
|
|
224
144
|
private get serverUpperBounds();
|
|
225
|
-
/**
|
|
226
|
-
* Resolves the configuration and publishes it, unless the result is deep-equal to what is already there.
|
|
227
|
-
*
|
|
228
|
-
* The guard is needed because `StateStore.next`'s own `===` no-op can never apply here: every resolution
|
|
229
|
-
* allocates a new object, so without a comparison *every* publish notifies, whether or not any value
|
|
230
|
-
* moved.
|
|
231
|
-
*
|
|
232
|
-
* Worth the walk: `isEqual` over a resolved composer config measures ~1.7µs, against a resolution at
|
|
233
|
-
* ~3.5µs plus every subscriber's work. The dominant source of no-op publishes is fixed upstream in
|
|
234
|
-
* `StreamChat._addChannelConfig`, which stops a repeated channel query from waking that channel's
|
|
235
|
-
* composer at all; this
|
|
236
|
-
* catches the rest — re-registering a declarative value that has not changed, a `reset` with nothing
|
|
237
|
-
* registered, an empty `updateConfig({})`.
|
|
238
|
-
*/
|
|
239
145
|
private publishConfig;
|
|
240
146
|
/**
|
|
241
|
-
* Rebuilds the configuration from its inputs and **discards
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* Called by the constructor and by `client.config.reset()`, where dropping them is the point: a reset
|
|
246
|
-
* means "back to what is registered". Anything that merely needs the configuration re-resolved — the
|
|
247
|
-
* server's answer arriving, a declarative change — must use {@link publishConfig} or
|
|
248
|
-
* {@link applyServerRestrictions}, which keep them.
|
|
147
|
+
* Rebuilds the configuration from its inputs and **discards every {@link updateConfig} patch**,
|
|
148
|
+
* including those from sub-composer setters. To re-resolve and keep them, use
|
|
149
|
+
* {@link applyServerRestrictions}.
|
|
249
150
|
*/
|
|
250
151
|
initializeConfig: () => void;
|
|
251
152
|
/**
|
|
252
|
-
* Re-resolves the configuration against the channel's current server-side restrictions
|
|
253
|
-
*
|
|
254
|
-
* Call this when the server's answer may have changed — its config has just arrived, or it was updated.
|
|
255
|
-
* Safe in both directions, which is the whole reason it exists: a feature you disabled stays disabled
|
|
256
|
-
* when the server permits it, and a feature the server *stops* restricting goes back to whatever you
|
|
257
|
-
* asked for, because the restriction is applied to your request rather than to the previous result.
|
|
258
|
-
*
|
|
259
|
-
* Reachable rather than public: `Channel.query` is the only caller, covering a composer that has not
|
|
260
|
-
* registered subscriptions and so cannot hear the answer change through
|
|
261
|
-
* {@link subscribeChannelConfigChanged}. Nothing outside this package needs it — registering subscriptions
|
|
262
|
-
* is the supported way to stay current, and a composer that has done so is already covered. Marked
|
|
263
|
-
* `@internal` so it is not read as a supported extension point; the name is kept because what it does
|
|
264
|
-
* is* re-assert the server's restrictions, even though the whole resolution is what performs that.
|
|
153
|
+
* Re-resolves the configuration against the channel's current server-side restrictions, keeping
|
|
154
|
+
* `updateConfig` patches. `Channel.query` calls it for composers without registered subscriptions.
|
|
265
155
|
*
|
|
266
156
|
* @internal
|
|
267
157
|
*/
|
|
@@ -276,10 +166,8 @@ export declare class MessageComposer extends WithSubscriptions {
|
|
|
276
166
|
getSnapshot: () => MessageComposerSnapshot;
|
|
277
167
|
restoreSnapshot: (snapshot: MessageComposerSnapshot) => void;
|
|
278
168
|
/**
|
|
279
|
-
* Moves this composition into `target`, replacing what `target` held, and clears this composer
|
|
280
|
-
*
|
|
281
|
-
* reply-in-channel choice. An upload still running keeps running and its result lands in `target`
|
|
282
|
-
* (see {@link AttachmentManager.takeOver}). Nothing is sent.
|
|
169
|
+
* Moves this composition into `target`, replacing what `target` held, and clears this composer.
|
|
170
|
+
* Running uploads continue into `target` (see {@link AttachmentManager.takeOver}). Nothing is sent.
|
|
283
171
|
*
|
|
284
172
|
* @internal
|
|
285
173
|
*/
|
|
@@ -298,16 +186,6 @@ export declare class MessageComposer extends WithSubscriptions {
|
|
|
298
186
|
registerSubscriptions: () => UnregisterSubscriptions;
|
|
299
187
|
private subscribeMessageUpdated;
|
|
300
188
|
private subscribeMessageComposerSetupStateChange;
|
|
301
|
-
/**
|
|
302
|
-
* The channel's server-side config (`client.channelServerConfigs[cid]`) is populated by `query`/`watch`,
|
|
303
|
-
* which for a channel opened via `client.channelManager.ensure({ type, id })` happens *after* this composer was
|
|
304
|
-
* constructed. Left unwatched, the composer would keep the defaults it derived when `serverConfig` was
|
|
305
|
-
* still undefined — so `location.enabled` would stay `true` for an app that disables `shared_locations`
|
|
306
|
-
* server-side. Re-deriving when the config lands keeps the server authoritative.
|
|
307
|
-
*
|
|
308
|
-
* Selected by cid, matching the store's key space: `shared_locations` and `max_message_length` are both
|
|
309
|
-
* overridable per channel, so a sibling channel's config is not this composer's answer.
|
|
310
|
-
*/
|
|
311
189
|
private subscribeChannelConfigChanged;
|
|
312
190
|
private subscribeMessageDeleted;
|
|
313
191
|
private subscribeDraftUpdated;
|
|
@@ -330,27 +208,15 @@ export declare class MessageComposer extends WithSubscriptions {
|
|
|
330
208
|
deleteDraft: () => Promise<void>;
|
|
331
209
|
getDraft: () => Promise<void>;
|
|
332
210
|
createPoll: () => Promise<void>;
|
|
333
|
-
/**
|
|
334
|
-
* Lets go of what the submitted message took with it.
|
|
335
|
-
*
|
|
336
|
-
* A poll message carries no text or attachments of its own, so the composer keeps whatever else
|
|
337
|
-
* was drafted and releases only the poll. Everything else is a full clear.
|
|
338
|
-
*/
|
|
211
|
+
/** Clears the composer, or only detaches the poll when `retainsCompositionOnSubmit`. */
|
|
339
212
|
private releaseSubmittedComposition;
|
|
340
213
|
private reportSubmitFailure;
|
|
341
214
|
/**
|
|
342
|
-
* Composes the message
|
|
343
|
-
*
|
|
344
|
-
* Never rejects - see {@link MessageComposerSubmitResult} for what each outcome means and where
|
|
345
|
-
* the content ends up. A failure is reported through `client.notifications`, and the message
|
|
346
|
-
* stays in the list marked `failed`, which is where the user retries it. Callers rendering their
|
|
347
|
-
* own post-send feedback have to check the result.
|
|
215
|
+
* Composes and sends the message. Never rejects: see {@link MessageComposerSubmitResult}. A failure is
|
|
216
|
+
* reported through `client.notifications`.
|
|
348
217
|
*/
|
|
349
218
|
send: () => Promise<MessageComposerSubmitResult>;
|
|
350
|
-
/**
|
|
351
|
-
* Composes the edit and saves it, on the same terms as {@link send} - including releasing the
|
|
352
|
-
* composer before the request rather than after it.
|
|
353
|
-
*/
|
|
219
|
+
/** Composes and saves the edit, on the same terms as {@link send}. */
|
|
354
220
|
update: () => Promise<MessageComposerSubmitResult>;
|
|
355
221
|
sendLocation: () => Promise<void>;
|
|
356
222
|
}
|
package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts
CHANGED
|
@@ -3,19 +3,9 @@ import type { MessageComposer } from '../../../messageComposer';
|
|
|
3
3
|
/**
|
|
4
4
|
* Writes the uploaded URL onto the attachment and releases its local preview.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* composer's own — still listed in `attachmentManager.attachments`, i.e. still shown above the
|
|
11
|
-
* input, waiting to be sent.
|
|
12
|
-
*
|
|
13
|
-
* This runs when an upload finishes, which can be after the composer was cleared: `uploadFile`
|
|
14
|
-
* executes this chain before the (by then no-op) `updateAttachment`. If the attachment is gone
|
|
15
|
-
* from the composer, a message is rendering from the preview instead, and releasing it would
|
|
16
|
-
* blank that message out. A message can be sent with uploads still running — see
|
|
17
|
-
* {@link AttachmentManagerConfig.pendingUploadsEnabled}.
|
|
18
|
-
*
|
|
19
|
-
* Omit `composer` and the preview is always released.
|
|
6
|
+
* With `composer`, the preview is released only while the attachment is still in
|
|
7
|
+
* `attachmentManager.attachments`: an upload can finish after the composer was cleared (see
|
|
8
|
+
* {@link AttachmentManagerConfig.pendingUploadsEnabled}), and a sent message may still render from it.
|
|
9
|
+
* Without `composer`, it is always released.
|
|
20
10
|
*/
|
|
21
11
|
export declare const createPostUploadAttachmentEnrichmentMiddleware: (composer?: MessageComposer) => AttachmentPostUploadMiddleware;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import type { MessageComposer } from '../../messageComposer';
|
|
2
2
|
import type { MessageCompositionMiddleware, MessageDraftCompositionMiddleware } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Composes the message's attachments.
|
|
5
|
-
*
|
|
6
|
-
* By default an upload still in flight blocks the send: the chain warns and discards the
|
|
7
|
-
* composition. With {@link AttachmentManagerConfig.pendingUploadsEnabled} on it composes
|
|
8
|
-
* anyway, leaving `message.attachments` without the unresolved ones — `MessageOperations` awaits
|
|
9
|
-
* those uploads and fills in the URLs before the request goes out.
|
|
10
|
-
*
|
|
11
|
-
* The config is read per composition rather than at construction, so `updateConfig` takes effect
|
|
12
|
-
* on the next send with no need to reinstall anything.
|
|
4
|
+
* Composes the message's attachments. An upload in flight blocks the send (warns and discards) unless
|
|
5
|
+
* {@link AttachmentManagerConfig.pendingUploadsEnabled} is on. The config is read per composition.
|
|
13
6
|
*/
|
|
14
7
|
export declare const createAttachmentsCompositionMiddleware: (composer: MessageComposer) => MessageCompositionMiddleware;
|
|
15
8
|
export declare const createDraftAttachmentsCompositionMiddleware: (composer: MessageComposer) => MessageDraftCompositionMiddleware;
|
|
@@ -14,10 +14,8 @@ export type UpdateFieldsData = Partial<Omit<PollComposerState['data'], 'options'
|
|
|
14
14
|
options?: PollComposerOptionUpdate;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* Field validation errors, keyed by field
|
|
18
|
-
*
|
|
19
|
-
* Values carry a stable {@link PollComposerValidationError.code} rather than being bare English, so a UI can
|
|
20
|
-
* localize them; see {@link POLL_COMPOSER_VALIDATION_CODE}.
|
|
17
|
+
* Field validation errors, keyed by field (`options` errors by option ID). Each carries a stable
|
|
18
|
+
* {@link PollComposerValidationError.code} for localization.
|
|
21
19
|
*/
|
|
22
20
|
export type PollComposerFieldErrors = Partial<Omit<Record<keyof CreatePollRequest, PollComposerValidationError>, 'options'> & {
|
|
23
21
|
options?: Record<string, PollComposerValidationError>;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* errors, rendered inline beside the input that produced them, and they never reach
|
|
6
|
-
* `NotificationManager` — routing them there would raise a toast per keystroke. `CORE_NOTIFICATION_TYPE`
|
|
7
|
-
* is the notification counterpart; the two sets are disjoint and neither substitutes for the other.
|
|
8
|
-
*
|
|
9
|
-
* **These values are public API.** UI SDKs key their translation tables on them, so renaming one is a
|
|
10
|
-
* breaking change.
|
|
2
|
+
* Identifiers for poll-composer field validation failures. They are rendered inline and never reach
|
|
3
|
+
* `NotificationManager` (unlike `CORE_NOTIFICATION_TYPE`). **Public API:** UI SDKs key translations on
|
|
4
|
+
* them, so renaming one is breaking.
|
|
11
5
|
*/
|
|
12
6
|
export declare const POLL_COMPOSER_VALIDATION_CODE: {
|
|
13
7
|
readonly maxVotesNotNumeric: "validation:poll:maxVotes:notNumeric";
|
|
@@ -18,13 +12,7 @@ export declare const POLL_COMPOSER_VALIDATION_CODE: {
|
|
|
18
12
|
readonly optionEmpty: "validation:poll:option:empty";
|
|
19
13
|
};
|
|
20
14
|
export type PollComposerValidationCode = (typeof POLL_COMPOSER_VALIDATION_CODE)[keyof typeof POLL_COMPOSER_VALIDATION_CODE];
|
|
21
|
-
/**
|
|
22
|
-
* A poll-composer field validation failure.
|
|
23
|
-
*
|
|
24
|
-
* `code` is the stable identifier to resolve localized copy from. `message` carries untranslated
|
|
25
|
-
* English alongside it so a consumer with no i18n layer still renders something, and so an
|
|
26
|
-
* identifier a consumer does not recognize degrades to readable text instead of a blank field.
|
|
27
|
-
*/
|
|
15
|
+
/** A poll-composer field validation failure. `message` is an English fallback for `code`. */
|
|
28
16
|
export type PollComposerValidationError = {
|
|
29
17
|
/** Stable identifier. See {@link POLL_COMPOSER_VALIDATION_CODE}. */
|
|
30
18
|
code: PollComposerValidationCode;
|
|
@@ -36,9 +24,9 @@ export type PollComposerValidationError = {
|
|
|
36
24
|
/** Builds a {@link PollComposerValidationError}, filling in the English fallback for `code`. */
|
|
37
25
|
export declare const pollComposerValidationError: (code: PollComposerValidationCode, metadata?: Record<string, unknown>) => PollComposerValidationError;
|
|
38
26
|
/**
|
|
39
|
-
*
|
|
27
|
+
* Distinguishes a single failure from the per-option-ID record that `options` errors use.
|
|
40
28
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
29
|
+
* @param value - A field error entry.
|
|
30
|
+
* @returns Whether `value` is a single `PollComposerValidationError`.
|
|
43
31
|
*/
|
|
44
32
|
export declare const isPollComposerValidationError: (value: unknown) => value is PollComposerValidationError;
|
|
@@ -35,6 +35,15 @@ export declare class CommandSearchSource extends BaseSearchSourceSync<CommandSug
|
|
|
35
35
|
protected filterQueryResults(items: CommandSuggestion[]): CommandSuggestion[];
|
|
36
36
|
}
|
|
37
37
|
export type CommandsMiddleware = Middleware<TextComposerMiddlewareExecutorState<CommandSuggestion>, 'onChange' | 'onSuggestionItemSelect'>;
|
|
38
|
+
/**
|
|
39
|
+
* Suggests and activates slash commands.
|
|
40
|
+
*
|
|
41
|
+
* @param channel - The channel whose commands are suggested.
|
|
42
|
+
* @param options - Middleware options. Defaults to `trigger: '/'` and `minChars: 1`.
|
|
43
|
+
* @param options.composer - Used to refuse commands disabled by the editing or quoting state.
|
|
44
|
+
* @param options.searchSource - A search source to use instead of a new one. Its state is reset.
|
|
45
|
+
* @returns The commands middleware.
|
|
46
|
+
*/
|
|
38
47
|
export declare const createCommandsMiddleware: (channel: Channel, options?: Partial<TextComposerMiddlewareOptions> & {
|
|
39
48
|
composer?: MessageComposer;
|
|
40
49
|
searchSource?: CommandSearchSource;
|
|
@@ -11,10 +11,13 @@ export declare const accentsMap: {
|
|
|
11
11
|
export declare const removeDiacritics: (text?: string) => string;
|
|
12
12
|
export declare const calculateLevenshtein: (query: string, name: string) => number;
|
|
13
13
|
export type MentionsSearchSourceOptions = SearchSourceOptions & {
|
|
14
|
-
/**
|
|
14
|
+
/** Base filters for the app-wide user query (`mentionAllAppUsers`). */
|
|
15
15
|
userFilters?: UserFilters;
|
|
16
16
|
userSort?: SortParamRequest[];
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Replaces the default `name` autocomplete filter of the channel member query, so the typed text
|
|
19
|
+
* is not applied.
|
|
20
|
+
*/
|
|
18
21
|
memberFilters?: MemberFilters;
|
|
19
22
|
memberSort?: SortParamRequest[];
|
|
20
23
|
searchOptions?: Omit<UserOptions, 'limit' | 'offset'>;
|
|
@@ -210,25 +213,15 @@ export declare class MentionsSearchSource extends BaseSearchSource<MentionSugges
|
|
|
210
213
|
filterQueryResults(items: MentionSuggestion[]): MentionSuggestion[];
|
|
211
214
|
resetState(): void;
|
|
212
215
|
}
|
|
216
|
+
export type MentionsMiddleware = Middleware<TextComposerMiddlewareExecutorState<MentionSuggestion>, 'onChange' | 'onSuggestionItemSelect'>;
|
|
213
217
|
/**
|
|
214
|
-
*
|
|
215
|
-
* Usage:
|
|
216
|
-
*
|
|
217
|
-
* const textComposer = new TextComposer(options);
|
|
218
|
+
* Suggests and inserts mentions.
|
|
218
219
|
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* @param channel
|
|
225
|
-
* @param {{
|
|
226
|
-
* minChars: number;
|
|
227
|
-
* trigger: string;
|
|
228
|
-
* }} options
|
|
229
|
-
* @returns
|
|
220
|
+
* @param channel - The channel to search mentions in.
|
|
221
|
+
* @param options - Middleware options. Defaults to `trigger: '@'` and `minChars: 1`.
|
|
222
|
+
* @param options.searchSource - A search source to use instead of a new one. Its state is reset.
|
|
223
|
+
* @returns The mentions middleware.
|
|
230
224
|
*/
|
|
231
|
-
export type MentionsMiddleware = Middleware<TextComposerMiddlewareExecutorState<MentionSuggestion>, 'onChange' | 'onSuggestionItemSelect'>;
|
|
232
225
|
export declare const createMentionsMiddleware: (channel: Channel, options?: Partial<TextComposerMiddlewareOptions> & {
|
|
233
226
|
searchSource?: MentionsSearchSource;
|
|
234
227
|
}) => MentionsMiddleware;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { TextSelection } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Finds the trigger-prefixed token that ends `text`.
|
|
4
|
+
*
|
|
5
|
+
* @param params.trigger - The trigger character, e.g. `@` or `/`.
|
|
6
|
+
* @param params.text - The text to search.
|
|
7
|
+
* @param params.isCommand - Require the trigger to start the text and the token to contain no
|
|
8
|
+
* whitespace. Defaults to `false`.
|
|
9
|
+
* @param params.acceptTrailingSpaces - Let the token span one whitespace character. Ignored with
|
|
10
|
+
* `isCommand`. Defaults to `true`.
|
|
11
|
+
* @returns The trimmed token with its trigger, or `null`.
|
|
6
12
|
*/
|
|
7
13
|
export declare const getTriggerCharWithToken: ({ trigger, text, isCommand, acceptTrailingSpaces, }: {
|
|
8
14
|
trigger: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MessageComposer } from '../../messageComposer';
|
|
2
2
|
import type { MessageComposerEffect } from '../../messageComposer';
|
|
3
|
-
import type { Command,
|
|
3
|
+
import type { Command, UserResponse } from '../../../types';
|
|
4
4
|
import type { TokenizationPayload } from './textMiddlewareUtils';
|
|
5
5
|
import type { SearchSource, SearchSourceSync } from '../../../search';
|
|
6
6
|
import type { CustomTextComposerSuggestion } from '../../types.custom';
|
|
@@ -95,11 +95,6 @@ export type TextComposerState<T extends Suggestion = Suggestion> = {
|
|
|
95
95
|
mentions?: MentionEntity[];
|
|
96
96
|
selection: TextSelection;
|
|
97
97
|
text: string;
|
|
98
|
-
/**
|
|
99
|
-
* Live typing events keyed by user id.
|
|
100
|
-
* Maps `user.id` -> latest typing event (`typing.start`/`typing.stop`) for that user.
|
|
101
|
-
*/
|
|
102
|
-
typing: Record<string, Event>;
|
|
103
98
|
command?: Command | null;
|
|
104
99
|
suggestions?: Suggestions<T>;
|
|
105
100
|
};
|
|
@@ -35,11 +35,15 @@ export declare class PollComposer {
|
|
|
35
35
|
/**
|
|
36
36
|
* Updates specified fields and generates relevant errors.
|
|
37
37
|
*
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
40
|
-
*
|
|
38
|
+
* @param params - The fields to update and any externally produced errors.
|
|
39
|
+
* @param params.data - Partial poll data with the fields to update.
|
|
40
|
+
* @param params.injectedFieldErrors - Errors produced externally that will take precedence over
|
|
41
|
+
* the errors generated in the middleware chain (optional).
|
|
41
42
|
*/
|
|
42
|
-
updateFields: (data
|
|
43
|
+
updateFields: ({ data, injectedFieldErrors, }: {
|
|
44
|
+
data: UpdateFieldsData;
|
|
45
|
+
injectedFieldErrors?: PollComposerFieldErrors;
|
|
46
|
+
}) => Promise<void>;
|
|
43
47
|
handleFieldBlur: (field: keyof PollComposerState["data"]) => Promise<void>;
|
|
44
48
|
compose: () => Promise<import("..").PollComposerCompositionMiddlewareValueState | undefined>;
|
|
45
49
|
}
|
|
@@ -5,7 +5,7 @@ import type { TextSelection } from './middleware/textComposer/types';
|
|
|
5
5
|
import type { MentionEntity, TextComposerState, TextComposerStateSnapshot } from './middleware/textComposer/types';
|
|
6
6
|
import type { Suggestions } from './middleware/textComposer/types';
|
|
7
7
|
import type { MessageComposer } from './messageComposer';
|
|
8
|
-
import type { Command, DraftMessage,
|
|
8
|
+
import type { Command, DraftMessage, LocalMessage, UserResponse } from '../types';
|
|
9
9
|
export type TextComposerOptions = {
|
|
10
10
|
composer: MessageComposer;
|
|
11
11
|
message?: DraftMessage | LocalMessage;
|
|
@@ -35,19 +35,13 @@ export declare class TextComposer {
|
|
|
35
35
|
get selection(): TextSelection;
|
|
36
36
|
get suggestions(): Suggestions<import("..").Suggestion> | undefined;
|
|
37
37
|
get text(): string;
|
|
38
|
-
get typing(): Record<string, Event>;
|
|
39
|
-
set typing(typing: Record<string, Event>);
|
|
40
|
-
setTyping: (typing: Record<string, Event>) => void;
|
|
41
|
-
setTypingEvent: (userId: string, event: Event) => void;
|
|
42
|
-
removeTypingEvent: (userId: string) => void;
|
|
43
38
|
get textIsEmpty(): boolean;
|
|
44
39
|
initState: ({ message }?: {
|
|
45
40
|
message?: DraftMessage | LocalMessage;
|
|
46
41
|
}) => void;
|
|
47
42
|
/**
|
|
48
|
-
* Takes over `source`'s text
|
|
49
|
-
*
|
|
50
|
-
* `source`'s channel.
|
|
43
|
+
* Takes over `source`'s text, selection, mentions and command, not its suggestions (they belong to
|
|
44
|
+
* `source`'s open search).
|
|
51
45
|
*
|
|
52
46
|
* @internal
|
|
53
47
|
*/
|
|
@@ -40,24 +40,21 @@ export type BaseLocalAttachmentMetadata = {
|
|
|
40
40
|
};
|
|
41
41
|
export type LocalAttachmentUploadMetadata = {
|
|
42
42
|
file: File | FileReference;
|
|
43
|
-
/**
|
|
44
|
-
* Local preview URI, typically a Blob URL from `URL.createObjectURL(file)`
|
|
45
|
-
* or (for React Native `FileReference`) the provided `uri`.
|
|
46
|
-
*/
|
|
43
|
+
/** Local preview URI: a Blob URL for a `File`, or the `uri` of a React Native `FileReference`. */
|
|
47
44
|
previewUri?: string;
|
|
48
45
|
uploadState: AttachmentLoadingState;
|
|
49
46
|
/**
|
|
50
|
-
* Mirrors {@link UploadRecord.uploadConfirmationPending}: every byte
|
|
51
|
-
*
|
|
47
|
+
* Mirrors {@link UploadRecord.uploadConfirmationPending}: every byte is sent but the server has not
|
|
48
|
+
* confirmed. Render an indeterminate indicator rather than a full bar.
|
|
52
49
|
*/
|
|
53
50
|
uploadConfirmationPending?: boolean;
|
|
54
51
|
uploadPermissionCheck?: UploadPermissionCheckResult;
|
|
55
|
-
/** 0
|
|
52
|
+
/** 0 to 100 while uploading with progress tracking on; `undefined` otherwise or when indeterminate. */
|
|
56
53
|
uploadProgress?: number;
|
|
57
54
|
};
|
|
58
55
|
export type LocalImageAttachmentUploadMetadata = LocalAttachmentUploadMetadata & {
|
|
59
56
|
/**
|
|
60
|
-
* @deprecated `previewUri`
|
|
57
|
+
* @deprecated Use `LocalAttachmentUploadMetadata.previewUri` instead.
|
|
61
58
|
*/
|
|
62
59
|
previewUri?: string;
|
|
63
60
|
};
|