stream-chat-react 12.8.2 → 12.10.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/Attachment/components/WaveProgressBar.js +1 -1
- package/dist/components/Attachment/hooks/useAudioController.d.ts +1 -1
- package/dist/components/Attachment/hooks/useAudioController.js +1 -1
- package/dist/components/AutoCompleteTextarea/Textarea.js +0 -4
- package/dist/components/AutoCompleteTextarea/utils.js +1 -5
- package/dist/components/Channel/Channel.js +3 -2
- package/dist/components/Channel/channelState.d.ts +1 -3
- package/dist/components/Channel/channelState.js +1 -1
- package/dist/components/Channel/hooks/useIsMounted.d.ts +1 -1
- package/dist/components/ChannelList/hooks/useChannelListShape.d.ts +3 -3
- package/dist/components/ChannelList/hooks/useChannelListShape.js +54 -47
- package/dist/components/ChannelList/hooks/useChannelMembershipState.d.ts +3 -2
- package/dist/components/ChannelList/hooks/useChannelMembershipState.js +6 -15
- package/dist/components/ChannelList/hooks/useMobileNavigation.d.ts +1 -1
- package/dist/components/ChannelList/hooks/usePaginatedChannels.js +1 -1
- 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/ChannelSearch/SearchBar.d.ts +1 -1
- package/dist/components/ChannelSearch/SearchInput.d.ts +1 -1
- package/dist/components/ChannelSearch/hooks/useChannelSearch.js +1 -1
- 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/components/Gallery/BaseImage.d.ts +1 -3
- package/dist/components/Gallery/Gallery.js +10 -2
- package/dist/components/Gallery/ModalGallery.js +5 -4
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.js +4 -4
- package/dist/components/MessageActions/hooks/useMessageActionsBoxPopper.d.ts +1 -1
- package/dist/components/MessageInput/hooks/useMessageInputText.d.ts +1 -1
- package/dist/components/MessageInput/hooks/useMessageInputText.js +2 -2
- package/dist/components/MessageInput/hooks/useTimeElapsed.js +1 -1
- package/dist/components/MessageList/MessageList.js +0 -1
- package/dist/components/MessageList/VirtualizedMessageList.d.ts +1 -1
- package/dist/components/MessageList/VirtualizedMessageList.js +2 -2
- package/dist/components/MessageList/hooks/MessageList/useMessageListScrollManager.js +1 -1
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.js +1 -1
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useNewMessageNotification.d.ts +1 -1
- package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.js +2 -2
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.js +1 -1
- package/dist/components/MessageList/hooks/useMarkRead.d.ts +2 -4
- package/dist/components/MessageList/hooks/useMarkRead.js +14 -16
- package/dist/context/VirtualizedMessageListContext.d.ts +13 -0
- package/dist/context/VirtualizedMessageListContext.js +7 -0
- package/dist/experimental/index.browser.cjs.map +2 -2
- package/dist/experimental/index.node.cjs.map +2 -2
- package/dist/index.browser.cjs +721 -267
- package/dist/index.browser.cjs.map +4 -4
- package/dist/index.node.cjs +986 -286
- package/dist/index.node.cjs.map +4 -4
- package/package.json +17 -18
package/dist/index.browser.cjs
CHANGED
|
@@ -416,6 +416,200 @@ var require_extend = __commonJS({
|
|
|
416
416
|
}
|
|
417
417
|
});
|
|
418
418
|
|
|
419
|
+
// node_modules/react-markdown/node_modules/react-is/cjs/react-is.development.js
|
|
420
|
+
var require_react_is_development = __commonJS({
|
|
421
|
+
"node_modules/react-markdown/node_modules/react-is/cjs/react-is.development.js"(exports) {
|
|
422
|
+
"use strict";
|
|
423
|
+
if (true) {
|
|
424
|
+
(function() {
|
|
425
|
+
"use strict";
|
|
426
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
|
427
|
+
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
428
|
+
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
429
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
430
|
+
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
431
|
+
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
|
432
|
+
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
433
|
+
var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context");
|
|
434
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
435
|
+
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
436
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
|
437
|
+
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
|
438
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
439
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
440
|
+
var enableScopeAPI = false;
|
|
441
|
+
var enableCacheElement = false;
|
|
442
|
+
var enableTransitionTracing = false;
|
|
443
|
+
var enableLegacyHidden = false;
|
|
444
|
+
var enableDebugTracing = false;
|
|
445
|
+
var REACT_MODULE_REFERENCE;
|
|
446
|
+
{
|
|
447
|
+
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
|
448
|
+
}
|
|
449
|
+
function isValidElementType(type) {
|
|
450
|
+
if (typeof type === "string" || typeof type === "function") {
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
|
454
|
+
return true;
|
|
455
|
+
}
|
|
456
|
+
if (typeof type === "object" && type !== null) {
|
|
457
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
458
|
+
// types supported by any Flight configuration anywhere since
|
|
459
|
+
// we don't know which Flight build this will end up being used
|
|
460
|
+
// with.
|
|
461
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return false;
|
|
466
|
+
}
|
|
467
|
+
function typeOf(object) {
|
|
468
|
+
if (typeof object === "object" && object !== null) {
|
|
469
|
+
var $$typeof = object.$$typeof;
|
|
470
|
+
switch ($$typeof) {
|
|
471
|
+
case REACT_ELEMENT_TYPE:
|
|
472
|
+
var type = object.type;
|
|
473
|
+
switch (type) {
|
|
474
|
+
case REACT_FRAGMENT_TYPE:
|
|
475
|
+
case REACT_PROFILER_TYPE:
|
|
476
|
+
case REACT_STRICT_MODE_TYPE:
|
|
477
|
+
case REACT_SUSPENSE_TYPE:
|
|
478
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
479
|
+
return type;
|
|
480
|
+
default:
|
|
481
|
+
var $$typeofType = type && type.$$typeof;
|
|
482
|
+
switch ($$typeofType) {
|
|
483
|
+
case REACT_SERVER_CONTEXT_TYPE:
|
|
484
|
+
case REACT_CONTEXT_TYPE:
|
|
485
|
+
case REACT_FORWARD_REF_TYPE:
|
|
486
|
+
case REACT_LAZY_TYPE:
|
|
487
|
+
case REACT_MEMO_TYPE:
|
|
488
|
+
case REACT_PROVIDER_TYPE:
|
|
489
|
+
return $$typeofType;
|
|
490
|
+
default:
|
|
491
|
+
return $$typeof;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
case REACT_PORTAL_TYPE:
|
|
495
|
+
return $$typeof;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
return void 0;
|
|
499
|
+
}
|
|
500
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
501
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
502
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
503
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
504
|
+
var Fragment2 = REACT_FRAGMENT_TYPE;
|
|
505
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
506
|
+
var Memo = REACT_MEMO_TYPE;
|
|
507
|
+
var Portal2 = REACT_PORTAL_TYPE;
|
|
508
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
509
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
510
|
+
var Suspense2 = REACT_SUSPENSE_TYPE;
|
|
511
|
+
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
512
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
513
|
+
var hasWarnedAboutDeprecatedIsConcurrentMode = false;
|
|
514
|
+
function isAsyncMode(object) {
|
|
515
|
+
{
|
|
516
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
517
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
518
|
+
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.");
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
function isConcurrentMode(object) {
|
|
524
|
+
{
|
|
525
|
+
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
|
526
|
+
hasWarnedAboutDeprecatedIsConcurrentMode = true;
|
|
527
|
+
console["warn"]("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.");
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
function isContextConsumer(object) {
|
|
533
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
534
|
+
}
|
|
535
|
+
function isContextProvider(object) {
|
|
536
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
537
|
+
}
|
|
538
|
+
function isElement2(object) {
|
|
539
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
540
|
+
}
|
|
541
|
+
function isForwardRef(object) {
|
|
542
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
543
|
+
}
|
|
544
|
+
function isFragment(object) {
|
|
545
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
546
|
+
}
|
|
547
|
+
function isLazy(object) {
|
|
548
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
549
|
+
}
|
|
550
|
+
function isMemo(object) {
|
|
551
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
552
|
+
}
|
|
553
|
+
function isPortal(object) {
|
|
554
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
555
|
+
}
|
|
556
|
+
function isProfiler(object) {
|
|
557
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
558
|
+
}
|
|
559
|
+
function isStrictMode(object) {
|
|
560
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
561
|
+
}
|
|
562
|
+
function isSuspense(object) {
|
|
563
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
564
|
+
}
|
|
565
|
+
function isSuspenseList(object) {
|
|
566
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
567
|
+
}
|
|
568
|
+
exports.ContextConsumer = ContextConsumer;
|
|
569
|
+
exports.ContextProvider = ContextProvider;
|
|
570
|
+
exports.Element = Element;
|
|
571
|
+
exports.ForwardRef = ForwardRef;
|
|
572
|
+
exports.Fragment = Fragment2;
|
|
573
|
+
exports.Lazy = Lazy;
|
|
574
|
+
exports.Memo = Memo;
|
|
575
|
+
exports.Portal = Portal2;
|
|
576
|
+
exports.Profiler = Profiler;
|
|
577
|
+
exports.StrictMode = StrictMode;
|
|
578
|
+
exports.Suspense = Suspense2;
|
|
579
|
+
exports.SuspenseList = SuspenseList;
|
|
580
|
+
exports.isAsyncMode = isAsyncMode;
|
|
581
|
+
exports.isConcurrentMode = isConcurrentMode;
|
|
582
|
+
exports.isContextConsumer = isContextConsumer;
|
|
583
|
+
exports.isContextProvider = isContextProvider;
|
|
584
|
+
exports.isElement = isElement2;
|
|
585
|
+
exports.isForwardRef = isForwardRef;
|
|
586
|
+
exports.isFragment = isFragment;
|
|
587
|
+
exports.isLazy = isLazy;
|
|
588
|
+
exports.isMemo = isMemo;
|
|
589
|
+
exports.isPortal = isPortal;
|
|
590
|
+
exports.isProfiler = isProfiler;
|
|
591
|
+
exports.isStrictMode = isStrictMode;
|
|
592
|
+
exports.isSuspense = isSuspense;
|
|
593
|
+
exports.isSuspenseList = isSuspenseList;
|
|
594
|
+
exports.isValidElementType = isValidElementType;
|
|
595
|
+
exports.typeOf = typeOf;
|
|
596
|
+
})();
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
// node_modules/react-markdown/node_modules/react-is/index.js
|
|
602
|
+
var require_react_is = __commonJS({
|
|
603
|
+
"node_modules/react-markdown/node_modules/react-is/index.js"(exports, module2) {
|
|
604
|
+
"use strict";
|
|
605
|
+
if (false) {
|
|
606
|
+
module2.exports = null;
|
|
607
|
+
} else {
|
|
608
|
+
module2.exports = require_react_is_development();
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
|
|
419
613
|
// node_modules/inline-style-parser/index.js
|
|
420
614
|
var require_inline_style_parser = __commonJS({
|
|
421
615
|
"node_modules/inline-style-parser/index.js"(exports, module2) {
|
|
@@ -2535,7 +2729,7 @@ var require_unified = __commonJS({
|
|
|
2535
2729
|
processor.stringify = stringify3;
|
|
2536
2730
|
processor.run = run;
|
|
2537
2731
|
processor.runSync = runSync;
|
|
2538
|
-
processor.process =
|
|
2732
|
+
processor.process = process2;
|
|
2539
2733
|
processor.processSync = processSync;
|
|
2540
2734
|
return processor;
|
|
2541
2735
|
function processor() {
|
|
@@ -2715,7 +2909,7 @@ var require_unified = __commonJS({
|
|
|
2715
2909
|
}
|
|
2716
2910
|
return Compiler(node2, file);
|
|
2717
2911
|
}
|
|
2718
|
-
function
|
|
2912
|
+
function process2(doc, cb) {
|
|
2719
2913
|
freeze();
|
|
2720
2914
|
assertParser2("process", processor.Parser);
|
|
2721
2915
|
assertCompiler2("process", processor.Compiler);
|
|
@@ -2744,7 +2938,7 @@ var require_unified = __commonJS({
|
|
|
2744
2938
|
assertParser2("processSync", processor.Parser);
|
|
2745
2939
|
assertCompiler2("processSync", processor.Compiler);
|
|
2746
2940
|
file = vfile2(doc);
|
|
2747
|
-
|
|
2941
|
+
process2(file, done);
|
|
2748
2942
|
assertDone2("processSync", "process", complete);
|
|
2749
2943
|
return file;
|
|
2750
2944
|
function done(error) {
|
|
@@ -2757,9 +2951,9 @@ var require_unified = __commonJS({
|
|
|
2757
2951
|
return typeof value === "function" && value.prototype && // A function with keys in its prototype is probably a constructor.
|
|
2758
2952
|
// Classes’ prototype methods are not enumerable, so we check if some value
|
|
2759
2953
|
// exists in the prototype.
|
|
2760
|
-
(
|
|
2954
|
+
(keys3(value.prototype) || name in value.prototype);
|
|
2761
2955
|
}
|
|
2762
|
-
function
|
|
2956
|
+
function keys3(value) {
|
|
2763
2957
|
var key;
|
|
2764
2958
|
for (key in value) {
|
|
2765
2959
|
return true;
|
|
@@ -8274,13 +8468,180 @@ var require_disallow_node = __commonJS({
|
|
|
8274
8468
|
}
|
|
8275
8469
|
});
|
|
8276
8470
|
|
|
8471
|
+
// node_modules/react-is/cjs/react-is.development.js
|
|
8472
|
+
var require_react_is_development2 = __commonJS({
|
|
8473
|
+
"node_modules/react-is/cjs/react-is.development.js"(exports) {
|
|
8474
|
+
"use strict";
|
|
8475
|
+
if (true) {
|
|
8476
|
+
(function() {
|
|
8477
|
+
"use strict";
|
|
8478
|
+
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
8479
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
|
|
8480
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
|
|
8481
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
|
|
8482
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
|
|
8483
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
|
|
8484
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
|
|
8485
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
|
|
8486
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
|
|
8487
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
|
|
8488
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
|
|
8489
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
|
|
8490
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
|
|
8491
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
|
|
8492
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
|
|
8493
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
|
|
8494
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
|
|
8495
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
|
|
8496
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
|
|
8497
|
+
function isValidElementType(type) {
|
|
8498
|
+
return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
8499
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
8500
|
+
}
|
|
8501
|
+
function typeOf(object) {
|
|
8502
|
+
if (typeof object === "object" && object !== null) {
|
|
8503
|
+
var $$typeof = object.$$typeof;
|
|
8504
|
+
switch ($$typeof) {
|
|
8505
|
+
case REACT_ELEMENT_TYPE:
|
|
8506
|
+
var type = object.type;
|
|
8507
|
+
switch (type) {
|
|
8508
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
8509
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
8510
|
+
case REACT_FRAGMENT_TYPE:
|
|
8511
|
+
case REACT_PROFILER_TYPE:
|
|
8512
|
+
case REACT_STRICT_MODE_TYPE:
|
|
8513
|
+
case REACT_SUSPENSE_TYPE:
|
|
8514
|
+
return type;
|
|
8515
|
+
default:
|
|
8516
|
+
var $$typeofType = type && type.$$typeof;
|
|
8517
|
+
switch ($$typeofType) {
|
|
8518
|
+
case REACT_CONTEXT_TYPE:
|
|
8519
|
+
case REACT_FORWARD_REF_TYPE:
|
|
8520
|
+
case REACT_LAZY_TYPE:
|
|
8521
|
+
case REACT_MEMO_TYPE:
|
|
8522
|
+
case REACT_PROVIDER_TYPE:
|
|
8523
|
+
return $$typeofType;
|
|
8524
|
+
default:
|
|
8525
|
+
return $$typeof;
|
|
8526
|
+
}
|
|
8527
|
+
}
|
|
8528
|
+
case REACT_PORTAL_TYPE:
|
|
8529
|
+
return $$typeof;
|
|
8530
|
+
}
|
|
8531
|
+
}
|
|
8532
|
+
return void 0;
|
|
8533
|
+
}
|
|
8534
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
8535
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
8536
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
8537
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
8538
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
8539
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
8540
|
+
var Fragment2 = REACT_FRAGMENT_TYPE;
|
|
8541
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
8542
|
+
var Memo = REACT_MEMO_TYPE;
|
|
8543
|
+
var Portal2 = REACT_PORTAL_TYPE;
|
|
8544
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
8545
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
8546
|
+
var Suspense2 = REACT_SUSPENSE_TYPE;
|
|
8547
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
8548
|
+
function isAsyncMode(object) {
|
|
8549
|
+
{
|
|
8550
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
8551
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
8552
|
+
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
|
|
8553
|
+
}
|
|
8554
|
+
}
|
|
8555
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
8556
|
+
}
|
|
8557
|
+
function isConcurrentMode(object) {
|
|
8558
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
8559
|
+
}
|
|
8560
|
+
function isContextConsumer(object) {
|
|
8561
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
8562
|
+
}
|
|
8563
|
+
function isContextProvider(object) {
|
|
8564
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
8565
|
+
}
|
|
8566
|
+
function isElement2(object) {
|
|
8567
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
8568
|
+
}
|
|
8569
|
+
function isForwardRef(object) {
|
|
8570
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
8571
|
+
}
|
|
8572
|
+
function isFragment(object) {
|
|
8573
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
8574
|
+
}
|
|
8575
|
+
function isLazy(object) {
|
|
8576
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
8577
|
+
}
|
|
8578
|
+
function isMemo(object) {
|
|
8579
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
8580
|
+
}
|
|
8581
|
+
function isPortal(object) {
|
|
8582
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
8583
|
+
}
|
|
8584
|
+
function isProfiler(object) {
|
|
8585
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
8586
|
+
}
|
|
8587
|
+
function isStrictMode(object) {
|
|
8588
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
8589
|
+
}
|
|
8590
|
+
function isSuspense(object) {
|
|
8591
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
8592
|
+
}
|
|
8593
|
+
exports.AsyncMode = AsyncMode;
|
|
8594
|
+
exports.ConcurrentMode = ConcurrentMode;
|
|
8595
|
+
exports.ContextConsumer = ContextConsumer;
|
|
8596
|
+
exports.ContextProvider = ContextProvider;
|
|
8597
|
+
exports.Element = Element;
|
|
8598
|
+
exports.ForwardRef = ForwardRef;
|
|
8599
|
+
exports.Fragment = Fragment2;
|
|
8600
|
+
exports.Lazy = Lazy;
|
|
8601
|
+
exports.Memo = Memo;
|
|
8602
|
+
exports.Portal = Portal2;
|
|
8603
|
+
exports.Profiler = Profiler;
|
|
8604
|
+
exports.StrictMode = StrictMode;
|
|
8605
|
+
exports.Suspense = Suspense2;
|
|
8606
|
+
exports.isAsyncMode = isAsyncMode;
|
|
8607
|
+
exports.isConcurrentMode = isConcurrentMode;
|
|
8608
|
+
exports.isContextConsumer = isContextConsumer;
|
|
8609
|
+
exports.isContextProvider = isContextProvider;
|
|
8610
|
+
exports.isElement = isElement2;
|
|
8611
|
+
exports.isForwardRef = isForwardRef;
|
|
8612
|
+
exports.isFragment = isFragment;
|
|
8613
|
+
exports.isLazy = isLazy;
|
|
8614
|
+
exports.isMemo = isMemo;
|
|
8615
|
+
exports.isPortal = isPortal;
|
|
8616
|
+
exports.isProfiler = isProfiler;
|
|
8617
|
+
exports.isStrictMode = isStrictMode;
|
|
8618
|
+
exports.isSuspense = isSuspense;
|
|
8619
|
+
exports.isValidElementType = isValidElementType;
|
|
8620
|
+
exports.typeOf = typeOf;
|
|
8621
|
+
})();
|
|
8622
|
+
}
|
|
8623
|
+
}
|
|
8624
|
+
});
|
|
8625
|
+
|
|
8626
|
+
// node_modules/react-is/index.js
|
|
8627
|
+
var require_react_is2 = __commonJS({
|
|
8628
|
+
"node_modules/react-is/index.js"(exports, module2) {
|
|
8629
|
+
"use strict";
|
|
8630
|
+
if (false) {
|
|
8631
|
+
module2.exports = null;
|
|
8632
|
+
} else {
|
|
8633
|
+
module2.exports = require_react_is_development2();
|
|
8634
|
+
}
|
|
8635
|
+
}
|
|
8636
|
+
});
|
|
8637
|
+
|
|
8277
8638
|
// node_modules/mml-react/node_modules/react-markdown/lib/ast-to-react.js
|
|
8278
8639
|
var require_ast_to_react = __commonJS({
|
|
8279
8640
|
"node_modules/mml-react/node_modules/react-markdown/lib/ast-to-react.js"(exports, module2) {
|
|
8280
8641
|
"use strict";
|
|
8281
|
-
var
|
|
8642
|
+
var React211 = require("react");
|
|
8282
8643
|
var xtend = require_immutable();
|
|
8283
|
-
var ReactIs2 =
|
|
8644
|
+
var ReactIs2 = require_react_is2();
|
|
8284
8645
|
function astToReact(node2, options) {
|
|
8285
8646
|
var parent = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
8286
8647
|
var index3 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
|
|
@@ -8305,7 +8666,7 @@ var require_ast_to_react = __commonJS({
|
|
|
8305
8666
|
throw new Error("Renderer for type `".concat(node2.type, "` not defined or is not renderable"));
|
|
8306
8667
|
}
|
|
8307
8668
|
var nodeProps = getNodeProps(node2, key, options, renderer, parent, index3);
|
|
8308
|
-
return
|
|
8669
|
+
return React211.createElement(renderer, nodeProps, nodeProps.children || resolveChildren() || void 0);
|
|
8309
8670
|
function resolveChildren() {
|
|
8310
8671
|
return node2.children && node2.children.map(function(childNode, i) {
|
|
8311
8672
|
return astToReact(childNode, options, {
|
|
@@ -8319,7 +8680,7 @@ var require_ast_to_react = __commonJS({
|
|
|
8319
8680
|
var props = {
|
|
8320
8681
|
key
|
|
8321
8682
|
};
|
|
8322
|
-
var isSimpleRenderer = typeof renderer === "string" || renderer ===
|
|
8683
|
+
var isSimpleRenderer = typeof renderer === "string" || renderer === React211.Fragment;
|
|
8323
8684
|
if (opts.sourcePos && node2.position) {
|
|
8324
8685
|
props["data-sourcepos"] = flattenPosition2(node2.position);
|
|
8325
8686
|
}
|
|
@@ -8472,14 +8833,14 @@ var require_ast_to_react = __commonJS({
|
|
|
8472
8833
|
function mergeNodeChildren(node2, parsedChildren) {
|
|
8473
8834
|
var el = node2.element;
|
|
8474
8835
|
if (Array.isArray(el)) {
|
|
8475
|
-
var Fragment2 =
|
|
8476
|
-
return
|
|
8836
|
+
var Fragment2 = React211.Fragment || "div";
|
|
8837
|
+
return React211.createElement(Fragment2, null, el);
|
|
8477
8838
|
}
|
|
8478
8839
|
if (el.props.children || parsedChildren) {
|
|
8479
|
-
var children =
|
|
8480
|
-
return
|
|
8840
|
+
var children = React211.Children.toArray(el.props.children).concat(parsedChildren);
|
|
8841
|
+
return React211.cloneElement(el, null, children);
|
|
8481
8842
|
}
|
|
8482
|
-
return
|
|
8843
|
+
return React211.cloneElement(el, null);
|
|
8483
8844
|
}
|
|
8484
8845
|
function flattenPosition2(pos) {
|
|
8485
8846
|
return [pos.start.line, ":", pos.start.column, "-", pos.end.line, ":", pos.end.column].map(String).join("");
|
|
@@ -8603,9 +8964,9 @@ var require_renderers = __commonJS({
|
|
|
8603
8964
|
"node_modules/mml-react/node_modules/react-markdown/lib/renderers.js"(exports, module2) {
|
|
8604
8965
|
"use strict";
|
|
8605
8966
|
var xtend = require_immutable();
|
|
8606
|
-
var
|
|
8607
|
-
var supportsStringRender = parseInt((
|
|
8608
|
-
var createElement =
|
|
8967
|
+
var React211 = require("react");
|
|
8968
|
+
var supportsStringRender = parseInt((React211.version || "16").slice(0, 2), 10) >= 16;
|
|
8969
|
+
var createElement = React211.createElement;
|
|
8609
8970
|
module2.exports = {
|
|
8610
8971
|
break: "br",
|
|
8611
8972
|
paragraph: "p",
|
|
@@ -8641,7 +9002,7 @@ var require_renderers = __commonJS({
|
|
|
8641
9002
|
}
|
|
8642
9003
|
function Root(props) {
|
|
8643
9004
|
var className = props.className;
|
|
8644
|
-
var root2 = !className &&
|
|
9005
|
+
var root2 = !className && React211.Fragment || "div";
|
|
8645
9006
|
return createElement(root2, className ? {
|
|
8646
9007
|
className
|
|
8647
9008
|
} : null, props.children);
|
|
@@ -8697,7 +9058,7 @@ var require_renderers = __commonJS({
|
|
|
8697
9058
|
var dangerous = props.allowDangerousHtml || props.escapeHtml === false;
|
|
8698
9059
|
var tag = props.isBlock ? "div" : "span";
|
|
8699
9060
|
if (!dangerous) {
|
|
8700
|
-
return createElement(
|
|
9061
|
+
return createElement(React211.Fragment || tag, null, props.value);
|
|
8701
9062
|
}
|
|
8702
9063
|
var nodeProps = {
|
|
8703
9064
|
dangerouslySetInnerHTML: {
|
|
@@ -8707,7 +9068,7 @@ var require_renderers = __commonJS({
|
|
|
8707
9068
|
return createElement(tag, nodeProps);
|
|
8708
9069
|
}
|
|
8709
9070
|
function ParsedHtml(props) {
|
|
8710
|
-
return props["data-sourcepos"] ?
|
|
9071
|
+
return props["data-sourcepos"] ? React211.cloneElement(props.element, {
|
|
8711
9072
|
"data-sourcepos": props["data-sourcepos"]
|
|
8712
9073
|
}) : props.element;
|
|
8713
9074
|
}
|
|
@@ -16321,14 +16682,14 @@ var init_mml_react_esm = __esm({
|
|
|
16321
16682
|
this.reset(true);
|
|
16322
16683
|
}
|
|
16323
16684
|
exports.keys = function(object) {
|
|
16324
|
-
var
|
|
16685
|
+
var keys3 = [];
|
|
16325
16686
|
for (var key in object) {
|
|
16326
|
-
|
|
16687
|
+
keys3.push(key);
|
|
16327
16688
|
}
|
|
16328
|
-
|
|
16689
|
+
keys3.reverse();
|
|
16329
16690
|
return function next() {
|
|
16330
|
-
while (
|
|
16331
|
-
var key2 =
|
|
16691
|
+
while (keys3.length) {
|
|
16692
|
+
var key2 = keys3.pop();
|
|
16332
16693
|
if (key2 in object) {
|
|
16333
16694
|
next.value = key2;
|
|
16334
16695
|
next.done = false;
|
|
@@ -17622,6 +17983,7 @@ __export(src_exports, {
|
|
|
17622
17983
|
enTranslations: () => en_default,
|
|
17623
17984
|
esTranslations: () => es_default,
|
|
17624
17985
|
escapeRegExp: () => escapeRegExp,
|
|
17986
|
+
extractSortValue: () => extractSortValue,
|
|
17625
17987
|
findLastPinnedChannelIndex: () => findLastPinnedChannelIndex,
|
|
17626
17988
|
frTranslations: () => fr_default,
|
|
17627
17989
|
getChannel: () => getChannel,
|
|
@@ -18085,16 +18447,16 @@ var import_react7 = require("react");
|
|
|
18085
18447
|
|
|
18086
18448
|
// src/store/hooks/useStateStore.ts
|
|
18087
18449
|
var import_react6 = require("react");
|
|
18088
|
-
function useStateStore(store,
|
|
18450
|
+
function useStateStore(store, selector7) {
|
|
18089
18451
|
const [state, setState] = (0, import_react6.useState)(() => {
|
|
18090
18452
|
if (!store) return void 0;
|
|
18091
|
-
return
|
|
18453
|
+
return selector7(store.getLatestValue());
|
|
18092
18454
|
});
|
|
18093
18455
|
(0, import_react6.useEffect)(() => {
|
|
18094
18456
|
if (!store) return;
|
|
18095
|
-
const unsubscribe = store.subscribeWithSelector(
|
|
18457
|
+
const unsubscribe = store.subscribeWithSelector(selector7, setState);
|
|
18096
18458
|
return unsubscribe;
|
|
18097
|
-
}, [store,
|
|
18459
|
+
}, [store, selector7]);
|
|
18098
18460
|
return state;
|
|
18099
18461
|
}
|
|
18100
18462
|
|
|
@@ -18868,7 +19230,7 @@ var WaveProgressBar = ({
|
|
|
18868
19230
|
const isDragging = (0, import_react27.useRef)(false);
|
|
18869
19231
|
const [root2, setRoot] = (0, import_react27.useState)(null);
|
|
18870
19232
|
const [trackAxisX, setTrackAxisX] = (0, import_react27.useState)();
|
|
18871
|
-
const lastRootWidth = (0, import_react27.useRef)();
|
|
19233
|
+
const lastRootWidth = (0, import_react27.useRef)(void 0);
|
|
18872
19234
|
const handleDragStart = (e2) => {
|
|
18873
19235
|
e2.preventDefault();
|
|
18874
19236
|
if (!progressIndicator) return;
|
|
@@ -18989,7 +19351,7 @@ var useAudioController = ({
|
|
|
18989
19351
|
const [canPlayRecord, setCanPlayRecord] = (0, import_react28.useState)(true);
|
|
18990
19352
|
const [secondsElapsed, setSecondsElapsed] = (0, import_react28.useState)(0);
|
|
18991
19353
|
const [playbackRateIndex, setPlaybackRateIndex] = (0, import_react28.useState)(0);
|
|
18992
|
-
const playTimeout = (0, import_react28.useRef)();
|
|
19354
|
+
const playTimeout = (0, import_react28.useRef)(void 0);
|
|
18993
19355
|
const audioRef = (0, import_react28.useRef)(null);
|
|
18994
19356
|
const registerError = (0, import_react28.useCallback)(
|
|
18995
19357
|
(e2) => {
|
|
@@ -20377,19 +20739,22 @@ var ModalGallery = (props) => {
|
|
|
20377
20739
|
source: imageSrc
|
|
20378
20740
|
};
|
|
20379
20741
|
}),
|
|
20380
|
-
|
|
20381
|
-
[images]
|
|
20742
|
+
[images, t2]
|
|
20382
20743
|
);
|
|
20383
|
-
return
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
|
|
20387
|
-
|
|
20388
|
-
|
|
20389
|
-
|
|
20390
|
-
|
|
20391
|
-
|
|
20392
|
-
|
|
20744
|
+
return (
|
|
20745
|
+
// ignore the TS error as react-image-gallery was on @types/react@18 while stream-chat-react being upgraded to React 19 (https://github.com/xiaolin/react-image-gallery/issues/809)
|
|
20746
|
+
// @ts-expect-error
|
|
20747
|
+
/* @__PURE__ */ import_react39.default.createElement(
|
|
20748
|
+
import_react_image_gallery.default,
|
|
20749
|
+
{
|
|
20750
|
+
items: formattedArray,
|
|
20751
|
+
renderItem,
|
|
20752
|
+
showIndex: true,
|
|
20753
|
+
showPlayButton: false,
|
|
20754
|
+
showThumbnails: false,
|
|
20755
|
+
startIndex: index3
|
|
20756
|
+
}
|
|
20757
|
+
)
|
|
20393
20758
|
);
|
|
20394
20759
|
};
|
|
20395
20760
|
|
|
@@ -20425,7 +20790,11 @@ var UnMemoizedGallery = (props) => {
|
|
|
20425
20790
|
backgroundImage: `url(${images[lastImageIndexInPreview].previewUrl || images[lastImageIndexInPreview].image_url || images[lastImageIndexInPreview].thumb_url})`,
|
|
20426
20791
|
...image3.style
|
|
20427
20792
|
},
|
|
20428
|
-
...innerRefs?.current && {
|
|
20793
|
+
...innerRefs?.current && {
|
|
20794
|
+
ref: (r) => {
|
|
20795
|
+
innerRefs.current[i] = r;
|
|
20796
|
+
}
|
|
20797
|
+
}
|
|
20429
20798
|
},
|
|
20430
20799
|
/* @__PURE__ */ import_react40.default.createElement("p", null, t2("{{ imageCount }} more", {
|
|
20431
20800
|
imageCount: images.length - countImagesDisplayedInPreview
|
|
@@ -20445,7 +20814,11 @@ var UnMemoizedGallery = (props) => {
|
|
|
20445
20814
|
src: (0, import_sanitize_url2.sanitizeUrl)(image3.previewUrl || image3.image_url || image3.thumb_url),
|
|
20446
20815
|
style: image3.style,
|
|
20447
20816
|
title: image3?.fallback || imageFallbackTitle,
|
|
20448
|
-
...innerRefs?.current && {
|
|
20817
|
+
...innerRefs?.current && {
|
|
20818
|
+
ref: (r) => {
|
|
20819
|
+
innerRefs.current[i] = r;
|
|
20820
|
+
}
|
|
20821
|
+
}
|
|
20449
20822
|
}
|
|
20450
20823
|
)
|
|
20451
20824
|
)
|
|
@@ -22420,7 +22793,7 @@ function base() {
|
|
|
22420
22793
|
processor.stringify = stringify3;
|
|
22421
22794
|
processor.run = run;
|
|
22422
22795
|
processor.runSync = runSync;
|
|
22423
|
-
processor.process =
|
|
22796
|
+
processor.process = process2;
|
|
22424
22797
|
processor.processSync = processSync;
|
|
22425
22798
|
return processor;
|
|
22426
22799
|
function processor() {
|
|
@@ -22597,7 +22970,7 @@ function base() {
|
|
|
22597
22970
|
complete = true;
|
|
22598
22971
|
}
|
|
22599
22972
|
}
|
|
22600
|
-
function
|
|
22973
|
+
function process2(doc, callback) {
|
|
22601
22974
|
processor.freeze();
|
|
22602
22975
|
assertParser("process", processor.Parser);
|
|
22603
22976
|
assertCompiler("process", processor.Compiler);
|
|
@@ -29961,7 +30334,7 @@ function rehypeFilter(options) {
|
|
|
29961
30334
|
|
|
29962
30335
|
// node_modules/react-markdown/lib/ast-to-react.js
|
|
29963
30336
|
var import_react48 = __toESM(require("react"), 1);
|
|
29964
|
-
var import_react_is = __toESM(
|
|
30337
|
+
var import_react_is = __toESM(require_react_is(), 1);
|
|
29965
30338
|
|
|
29966
30339
|
// node_modules/hast-util-whitespace/index.js
|
|
29967
30340
|
function whitespace(thing) {
|
|
@@ -33180,11 +33553,9 @@ var import_react62 = __toESM(require("react"));
|
|
|
33180
33553
|
var import_prop_types2 = __toESM(require("prop-types"));
|
|
33181
33554
|
var import_react_textarea_autosize = __toESM(require("react-textarea-autosize"));
|
|
33182
33555
|
var import_textarea_caret = __toESM(require("textarea-caret"));
|
|
33183
|
-
var import_react_is3 = require("react-is");
|
|
33184
33556
|
var import_clsx17 = __toESM(require("clsx"));
|
|
33185
33557
|
|
|
33186
33558
|
// src/components/AutoCompleteTextarea/utils.js
|
|
33187
|
-
var import_react_is2 = require("react-is");
|
|
33188
33559
|
var DEFAULT_CARET_POSITION = "next";
|
|
33189
33560
|
function defaultScrollToItem(container, item2) {
|
|
33190
33561
|
if (!item2) return;
|
|
@@ -33211,10 +33582,7 @@ var triggerPropsCheck = ({ trigger }) => {
|
|
|
33211
33582
|
return Error("Invalid prop trigger. Keys of the object has to be string / one character.");
|
|
33212
33583
|
}
|
|
33213
33584
|
const triggerSetting = settings;
|
|
33214
|
-
const { callback,
|
|
33215
|
-
if (!(0, import_react_is2.isValidElementType)(component)) {
|
|
33216
|
-
return Error("Invalid prop trigger: component should be defined.");
|
|
33217
|
-
}
|
|
33585
|
+
const { callback, dataProvider, output } = triggerSetting;
|
|
33218
33586
|
if (!dataProvider || typeof dataProvider !== "function") {
|
|
33219
33587
|
return Error("Invalid prop trigger: dataProvider should be defined.");
|
|
33220
33588
|
}
|
|
@@ -33747,9 +34115,6 @@ See https://github.com/webscopeio/react-textarea-autocomplete#trigger-type for m
|
|
|
33747
34115
|
if (!Array.isArray(data)) {
|
|
33748
34116
|
throw new Error("Trigger provider has to provide an array!");
|
|
33749
34117
|
}
|
|
33750
|
-
if (!(0, import_react_is3.isValidElementType)(component)) {
|
|
33751
|
-
throw new Error("Component should be defined!");
|
|
33752
|
-
}
|
|
33753
34118
|
if (currentTrigger !== this.state.currentTrigger) return;
|
|
33754
34119
|
if (!data.length) {
|
|
33755
34120
|
this._closeAutocomplete();
|
|
@@ -34134,7 +34499,7 @@ ReactTextareaAutocomplete.propTypes = {
|
|
|
34134
34499
|
};
|
|
34135
34500
|
|
|
34136
34501
|
// src/components/Channel/Channel.tsx
|
|
34137
|
-
var
|
|
34502
|
+
var import_react259 = __toESM(require("react"));
|
|
34138
34503
|
var import_lodash23 = __toESM(require("lodash.debounce"));
|
|
34139
34504
|
var import_lodash24 = __toESM(require("lodash.defaultsdeep"));
|
|
34140
34505
|
var import_lodash25 = __toESM(require("lodash.throttle"));
|
|
@@ -34142,7 +34507,7 @@ var import_nanoid11 = require("nanoid");
|
|
|
34142
34507
|
var import_clsx64 = __toESM(require("clsx"));
|
|
34143
34508
|
|
|
34144
34509
|
// src/components/Channel/channelState.ts
|
|
34145
|
-
var
|
|
34510
|
+
var makeChannelReducer = () => (state, action) => {
|
|
34146
34511
|
switch (action.type) {
|
|
34147
34512
|
case "closeThread": {
|
|
34148
34513
|
return {
|
|
@@ -38018,13 +38383,13 @@ var useMessageInputText = (props, state, dispatch, findAndEnqueueURLsToEnrich) =
|
|
|
38018
38383
|
const { channel } = useChannelStateContext("useMessageInputText");
|
|
38019
38384
|
const { additionalTextareaProps, focus, parent, publishTypingEvent = true } = props;
|
|
38020
38385
|
const { text: text6 } = state;
|
|
38021
|
-
const textareaRef = (0, import_react75.useRef)();
|
|
38386
|
+
const textareaRef = (0, import_react75.useRef)(void 0);
|
|
38022
38387
|
(0, import_react75.useEffect)(() => {
|
|
38023
38388
|
if (focus && textareaRef.current) {
|
|
38024
38389
|
textareaRef.current.focus();
|
|
38025
38390
|
}
|
|
38026
38391
|
}, [focus]);
|
|
38027
|
-
const newCursorPosition = (0, import_react75.useRef)();
|
|
38392
|
+
const newCursorPosition = (0, import_react75.useRef)(void 0);
|
|
38028
38393
|
const insertText = (0, import_react75.useCallback)(
|
|
38029
38394
|
(textToInsert) => {
|
|
38030
38395
|
const { maxLength } = additionalTextareaProps || {};
|
|
@@ -39961,7 +40326,10 @@ var moveChannelUpwards = ({
|
|
|
39961
40326
|
const targetChannelExistsWithinList = targetChannelIndex >= 0;
|
|
39962
40327
|
const targetChannelAlreadyAtTheTop = targetChannelIndex === 0;
|
|
39963
40328
|
const considerPinnedChannels = shouldConsiderPinnedChannels(sort);
|
|
39964
|
-
|
|
40329
|
+
const isTargetChannelPinned = isChannelPinned(channelToMove);
|
|
40330
|
+
if (targetChannelAlreadyAtTheTop || considerPinnedChannels && isTargetChannelPinned) {
|
|
40331
|
+
return channels;
|
|
40332
|
+
}
|
|
39965
40333
|
const newChannels = [...channels];
|
|
39966
40334
|
if (targetChannelExistsWithinList) {
|
|
39967
40335
|
newChannels.splice(targetChannelIndex, 1);
|
|
@@ -39978,25 +40346,48 @@ var moveChannelUpwards = ({
|
|
|
39978
40346
|
return newChannels;
|
|
39979
40347
|
};
|
|
39980
40348
|
var shouldConsiderPinnedChannels = (sort) => {
|
|
39981
|
-
|
|
39982
|
-
if (
|
|
39983
|
-
|
|
39984
|
-
|
|
39985
|
-
|
|
40349
|
+
const value = extractSortValue({ atIndex: 0, sort, targetKey: "pinned_at" });
|
|
40350
|
+
if (typeof value !== "number") return false;
|
|
40351
|
+
return Math.abs(value) === 1;
|
|
40352
|
+
};
|
|
40353
|
+
var extractSortValue = ({
|
|
40354
|
+
atIndex,
|
|
40355
|
+
sort,
|
|
40356
|
+
targetKey
|
|
40357
|
+
}) => {
|
|
40358
|
+
if (!sort) return null;
|
|
40359
|
+
let option = null;
|
|
40360
|
+
if (Array.isArray(sort)) {
|
|
40361
|
+
option = sort[atIndex] ?? null;
|
|
40362
|
+
} else {
|
|
40363
|
+
let index3 = 0;
|
|
40364
|
+
for (const key in sort) {
|
|
40365
|
+
if (index3 !== atIndex) {
|
|
40366
|
+
index3++;
|
|
40367
|
+
continue;
|
|
40368
|
+
}
|
|
40369
|
+
if (key !== targetKey) {
|
|
40370
|
+
return null;
|
|
40371
|
+
}
|
|
40372
|
+
option = sort;
|
|
40373
|
+
break;
|
|
40374
|
+
}
|
|
40375
|
+
}
|
|
40376
|
+
return option?.[targetKey] ?? null;
|
|
39986
40377
|
};
|
|
39987
40378
|
var shouldConsiderArchivedChannels = (filters) => {
|
|
39988
40379
|
if (!filters) return false;
|
|
39989
|
-
return
|
|
40380
|
+
return typeof filters.archived === "boolean";
|
|
39990
40381
|
};
|
|
39991
40382
|
var isChannelPinned = (channel) => {
|
|
39992
40383
|
if (!channel) return false;
|
|
39993
|
-
const
|
|
39994
|
-
return
|
|
40384
|
+
const membership = channel.state.membership;
|
|
40385
|
+
return typeof membership.pinned_at === "string";
|
|
39995
40386
|
};
|
|
39996
40387
|
var isChannelArchived = (channel) => {
|
|
39997
40388
|
if (!channel) return false;
|
|
39998
|
-
const
|
|
39999
|
-
return
|
|
40389
|
+
const membership = channel.state.membership;
|
|
40390
|
+
return typeof membership.archived_at === "string";
|
|
40000
40391
|
};
|
|
40001
40392
|
|
|
40002
40393
|
// src/components/ChannelList/hooks/usePaginatedChannels.ts
|
|
@@ -40008,7 +40399,7 @@ var usePaginatedChannels = (client, filters, sort, options, activeChannelHandler
|
|
|
40008
40399
|
} = useChatContext("usePaginatedChannels");
|
|
40009
40400
|
const [channels, setChannels] = (0, import_react90.useState)([]);
|
|
40010
40401
|
const [hasNextPage, setHasNextPage] = (0, import_react90.useState)(true);
|
|
40011
|
-
const lastRecoveryTimestamp = (0, import_react90.useRef)();
|
|
40402
|
+
const lastRecoveryTimestamp = (0, import_react90.useRef)(void 0);
|
|
40012
40403
|
const recoveryThrottleInterval = recoveryThrottleIntervalMs < MIN_RECOVER_LOADED_CHANNELS_THROTTLE_INTERVAL_IN_MS ? MIN_RECOVER_LOADED_CHANNELS_THROTTLE_INTERVAL_IN_MS : recoveryThrottleIntervalMs ?? RECOVER_LOADED_CHANNELS_THROTTLE_INTERVAL_IN_MS;
|
|
40013
40404
|
const filterString = (0, import_react90.useMemo)(() => JSON.stringify(filters), [filters]);
|
|
40014
40405
|
const sortString = (0, import_react90.useMemo)(() => JSON.stringify(sort), [sort]);
|
|
@@ -40110,7 +40501,7 @@ var useChannelSearch = ({
|
|
|
40110
40501
|
const [query, setQuery] = (0, import_react91.useState)("");
|
|
40111
40502
|
const [results, setResults] = (0, import_react91.useState)([]);
|
|
40112
40503
|
const [searching, setSearching] = (0, import_react91.useState)(false);
|
|
40113
|
-
const searchQueryPromiseInProgress = (0, import_react91.useRef)();
|
|
40504
|
+
const searchQueryPromiseInProgress = (0, import_react91.useRef)(void 0);
|
|
40114
40505
|
const shouldIgnoreQueryResults = (0, import_react91.useRef)(false);
|
|
40115
40506
|
const inputRef = (0, import_react91.useRef)(null);
|
|
40116
40507
|
const searchBarRef = (0, import_react91.useRef)(null);
|
|
@@ -40859,33 +41250,33 @@ var useChannelListShapeDefaults = () => {
|
|
|
40859
41250
|
if (typeof customHandler === "function") {
|
|
40860
41251
|
return customHandler(setChannels, event);
|
|
40861
41252
|
}
|
|
40862
|
-
|
|
40863
|
-
|
|
41253
|
+
const channelType = event.channel_type;
|
|
41254
|
+
const channelId = event.channel_id;
|
|
41255
|
+
if (!channelType || !channelId) return;
|
|
41256
|
+
setChannels((currentChannels) => {
|
|
41257
|
+
const targetChannel = client.channel(channelType, channelId);
|
|
41258
|
+
const targetChannelIndex = currentChannels.indexOf(targetChannel);
|
|
40864
41259
|
const targetChannelExistsWithinList = targetChannelIndex >= 0;
|
|
40865
|
-
const targetChannel = channels[targetChannelIndex];
|
|
40866
41260
|
const isTargetChannelPinned = isChannelPinned(targetChannel);
|
|
40867
41261
|
const isTargetChannelArchived = isChannelArchived(targetChannel);
|
|
40868
41262
|
const considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
40869
41263
|
const considerPinnedChannels = shouldConsiderPinnedChannels(sort);
|
|
40870
41264
|
if (
|
|
40871
|
-
// target channel is archived
|
|
40872
|
-
isTargetChannelArchived &&
|
|
40873
|
-
|
|
41265
|
+
// filter is defined, target channel is archived and filter option is set to false
|
|
41266
|
+
considerArchivedChannels && isTargetChannelArchived && !filters.archived || // filter is defined, target channel isn't archived and filter option is set to true
|
|
41267
|
+
considerArchivedChannels && !isTargetChannelArchived && filters.archived || // sort option is defined, target channel is pinned
|
|
41268
|
+
considerPinnedChannels && isTargetChannelPinned || // list order is locked
|
|
40874
41269
|
lockChannelOrder || // target channel is not within the loaded list and loading from cache is disallowed
|
|
40875
41270
|
!targetChannelExistsWithinList && !allowNewMessagesFromUnfilteredChannels
|
|
40876
41271
|
) {
|
|
40877
|
-
return
|
|
40878
|
-
}
|
|
40879
|
-
const channelToMove = channels[targetChannelIndex] ?? (allowNewMessagesFromUnfilteredChannels && event.channel_type ? client.channel(event.channel_type, event.channel_id) : null);
|
|
40880
|
-
if (channelToMove) {
|
|
40881
|
-
return moveChannelUpwards({
|
|
40882
|
-
channels,
|
|
40883
|
-
channelToMove,
|
|
40884
|
-
channelToMoveIndexWithinChannels: targetChannelIndex,
|
|
40885
|
-
sort
|
|
40886
|
-
});
|
|
41272
|
+
return currentChannels;
|
|
40887
41273
|
}
|
|
40888
|
-
return
|
|
41274
|
+
return moveChannelUpwards({
|
|
41275
|
+
channels: currentChannels,
|
|
41276
|
+
channelToMove: targetChannel,
|
|
41277
|
+
channelToMoveIndexWithinChannels: targetChannelIndex,
|
|
41278
|
+
sort
|
|
41279
|
+
});
|
|
40889
41280
|
});
|
|
40890
41281
|
},
|
|
40891
41282
|
[client]
|
|
@@ -40911,7 +41302,7 @@ var useChannelListShapeDefaults = () => {
|
|
|
40911
41302
|
type: event.channel.type
|
|
40912
41303
|
});
|
|
40913
41304
|
const considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
40914
|
-
if (isChannelArchived(channel) && considerArchivedChannels) {
|
|
41305
|
+
if (isChannelArchived(channel) && considerArchivedChannels && !filters.archived) {
|
|
40915
41306
|
return;
|
|
40916
41307
|
}
|
|
40917
41308
|
if (!allowNewMessagesFromUnfilteredChannels) {
|
|
@@ -40933,26 +41324,33 @@ var useChannelListShapeDefaults = () => {
|
|
|
40933
41324
|
allowNewMessagesFromUnfilteredChannels,
|
|
40934
41325
|
customHandler,
|
|
40935
41326
|
event,
|
|
40936
|
-
setChannels
|
|
41327
|
+
setChannels,
|
|
41328
|
+
sort
|
|
40937
41329
|
}) => {
|
|
40938
41330
|
if (typeof customHandler === "function") {
|
|
40939
41331
|
return customHandler(setChannels, event);
|
|
40940
41332
|
}
|
|
40941
|
-
if (
|
|
40942
|
-
|
|
40943
|
-
client,
|
|
40944
|
-
id: event.channel.id,
|
|
40945
|
-
members: event.channel.members?.reduce((acc, { user, user_id }) => {
|
|
40946
|
-
const userId = user_id || user?.id;
|
|
40947
|
-
if (userId) {
|
|
40948
|
-
acc.push(userId);
|
|
40949
|
-
}
|
|
40950
|
-
return acc;
|
|
40951
|
-
}, []),
|
|
40952
|
-
type: event.channel.type
|
|
40953
|
-
});
|
|
40954
|
-
setChannels((channels) => (0, import_lodash11.default)([channel, ...channels], "cid"));
|
|
41333
|
+
if (!event.channel || !allowNewMessagesFromUnfilteredChannels) {
|
|
41334
|
+
return;
|
|
40955
41335
|
}
|
|
41336
|
+
const channel = await getChannel({
|
|
41337
|
+
client,
|
|
41338
|
+
id: event.channel.id,
|
|
41339
|
+
members: event.channel.members?.reduce((newMembers, { user, user_id }) => {
|
|
41340
|
+
const userId = user_id || user?.id;
|
|
41341
|
+
if (userId) newMembers.push(userId);
|
|
41342
|
+
return newMembers;
|
|
41343
|
+
}, []),
|
|
41344
|
+
type: event.channel.type
|
|
41345
|
+
});
|
|
41346
|
+
setChannels(
|
|
41347
|
+
(channels) => moveChannelUpwards({
|
|
41348
|
+
channels,
|
|
41349
|
+
channelToMove: channel,
|
|
41350
|
+
channelToMoveIndexWithinChannels: -1,
|
|
41351
|
+
sort
|
|
41352
|
+
})
|
|
41353
|
+
);
|
|
40956
41354
|
},
|
|
40957
41355
|
[client]
|
|
40958
41356
|
);
|
|
@@ -40970,29 +41368,37 @@ var useChannelListShapeDefaults = () => {
|
|
|
40970
41368
|
[]
|
|
40971
41369
|
);
|
|
40972
41370
|
const handleMemberUpdated = (0, import_react101.useCallback)(
|
|
40973
|
-
({
|
|
41371
|
+
({
|
|
41372
|
+
event,
|
|
41373
|
+
filters,
|
|
41374
|
+
lockChannelOrder,
|
|
41375
|
+
setChannels,
|
|
41376
|
+
sort
|
|
41377
|
+
}) => {
|
|
40974
41378
|
if (!event.member?.user || event.member.user.id !== client.userID || !event.channel_type) {
|
|
40975
41379
|
return;
|
|
40976
41380
|
}
|
|
40977
|
-
const member = event.member;
|
|
40978
41381
|
const channelType = event.channel_type;
|
|
40979
41382
|
const channelId = event.channel_id;
|
|
40980
41383
|
const considerPinnedChannels = shouldConsiderPinnedChannels(sort);
|
|
40981
|
-
const
|
|
41384
|
+
const considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
41385
|
+
const pinnedAtSort = extractSortValue({ atIndex: 0, sort, targetKey: "pinned_at" });
|
|
40982
41386
|
setChannels((currentChannels) => {
|
|
40983
41387
|
const targetChannel = client.channel(channelType, channelId);
|
|
40984
41388
|
const targetChannelIndex = currentChannels.indexOf(targetChannel);
|
|
40985
41389
|
const targetChannelExistsWithinList = targetChannelIndex >= 0;
|
|
41390
|
+
const isTargetChannelArchived = isChannelArchived(targetChannel);
|
|
41391
|
+
const isTargetChannelPinned = isChannelPinned(targetChannel);
|
|
40986
41392
|
if (!considerPinnedChannels || lockChannelOrder) return currentChannels;
|
|
40987
41393
|
const newChannels = [...currentChannels];
|
|
40988
41394
|
if (targetChannelExistsWithinList) {
|
|
40989
41395
|
newChannels.splice(targetChannelIndex, 1);
|
|
40990
41396
|
}
|
|
40991
|
-
if (
|
|
41397
|
+
if (considerArchivedChannels && isTargetChannelArchived && !filters.archived || considerArchivedChannels && !isTargetChannelArchived && filters.archived) {
|
|
40992
41398
|
return newChannels;
|
|
40993
41399
|
}
|
|
40994
41400
|
let lastPinnedChannelIndex = null;
|
|
40995
|
-
if (pinnedAtSort === 1 || pinnedAtSort === -1 && !
|
|
41401
|
+
if (pinnedAtSort === 1 || pinnedAtSort === -1 && !isTargetChannelPinned) {
|
|
40996
41402
|
lastPinnedChannelIndex = findLastPinnedChannelIndex({ channels: newChannels });
|
|
40997
41403
|
}
|
|
40998
41404
|
const newTargetChannelIndex = typeof lastPinnedChannelIndex === "number" ? lastPinnedChannelIndex + 1 : 0;
|
|
@@ -41122,8 +41528,8 @@ var usePrepareShapeHandlers = ({
|
|
|
41122
41528
|
sort
|
|
41123
41529
|
}) => {
|
|
41124
41530
|
const defaults = useChannelListShapeDefaults();
|
|
41125
|
-
const defaultHandleChannelListShapeRef = (0, import_react101.useRef)();
|
|
41126
|
-
const customHandleChannelListShapeRef = (0, import_react101.useRef)();
|
|
41531
|
+
const defaultHandleChannelListShapeRef = (0, import_react101.useRef)(void 0);
|
|
41532
|
+
const customHandleChannelListShapeRef = (0, import_react101.useRef)(void 0);
|
|
41127
41533
|
customHandleChannelListShapeRef.current = (event) => {
|
|
41128
41534
|
customHandleChannelListShape?.({ defaults, event, setChannels });
|
|
41129
41535
|
};
|
|
@@ -41193,6 +41599,7 @@ var usePrepareShapeHandlers = ({
|
|
|
41193
41599
|
case "member.updated":
|
|
41194
41600
|
defaults.handleMemberUpdated({
|
|
41195
41601
|
event,
|
|
41602
|
+
filters,
|
|
41196
41603
|
lockChannelOrder,
|
|
41197
41604
|
setChannels,
|
|
41198
41605
|
sort
|
|
@@ -41676,24 +42083,41 @@ var useUserPresenceChangedListener = (setChannels) => {
|
|
|
41676
42083
|
}, [client, setChannels]);
|
|
41677
42084
|
};
|
|
41678
42085
|
|
|
41679
|
-
// src/components/ChannelList/hooks/
|
|
42086
|
+
// src/components/ChannelList/hooks/useSelectedChannelState.ts
|
|
41680
42087
|
var import_react113 = require("react");
|
|
41681
|
-
var
|
|
41682
|
-
|
|
41683
|
-
channel?.state.membership || {}
|
|
41684
|
-
);
|
|
41685
|
-
const { client } = useChatContext();
|
|
41686
|
-
(0, import_react113.useEffect)(() => {
|
|
41687
|
-
if (!channel) return;
|
|
41688
|
-
const subscriptions = ["member.updated"].map(
|
|
41689
|
-
(v) => client.on(v, () => {
|
|
41690
|
-
setMembership(channel.state.membership);
|
|
41691
|
-
})
|
|
41692
|
-
);
|
|
41693
|
-
return () => subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
41694
|
-
}, [client, channel]);
|
|
41695
|
-
return membership;
|
|
42088
|
+
var import_shim = require("use-sync-external-store/shim");
|
|
42089
|
+
var noop = () => {
|
|
41696
42090
|
};
|
|
42091
|
+
function useSelectedChannelState({
|
|
42092
|
+
channel,
|
|
42093
|
+
stateChangeEventKeys = ["all"],
|
|
42094
|
+
selector: selector7
|
|
42095
|
+
}) {
|
|
42096
|
+
const subscribe = (0, import_react113.useCallback)(
|
|
42097
|
+
(onStoreChange) => {
|
|
42098
|
+
if (!channel) return noop;
|
|
42099
|
+
const subscriptions = stateChangeEventKeys.map(
|
|
42100
|
+
(et) => channel.on(et, () => {
|
|
42101
|
+
onStoreChange(selector7(channel));
|
|
42102
|
+
})
|
|
42103
|
+
);
|
|
42104
|
+
return () => subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
42105
|
+
},
|
|
42106
|
+
[channel, selector7, stateChangeEventKeys]
|
|
42107
|
+
);
|
|
42108
|
+
const getSnapshot = (0, import_react113.useCallback)(() => {
|
|
42109
|
+
if (!channel) return void 0;
|
|
42110
|
+
return selector7(channel);
|
|
42111
|
+
}, [channel, selector7]);
|
|
42112
|
+
return (0, import_shim.useSyncExternalStore)(subscribe, getSnapshot);
|
|
42113
|
+
}
|
|
42114
|
+
|
|
42115
|
+
// src/components/ChannelList/hooks/useChannelMembershipState.ts
|
|
42116
|
+
var selector = (c) => c.state.membership;
|
|
42117
|
+
var keys2 = ["member.updated"];
|
|
42118
|
+
function useChannelMembershipState(channel) {
|
|
42119
|
+
return useSelectedChannelState({ channel, selector, stateChangeEventKeys: keys2 });
|
|
42120
|
+
}
|
|
41697
42121
|
|
|
41698
42122
|
// src/components/ChannelPreview/icons.tsx
|
|
41699
42123
|
var import_react114 = __toESM(require("react"));
|
|
@@ -42178,12 +42602,12 @@ var ThreadAdapter = ({ children }) => {
|
|
|
42178
42602
|
useActiveThread({ activeThread });
|
|
42179
42603
|
return /* @__PURE__ */ import_react122.default.createElement(ThreadProvider, { thread: activeThread }, children);
|
|
42180
42604
|
};
|
|
42181
|
-
var
|
|
42605
|
+
var selector2 = ({ unreadThreadCount }) => ({
|
|
42182
42606
|
unreadThreadCount
|
|
42183
42607
|
});
|
|
42184
42608
|
var ChatViewSelector = () => {
|
|
42185
42609
|
const { client } = useChatContext();
|
|
42186
|
-
const { unreadThreadCount } = useStateStore(client.threads.state,
|
|
42610
|
+
const { unreadThreadCount } = useStateStore(client.threads.state, selector2);
|
|
42187
42611
|
const { activeChatView, setActiveChatView } = (0, import_react122.useContext)(ChatViewContext);
|
|
42188
42612
|
return /* @__PURE__ */ import_react122.default.createElement("div", { className: "str-chat__chat-view__selector" }, /* @__PURE__ */ import_react122.default.createElement(
|
|
42189
42613
|
"button",
|
|
@@ -42245,7 +42669,7 @@ var getTitleFromMessage = ({
|
|
|
42245
42669
|
var ThreadListItemUI = (props) => {
|
|
42246
42670
|
const { client } = useChatContext();
|
|
42247
42671
|
const thread = useThreadListItemContext();
|
|
42248
|
-
const
|
|
42672
|
+
const selector7 = (0, import_react123.useCallback)(
|
|
42249
42673
|
(nextValue) => ({
|
|
42250
42674
|
channel: nextValue.channel,
|
|
42251
42675
|
deletedAt: nextValue.deletedAt,
|
|
@@ -42257,7 +42681,7 @@ var ThreadListItemUI = (props) => {
|
|
|
42257
42681
|
);
|
|
42258
42682
|
const { channel, deletedAt, latestReply, ownUnreadMessageCount, parentMessage } = useStateStore(
|
|
42259
42683
|
thread.state,
|
|
42260
|
-
|
|
42684
|
+
selector7
|
|
42261
42685
|
);
|
|
42262
42686
|
const { displayTitle: channelDisplayTitle } = useChannelPreviewInfo({ channel });
|
|
42263
42687
|
const { activeThread, setActiveThread } = useThreadsViewContext();
|
|
@@ -42294,12 +42718,12 @@ var ThreadListEmptyPlaceholder = () => /* @__PURE__ */ import_react125.default.c
|
|
|
42294
42718
|
|
|
42295
42719
|
// src/components/Threads/ThreadList/ThreadListUnseenThreadsBanner.tsx
|
|
42296
42720
|
var import_react126 = __toESM(require("react"));
|
|
42297
|
-
var
|
|
42721
|
+
var selector3 = (nextValue) => ({
|
|
42298
42722
|
unseenThreadIds: nextValue.unseenThreadIds
|
|
42299
42723
|
});
|
|
42300
42724
|
var ThreadListUnseenThreadsBanner = () => {
|
|
42301
42725
|
const { client } = useChatContext();
|
|
42302
|
-
const { unseenThreadIds } = useStateStore(client.threads.state,
|
|
42726
|
+
const { unseenThreadIds } = useStateStore(client.threads.state, selector3);
|
|
42303
42727
|
if (!unseenThreadIds.length) return null;
|
|
42304
42728
|
return /* @__PURE__ */ import_react126.default.createElement("div", { className: "str-chat__unseen-threads-banner" }, unseenThreadIds.length, " unread threads", /* @__PURE__ */ import_react126.default.createElement(
|
|
42305
42729
|
"button",
|
|
@@ -42313,19 +42737,19 @@ var ThreadListUnseenThreadsBanner = () => {
|
|
|
42313
42737
|
|
|
42314
42738
|
// src/components/Threads/ThreadList/ThreadListLoadingIndicator.tsx
|
|
42315
42739
|
var import_react127 = __toESM(require("react"));
|
|
42316
|
-
var
|
|
42740
|
+
var selector4 = (nextValue) => ({
|
|
42317
42741
|
isLoadingNext: nextValue.pagination.isLoadingNext
|
|
42318
42742
|
});
|
|
42319
42743
|
var ThreadListLoadingIndicator = () => {
|
|
42320
42744
|
const { LoadingIndicator: LoadingIndicator2 = LoadingIndicator } = useComponentContext();
|
|
42321
42745
|
const { client } = useChatContext();
|
|
42322
|
-
const { isLoadingNext } = useStateStore(client.threads.state,
|
|
42746
|
+
const { isLoadingNext } = useStateStore(client.threads.state, selector4);
|
|
42323
42747
|
if (!isLoadingNext) return null;
|
|
42324
42748
|
return /* @__PURE__ */ import_react127.default.createElement("div", { className: "str-chat__thread-list-loading-indicator" }, /* @__PURE__ */ import_react127.default.createElement(LoadingIndicator2, null));
|
|
42325
42749
|
};
|
|
42326
42750
|
|
|
42327
42751
|
// src/components/Threads/ThreadList/ThreadList.tsx
|
|
42328
|
-
var
|
|
42752
|
+
var selector5 = (nextValue) => ({ threads: nextValue.threads });
|
|
42329
42753
|
var computeItemKey = (_, item2) => item2.id;
|
|
42330
42754
|
var useThreadList = () => {
|
|
42331
42755
|
const { client } = useChatContext();
|
|
@@ -42354,7 +42778,7 @@ var ThreadList = ({ virtuosoProps }) => {
|
|
|
42354
42778
|
ThreadListLoadingIndicator: ThreadListLoadingIndicator2 = ThreadListLoadingIndicator,
|
|
42355
42779
|
ThreadListUnseenThreadsBanner: ThreadListUnseenThreadsBanner2 = ThreadListUnseenThreadsBanner
|
|
42356
42780
|
} = useComponentContext();
|
|
42357
|
-
const { threads } = useStateStore(client.threads.state,
|
|
42781
|
+
const { threads } = useStateStore(client.threads.state, selector5);
|
|
42358
42782
|
useThreadList();
|
|
42359
42783
|
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(
|
|
42360
42784
|
import_react_virtuoso.Virtuoso,
|
|
@@ -45742,7 +46166,7 @@ var import_react194 = __toESM(require("react"));
|
|
|
45742
46166
|
var import_react193 = require("react");
|
|
45743
46167
|
var useTimeElapsed = ({ startOnMount } = {}) => {
|
|
45744
46168
|
const [secondsElapsed, setSecondsElapsed] = (0, import_react193.useState)(0);
|
|
45745
|
-
const updateInterval = (0, import_react193.useRef)();
|
|
46169
|
+
const updateInterval = (0, import_react193.useRef)(void 0);
|
|
45746
46170
|
const startCounter = (0, import_react193.useCallback)(() => {
|
|
45747
46171
|
if (updateInterval.current) return;
|
|
45748
46172
|
updateInterval.current = setInterval(() => {
|
|
@@ -46572,7 +46996,7 @@ var UnMemoizedChatAutoComplete = (props) => {
|
|
|
46572
46996
|
closeCommandsList: messageInput.closeCommandsList,
|
|
46573
46997
|
closeMentionsList: messageInput.closeMentionsList,
|
|
46574
46998
|
containerClassName: "str-chat__textarea str-chat__message-textarea-react-host",
|
|
46575
|
-
disabled: disabled || !!cooldownRemaining,
|
|
46999
|
+
disabled: (props.disabled ?? disabled) || !!cooldownRemaining,
|
|
46576
47000
|
disableMentions: messageInput.disableMentions,
|
|
46577
47001
|
grow: messageInput.grow,
|
|
46578
47002
|
handleSubmit: props.handleSubmit || messageInput.handleSubmit,
|
|
@@ -47967,7 +48391,7 @@ function useMessageListScrollManager(params) {
|
|
|
47967
48391
|
offsetHeight: 0,
|
|
47968
48392
|
scrollHeight: 0
|
|
47969
48393
|
});
|
|
47970
|
-
const messages = (0, import_react231.useRef)();
|
|
48394
|
+
const messages = (0, import_react231.useRef)(void 0);
|
|
47971
48395
|
const scrollTop = (0, import_react231.useRef)(0);
|
|
47972
48396
|
(0, import_react231.useLayoutEffect)(() => {
|
|
47973
48397
|
const prevMeasures = measures.current;
|
|
@@ -48175,25 +48599,26 @@ var useUnreadMessagesNotification = ({
|
|
|
48175
48599
|
|
|
48176
48600
|
// src/components/MessageList/hooks/useMarkRead.ts
|
|
48177
48601
|
var import_react236 = require("react");
|
|
48602
|
+
var hasReadLastMessage = (channel, userId) => {
|
|
48603
|
+
const latestMessageIdInChannel = channel.state.latestMessages.slice(-1)[0]?.id;
|
|
48604
|
+
const lastReadMessageIdServer = channel.state.read[userId]?.last_read_message_id;
|
|
48605
|
+
return latestMessageIdInChannel === lastReadMessageIdServer;
|
|
48606
|
+
};
|
|
48178
48607
|
var useMarkRead = ({
|
|
48179
48608
|
isMessageListScrolledToBottom,
|
|
48180
48609
|
messageListIsThread,
|
|
48181
|
-
unreadCount,
|
|
48182
48610
|
wasMarkedUnread
|
|
48183
48611
|
}) => {
|
|
48184
48612
|
const { client } = useChatContext("useMarkRead");
|
|
48185
48613
|
const { markRead, setChannelUnreadUiState } = useChannelActionContext("useMarkRead");
|
|
48186
48614
|
const { channel } = useChannelStateContext("useMarkRead");
|
|
48187
|
-
const previousRenderMessageListScrolledToBottom = (0, import_react236.useRef)(isMessageListScrolledToBottom);
|
|
48188
48615
|
(0, import_react236.useEffect)(() => {
|
|
48189
|
-
const shouldMarkRead = (
|
|
48616
|
+
const shouldMarkRead = () => !document.hidden && !wasMarkedUnread && !messageListIsThread && isMessageListScrolledToBottom && client.user?.id && !hasReadLastMessage(channel, client.user.id);
|
|
48190
48617
|
const onVisibilityChange = () => {
|
|
48191
|
-
if (shouldMarkRead(
|
|
48618
|
+
if (shouldMarkRead()) markRead();
|
|
48192
48619
|
};
|
|
48193
48620
|
const handleMessageNew = (event) => {
|
|
48194
|
-
const isOwnMessage = event.user?.id && event.user.id === client.user?.id;
|
|
48195
48621
|
const mainChannelUpdated = !event.message?.parent_id || event.message?.show_in_channel;
|
|
48196
|
-
if (isOwnMessage) return;
|
|
48197
48622
|
if (!isMessageListScrolledToBottom || wasMarkedUnread || document.hidden) {
|
|
48198
48623
|
setChannelUnreadUiState((prev) => {
|
|
48199
48624
|
const previousUnreadCount = prev?.unread_messages ?? 0;
|
|
@@ -48208,15 +48633,15 @@ var useMarkRead = ({
|
|
|
48208
48633
|
unread_messages: previousUnreadCount + 1
|
|
48209
48634
|
};
|
|
48210
48635
|
});
|
|
48211
|
-
} else if (mainChannelUpdated && shouldMarkRead(
|
|
48636
|
+
} else if (mainChannelUpdated && shouldMarkRead()) {
|
|
48212
48637
|
markRead();
|
|
48213
48638
|
}
|
|
48214
48639
|
};
|
|
48215
48640
|
channel.on("message.new", handleMessageNew);
|
|
48216
48641
|
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
48217
|
-
|
|
48218
|
-
|
|
48219
|
-
|
|
48642
|
+
if (shouldMarkRead()) {
|
|
48643
|
+
markRead();
|
|
48644
|
+
}
|
|
48220
48645
|
return () => {
|
|
48221
48646
|
channel.off("message.new", handleMessageNew);
|
|
48222
48647
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
@@ -48228,7 +48653,6 @@ var useMarkRead = ({
|
|
|
48228
48653
|
markRead,
|
|
48229
48654
|
messageListIsThread,
|
|
48230
48655
|
setChannelUnreadUiState,
|
|
48231
|
-
unreadCount,
|
|
48232
48656
|
wasMarkedUnread
|
|
48233
48657
|
]);
|
|
48234
48658
|
};
|
|
@@ -48372,10 +48796,10 @@ var InfiniteScroll = (props) => {
|
|
|
48372
48796
|
const loadPreviousPageFn = loadPreviousPage || loadMore;
|
|
48373
48797
|
const hasNextPageFlag = hasNextPage || hasMoreNewer;
|
|
48374
48798
|
const hasPreviousPageFlag = hasPreviousPage || hasMore;
|
|
48375
|
-
const scrollComponent = (0, import_react241.useRef)();
|
|
48376
|
-
const previousOffset = (0, import_react241.useRef)();
|
|
48377
|
-
const previousReverseOffset = (0, import_react241.useRef)();
|
|
48378
|
-
const scrollListenerRef = (0, import_react241.useRef)();
|
|
48799
|
+
const scrollComponent = (0, import_react241.useRef)(void 0);
|
|
48800
|
+
const previousOffset = (0, import_react241.useRef)(void 0);
|
|
48801
|
+
const previousReverseOffset = (0, import_react241.useRef)(void 0);
|
|
48802
|
+
const scrollListenerRef = (0, import_react241.useRef)(void 0);
|
|
48379
48803
|
scrollListenerRef.current = () => {
|
|
48380
48804
|
const element4 = scrollComponent.current;
|
|
48381
48805
|
if (!element4 || element4.offsetParent === null) {
|
|
@@ -48781,7 +49205,6 @@ var MessageListWithContext = (props) => {
|
|
|
48781
49205
|
useMarkRead({
|
|
48782
49206
|
isMessageListScrolledToBottom,
|
|
48783
49207
|
messageListIsThread: threadList,
|
|
48784
|
-
unreadCount: channelUnreadUiState?.unread_messages ?? 0,
|
|
48785
49208
|
wasMarkedUnread: !!channelUnreadUiState?.first_unread_message_id
|
|
48786
49209
|
});
|
|
48787
49210
|
const { messageGroupStyles, messages: enrichedMessages } = useEnrichedMessages({
|
|
@@ -48999,7 +49422,7 @@ var ScrollToBottomButton = import_react248.default.memo(
|
|
|
48999
49422
|
);
|
|
49000
49423
|
|
|
49001
49424
|
// src/components/MessageList/VirtualizedMessageList.tsx
|
|
49002
|
-
var
|
|
49425
|
+
var import_react258 = __toESM(require("react"));
|
|
49003
49426
|
var import_react_virtuoso3 = require("react-virtuoso");
|
|
49004
49427
|
|
|
49005
49428
|
// src/components/MessageList/hooks/VirtualizedMessageList/useNewMessageNotification.ts
|
|
@@ -49043,8 +49466,10 @@ var STATUSES_EXCLUDED_FROM_PREPEND = {
|
|
|
49043
49466
|
};
|
|
49044
49467
|
function usePrependedMessagesCount(messages, hasDateSeparator) {
|
|
49045
49468
|
const firstRealMessageIndex = hasDateSeparator ? 1 : 0;
|
|
49046
|
-
const firstMessageOnFirstLoadedPage = (0, import_react250.useRef)();
|
|
49047
|
-
const previousFirstMessageOnFirstLoadedPage = (0, import_react250.useRef)(
|
|
49469
|
+
const firstMessageOnFirstLoadedPage = (0, import_react250.useRef)(void 0);
|
|
49470
|
+
const previousFirstMessageOnFirstLoadedPage = (0, import_react250.useRef)(
|
|
49471
|
+
void 0
|
|
49472
|
+
);
|
|
49048
49473
|
const previousNumItemsPrepended = (0, import_react250.useRef)(0);
|
|
49049
49474
|
const numItemsPrepended = (0, import_react250.useMemo)(() => {
|
|
49050
49475
|
if (!messages || !messages.length) {
|
|
@@ -49126,7 +49551,7 @@ var useMessageSetKey = ({
|
|
|
49126
49551
|
messages
|
|
49127
49552
|
}) => {
|
|
49128
49553
|
const [messageSetKey, setMessageSetKey] = (0, import_react253.useState)(+/* @__PURE__ */ new Date());
|
|
49129
|
-
const firstMessageId = (0, import_react253.useRef)();
|
|
49554
|
+
const firstMessageId = (0, import_react253.useRef)(void 0);
|
|
49130
49555
|
(0, import_react253.useEffect)(() => {
|
|
49131
49556
|
const continuousSet = messages?.find((message) => message.id === firstMessageId.current);
|
|
49132
49557
|
if (!continuousSet) {
|
|
@@ -49147,7 +49572,7 @@ var useScrollToBottomOnNewMessage = ({
|
|
|
49147
49572
|
scrollToLatestMessageOnFocus
|
|
49148
49573
|
}) => {
|
|
49149
49574
|
const [newMessagesReceivedInBackground, setNewMessagesReceivedInBackground] = (0, import_react254.useState)(false);
|
|
49150
|
-
const scrollToBottomIfConfigured = (0, import_react254.useRef)();
|
|
49575
|
+
const scrollToBottomIfConfigured = (0, import_react254.useRef)(void 0);
|
|
49151
49576
|
scrollToBottomIfConfigured.current = (event) => {
|
|
49152
49577
|
if (!scrollToLatestMessageOnFocus || !newMessagesReceivedInBackground || event.target !== window) {
|
|
49153
49578
|
return;
|
|
@@ -49337,6 +49762,14 @@ var messageRenderer = (virtuosoIndex, _data, virtuosoContext) => {
|
|
|
49337
49762
|
));
|
|
49338
49763
|
};
|
|
49339
49764
|
|
|
49765
|
+
// src/context/VirtualizedMessageListContext.tsx
|
|
49766
|
+
var import_react257 = __toESM(require("react"));
|
|
49767
|
+
var VirtualizedMessageListContext = (0, import_react257.createContext)(void 0);
|
|
49768
|
+
var VirtualizedMessageListContextProvider = ({
|
|
49769
|
+
children,
|
|
49770
|
+
value
|
|
49771
|
+
}) => /* @__PURE__ */ import_react257.default.createElement(VirtualizedMessageListContext.Provider, { value }, children);
|
|
49772
|
+
|
|
49340
49773
|
// src/components/MessageList/VirtualizedMessageList.tsx
|
|
49341
49774
|
function captureResizeObserverExceededError(e2) {
|
|
49342
49775
|
if (e2.message === "ResizeObserver loop completed with undelivered notifications." || e2.message === "ResizeObserver loop limit exceeded") {
|
|
@@ -49344,7 +49777,7 @@ function captureResizeObserverExceededError(e2) {
|
|
|
49344
49777
|
}
|
|
49345
49778
|
}
|
|
49346
49779
|
function useCaptureResizeObserverExceededError() {
|
|
49347
|
-
(0,
|
|
49780
|
+
(0, import_react258.useEffect)(() => {
|
|
49348
49781
|
window.addEventListener("error", captureResizeObserverExceededError);
|
|
49349
49782
|
return () => {
|
|
49350
49783
|
window.removeEventListener("error", captureResizeObserverExceededError);
|
|
@@ -49431,8 +49864,8 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49431
49864
|
} = useComponentContext("VirtualizedMessageList");
|
|
49432
49865
|
const MessageUIComponent = MessageUIComponentFromProps || MessageUIComponentFromContext;
|
|
49433
49866
|
const { client, customClasses } = useChatContext("VirtualizedMessageList");
|
|
49434
|
-
const virtuoso = (0,
|
|
49435
|
-
const lastRead = (0,
|
|
49867
|
+
const virtuoso = (0, import_react258.useRef)(null);
|
|
49868
|
+
const lastRead = (0, import_react258.useMemo)(() => channel.lastRead?.(), [channel]);
|
|
49436
49869
|
const {
|
|
49437
49870
|
show: showUnreadMessagesNotification,
|
|
49438
49871
|
toggleShowUnreadMessagesNotification
|
|
@@ -49444,7 +49877,7 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49444
49877
|
const { giphyPreviewMessage, setGiphyPreviewMessage } = useGiphyPreview(
|
|
49445
49878
|
separateGiphyPreview
|
|
49446
49879
|
);
|
|
49447
|
-
const processedMessages = (0,
|
|
49880
|
+
const processedMessages = (0, import_react258.useMemo)(() => {
|
|
49448
49881
|
if (typeof messages === "undefined") {
|
|
49449
49882
|
return [];
|
|
49450
49883
|
}
|
|
@@ -49476,11 +49909,11 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49476
49909
|
returnAllReadData,
|
|
49477
49910
|
userID: client.userID
|
|
49478
49911
|
});
|
|
49479
|
-
const lastReceivedMessageId = (0,
|
|
49912
|
+
const lastReceivedMessageId = (0, import_react258.useMemo)(() => getLastReceived(processedMessages), [
|
|
49480
49913
|
processedMessages
|
|
49481
49914
|
]);
|
|
49482
49915
|
const groupStylesFn = groupStyles || getGroupStyles;
|
|
49483
|
-
const messageGroupStyles = (0,
|
|
49916
|
+
const messageGroupStyles = (0, import_react258.useMemo)(
|
|
49484
49917
|
() => processedMessages.reduce((acc, message, i) => {
|
|
49485
49918
|
const style = groupStylesFn(
|
|
49486
49919
|
message,
|
|
@@ -49506,10 +49939,9 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49506
49939
|
useMarkRead({
|
|
49507
49940
|
isMessageListScrolledToBottom,
|
|
49508
49941
|
messageListIsThread: !!threadList,
|
|
49509
|
-
unreadCount: channelUnreadUiState?.unread_messages ?? 0,
|
|
49510
49942
|
wasMarkedUnread: !!channelUnreadUiState?.first_unread_message_id
|
|
49511
49943
|
});
|
|
49512
|
-
const scrollToBottom = (0,
|
|
49944
|
+
const scrollToBottom = (0, import_react258.useCallback)(async () => {
|
|
49513
49945
|
if (hasMoreNewer) {
|
|
49514
49946
|
await jumpToLatestMessage();
|
|
49515
49947
|
return;
|
|
@@ -49531,7 +49963,7 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49531
49963
|
const numItemsPrepended = usePrependedMessagesCount(processedMessages, !disableDateSeparator);
|
|
49532
49964
|
const { messageSetKey } = useMessageSetKey({ messages });
|
|
49533
49965
|
const shouldForceScrollToBottom = useShouldForceScrollToBottom(processedMessages, client.userID);
|
|
49534
|
-
const handleItemsRendered = (0,
|
|
49966
|
+
const handleItemsRendered = (0, import_react258.useMemo)(
|
|
49535
49967
|
() => makeItemsRenderedHandler([toggleShowUnreadMessagesNotification], processedMessages),
|
|
49536
49968
|
[processedMessages, toggleShowUnreadMessagesNotification]
|
|
49537
49969
|
);
|
|
@@ -49544,7 +49976,7 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49544
49976
|
}
|
|
49545
49977
|
return isAtBottom ? stickToBottomScrollBehavior : false;
|
|
49546
49978
|
};
|
|
49547
|
-
const computeItemKey2 = (0,
|
|
49979
|
+
const computeItemKey2 = (0, import_react258.useCallback)(
|
|
49548
49980
|
(index3, _, { numItemsPrepended: numItemsPrepended2, processedMessages: processedMessages2 }) => processedMessages2[calculateItemIndex(index3, numItemsPrepended2)].id,
|
|
49549
49981
|
[]
|
|
49550
49982
|
);
|
|
@@ -49561,7 +49993,7 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49561
49993
|
loadMore?.(messageLimit);
|
|
49562
49994
|
}
|
|
49563
49995
|
};
|
|
49564
|
-
(0,
|
|
49996
|
+
(0, import_react258.useEffect)(() => {
|
|
49565
49997
|
let scrollTimeout;
|
|
49566
49998
|
if (highlightedMessageId) {
|
|
49567
49999
|
const index3 = findMessageIndex(processedMessages, highlightedMessageId);
|
|
@@ -49577,7 +50009,7 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49577
50009
|
}, [highlightedMessageId, processedMessages]);
|
|
49578
50010
|
if (!processedMessages) return null;
|
|
49579
50011
|
const dialogManagerId = threadList ? "virtualized-message-list-dialog-manager-thread" : "virtualized-message-list-dialog-manager";
|
|
49580
|
-
return /* @__PURE__ */
|
|
50012
|
+
return /* @__PURE__ */ import_react258.default.createElement(VirtualizedMessageListContextProvider, { value: { scrollToBottom } }, /* @__PURE__ */ import_react258.default.createElement(MessageListMainPanel2, null, /* @__PURE__ */ import_react258.default.createElement(DialogManagerProvider, { id: dialogManagerId }, !threadList && showUnreadMessagesNotification && /* @__PURE__ */ import_react258.default.createElement(UnreadMessagesNotification2, { unreadCount: channelUnreadUiState?.unread_messages }), /* @__PURE__ */ import_react258.default.createElement("div", { className: customClasses?.virtualizedMessageList || "str-chat__virtual-list" }, /* @__PURE__ */ import_react258.default.createElement(
|
|
49581
50013
|
import_react_virtuoso3.Virtuoso,
|
|
49582
50014
|
{
|
|
49583
50015
|
atBottomStateChange,
|
|
@@ -49642,7 +50074,7 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49642
50074
|
...scrollSeekPlaceHolder ? { scrollSeek: scrollSeekPlaceHolder } : {},
|
|
49643
50075
|
...defaultItemHeight ? { defaultItemHeight } : {}
|
|
49644
50076
|
}
|
|
49645
|
-
))), TypingIndicator2 && /* @__PURE__ */
|
|
50077
|
+
))), TypingIndicator2 && /* @__PURE__ */ import_react258.default.createElement(TypingIndicator2, null)), /* @__PURE__ */ import_react258.default.createElement(
|
|
49646
50078
|
MessageListNotifications2,
|
|
49647
50079
|
{
|
|
49648
50080
|
hasNewMessages: newMessagesNotification,
|
|
@@ -49654,7 +50086,7 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49654
50086
|
threadList,
|
|
49655
50087
|
unreadCount: threadList ? void 0 : channelUnreadUiState?.unread_messages
|
|
49656
50088
|
}
|
|
49657
|
-
), giphyPreviewMessage && /* @__PURE__ */
|
|
50089
|
+
), giphyPreviewMessage && /* @__PURE__ */ import_react258.default.createElement(GiphyPreviewMessage2, { message: giphyPreviewMessage }));
|
|
49658
50090
|
};
|
|
49659
50091
|
function VirtualizedMessageList(props) {
|
|
49660
50092
|
const {
|
|
@@ -49676,7 +50108,7 @@ function VirtualizedMessageList(props) {
|
|
|
49676
50108
|
suppressAutoscroll
|
|
49677
50109
|
} = useChannelStateContext("VirtualizedMessageList");
|
|
49678
50110
|
const messages = props.messages || contextMessages;
|
|
49679
|
-
return /* @__PURE__ */
|
|
50111
|
+
return /* @__PURE__ */ import_react258.default.createElement(
|
|
49680
50112
|
VirtualizedMessageListWithContext,
|
|
49681
50113
|
{
|
|
49682
50114
|
channel,
|
|
@@ -49867,7 +50299,7 @@ var ChannelContainer = ({
|
|
|
49867
50299
|
customClasses
|
|
49868
50300
|
});
|
|
49869
50301
|
const className = (0, import_clsx64.default)(chatClass, theme, channelClass, additionalClassName);
|
|
49870
|
-
return /* @__PURE__ */
|
|
50302
|
+
return /* @__PURE__ */ import_react259.default.createElement("div", { id: CHANNEL_CONTAINER_ID, ...props, className }, children);
|
|
49871
50303
|
};
|
|
49872
50304
|
var UnMemoizedChannel = (props) => {
|
|
49873
50305
|
const {
|
|
@@ -49881,15 +50313,15 @@ var UnMemoizedChannel = (props) => {
|
|
|
49881
50313
|
);
|
|
49882
50314
|
const channel = propsChannel || contextChannel;
|
|
49883
50315
|
if (channelsQueryState.queryInProgress === "reload" && LoadingIndicator2) {
|
|
49884
|
-
return /* @__PURE__ */
|
|
50316
|
+
return /* @__PURE__ */ import_react259.default.createElement(ChannelContainer, null, /* @__PURE__ */ import_react259.default.createElement(LoadingIndicator2, null));
|
|
49885
50317
|
}
|
|
49886
50318
|
if (channelsQueryState.error && LoadingErrorIndicator2) {
|
|
49887
|
-
return /* @__PURE__ */
|
|
50319
|
+
return /* @__PURE__ */ import_react259.default.createElement(ChannelContainer, null, /* @__PURE__ */ import_react259.default.createElement(LoadingErrorIndicator2, { error: channelsQueryState.error }));
|
|
49888
50320
|
}
|
|
49889
50321
|
if (!channel?.cid) {
|
|
49890
|
-
return /* @__PURE__ */
|
|
50322
|
+
return /* @__PURE__ */ import_react259.default.createElement(ChannelContainer, null, EmptyPlaceholder2);
|
|
49891
50323
|
}
|
|
49892
|
-
return /* @__PURE__ */
|
|
50324
|
+
return /* @__PURE__ */ import_react259.default.createElement(ChannelInner, { ...props, channel, key: channel.cid });
|
|
49893
50325
|
};
|
|
49894
50326
|
var ChannelInner = (props) => {
|
|
49895
50327
|
const {
|
|
@@ -49915,7 +50347,7 @@ var ChannelInner = (props) => {
|
|
|
49915
50347
|
optionalMessageInputProps = {},
|
|
49916
50348
|
skipMessageDataMemoization
|
|
49917
50349
|
} = props;
|
|
49918
|
-
const channelQueryOptions = (0,
|
|
50350
|
+
const channelQueryOptions = (0, import_react259.useMemo)(
|
|
49919
50351
|
() => (0, import_lodash24.default)(propChannelQueryOptions, {
|
|
49920
50352
|
messages: { limit: DEFAULT_INITIAL_CHANNEL_PAGE_SIZE }
|
|
49921
50353
|
}),
|
|
@@ -49931,12 +50363,13 @@ var ChannelInner = (props) => {
|
|
|
49931
50363
|
const chatContainerClass = getChatContainerClass(customClasses?.chatContainer);
|
|
49932
50364
|
const windowsEmojiClass = useImageFlagEmojisOnWindowsClass();
|
|
49933
50365
|
const thread = useThreadContext();
|
|
49934
|
-
const [channelConfig, setChannelConfig] = (0,
|
|
49935
|
-
const [notifications, setNotifications] = (0,
|
|
49936
|
-
const [quotedMessage, setQuotedMessage] = (0,
|
|
49937
|
-
const [channelUnreadUiState, _setChannelUnreadUiState] = (0,
|
|
49938
|
-
const notificationTimeouts = (0,
|
|
49939
|
-
const
|
|
50366
|
+
const [channelConfig, setChannelConfig] = (0, import_react259.useState)(channel.getConfig());
|
|
50367
|
+
const [notifications, setNotifications] = (0, import_react259.useState)([]);
|
|
50368
|
+
const [quotedMessage, setQuotedMessage] = (0, import_react259.useState)();
|
|
50369
|
+
const [channelUnreadUiState, _setChannelUnreadUiState] = (0, import_react259.useState)();
|
|
50370
|
+
const notificationTimeouts = (0, import_react259.useRef)([]);
|
|
50371
|
+
const channelReducer = (0, import_react259.useMemo)(() => makeChannelReducer(), []);
|
|
50372
|
+
const [state, dispatch] = (0, import_react259.useReducer)(
|
|
49940
50373
|
channelReducer,
|
|
49941
50374
|
// channel.initialized === false if client.channel().query() was not called, e.g. ChannelList is not used
|
|
49942
50375
|
// => Channel will call channel.watch() in useLayoutEffect => state.loading is used to signal the watch() call state
|
|
@@ -49947,9 +50380,9 @@ var ChannelInner = (props) => {
|
|
|
49947
50380
|
}
|
|
49948
50381
|
);
|
|
49949
50382
|
const isMounted = useIsMounted();
|
|
49950
|
-
const originalTitle = (0,
|
|
49951
|
-
const lastRead = (0,
|
|
49952
|
-
const online = (0,
|
|
50383
|
+
const originalTitle = (0, import_react259.useRef)("");
|
|
50384
|
+
const lastRead = (0, import_react259.useRef)(void 0);
|
|
50385
|
+
const online = (0, import_react259.useRef)(true);
|
|
49953
50386
|
const channelCapabilitiesArray = channel.data?.own_capabilities;
|
|
49954
50387
|
const throttledCopyStateFromChannel = (0, import_lodash25.default)(
|
|
49955
50388
|
() => dispatch({ channel, type: "copyStateFromChannelOnEvent" }),
|
|
@@ -49959,14 +50392,14 @@ var ChannelInner = (props) => {
|
|
|
49959
50392
|
trailing: true
|
|
49960
50393
|
}
|
|
49961
50394
|
);
|
|
49962
|
-
const setChannelUnreadUiState = (0,
|
|
50395
|
+
const setChannelUnreadUiState = (0, import_react259.useMemo)(
|
|
49963
50396
|
() => (0, import_lodash25.default)(_setChannelUnreadUiState, 200, {
|
|
49964
50397
|
leading: true,
|
|
49965
50398
|
trailing: false
|
|
49966
50399
|
}),
|
|
49967
50400
|
[]
|
|
49968
50401
|
);
|
|
49969
|
-
const markRead = (0,
|
|
50402
|
+
const markRead = (0, import_react259.useMemo)(
|
|
49970
50403
|
() => (0, import_lodash25.default)(
|
|
49971
50404
|
async (options) => {
|
|
49972
50405
|
const { updateChannelUiUnreadState = true } = options ?? {};
|
|
@@ -50061,7 +50494,7 @@ var ChannelInner = (props) => {
|
|
|
50061
50494
|
}
|
|
50062
50495
|
throttledCopyStateFromChannel();
|
|
50063
50496
|
};
|
|
50064
|
-
(0,
|
|
50497
|
+
(0, import_react259.useLayoutEffect)(() => {
|
|
50065
50498
|
let errored = false;
|
|
50066
50499
|
let done = false;
|
|
50067
50500
|
(async () => {
|
|
@@ -50127,16 +50560,16 @@ var ChannelInner = (props) => {
|
|
|
50127
50560
|
channelConfig?.read_events,
|
|
50128
50561
|
initializeOnMount
|
|
50129
50562
|
]);
|
|
50130
|
-
(0,
|
|
50563
|
+
(0, import_react259.useEffect)(() => {
|
|
50131
50564
|
if (!state.thread) return;
|
|
50132
50565
|
const message = state.messages?.find((m) => m.id === state.thread?.id);
|
|
50133
50566
|
if (message) dispatch({ message, type: "setThread" });
|
|
50134
50567
|
}, [state.messages, state.thread]);
|
|
50135
|
-
const addNotification = (0,
|
|
50568
|
+
const addNotification = (0, import_react259.useMemo)(
|
|
50136
50569
|
() => makeAddNotifications(setNotifications, notificationTimeouts.current),
|
|
50137
50570
|
[]
|
|
50138
50571
|
);
|
|
50139
|
-
const loadMoreFinished = (0,
|
|
50572
|
+
const loadMoreFinished = (0, import_react259.useCallback)(
|
|
50140
50573
|
(0, import_lodash23.default)(
|
|
50141
50574
|
(hasMore, messages) => {
|
|
50142
50575
|
if (!isMounted.current) return;
|
|
@@ -50197,8 +50630,8 @@ var ChannelInner = (props) => {
|
|
|
50197
50630
|
});
|
|
50198
50631
|
return queryResponse.messages.length;
|
|
50199
50632
|
};
|
|
50200
|
-
const clearHighlightedMessageTimeoutId = (0,
|
|
50201
|
-
const jumpToMessage = (0,
|
|
50633
|
+
const clearHighlightedMessageTimeoutId = (0, import_react259.useRef)(null);
|
|
50634
|
+
const jumpToMessage = (0, import_react259.useCallback)(
|
|
50202
50635
|
async (messageId, messageLimit = DEFAULT_JUMP_TO_PAGE_SIZE, highlightDuration = DEFAULT_HIGHLIGHT_DURATION) => {
|
|
50203
50636
|
dispatch({ loadingMore: true, type: "setLoadingMore" });
|
|
50204
50637
|
await channel.state.loadMessageIntoState(messageId, void 0, messageLimit);
|
|
@@ -50218,14 +50651,14 @@ var ChannelInner = (props) => {
|
|
|
50218
50651
|
},
|
|
50219
50652
|
[channel, loadMoreFinished]
|
|
50220
50653
|
);
|
|
50221
|
-
const jumpToLatestMessage = (0,
|
|
50654
|
+
const jumpToLatestMessage = (0, import_react259.useCallback)(async () => {
|
|
50222
50655
|
await channel.state.loadMessageIntoState("latest");
|
|
50223
50656
|
loadMoreFinished(channel.state.messagePagination.hasPrev, channel.state.messages);
|
|
50224
50657
|
dispatch({
|
|
50225
50658
|
type: "jumpToLatestMessage"
|
|
50226
50659
|
});
|
|
50227
50660
|
}, [channel, loadMoreFinished]);
|
|
50228
|
-
const jumpToFirstUnreadMessage = (0,
|
|
50661
|
+
const jumpToFirstUnreadMessage = (0, import_react259.useCallback)(
|
|
50229
50662
|
async (queryMessageLimit = DEFAULT_JUMP_TO_PAGE_SIZE, highlightDuration = DEFAULT_HIGHLIGHT_DURATION) => {
|
|
50230
50663
|
if (!channelUnreadUiState?.unread_messages) return;
|
|
50231
50664
|
let lastReadMessageId = channelUnreadUiState?.last_read_message_id;
|
|
@@ -50330,7 +50763,7 @@ var ChannelInner = (props) => {
|
|
|
50330
50763
|
},
|
|
50331
50764
|
[addNotification, channel, loadMoreFinished, t2, channelUnreadUiState]
|
|
50332
50765
|
);
|
|
50333
|
-
const deleteMessage = (0,
|
|
50766
|
+
const deleteMessage = (0, import_react259.useCallback)(
|
|
50334
50767
|
async (message) => {
|
|
50335
50768
|
if (!message?.id) {
|
|
50336
50769
|
throw new Error("Cannot delete a message - missing message ID.");
|
|
@@ -50479,7 +50912,7 @@ var ChannelInner = (props) => {
|
|
|
50479
50912
|
event?.preventDefault();
|
|
50480
50913
|
dispatch({ type: "closeThread" });
|
|
50481
50914
|
};
|
|
50482
|
-
const loadMoreThreadFinished = (0,
|
|
50915
|
+
const loadMoreThreadFinished = (0, import_react259.useCallback)(
|
|
50483
50916
|
(0, import_lodash23.default)(
|
|
50484
50917
|
(threadHasMore, threadMessages) => {
|
|
50485
50918
|
dispatch({
|
|
@@ -50540,7 +50973,7 @@ var ChannelInner = (props) => {
|
|
|
50540
50973
|
videoAttachmentSizeHandler: props.videoAttachmentSizeHandler || getVideoAttachmentConfiguration,
|
|
50541
50974
|
watcher_count: state.watcherCount
|
|
50542
50975
|
});
|
|
50543
|
-
const channelActionContextValue = (0,
|
|
50976
|
+
const channelActionContextValue = (0, import_react259.useMemo)(
|
|
50544
50977
|
() => ({
|
|
50545
50978
|
addNotification,
|
|
50546
50979
|
closeThread,
|
|
@@ -50581,7 +51014,7 @@ var ChannelInner = (props) => {
|
|
|
50581
51014
|
setChannelUnreadUiState
|
|
50582
51015
|
]
|
|
50583
51016
|
);
|
|
50584
|
-
const componentContextValue = (0,
|
|
51017
|
+
const componentContextValue = (0, import_react259.useMemo)(
|
|
50585
51018
|
() => ({
|
|
50586
51019
|
Attachment: props.Attachment,
|
|
50587
51020
|
AttachmentPreviewList: props.AttachmentPreviewList,
|
|
@@ -50709,26 +51142,26 @@ var ChannelInner = (props) => {
|
|
|
50709
51142
|
typing
|
|
50710
51143
|
});
|
|
50711
51144
|
if (state.error) {
|
|
50712
|
-
return /* @__PURE__ */
|
|
51145
|
+
return /* @__PURE__ */ import_react259.default.createElement(ChannelContainer, null, /* @__PURE__ */ import_react259.default.createElement(LoadingErrorIndicator2, { error: state.error }));
|
|
50713
51146
|
}
|
|
50714
51147
|
if (state.loading) {
|
|
50715
|
-
return /* @__PURE__ */
|
|
51148
|
+
return /* @__PURE__ */ import_react259.default.createElement(ChannelContainer, null, /* @__PURE__ */ import_react259.default.createElement(LoadingIndicator2, null));
|
|
50716
51149
|
}
|
|
50717
51150
|
if (!channel.watch) {
|
|
50718
|
-
return /* @__PURE__ */
|
|
51151
|
+
return /* @__PURE__ */ import_react259.default.createElement(ChannelContainer, null, /* @__PURE__ */ import_react259.default.createElement("div", null, t2("Channel Missing")));
|
|
50719
51152
|
}
|
|
50720
|
-
return /* @__PURE__ */
|
|
51153
|
+
return /* @__PURE__ */ import_react259.default.createElement(ChannelContainer, { className: windowsEmojiClass }, /* @__PURE__ */ import_react259.default.createElement(ChannelStateProvider, { value: channelStateContextValue }, /* @__PURE__ */ import_react259.default.createElement(ChannelActionProvider, { value: channelActionContextValue }, /* @__PURE__ */ import_react259.default.createElement(WithComponents, { overrides: componentContextValue }, /* @__PURE__ */ import_react259.default.createElement(TypingProvider, { value: typingContextValue }, /* @__PURE__ */ import_react259.default.createElement("div", { className: `${chatContainerClass}` }, dragAndDropWindow && /* @__PURE__ */ import_react259.default.createElement(DropzoneProvider, { ...optionalMessageInputProps }, children), !dragAndDropWindow && /* @__PURE__ */ import_react259.default.createElement(import_react259.default.Fragment, null, children)))))));
|
|
50721
51154
|
};
|
|
50722
|
-
var Channel =
|
|
51155
|
+
var Channel = import_react259.default.memo(UnMemoizedChannel);
|
|
50723
51156
|
|
|
50724
51157
|
// src/components/ChannelHeader/ChannelHeader.tsx
|
|
50725
|
-
var
|
|
51158
|
+
var import_react261 = __toESM(require("react"));
|
|
50726
51159
|
|
|
50727
51160
|
// src/components/ChannelHeader/icons.tsx
|
|
50728
|
-
var
|
|
51161
|
+
var import_react260 = __toESM(require("react"));
|
|
50729
51162
|
var MenuIcon2 = ({ title }) => {
|
|
50730
51163
|
const { t: t2 } = useTranslationContext("MenuIcon");
|
|
50731
|
-
return /* @__PURE__ */
|
|
51164
|
+
return /* @__PURE__ */ import_react260.default.createElement("svg", { "data-testid": "menu-icon", viewBox: "0 0 448 512", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react260.default.createElement("title", null, title ?? t2("Menu")), /* @__PURE__ */ import_react260.default.createElement(
|
|
50732
51165
|
"path",
|
|
50733
51166
|
{
|
|
50734
51167
|
d: "M0 88C0 74.75 10.75 64 24 64H424C437.3 64 448 74.75 448 88C448 101.3 437.3 112 424 112H24C10.75 112 0 101.3 0 88zM0 248C0 234.7 10.75 224 24 224H424C437.3 224 448 234.7 448 248C448 261.3 437.3 272 424 272H24C10.75 272 0 261.3 0 248zM424 432H24C10.75 432 0 421.3 0 408C0 394.7 10.75 384 24 384H424C437.3 384 448 394.7 448 408C448 421.3 437.3 432 424 432z",
|
|
@@ -50755,15 +51188,15 @@ var ChannelHeader = (props) => {
|
|
|
50755
51188
|
overrideTitle
|
|
50756
51189
|
});
|
|
50757
51190
|
const { member_count, subtitle } = channel?.data || {};
|
|
50758
|
-
return /* @__PURE__ */
|
|
51191
|
+
return /* @__PURE__ */ import_react261.default.createElement("div", { className: "str-chat__channel-header" }, /* @__PURE__ */ import_react261.default.createElement(
|
|
50759
51192
|
"button",
|
|
50760
51193
|
{
|
|
50761
51194
|
"aria-label": t2("aria/Menu"),
|
|
50762
51195
|
className: "str-chat__header-hamburger",
|
|
50763
51196
|
onClick: openMobileNav
|
|
50764
51197
|
},
|
|
50765
|
-
/* @__PURE__ */
|
|
50766
|
-
), /* @__PURE__ */
|
|
51198
|
+
/* @__PURE__ */ import_react261.default.createElement(MenuIcon3, null)
|
|
51199
|
+
), /* @__PURE__ */ import_react261.default.createElement(
|
|
50767
51200
|
Avatar2,
|
|
50768
51201
|
{
|
|
50769
51202
|
className: "str-chat__avatar--channel-header",
|
|
@@ -50771,35 +51204,35 @@ var ChannelHeader = (props) => {
|
|
|
50771
51204
|
image: displayImage,
|
|
50772
51205
|
name: displayTitle
|
|
50773
51206
|
}
|
|
50774
|
-
), /* @__PURE__ */
|
|
51207
|
+
), /* @__PURE__ */ import_react261.default.createElement("div", { className: "str-chat__channel-header-end" }, /* @__PURE__ */ import_react261.default.createElement("p", { className: "str-chat__channel-header-title" }, displayTitle, " ", live && /* @__PURE__ */ import_react261.default.createElement("span", { className: "str-chat__header-livestream-livelabel" }, t2("live"))), subtitle && /* @__PURE__ */ import_react261.default.createElement("p", { className: "str-chat__channel-header-subtitle" }, subtitle), /* @__PURE__ */ import_react261.default.createElement("p", { className: "str-chat__channel-header-info" }, !live && !!member_count && member_count > 0 && /* @__PURE__ */ import_react261.default.createElement(import_react261.default.Fragment, null, t2("{{ memberCount }} members", {
|
|
50775
51208
|
memberCount: member_count
|
|
50776
51209
|
}), ",", " "), t2("{{ watcherCount }} online", { watcherCount: watcher_count }))));
|
|
50777
51210
|
};
|
|
50778
51211
|
|
|
50779
51212
|
// src/components/Chat/Chat.tsx
|
|
50780
|
-
var
|
|
51213
|
+
var import_react265 = __toESM(require("react"));
|
|
50781
51214
|
|
|
50782
51215
|
// src/components/Chat/hooks/useChat.ts
|
|
50783
|
-
var
|
|
51216
|
+
var import_react262 = require("react");
|
|
50784
51217
|
var useChat = ({
|
|
50785
51218
|
client,
|
|
50786
51219
|
defaultLanguage = "en",
|
|
50787
51220
|
i18nInstance,
|
|
50788
51221
|
initialNavOpen
|
|
50789
51222
|
}) => {
|
|
50790
|
-
const [translators, setTranslators] = (0,
|
|
51223
|
+
const [translators, setTranslators] = (0, import_react262.useState)({
|
|
50791
51224
|
t: (key) => key,
|
|
50792
51225
|
tDateTimeParser: defaultDateTimeParser,
|
|
50793
51226
|
userLanguage: "en"
|
|
50794
51227
|
});
|
|
50795
|
-
const [channel, setChannel] = (0,
|
|
50796
|
-
const [mutes, setMutes] = (0,
|
|
50797
|
-
const [navOpen, setNavOpen] = (0,
|
|
50798
|
-
const [latestMessageDatesByChannels, setLatestMessageDatesByChannels] = (0,
|
|
51228
|
+
const [channel, setChannel] = (0, import_react262.useState)();
|
|
51229
|
+
const [mutes, setMutes] = (0, import_react262.useState)([]);
|
|
51230
|
+
const [navOpen, setNavOpen] = (0, import_react262.useState)(initialNavOpen);
|
|
51231
|
+
const [latestMessageDatesByChannels, setLatestMessageDatesByChannels] = (0, import_react262.useState)({});
|
|
50799
51232
|
const clientMutes = client.user?.mutes || [];
|
|
50800
51233
|
const closeMobileNav = () => setNavOpen(false);
|
|
50801
51234
|
const openMobileNav = () => setTimeout(() => setNavOpen(true), 100);
|
|
50802
|
-
const appSettings = (0,
|
|
51235
|
+
const appSettings = (0, import_react262.useRef)(null);
|
|
50803
51236
|
const getAppSettings = () => {
|
|
50804
51237
|
if (appSettings.current) {
|
|
50805
51238
|
return appSettings.current;
|
|
@@ -50807,11 +51240,11 @@ var useChat = ({
|
|
|
50807
51240
|
appSettings.current = client.getAppSettings();
|
|
50808
51241
|
return appSettings.current;
|
|
50809
51242
|
};
|
|
50810
|
-
(0,
|
|
51243
|
+
(0, import_react262.useEffect)(() => {
|
|
50811
51244
|
if (!client) return;
|
|
50812
51245
|
const userAgent = client.getUserAgent();
|
|
50813
51246
|
if (!userAgent.includes("stream-chat-react")) {
|
|
50814
|
-
client.setUserAgent(`stream-chat-react-12.
|
|
51247
|
+
client.setUserAgent(`stream-chat-react-12.10.0-${userAgent}`);
|
|
50815
51248
|
}
|
|
50816
51249
|
client.threads.registerSubscriptions();
|
|
50817
51250
|
client.polls.registerSubscriptions();
|
|
@@ -50820,7 +51253,7 @@ var useChat = ({
|
|
|
50820
51253
|
client.polls.unregisterSubscriptions();
|
|
50821
51254
|
};
|
|
50822
51255
|
}, [client]);
|
|
50823
|
-
(0,
|
|
51256
|
+
(0, import_react262.useEffect)(() => {
|
|
50824
51257
|
setMutes(clientMutes);
|
|
50825
51258
|
const handleEvent = (event) => {
|
|
50826
51259
|
setMutes(event.me?.mutes || []);
|
|
@@ -50828,7 +51261,7 @@ var useChat = ({
|
|
|
50828
51261
|
client.on("notification.mutes_updated", handleEvent);
|
|
50829
51262
|
return () => client.off("notification.mutes_updated", handleEvent);
|
|
50830
51263
|
}, [clientMutes?.length]);
|
|
50831
|
-
(0,
|
|
51264
|
+
(0, import_react262.useEffect)(() => {
|
|
50832
51265
|
let userLanguage = client.user?.language;
|
|
50833
51266
|
if (!userLanguage) {
|
|
50834
51267
|
const browserLanguage = window.navigator.language.slice(0, 2);
|
|
@@ -50845,7 +51278,7 @@ var useChat = ({
|
|
|
50845
51278
|
});
|
|
50846
51279
|
});
|
|
50847
51280
|
}, [i18nInstance]);
|
|
50848
|
-
const setActiveChannel = (0,
|
|
51281
|
+
const setActiveChannel = (0, import_react262.useCallback)(
|
|
50849
51282
|
async (activeChannel, watchers = {}, event) => {
|
|
50850
51283
|
if (event && event.preventDefault) event.preventDefault();
|
|
50851
51284
|
if (activeChannel && Object.keys(watchers).length) {
|
|
@@ -50856,7 +51289,7 @@ var useChat = ({
|
|
|
50856
51289
|
},
|
|
50857
51290
|
[]
|
|
50858
51291
|
);
|
|
50859
|
-
(0,
|
|
51292
|
+
(0, import_react262.useEffect)(() => {
|
|
50860
51293
|
setLatestMessageDatesByChannels({});
|
|
50861
51294
|
}, [client.user?.id]);
|
|
50862
51295
|
return {
|
|
@@ -50873,7 +51306,7 @@ var useChat = ({
|
|
|
50873
51306
|
};
|
|
50874
51307
|
|
|
50875
51308
|
// src/components/Chat/hooks/useCreateChatContext.ts
|
|
50876
|
-
var
|
|
51309
|
+
var import_react263 = require("react");
|
|
50877
51310
|
var useCreateChatContext = (value) => {
|
|
50878
51311
|
const {
|
|
50879
51312
|
channel,
|
|
@@ -50897,7 +51330,7 @@ var useCreateChatContext = (value) => {
|
|
|
50897
51330
|
const clientValues = `${client.clientID}${Object.keys(client.activeChannels).length}${Object.keys(client.listeners).length}${client.mutedChannels.length}
|
|
50898
51331
|
${client.user?.id}`;
|
|
50899
51332
|
const mutedUsersLength = mutes.length;
|
|
50900
|
-
const chatContext = (0,
|
|
51333
|
+
const chatContext = (0, import_react263.useMemo)(
|
|
50901
51334
|
() => ({
|
|
50902
51335
|
channel,
|
|
50903
51336
|
channelsQueryState,
|
|
@@ -50930,10 +51363,10 @@ var useCreateChatContext = (value) => {
|
|
|
50930
51363
|
};
|
|
50931
51364
|
|
|
50932
51365
|
// src/components/Chat/hooks/useChannelsQueryState.ts
|
|
50933
|
-
var
|
|
51366
|
+
var import_react264 = require("react");
|
|
50934
51367
|
var useChannelsQueryState = () => {
|
|
50935
|
-
const [error, setError] = (0,
|
|
50936
|
-
const [queryInProgress, setQueryInProgress] = (0,
|
|
51368
|
+
const [error, setError] = (0, import_react264.useState)(null);
|
|
51369
|
+
const [queryInProgress, setQueryInProgress] = (0, import_react264.useState)("uninitialized");
|
|
50937
51370
|
return {
|
|
50938
51371
|
error,
|
|
50939
51372
|
queryInProgress,
|
|
@@ -50984,11 +51417,11 @@ var Chat = (props) => {
|
|
|
50984
51417
|
useImageFlagEmojisOnWindows
|
|
50985
51418
|
});
|
|
50986
51419
|
if (!translators.t) return null;
|
|
50987
|
-
return /* @__PURE__ */
|
|
51420
|
+
return /* @__PURE__ */ import_react265.default.createElement(ChatProvider, { value: chatContextValue }, /* @__PURE__ */ import_react265.default.createElement(TranslationProvider, { value: translators }, children));
|
|
50988
51421
|
};
|
|
50989
51422
|
|
|
50990
51423
|
// src/components/Chat/hooks/useCreateChatClient.ts
|
|
50991
|
-
var
|
|
51424
|
+
var import_react266 = require("react");
|
|
50992
51425
|
var import_stream_chat6 = require("stream-chat");
|
|
50993
51426
|
var useCreateChatClient = ({
|
|
50994
51427
|
apiKey,
|
|
@@ -50996,13 +51429,13 @@ var useCreateChatClient = ({
|
|
|
50996
51429
|
tokenOrProvider,
|
|
50997
51430
|
userData
|
|
50998
51431
|
}) => {
|
|
50999
|
-
const [chatClient, setChatClient] = (0,
|
|
51000
|
-
const [cachedUserData, setCachedUserData] = (0,
|
|
51432
|
+
const [chatClient, setChatClient] = (0, import_react266.useState)(null);
|
|
51433
|
+
const [cachedUserData, setCachedUserData] = (0, import_react266.useState)(userData);
|
|
51001
51434
|
if (userData.id !== cachedUserData.id) {
|
|
51002
51435
|
setCachedUserData(userData);
|
|
51003
51436
|
}
|
|
51004
|
-
const [cachedOptions] = (0,
|
|
51005
|
-
(0,
|
|
51437
|
+
const [cachedOptions] = (0, import_react266.useState)(options);
|
|
51438
|
+
(0, import_react266.useEffect)(() => {
|
|
51006
51439
|
const client = new import_stream_chat6.StreamChat(apiKey, void 0, cachedOptions);
|
|
51007
51440
|
let didUserConnectInterrupt = false;
|
|
51008
51441
|
const connectionPromise = client.connectUser(cachedUserData, tokenOrProvider).then(() => {
|
|
@@ -51020,17 +51453,17 @@ var useCreateChatClient = ({
|
|
|
51020
51453
|
};
|
|
51021
51454
|
|
|
51022
51455
|
// src/components/Thread/Thread.tsx
|
|
51023
|
-
var
|
|
51456
|
+
var import_react271 = __toESM(require("react"));
|
|
51024
51457
|
var import_clsx65 = __toESM(require("clsx"));
|
|
51025
51458
|
|
|
51026
51459
|
// src/components/Thread/ThreadHeader.tsx
|
|
51027
|
-
var
|
|
51460
|
+
var import_react268 = __toESM(require("react"));
|
|
51028
51461
|
|
|
51029
51462
|
// src/components/Thread/icons.tsx
|
|
51030
|
-
var
|
|
51463
|
+
var import_react267 = __toESM(require("react"));
|
|
51031
51464
|
var CloseIcon3 = ({ title }) => {
|
|
51032
51465
|
const { t: t2 } = useTranslationContext("CloseIcon");
|
|
51033
|
-
return /* @__PURE__ */
|
|
51466
|
+
return /* @__PURE__ */ import_react267.default.createElement(
|
|
51034
51467
|
"svg",
|
|
51035
51468
|
{
|
|
51036
51469
|
"data-testid": "close-no-outline",
|
|
@@ -51038,8 +51471,8 @@ var CloseIcon3 = ({ title }) => {
|
|
|
51038
51471
|
viewBox: "0 0 24 24",
|
|
51039
51472
|
xmlns: "http://www.w3.org/2000/svg"
|
|
51040
51473
|
},
|
|
51041
|
-
/* @__PURE__ */
|
|
51042
|
-
/* @__PURE__ */
|
|
51474
|
+
/* @__PURE__ */ import_react267.default.createElement("title", null, title ?? t2("Close")),
|
|
51475
|
+
/* @__PURE__ */ import_react267.default.createElement(
|
|
51043
51476
|
"path",
|
|
51044
51477
|
{
|
|
51045
51478
|
d: "M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z",
|
|
@@ -51059,7 +51492,7 @@ var ThreadHeader = (props) => {
|
|
|
51059
51492
|
overrideImage,
|
|
51060
51493
|
overrideTitle
|
|
51061
51494
|
});
|
|
51062
|
-
return /* @__PURE__ */
|
|
51495
|
+
return /* @__PURE__ */ import_react268.default.createElement("div", { className: "str-chat__thread-header" }, /* @__PURE__ */ import_react268.default.createElement("div", { className: "str-chat__thread-header-details" }, /* @__PURE__ */ import_react268.default.createElement("div", { className: "str-chat__thread-header-title" }, t2("Thread")), /* @__PURE__ */ import_react268.default.createElement("div", { className: "str-chat__thread-header-subtitle" }, displayTitle)), /* @__PURE__ */ import_react268.default.createElement(
|
|
51063
51496
|
"button",
|
|
51064
51497
|
{
|
|
51065
51498
|
"aria-label": t2("aria/Close thread"),
|
|
@@ -51067,20 +51500,20 @@ var ThreadHeader = (props) => {
|
|
|
51067
51500
|
"data-testid": "close-button",
|
|
51068
51501
|
onClick: closeThread
|
|
51069
51502
|
},
|
|
51070
|
-
/* @__PURE__ */
|
|
51503
|
+
/* @__PURE__ */ import_react268.default.createElement(CloseIcon3, null)
|
|
51071
51504
|
));
|
|
51072
51505
|
};
|
|
51073
51506
|
|
|
51074
51507
|
// src/components/Thread/ThreadHead.tsx
|
|
51075
|
-
var
|
|
51508
|
+
var import_react270 = __toESM(require("react"));
|
|
51076
51509
|
|
|
51077
51510
|
// src/components/Thread/ThreadStart.tsx
|
|
51078
|
-
var
|
|
51511
|
+
var import_react269 = __toESM(require("react"));
|
|
51079
51512
|
var ThreadStart = () => {
|
|
51080
51513
|
const { thread } = useChannelStateContext("ThreadStart");
|
|
51081
51514
|
const { t: t2 } = useTranslationContext("ThreadStart");
|
|
51082
51515
|
if (!thread?.reply_count) return null;
|
|
51083
|
-
return /* @__PURE__ */
|
|
51516
|
+
return /* @__PURE__ */ import_react269.default.createElement("div", { className: "str-chat__thread-start" }, t2("replyCount", { count: thread.reply_count }));
|
|
51084
51517
|
};
|
|
51085
51518
|
|
|
51086
51519
|
// src/components/Thread/ThreadHead.tsx
|
|
@@ -51088,7 +51521,7 @@ var ThreadHead = (props) => {
|
|
|
51088
51521
|
const { ThreadStart: ThreadStart2 = ThreadStart } = useComponentContext(
|
|
51089
51522
|
"ThreadHead"
|
|
51090
51523
|
);
|
|
51091
|
-
return /* @__PURE__ */
|
|
51524
|
+
return /* @__PURE__ */ import_react270.default.createElement("div", { className: "str-chat__parent-message-li" }, /* @__PURE__ */ import_react270.default.createElement(Message, { initialMessage: true, threadList: true, ...props }), /* @__PURE__ */ import_react270.default.createElement(ThreadStart2, null));
|
|
51092
51525
|
};
|
|
51093
51526
|
|
|
51094
51527
|
// src/components/Thread/Thread.tsx
|
|
@@ -51098,10 +51531,10 @@ var Thread = (props) => {
|
|
|
51098
51531
|
if (!thread && !threadInstance || channelConfig?.replies === false) return null;
|
|
51099
51532
|
return (
|
|
51100
51533
|
// FIXME: TS is having trouble here as at least one of the two would always be defined
|
|
51101
|
-
/* @__PURE__ */
|
|
51534
|
+
/* @__PURE__ */ import_react271.default.createElement(ThreadInner, { ...props, key: `thread-${(thread ?? threadInstance)?.id}-${channel?.cid}` })
|
|
51102
51535
|
);
|
|
51103
51536
|
};
|
|
51104
|
-
var
|
|
51537
|
+
var selector6 = (nextValue) => ({
|
|
51105
51538
|
isLoadingNext: nextValue.pagination.isLoadingNext,
|
|
51106
51539
|
isLoadingPrev: nextValue.pagination.isLoadingPrev,
|
|
51107
51540
|
parentMessage: nextValue.parentMessage,
|
|
@@ -51121,7 +51554,7 @@ var ThreadInner = (props) => {
|
|
|
51121
51554
|
virtualized
|
|
51122
51555
|
} = props;
|
|
51123
51556
|
const threadInstance = useThreadContext();
|
|
51124
|
-
const { isLoadingNext, isLoadingPrev, parentMessage, replies } = useStateStore(threadInstance?.state,
|
|
51557
|
+
const { isLoadingNext, isLoadingPrev, parentMessage, replies } = useStateStore(threadInstance?.state, selector6) ?? {};
|
|
51125
51558
|
const {
|
|
51126
51559
|
thread,
|
|
51127
51560
|
threadHasMore,
|
|
@@ -51143,7 +51576,7 @@ var ThreadInner = (props) => {
|
|
|
51143
51576
|
const FallbackMessage = virtualized && VirtualMessage ? VirtualMessage : ContextMessage;
|
|
51144
51577
|
const MessageUIComponent = ThreadMessage || FallbackMessage;
|
|
51145
51578
|
const ThreadMessageList = virtualized ? VirtualizedMessageList : MessageList;
|
|
51146
|
-
(0,
|
|
51579
|
+
(0, import_react271.useEffect)(() => {
|
|
51147
51580
|
if (thread?.id && thread?.reply_count) {
|
|
51148
51581
|
loadMoreThread();
|
|
51149
51582
|
}
|
|
@@ -51165,7 +51598,7 @@ var ThreadInner = (props) => {
|
|
|
51165
51598
|
const threadClass = customClasses?.thread || (0, import_clsx65.default)("str-chat__thread-container str-chat__thread", {
|
|
51166
51599
|
"str-chat__thread--virtualized": virtualized
|
|
51167
51600
|
});
|
|
51168
|
-
const head = /* @__PURE__ */
|
|
51601
|
+
const head = /* @__PURE__ */ import_react271.default.createElement(
|
|
51169
51602
|
ThreadHead2,
|
|
51170
51603
|
{
|
|
51171
51604
|
key: messageAsThread.id,
|
|
@@ -51174,7 +51607,7 @@ var ThreadInner = (props) => {
|
|
|
51174
51607
|
...additionalParentMessageProps
|
|
51175
51608
|
}
|
|
51176
51609
|
);
|
|
51177
|
-
return /* @__PURE__ */
|
|
51610
|
+
return /* @__PURE__ */ import_react271.default.createElement("div", { className: threadClass }, /* @__PURE__ */ import_react271.default.createElement(ThreadHeader2, { closeThread, thread: messageAsThread }), /* @__PURE__ */ import_react271.default.createElement(
|
|
51178
51611
|
ThreadMessageList,
|
|
51179
51612
|
{
|
|
51180
51613
|
disableDateSeparator: !enableDateSeparator,
|
|
@@ -51186,7 +51619,7 @@ var ThreadInner = (props) => {
|
|
|
51186
51619
|
...threadProps,
|
|
51187
51620
|
...virtualized ? additionalVirtualizedMessageListProps : additionalMessageListProps
|
|
51188
51621
|
}
|
|
51189
|
-
), /* @__PURE__ */
|
|
51622
|
+
), /* @__PURE__ */ import_react271.default.createElement(
|
|
51190
51623
|
MessageInput,
|
|
51191
51624
|
{
|
|
51192
51625
|
focus: autoFocus,
|
|
@@ -51200,12 +51633,12 @@ var ThreadInner = (props) => {
|
|
|
51200
51633
|
};
|
|
51201
51634
|
|
|
51202
51635
|
// src/components/Window/Window.tsx
|
|
51203
|
-
var
|
|
51636
|
+
var import_react272 = __toESM(require("react"));
|
|
51204
51637
|
var import_clsx66 = __toESM(require("clsx"));
|
|
51205
51638
|
var UnMemoizedWindow = (props) => {
|
|
51206
51639
|
const { children, thread: propThread } = props;
|
|
51207
51640
|
const { thread: contextThread } = useChannelStateContext("Window");
|
|
51208
|
-
return /* @__PURE__ */
|
|
51641
|
+
return /* @__PURE__ */ import_react272.default.createElement(
|
|
51209
51642
|
"div",
|
|
51210
51643
|
{
|
|
51211
51644
|
className: (0, import_clsx66.default)("str-chat__main-panel", {
|
|
@@ -51215,7 +51648,7 @@ var UnMemoizedWindow = (props) => {
|
|
|
51215
51648
|
children
|
|
51216
51649
|
);
|
|
51217
51650
|
};
|
|
51218
|
-
var Window =
|
|
51651
|
+
var Window = import_react272.default.memo(UnMemoizedWindow);
|
|
51219
51652
|
/*! Bundled license information:
|
|
51220
51653
|
|
|
51221
51654
|
is-buffer/index.js:
|
|
@@ -51225,5 +51658,26 @@ is-buffer/index.js:
|
|
|
51225
51658
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
51226
51659
|
* @license MIT
|
|
51227
51660
|
*)
|
|
51661
|
+
|
|
51662
|
+
react-is/cjs/react-is.development.js:
|
|
51663
|
+
(**
|
|
51664
|
+
* @license React
|
|
51665
|
+
* react-is.development.js
|
|
51666
|
+
*
|
|
51667
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
51668
|
+
*
|
|
51669
|
+
* This source code is licensed under the MIT license found in the
|
|
51670
|
+
* LICENSE file in the root directory of this source tree.
|
|
51671
|
+
*)
|
|
51672
|
+
|
|
51673
|
+
react-is/cjs/react-is.development.js:
|
|
51674
|
+
(** @license React v16.13.1
|
|
51675
|
+
* react-is.development.js
|
|
51676
|
+
*
|
|
51677
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
51678
|
+
*
|
|
51679
|
+
* This source code is licensed under the MIT license found in the
|
|
51680
|
+
* LICENSE file in the root directory of this source tree.
|
|
51681
|
+
*)
|
|
51228
51682
|
*/
|
|
51229
51683
|
//# sourceMappingURL=index.browser.cjs.map
|