stream-chat 9.32.0 → 9.34.0
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 +12 -4
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +12 -4
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +12 -4
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/channel_manager.d.ts +0 -1
- package/dist/types/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/channel_manager.ts +2 -3
- package/src/messageComposer/middleware/pollComposer/state.ts +10 -0
- package/src/types.ts +1 -0
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/channel_manager.ts
CHANGED
|
@@ -149,7 +149,6 @@ export const DEFAULT_CHANNEL_MANAGER_OPTIONS = {
|
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
export const DEFAULT_CHANNEL_MANAGER_PAGINATION_OPTIONS = {
|
|
152
|
-
limit: 10,
|
|
153
152
|
offset: 0,
|
|
154
153
|
};
|
|
155
154
|
|
|
@@ -293,7 +292,7 @@ export class ChannelManager extends WithSubscriptions {
|
|
|
293
292
|
channels,
|
|
294
293
|
pagination: {
|
|
295
294
|
...pagination,
|
|
296
|
-
hasNext: (channels?.length ?? 0) >= limit,
|
|
295
|
+
hasNext: (channels?.length ?? 0) >= (limit ?? 1),
|
|
297
296
|
isLoading: false,
|
|
298
297
|
options: newOptions,
|
|
299
298
|
},
|
|
@@ -446,7 +445,7 @@ export class ChannelManager extends WithSubscriptions {
|
|
|
446
445
|
channels: uniqBy<Channel>([...(channels || []), ...nextChannels], 'cid'),
|
|
447
446
|
pagination: {
|
|
448
447
|
...pagination,
|
|
449
|
-
hasNext: (nextChannels?.length ?? 0) >= limit,
|
|
448
|
+
hasNext: (nextChannels?.length ?? 0) >= (limit ?? 1),
|
|
450
449
|
isLoading: false,
|
|
451
450
|
isLoadingNext: false,
|
|
452
451
|
options: newOptions,
|
|
@@ -106,6 +106,13 @@ export const isTargetedOptionTextUpdate = (
|
|
|
106
106
|
typeof (value as TargetedPollOptionTextUpdate)?.index === 'number' &&
|
|
107
107
|
typeof (value as TargetedPollOptionTextUpdate)?.text === 'string';
|
|
108
108
|
|
|
109
|
+
const clampMaxVotesAllowed = (value: unknown): string => {
|
|
110
|
+
if (value === '' || value == null) return '';
|
|
111
|
+
const num = typeof value === 'string' ? parseInt(value, 10) : Number(value);
|
|
112
|
+
if (!Number.isInteger(num) || Number.isNaN(num)) return '';
|
|
113
|
+
return String(Math.min(10, Math.max(2, num)));
|
|
114
|
+
};
|
|
115
|
+
|
|
109
116
|
export const pollCompositionStateProcessors: Partial<
|
|
110
117
|
Record<keyof PollComposerState['data'], PollCompositionStateProcessor>
|
|
111
118
|
> = {
|
|
@@ -113,6 +120,9 @@ export const pollCompositionStateProcessors: Partial<
|
|
|
113
120
|
enforce_unique_vote: value,
|
|
114
121
|
max_votes_allowed: '',
|
|
115
122
|
}),
|
|
123
|
+
max_votes_allowed: ({ value }) => ({
|
|
124
|
+
max_votes_allowed: clampMaxVotesAllowed(value),
|
|
125
|
+
}),
|
|
116
126
|
options: ({ value, data }) => {
|
|
117
127
|
// If it's a direct array update (like drag-drop reordering)
|
|
118
128
|
if (Array.isArray(value)) {
|