stream-chat-react 12.8.2 → 12.9.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/components/ChannelList/hooks/useChannelListShape.d.ts +3 -3
- package/dist/components/ChannelList/hooks/useChannelListShape.js +52 -45
- package/dist/components/ChannelList/hooks/useChannelMembershipState.d.ts +3 -2
- package/dist/components/ChannelList/hooks/useChannelMembershipState.js +6 -15
- package/dist/components/ChannelList/hooks/useSelectedChannelState.d.ts +11 -0
- package/dist/components/ChannelList/hooks/useSelectedChannelState.js +20 -0
- package/dist/components/ChannelList/utils.d.ts +16 -6
- package/dist/components/ChannelList/utils.js +44 -18
- package/dist/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/ChatAutoComplete/ChatAutoComplete.d.ts +2 -0
- package/dist/components/ChatAutoComplete/ChatAutoComplete.js +1 -1
- package/dist/index.browser.cjs +150 -90
- package/dist/index.browser.cjs.map +4 -4
- package/dist/index.node.cjs +151 -90
- package/dist/index.node.cjs.map +4 -4
- package/package.json +6 -4
package/dist/index.node.cjs
CHANGED
|
@@ -2531,9 +2531,9 @@ var require_unified = __commonJS({
|
|
|
2531
2531
|
return typeof value === "function" && value.prototype && // A function with keys in its prototype is probably a constructor.
|
|
2532
2532
|
// Classes’ prototype methods are not enumerable, so we check if some value
|
|
2533
2533
|
// exists in the prototype.
|
|
2534
|
-
(
|
|
2534
|
+
(keys3(value.prototype) || name in value.prototype);
|
|
2535
2535
|
}
|
|
2536
|
-
function
|
|
2536
|
+
function keys3(value) {
|
|
2537
2537
|
var key;
|
|
2538
2538
|
for (key in value) {
|
|
2539
2539
|
return true;
|
|
@@ -18902,14 +18902,14 @@ var require_mml_react_cjs_development = __commonJS({
|
|
|
18902
18902
|
this.reset(true);
|
|
18903
18903
|
}
|
|
18904
18904
|
exports3.keys = function(object) {
|
|
18905
|
-
var
|
|
18905
|
+
var keys3 = [];
|
|
18906
18906
|
for (var key in object) {
|
|
18907
|
-
|
|
18907
|
+
keys3.push(key);
|
|
18908
18908
|
}
|
|
18909
|
-
|
|
18909
|
+
keys3.reverse();
|
|
18910
18910
|
return function next() {
|
|
18911
|
-
while (
|
|
18912
|
-
var key2 =
|
|
18911
|
+
while (keys3.length) {
|
|
18912
|
+
var key2 = keys3.pop();
|
|
18913
18913
|
if (key2 in object) {
|
|
18914
18914
|
next.value = key2;
|
|
18915
18915
|
next.done = false;
|
|
@@ -20319,6 +20319,7 @@ __export(src_exports, {
|
|
|
20319
20319
|
enTranslations: () => en_default,
|
|
20320
20320
|
esTranslations: () => es_default,
|
|
20321
20321
|
escapeRegExp: () => escapeRegExp,
|
|
20322
|
+
extractSortValue: () => extractSortValue,
|
|
20322
20323
|
findLastPinnedChannelIndex: () => findLastPinnedChannelIndex,
|
|
20323
20324
|
frTranslations: () => fr_default,
|
|
20324
20325
|
getChannel: () => getChannel,
|
|
@@ -20782,16 +20783,16 @@ var import_react7 = require("react");
|
|
|
20782
20783
|
|
|
20783
20784
|
// src/store/hooks/useStateStore.ts
|
|
20784
20785
|
var import_react6 = require("react");
|
|
20785
|
-
function useStateStore(store,
|
|
20786
|
+
function useStateStore(store, selector7) {
|
|
20786
20787
|
const [state, setState] = (0, import_react6.useState)(() => {
|
|
20787
20788
|
if (!store) return void 0;
|
|
20788
|
-
return
|
|
20789
|
+
return selector7(store.getLatestValue());
|
|
20789
20790
|
});
|
|
20790
20791
|
(0, import_react6.useEffect)(() => {
|
|
20791
20792
|
if (!store) return;
|
|
20792
|
-
const unsubscribe = store.subscribeWithSelector(
|
|
20793
|
+
const unsubscribe = store.subscribeWithSelector(selector7, setState);
|
|
20793
20794
|
return unsubscribe;
|
|
20794
|
-
}, [store,
|
|
20795
|
+
}, [store, selector7]);
|
|
20795
20796
|
return state;
|
|
20796
20797
|
}
|
|
20797
20798
|
|
|
@@ -44528,7 +44529,10 @@ var moveChannelUpwards = ({
|
|
|
44528
44529
|
const targetChannelExistsWithinList = targetChannelIndex >= 0;
|
|
44529
44530
|
const targetChannelAlreadyAtTheTop = targetChannelIndex === 0;
|
|
44530
44531
|
const considerPinnedChannels = shouldConsiderPinnedChannels(sort);
|
|
44531
|
-
|
|
44532
|
+
const isTargetChannelPinned = isChannelPinned(channelToMove);
|
|
44533
|
+
if (targetChannelAlreadyAtTheTop || considerPinnedChannels && isTargetChannelPinned) {
|
|
44534
|
+
return channels;
|
|
44535
|
+
}
|
|
44532
44536
|
const newChannels = [...channels];
|
|
44533
44537
|
if (targetChannelExistsWithinList) {
|
|
44534
44538
|
newChannels.splice(targetChannelIndex, 1);
|
|
@@ -44545,25 +44549,48 @@ var moveChannelUpwards = ({
|
|
|
44545
44549
|
return newChannels;
|
|
44546
44550
|
};
|
|
44547
44551
|
var shouldConsiderPinnedChannels = (sort) => {
|
|
44548
|
-
|
|
44549
|
-
if (
|
|
44550
|
-
|
|
44551
|
-
|
|
44552
|
-
|
|
44552
|
+
const value = extractSortValue({ atIndex: 0, sort, targetKey: "pinned_at" });
|
|
44553
|
+
if (typeof value !== "number") return false;
|
|
44554
|
+
return Math.abs(value) === 1;
|
|
44555
|
+
};
|
|
44556
|
+
var extractSortValue = ({
|
|
44557
|
+
atIndex,
|
|
44558
|
+
sort,
|
|
44559
|
+
targetKey
|
|
44560
|
+
}) => {
|
|
44561
|
+
if (!sort) return null;
|
|
44562
|
+
let option = null;
|
|
44563
|
+
if (Array.isArray(sort)) {
|
|
44564
|
+
option = sort[atIndex] ?? null;
|
|
44565
|
+
} else {
|
|
44566
|
+
let index3 = 0;
|
|
44567
|
+
for (const key in sort) {
|
|
44568
|
+
if (index3 !== atIndex) {
|
|
44569
|
+
index3++;
|
|
44570
|
+
continue;
|
|
44571
|
+
}
|
|
44572
|
+
if (key !== targetKey) {
|
|
44573
|
+
return null;
|
|
44574
|
+
}
|
|
44575
|
+
option = sort;
|
|
44576
|
+
break;
|
|
44577
|
+
}
|
|
44578
|
+
}
|
|
44579
|
+
return option?.[targetKey] ?? null;
|
|
44553
44580
|
};
|
|
44554
44581
|
var shouldConsiderArchivedChannels = (filters) => {
|
|
44555
44582
|
if (!filters) return false;
|
|
44556
|
-
return
|
|
44583
|
+
return typeof filters.archived === "boolean";
|
|
44557
44584
|
};
|
|
44558
44585
|
var isChannelPinned = (channel) => {
|
|
44559
44586
|
if (!channel) return false;
|
|
44560
|
-
const
|
|
44561
|
-
return
|
|
44587
|
+
const membership = channel.state.membership;
|
|
44588
|
+
return typeof membership.pinned_at === "string";
|
|
44562
44589
|
};
|
|
44563
44590
|
var isChannelArchived = (channel) => {
|
|
44564
44591
|
if (!channel) return false;
|
|
44565
|
-
const
|
|
44566
|
-
return
|
|
44592
|
+
const membership = channel.state.membership;
|
|
44593
|
+
return typeof membership.archived_at === "string";
|
|
44567
44594
|
};
|
|
44568
44595
|
|
|
44569
44596
|
// src/components/ChannelList/hooks/usePaginatedChannels.ts
|
|
@@ -45426,33 +45453,33 @@ var useChannelListShapeDefaults = () => {
|
|
|
45426
45453
|
if (typeof customHandler === "function") {
|
|
45427
45454
|
return customHandler(setChannels, event);
|
|
45428
45455
|
}
|
|
45429
|
-
|
|
45430
|
-
|
|
45456
|
+
const channelType = event.channel_type;
|
|
45457
|
+
const channelId = event.channel_id;
|
|
45458
|
+
if (!channelType || !channelId) return;
|
|
45459
|
+
setChannels((currentChannels) => {
|
|
45460
|
+
const targetChannel = client.channel(channelType, channelId);
|
|
45461
|
+
const targetChannelIndex = currentChannels.indexOf(targetChannel);
|
|
45431
45462
|
const targetChannelExistsWithinList = targetChannelIndex >= 0;
|
|
45432
|
-
const targetChannel = channels[targetChannelIndex];
|
|
45433
45463
|
const isTargetChannelPinned = isChannelPinned(targetChannel);
|
|
45434
45464
|
const isTargetChannelArchived = isChannelArchived(targetChannel);
|
|
45435
45465
|
const considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
45436
45466
|
const considerPinnedChannels = shouldConsiderPinnedChannels(sort);
|
|
45437
45467
|
if (
|
|
45438
|
-
// target channel is archived
|
|
45439
|
-
isTargetChannelArchived &&
|
|
45440
|
-
|
|
45468
|
+
// filter is defined, target channel is archived and filter option is set to false
|
|
45469
|
+
considerArchivedChannels && isTargetChannelArchived && !filters.archived || // filter is defined, target channel isn't archived and filter option is set to true
|
|
45470
|
+
considerArchivedChannels && !isTargetChannelArchived && filters.archived || // sort option is defined, target channel is pinned
|
|
45471
|
+
considerPinnedChannels && isTargetChannelPinned || // list order is locked
|
|
45441
45472
|
lockChannelOrder || // target channel is not within the loaded list and loading from cache is disallowed
|
|
45442
45473
|
!targetChannelExistsWithinList && !allowNewMessagesFromUnfilteredChannels
|
|
45443
45474
|
) {
|
|
45444
|
-
return
|
|
45445
|
-
}
|
|
45446
|
-
const channelToMove = channels[targetChannelIndex] ?? (allowNewMessagesFromUnfilteredChannels && event.channel_type ? client.channel(event.channel_type, event.channel_id) : null);
|
|
45447
|
-
if (channelToMove) {
|
|
45448
|
-
return moveChannelUpwards({
|
|
45449
|
-
channels,
|
|
45450
|
-
channelToMove,
|
|
45451
|
-
channelToMoveIndexWithinChannels: targetChannelIndex,
|
|
45452
|
-
sort
|
|
45453
|
-
});
|
|
45475
|
+
return currentChannels;
|
|
45454
45476
|
}
|
|
45455
|
-
return
|
|
45477
|
+
return moveChannelUpwards({
|
|
45478
|
+
channels: currentChannels,
|
|
45479
|
+
channelToMove: targetChannel,
|
|
45480
|
+
channelToMoveIndexWithinChannels: targetChannelIndex,
|
|
45481
|
+
sort
|
|
45482
|
+
});
|
|
45456
45483
|
});
|
|
45457
45484
|
},
|
|
45458
45485
|
[client]
|
|
@@ -45478,7 +45505,7 @@ var useChannelListShapeDefaults = () => {
|
|
|
45478
45505
|
type: event.channel.type
|
|
45479
45506
|
});
|
|
45480
45507
|
const considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
45481
|
-
if (isChannelArchived(channel) && considerArchivedChannels) {
|
|
45508
|
+
if (isChannelArchived(channel) && considerArchivedChannels && !filters.archived) {
|
|
45482
45509
|
return;
|
|
45483
45510
|
}
|
|
45484
45511
|
if (!allowNewMessagesFromUnfilteredChannels) {
|
|
@@ -45500,26 +45527,33 @@ var useChannelListShapeDefaults = () => {
|
|
|
45500
45527
|
allowNewMessagesFromUnfilteredChannels,
|
|
45501
45528
|
customHandler,
|
|
45502
45529
|
event,
|
|
45503
|
-
setChannels
|
|
45530
|
+
setChannels,
|
|
45531
|
+
sort
|
|
45504
45532
|
}) => {
|
|
45505
45533
|
if (typeof customHandler === "function") {
|
|
45506
45534
|
return customHandler(setChannels, event);
|
|
45507
45535
|
}
|
|
45508
|
-
if (
|
|
45509
|
-
|
|
45510
|
-
client,
|
|
45511
|
-
id: event.channel.id,
|
|
45512
|
-
members: event.channel.members?.reduce((acc, { user, user_id }) => {
|
|
45513
|
-
const userId = user_id || user?.id;
|
|
45514
|
-
if (userId) {
|
|
45515
|
-
acc.push(userId);
|
|
45516
|
-
}
|
|
45517
|
-
return acc;
|
|
45518
|
-
}, []),
|
|
45519
|
-
type: event.channel.type
|
|
45520
|
-
});
|
|
45521
|
-
setChannels((channels) => (0, import_lodash11.default)([channel, ...channels], "cid"));
|
|
45536
|
+
if (!event.channel || !allowNewMessagesFromUnfilteredChannels) {
|
|
45537
|
+
return;
|
|
45522
45538
|
}
|
|
45539
|
+
const channel = await getChannel({
|
|
45540
|
+
client,
|
|
45541
|
+
id: event.channel.id,
|
|
45542
|
+
members: event.channel.members?.reduce((newMembers, { user, user_id }) => {
|
|
45543
|
+
const userId = user_id || user?.id;
|
|
45544
|
+
if (userId) newMembers.push(userId);
|
|
45545
|
+
return newMembers;
|
|
45546
|
+
}, []),
|
|
45547
|
+
type: event.channel.type
|
|
45548
|
+
});
|
|
45549
|
+
setChannels(
|
|
45550
|
+
(channels) => moveChannelUpwards({
|
|
45551
|
+
channels,
|
|
45552
|
+
channelToMove: channel,
|
|
45553
|
+
channelToMoveIndexWithinChannels: -1,
|
|
45554
|
+
sort
|
|
45555
|
+
})
|
|
45556
|
+
);
|
|
45523
45557
|
},
|
|
45524
45558
|
[client]
|
|
45525
45559
|
);
|
|
@@ -45537,29 +45571,37 @@ var useChannelListShapeDefaults = () => {
|
|
|
45537
45571
|
[]
|
|
45538
45572
|
);
|
|
45539
45573
|
const handleMemberUpdated = (0, import_react101.useCallback)(
|
|
45540
|
-
({
|
|
45574
|
+
({
|
|
45575
|
+
event,
|
|
45576
|
+
filters,
|
|
45577
|
+
lockChannelOrder,
|
|
45578
|
+
setChannels,
|
|
45579
|
+
sort
|
|
45580
|
+
}) => {
|
|
45541
45581
|
if (!event.member?.user || event.member.user.id !== client.userID || !event.channel_type) {
|
|
45542
45582
|
return;
|
|
45543
45583
|
}
|
|
45544
|
-
const member = event.member;
|
|
45545
45584
|
const channelType = event.channel_type;
|
|
45546
45585
|
const channelId = event.channel_id;
|
|
45547
45586
|
const considerPinnedChannels = shouldConsiderPinnedChannels(sort);
|
|
45548
|
-
const
|
|
45587
|
+
const considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
45588
|
+
const pinnedAtSort = extractSortValue({ atIndex: 0, sort, targetKey: "pinned_at" });
|
|
45549
45589
|
setChannels((currentChannels) => {
|
|
45550
45590
|
const targetChannel = client.channel(channelType, channelId);
|
|
45551
45591
|
const targetChannelIndex = currentChannels.indexOf(targetChannel);
|
|
45552
45592
|
const targetChannelExistsWithinList = targetChannelIndex >= 0;
|
|
45593
|
+
const isTargetChannelArchived = isChannelArchived(targetChannel);
|
|
45594
|
+
const isTargetChannelPinned = isChannelPinned(targetChannel);
|
|
45553
45595
|
if (!considerPinnedChannels || lockChannelOrder) return currentChannels;
|
|
45554
45596
|
const newChannels = [...currentChannels];
|
|
45555
45597
|
if (targetChannelExistsWithinList) {
|
|
45556
45598
|
newChannels.splice(targetChannelIndex, 1);
|
|
45557
45599
|
}
|
|
45558
|
-
if (
|
|
45600
|
+
if (considerArchivedChannels && isTargetChannelArchived && !filters.archived || considerArchivedChannels && !isTargetChannelArchived && filters.archived) {
|
|
45559
45601
|
return newChannels;
|
|
45560
45602
|
}
|
|
45561
45603
|
let lastPinnedChannelIndex = null;
|
|
45562
|
-
if (pinnedAtSort === 1 || pinnedAtSort === -1 && !
|
|
45604
|
+
if (pinnedAtSort === 1 || pinnedAtSort === -1 && !isTargetChannelPinned) {
|
|
45563
45605
|
lastPinnedChannelIndex = findLastPinnedChannelIndex({ channels: newChannels });
|
|
45564
45606
|
}
|
|
45565
45607
|
const newTargetChannelIndex = typeof lastPinnedChannelIndex === "number" ? lastPinnedChannelIndex + 1 : 0;
|
|
@@ -45760,6 +45802,7 @@ var usePrepareShapeHandlers = ({
|
|
|
45760
45802
|
case "member.updated":
|
|
45761
45803
|
defaults.handleMemberUpdated({
|
|
45762
45804
|
event,
|
|
45805
|
+
filters,
|
|
45763
45806
|
lockChannelOrder,
|
|
45764
45807
|
setChannels,
|
|
45765
45808
|
sort
|
|
@@ -46243,24 +46286,41 @@ var useUserPresenceChangedListener = (setChannels) => {
|
|
|
46243
46286
|
}, [client, setChannels]);
|
|
46244
46287
|
};
|
|
46245
46288
|
|
|
46246
|
-
// src/components/ChannelList/hooks/
|
|
46289
|
+
// src/components/ChannelList/hooks/useSelectedChannelState.ts
|
|
46247
46290
|
var import_react113 = require("react");
|
|
46248
|
-
var
|
|
46249
|
-
|
|
46250
|
-
channel?.state.membership || {}
|
|
46251
|
-
);
|
|
46252
|
-
const { client } = useChatContext();
|
|
46253
|
-
(0, import_react113.useEffect)(() => {
|
|
46254
|
-
if (!channel) return;
|
|
46255
|
-
const subscriptions = ["member.updated"].map(
|
|
46256
|
-
(v) => client.on(v, () => {
|
|
46257
|
-
setMembership(channel.state.membership);
|
|
46258
|
-
})
|
|
46259
|
-
);
|
|
46260
|
-
return () => subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
46261
|
-
}, [client, channel]);
|
|
46262
|
-
return membership;
|
|
46291
|
+
var import_shim = require("use-sync-external-store/shim");
|
|
46292
|
+
var noop = () => {
|
|
46263
46293
|
};
|
|
46294
|
+
function useSelectedChannelState({
|
|
46295
|
+
channel,
|
|
46296
|
+
stateChangeEventKeys = ["all"],
|
|
46297
|
+
selector: selector7
|
|
46298
|
+
}) {
|
|
46299
|
+
const subscribe = (0, import_react113.useCallback)(
|
|
46300
|
+
(onStoreChange) => {
|
|
46301
|
+
if (!channel) return noop;
|
|
46302
|
+
const subscriptions = stateChangeEventKeys.map(
|
|
46303
|
+
(et) => channel.on(et, () => {
|
|
46304
|
+
onStoreChange(selector7(channel));
|
|
46305
|
+
})
|
|
46306
|
+
);
|
|
46307
|
+
return () => subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
46308
|
+
},
|
|
46309
|
+
[channel, selector7, stateChangeEventKeys]
|
|
46310
|
+
);
|
|
46311
|
+
const getSnapshot = (0, import_react113.useCallback)(() => {
|
|
46312
|
+
if (!channel) return void 0;
|
|
46313
|
+
return selector7(channel);
|
|
46314
|
+
}, [channel, selector7]);
|
|
46315
|
+
return (0, import_shim.useSyncExternalStore)(subscribe, getSnapshot);
|
|
46316
|
+
}
|
|
46317
|
+
|
|
46318
|
+
// src/components/ChannelList/hooks/useChannelMembershipState.ts
|
|
46319
|
+
var selector = (c) => c.state.membership;
|
|
46320
|
+
var keys2 = ["member.updated"];
|
|
46321
|
+
function useChannelMembershipState(channel) {
|
|
46322
|
+
return useSelectedChannelState({ channel, selector, stateChangeEventKeys: keys2 });
|
|
46323
|
+
}
|
|
46264
46324
|
|
|
46265
46325
|
// src/components/ChannelPreview/icons.tsx
|
|
46266
46326
|
var import_react114 = __toESM(require("react"));
|
|
@@ -46745,12 +46805,12 @@ var ThreadAdapter = ({ children }) => {
|
|
|
46745
46805
|
useActiveThread({ activeThread });
|
|
46746
46806
|
return /* @__PURE__ */ import_react122.default.createElement(ThreadProvider, { thread: activeThread }, children);
|
|
46747
46807
|
};
|
|
46748
|
-
var
|
|
46808
|
+
var selector2 = ({ unreadThreadCount }) => ({
|
|
46749
46809
|
unreadThreadCount
|
|
46750
46810
|
});
|
|
46751
46811
|
var ChatViewSelector = () => {
|
|
46752
46812
|
const { client } = useChatContext();
|
|
46753
|
-
const { unreadThreadCount } = useStateStore(client.threads.state,
|
|
46813
|
+
const { unreadThreadCount } = useStateStore(client.threads.state, selector2);
|
|
46754
46814
|
const { activeChatView, setActiveChatView } = (0, import_react122.useContext)(ChatViewContext);
|
|
46755
46815
|
return /* @__PURE__ */ import_react122.default.createElement("div", { className: "str-chat__chat-view__selector" }, /* @__PURE__ */ import_react122.default.createElement(
|
|
46756
46816
|
"button",
|
|
@@ -46812,7 +46872,7 @@ var getTitleFromMessage = ({
|
|
|
46812
46872
|
var ThreadListItemUI = (props) => {
|
|
46813
46873
|
const { client } = useChatContext();
|
|
46814
46874
|
const thread = useThreadListItemContext();
|
|
46815
|
-
const
|
|
46875
|
+
const selector7 = (0, import_react123.useCallback)(
|
|
46816
46876
|
(nextValue) => ({
|
|
46817
46877
|
channel: nextValue.channel,
|
|
46818
46878
|
deletedAt: nextValue.deletedAt,
|
|
@@ -46824,7 +46884,7 @@ var ThreadListItemUI = (props) => {
|
|
|
46824
46884
|
);
|
|
46825
46885
|
const { channel, deletedAt, latestReply, ownUnreadMessageCount, parentMessage } = useStateStore(
|
|
46826
46886
|
thread.state,
|
|
46827
|
-
|
|
46887
|
+
selector7
|
|
46828
46888
|
);
|
|
46829
46889
|
const { displayTitle: channelDisplayTitle } = useChannelPreviewInfo({ channel });
|
|
46830
46890
|
const { activeThread, setActiveThread } = useThreadsViewContext();
|
|
@@ -46861,12 +46921,12 @@ var ThreadListEmptyPlaceholder = () => /* @__PURE__ */ import_react125.default.c
|
|
|
46861
46921
|
|
|
46862
46922
|
// src/components/Threads/ThreadList/ThreadListUnseenThreadsBanner.tsx
|
|
46863
46923
|
var import_react126 = __toESM(require("react"));
|
|
46864
|
-
var
|
|
46924
|
+
var selector3 = (nextValue) => ({
|
|
46865
46925
|
unseenThreadIds: nextValue.unseenThreadIds
|
|
46866
46926
|
});
|
|
46867
46927
|
var ThreadListUnseenThreadsBanner = () => {
|
|
46868
46928
|
const { client } = useChatContext();
|
|
46869
|
-
const { unseenThreadIds } = useStateStore(client.threads.state,
|
|
46929
|
+
const { unseenThreadIds } = useStateStore(client.threads.state, selector3);
|
|
46870
46930
|
if (!unseenThreadIds.length) return null;
|
|
46871
46931
|
return /* @__PURE__ */ import_react126.default.createElement("div", { className: "str-chat__unseen-threads-banner" }, unseenThreadIds.length, " unread threads", /* @__PURE__ */ import_react126.default.createElement(
|
|
46872
46932
|
"button",
|
|
@@ -46880,19 +46940,19 @@ var ThreadListUnseenThreadsBanner = () => {
|
|
|
46880
46940
|
|
|
46881
46941
|
// src/components/Threads/ThreadList/ThreadListLoadingIndicator.tsx
|
|
46882
46942
|
var import_react127 = __toESM(require("react"));
|
|
46883
|
-
var
|
|
46943
|
+
var selector4 = (nextValue) => ({
|
|
46884
46944
|
isLoadingNext: nextValue.pagination.isLoadingNext
|
|
46885
46945
|
});
|
|
46886
46946
|
var ThreadListLoadingIndicator = () => {
|
|
46887
46947
|
const { LoadingIndicator: LoadingIndicator2 = LoadingIndicator } = useComponentContext();
|
|
46888
46948
|
const { client } = useChatContext();
|
|
46889
|
-
const { isLoadingNext } = useStateStore(client.threads.state,
|
|
46949
|
+
const { isLoadingNext } = useStateStore(client.threads.state, selector4);
|
|
46890
46950
|
if (!isLoadingNext) return null;
|
|
46891
46951
|
return /* @__PURE__ */ import_react127.default.createElement("div", { className: "str-chat__thread-list-loading-indicator" }, /* @__PURE__ */ import_react127.default.createElement(LoadingIndicator2, null));
|
|
46892
46952
|
};
|
|
46893
46953
|
|
|
46894
46954
|
// src/components/Threads/ThreadList/ThreadList.tsx
|
|
46895
|
-
var
|
|
46955
|
+
var selector5 = (nextValue) => ({ threads: nextValue.threads });
|
|
46896
46956
|
var computeItemKey = (_, item) => item.id;
|
|
46897
46957
|
var useThreadList = () => {
|
|
46898
46958
|
const { client } = useChatContext();
|
|
@@ -46921,7 +46981,7 @@ var ThreadList = ({ virtuosoProps }) => {
|
|
|
46921
46981
|
ThreadListLoadingIndicator: ThreadListLoadingIndicator2 = ThreadListLoadingIndicator,
|
|
46922
46982
|
ThreadListUnseenThreadsBanner: ThreadListUnseenThreadsBanner2 = ThreadListUnseenThreadsBanner
|
|
46923
46983
|
} = useComponentContext();
|
|
46924
|
-
const { threads } = useStateStore(client.threads.state,
|
|
46984
|
+
const { threads } = useStateStore(client.threads.state, selector5);
|
|
46925
46985
|
useThreadList();
|
|
46926
46986
|
return /* @__PURE__ */ import_react128.default.createElement("div", { className: "str-chat__thread-list-container" }, /* @__PURE__ */ import_react128.default.createElement(ThreadListUnseenThreadsBanner2, null), /* @__PURE__ */ import_react128.default.createElement(
|
|
46927
46987
|
import_react_virtuoso.Virtuoso,
|
|
@@ -51139,7 +51199,7 @@ var UnMemoizedChatAutoComplete = (props) => {
|
|
|
51139
51199
|
closeCommandsList: messageInput.closeCommandsList,
|
|
51140
51200
|
closeMentionsList: messageInput.closeMentionsList,
|
|
51141
51201
|
containerClassName: "str-chat__textarea str-chat__message-textarea-react-host",
|
|
51142
|
-
disabled: disabled || !!cooldownRemaining,
|
|
51202
|
+
disabled: (props.disabled ?? disabled) || !!cooldownRemaining,
|
|
51143
51203
|
disableMentions: messageInput.disableMentions,
|
|
51144
51204
|
grow: messageInput.grow,
|
|
51145
51205
|
handleSubmit: props.handleSubmit || messageInput.handleSubmit,
|
|
@@ -55378,7 +55438,7 @@ var useChat = ({
|
|
|
55378
55438
|
if (!client) return;
|
|
55379
55439
|
const userAgent = client.getUserAgent();
|
|
55380
55440
|
if (!userAgent.includes("stream-chat-react")) {
|
|
55381
|
-
client.setUserAgent(`stream-chat-react-12.
|
|
55441
|
+
client.setUserAgent(`stream-chat-react-12.9.0-${userAgent}`);
|
|
55382
55442
|
}
|
|
55383
55443
|
client.threads.registerSubscriptions();
|
|
55384
55444
|
client.polls.registerSubscriptions();
|
|
@@ -55668,7 +55728,7 @@ var Thread = (props) => {
|
|
|
55668
55728
|
/* @__PURE__ */ import_react269.default.createElement(ThreadInner, { ...props, key: `thread-${(thread ?? threadInstance)?.id}-${channel?.cid}` })
|
|
55669
55729
|
);
|
|
55670
55730
|
};
|
|
55671
|
-
var
|
|
55731
|
+
var selector6 = (nextValue) => ({
|
|
55672
55732
|
isLoadingNext: nextValue.pagination.isLoadingNext,
|
|
55673
55733
|
isLoadingPrev: nextValue.pagination.isLoadingPrev,
|
|
55674
55734
|
parentMessage: nextValue.parentMessage,
|
|
@@ -55688,7 +55748,7 @@ var ThreadInner = (props) => {
|
|
|
55688
55748
|
virtualized
|
|
55689
55749
|
} = props;
|
|
55690
55750
|
const threadInstance = useThreadContext();
|
|
55691
|
-
const { isLoadingNext, isLoadingPrev, parentMessage, replies } = useStateStore(threadInstance?.state,
|
|
55751
|
+
const { isLoadingNext, isLoadingPrev, parentMessage, replies } = useStateStore(threadInstance?.state, selector6) ?? {};
|
|
55692
55752
|
const {
|
|
55693
55753
|
thread,
|
|
55694
55754
|
threadHasMore,
|
|
@@ -56007,6 +56067,7 @@ var Window = import_react270.default.memo(UnMemoizedWindow);
|
|
|
56007
56067
|
enTranslations,
|
|
56008
56068
|
esTranslations,
|
|
56009
56069
|
escapeRegExp,
|
|
56070
|
+
extractSortValue,
|
|
56010
56071
|
findLastPinnedChannelIndex,
|
|
56011
56072
|
frTranslations,
|
|
56012
56073
|
getChannel,
|