stream-chat-react 14.6.0 → 14.6.1

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.
Files changed (44) hide show
  1. package/dist/cjs/{ReactPlayerWrapper.30240f76.js → ReactPlayerWrapper.c340ab05.js} +2 -2
  2. package/dist/cjs/{ReactPlayerWrapper.30240f76.js.map → ReactPlayerWrapper.c340ab05.js.map} +1 -1
  3. package/dist/cjs/audioProcessing.22303d69.js.map +1 -1
  4. package/dist/cjs/channel-detail.js +2 -2
  5. package/dist/cjs/channel-detail.js.map +1 -1
  6. package/dist/cjs/emojis.js +2 -2
  7. package/dist/cjs/emojis.js.map +1 -1
  8. package/dist/cjs/index.js +48 -50
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs/mp3-encoder.js.map +1 -1
  11. package/dist/cjs/{useChannelHeaderOnlineStatus.6546ac83.js → useChannelHeaderOnlineStatus.d39ede24.js} +25 -9
  12. package/dist/cjs/{useChannelHeaderOnlineStatus.6546ac83.js.map → useChannelHeaderOnlineStatus.d39ede24.js.map} +1 -1
  13. package/dist/cjs/{useMessageComposerController.c0dad9bc.js → useMessageComposerController.f1a3d182.js} +2 -2
  14. package/dist/cjs/{useMessageComposerController.c0dad9bc.js.map → useMessageComposerController.f1a3d182.js.map} +1 -1
  15. package/dist/cjs/{useNotificationApi.eb753f31.js → useNotificationApi.87ba0b39.js} +13 -13
  16. package/dist/cjs/useNotificationApi.87ba0b39.js.map +1 -0
  17. package/dist/css/index.css +3 -3
  18. package/dist/css/index.css.map +1 -1
  19. package/dist/es/audioProcessing.766ca76c.mjs.map +1 -1
  20. package/dist/es/channel-detail.mjs +2 -2
  21. package/dist/es/channel-detail.mjs.map +1 -1
  22. package/dist/es/emojis.mjs +2 -2
  23. package/dist/es/emojis.mjs.map +1 -1
  24. package/dist/es/index.mjs +32 -34
  25. package/dist/es/index.mjs.map +1 -1
  26. package/dist/es/mp3-encoder.mjs.map +1 -1
  27. package/dist/es/{useChannelHeaderOnlineStatus.c5215b13.mjs → useChannelHeaderOnlineStatus.b3a51ca7.mjs} +24 -8
  28. package/dist/es/{useChannelHeaderOnlineStatus.c5215b13.mjs.map → useChannelHeaderOnlineStatus.b3a51ca7.mjs.map} +1 -1
  29. package/dist/es/{useMessageComposerController.29f189b4.mjs → useMessageComposerController.2309f433.mjs} +2 -2
  30. package/dist/es/{useMessageComposerController.29f189b4.mjs.map → useMessageComposerController.2309f433.mjs.map} +1 -1
  31. package/dist/es/{useNotificationApi.fa5cddf9.mjs → useNotificationApi.eff88f29.mjs} +9 -9
  32. package/dist/es/useNotificationApi.eff88f29.mjs.map +1 -0
  33. package/dist/types/components/Channel/Channel.d.ts.map +1 -1
  34. package/dist/types/components/Channel/hooks/useCreateChannelStateContext.d.ts.map +1 -1
  35. package/dist/types/components/ChannelList/hooks/useChannelListShape.d.ts.map +1 -1
  36. package/dist/types/components/ChannelListItem/hooks/useIsChannelMuted.d.ts.map +1 -1
  37. package/dist/types/components/Message/renderText/regex.d.ts.map +1 -1
  38. package/dist/types/components/MessageList/hooks/useMarkRead.d.ts.map +1 -1
  39. package/dist/types/i18n/Streami18n.d.ts +12 -12
  40. package/dist/types/i18n/Streami18n.d.ts.map +1 -1
  41. package/dist/types/i18n/types.d.ts +1 -1
  42. package/package.json +8 -7
  43. package/dist/cjs/useNotificationApi.eb753f31.js.map +0 -1
  44. package/dist/es/useNotificationApi.fa5cddf9.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_useNotificationApi = require("./useNotificationApi.eb753f31.js");
3
- const require_useMessageComposerController = require("./useMessageComposerController.c0dad9bc.js");
2
+ const require_useNotificationApi = require("./useNotificationApi.87ba0b39.js");
3
+ const require_useMessageComposerController = require("./useMessageComposerController.f1a3d182.js");
4
4
  let react = require("react");
5
5
  react = require_useNotificationApi.__toESM(react);
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -1 +1 @@
1
- {"version":3,"file":"emojis.js","names":[],"sources":["../../src/plugins/Emojis/EmojiPicker.tsx","../../src/plugins/Emojis/middleware/textComposerEmojiMiddleware.ts"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport PickerImport from '@emoji-mart/react';\n\nimport { useMessageComposerContext, useTranslationContext } from '../../context';\nimport {\n Button,\n IconEmoji,\n type PopperLikePlacement,\n useMessageComposerController,\n} from '../../components';\nimport { usePopoverPosition } from '../../components/Dialog/hooks/usePopoverPosition';\nimport { useIsCooldownActive } from '../../components/MessageComposer/hooks/useIsCooldownActive';\n\n// @emoji-mart/react ships as CJS with the component on `exports.default`. Under\n// spec-strict ESM interop (e.g. Vite 8 / Rolldown, native Node ESM) a default\n// import yields the module namespace `{ default }` instead of the component,\n// which makes React throw \"Element type is invalid ... got: object\". Unwrap the\n// default defensively so it works regardless of interop.\nconst Picker =\n (PickerImport as unknown as { default?: typeof PickerImport }).default ?? PickerImport;\n\nconst isShadowRoot = (node: Node): node is ShadowRoot => !!(node as ShadowRoot).host;\n\nexport type EmojiPickerProps = {\n ButtonIconComponent?: React.ComponentType;\n buttonClassName?: string;\n pickerContainerClassName?: string;\n wrapperClassName?: string;\n closeOnEmojiSelect?: boolean;\n /**\n * Untyped [properties](https://github.com/missive/emoji-mart/tree/v5.5.2#options--props) to be\n * passed down to the [emoji-mart `Picker`](https://github.com/missive/emoji-mart/tree/v5.5.2#-picker) component\n */\n pickerProps?: Partial<{ theme: 'auto' | 'light' | 'dark' } & Record<string, unknown>>;\n /**\n * Floating UI placement (default: 'top-end') for the picker popover\n */\n placement?: PopperLikePlacement;\n};\n\nconst defaultButtonClassName = 'str-chat__emoji-picker-button';\n\nconst classNames: Pick<\n EmojiPickerProps,\n 'pickerContainerClassName' | 'wrapperClassName'\n> = {\n pickerContainerClassName: 'str-chat__message-textarea-emoji-picker-container',\n wrapperClassName: 'str-chat__message-textarea-emoji-picker',\n};\n\nexport const EmojiPicker = (props: EmojiPickerProps) => {\n const { t } = useTranslationContext('EmojiPicker');\n const { textareaRef } = useMessageComposerContext('EmojiPicker');\n const { textComposer } = useMessageComposerController();\n const isCooldownActive = useIsCooldownActive();\n const [displayPicker, setDisplayPicker] = useState(false);\n const [referenceElement, setReferenceElement] = useState<HTMLButtonElement | null>(\n null,\n );\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n const { refs, strategy, x, y } = usePopoverPosition({\n offset: 8,\n placement: props.placement ?? 'top-end',\n });\n\n useEffect(() => {\n refs.setReference(referenceElement);\n }, [referenceElement, refs]);\n useEffect(() => {\n refs.setFloating(popperElement);\n }, [popperElement, refs]);\n\n const { pickerContainerClassName, wrapperClassName } = classNames;\n\n const { ButtonIconComponent = IconEmoji } = props;\n const pickerStyle = props.pickerProps?.style as React.CSSProperties | undefined;\n\n useEffect(() => {\n if (!popperElement || !referenceElement) return;\n\n const handlePointerDown = (e: PointerEvent) => {\n const target = e.target as HTMLElement;\n\n const rootNode = target.getRootNode();\n\n if (\n popperElement.contains(isShadowRoot(rootNode) ? rootNode.host : target) ||\n referenceElement.contains(target)\n ) {\n return;\n }\n\n setDisplayPicker(false);\n };\n\n window.addEventListener('pointerdown', handlePointerDown);\n return () => window.removeEventListener('pointerdown', handlePointerDown);\n }, [referenceElement, popperElement]);\n\n return (\n <div className={props.wrapperClassName ?? wrapperClassName}>\n {displayPicker && (\n <div\n className={props.pickerContainerClassName ?? pickerContainerClassName}\n ref={setPopperElement}\n style={{ left: x ?? 0, position: strategy, top: y ?? 0 }}\n >\n <Picker\n data={async () => (await import('@emoji-mart/data')).default}\n onEmojiSelect={(e: { native: string }) => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n textComposer.insertText({ text: e.native });\n textarea.focus();\n if (props.closeOnEmojiSelect) {\n setDisplayPicker(false);\n }\n }}\n {...props.pickerProps}\n style={{ ...pickerStyle, '--shadow': 'none' }}\n />\n </div>\n )}\n <Button\n appearance='ghost'\n aria-expanded={displayPicker}\n aria-label={t('aria/Emoji picker')}\n circular\n className={props.buttonClassName ?? defaultButtonClassName}\n disabled={isCooldownActive}\n onClick={() => setDisplayPicker((cv) => !cv)}\n ref={setReferenceElement}\n size='sm'\n type='button'\n variant='secondary'\n >\n {ButtonIconComponent && <ButtonIconComponent />}\n </Button>\n </div>\n );\n};\n","import mergeWith from 'lodash.mergewith';\nimport type {\n Middleware,\n SearchSourceOptions,\n SearchSourceType,\n TextComposerMiddlewareExecutorState,\n TextComposerMiddlewareOptions,\n TextComposerSuggestion,\n} from 'stream-chat';\nimport {\n BaseSearchSource,\n getTokenizedSuggestionDisplayName,\n getTriggerCharWithToken,\n insertItemWithTrigger,\n replaceWordWithEntity,\n} from 'stream-chat';\nimport type {\n EmojiSearchIndex,\n EmojiSearchIndexResult,\n} from '../../../components/MessageComposer';\n\nexport type EmojiSuggestion<T extends EmojiSearchIndexResult = EmojiSearchIndexResult> =\n TextComposerSuggestion<T>;\n\nclass EmojiSearchSource<\n T extends TextComposerSuggestion<EmojiSearchIndexResult>,\n> extends BaseSearchSource<T> {\n readonly type: SearchSourceType = 'emoji';\n private emojiSearchIndex: EmojiSearchIndex;\n\n constructor(emojiSearchIndex: EmojiSearchIndex, options?: SearchSourceOptions) {\n super(options);\n this.emojiSearchIndex = emojiSearchIndex;\n }\n\n async query(searchQuery: string) {\n if (searchQuery.length === 0) {\n return { items: [] as T[], next: null };\n }\n const emojis = (await this.emojiSearchIndex.search(searchQuery)) ?? [];\n\n // emojiIndex.search sometimes returns undefined values, so filter those out first\n return {\n items: emojis\n .filter(Boolean)\n .slice(0, 7)\n .map(({ emoticons = [], id, name, native, skins = [] }) => {\n const [firstSkin] = skins;\n\n return {\n emoticons,\n id,\n name,\n native: native ?? firstSkin.native,\n };\n }) as T[],\n next: null, // todo: generate cursor\n };\n }\n\n protected filterQueryResults(items: T[]): T[] | Promise<T[]> {\n return items.map((item) => ({\n ...item,\n ...getTokenizedSuggestionDisplayName({\n displayName: item.id,\n searchToken: this.searchQuery,\n }),\n }));\n }\n}\n\nconst DEFAULT_OPTIONS: TextComposerMiddlewareOptions = { minChars: 1, trigger: ':' };\n\nexport type EmojiMiddleware<T extends EmojiSearchIndexResult = EmojiSearchIndexResult> =\n Middleware<\n TextComposerMiddlewareExecutorState<EmojiSuggestion<T>>,\n 'onChange' | 'onSuggestionItemSelect'\n >;\n\n/**\n * TextComposer middleware for mentions\n * Usage:\n *\n * const textComposer = new TextComposer(options);\n *\n * textComposer.use(new createTextComposerEmojiMiddleware(emojiSearchIndex, {\n * minChars: 2\n * }));\n *\n * @param emojiSearchIndex\n * @param {{\n * minChars: number;\n * trigger: string;\n * }} options\n * @returns\n */\nexport const createTextComposerEmojiMiddleware = (\n emojiSearchIndex: EmojiSearchIndex,\n options?: Partial<TextComposerMiddlewareOptions>,\n): EmojiMiddleware => {\n const finalOptions = mergeWith(DEFAULT_OPTIONS, options ?? {});\n const emojiSearchSource = new EmojiSearchSource(emojiSearchIndex);\n emojiSearchSource.activate();\n\n return {\n id: 'stream-io/emoji-middleware',\n // eslint-disable-next-line sort-keys\n handlers: {\n onChange: async ({ complete, forward, next, state }) => {\n if (!state.selection) return forward();\n\n const triggerWithToken = getTriggerCharWithToken({\n acceptTrailingSpaces: false,\n text: state.text.slice(0, state.selection.end),\n trigger: finalOptions.trigger,\n });\n\n const triggerWasRemoved =\n !triggerWithToken || triggerWithToken.length < finalOptions.minChars;\n\n if (triggerWasRemoved) {\n const hasSuggestionsForTrigger =\n state.suggestions?.trigger === finalOptions.trigger;\n const newState = { ...state };\n if (hasSuggestionsForTrigger && newState.suggestions) {\n delete newState.suggestions;\n }\n return next(newState);\n }\n\n const newSearchTriggerred =\n triggerWithToken && triggerWithToken === finalOptions.trigger;\n\n if (newSearchTriggerred) {\n emojiSearchSource.resetStateAndActivate();\n }\n\n const textWithReplacedWord = await replaceWordWithEntity({\n caretPosition: state.selection.end,\n getEntityString: async (word: string) => {\n const { items } = await emojiSearchSource.query(word);\n\n const emoji = items\n .filter(Boolean)\n .slice(0, 10)\n .find(({ emoticons }) => !!emoticons?.includes(word));\n\n if (!emoji) return null;\n\n const [firstSkin] = emoji.skins ?? [];\n\n return emoji.native ?? firstSkin.native;\n },\n text: state.text,\n });\n\n if (textWithReplacedWord !== state.text) {\n return complete({\n ...state,\n suggestions: undefined, // to prevent the TextComposerMiddlewareExecutor to run the first page query\n text: textWithReplacedWord,\n });\n }\n\n return complete({\n ...state,\n suggestions: {\n query: triggerWithToken.slice(1),\n searchSource: emojiSearchSource,\n trigger: finalOptions.trigger,\n },\n });\n },\n onSuggestionItemSelect: ({ complete, forward, state }) => {\n const { selectedSuggestion } = state.change ?? {};\n if (!selectedSuggestion || state.suggestions?.trigger !== finalOptions.trigger)\n return forward();\n\n emojiSearchSource.resetStateAndActivate();\n return complete({\n ...state,\n ...insertItemWithTrigger({\n insertText: `${'native' in selectedSuggestion ? selectedSuggestion.native : ''} `,\n selection: state.selection,\n text: state.text,\n trigger: finalOptions.trigger,\n }),\n suggestions: undefined, // Clear suggestions after selection\n });\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,IAAM,SACH,kBAAA,QAA8D,WAAW,kBAAA;AAE5E,IAAM,gBAAgB,SAAmC,CAAC,CAAE,KAAoB;AAmBhF,IAAM,yBAAyB;AAE/B,IAAM,aAGF;CACF,0BAA0B;CAC1B,kBAAkB;AACpB;AAEA,IAAa,eAAe,UAA4B;CACtD,MAAM,EAAE,MAAM,2BAAA,sBAAsB,aAAa;CACjD,MAAM,EAAE,gBAAgB,qCAAA,0BAA0B,aAAa;CAC/D,MAAM,EAAE,iBAAiB,qCAAA,6BAA6B;CACtD,MAAM,mBAAmB,qCAAA,oBAAoB;CAC7C,MAAM,CAAC,eAAe,qBAAA,GAAA,MAAA,UAA6B,KAAK;CACxD,MAAM,CAAC,kBAAkB,wBAAA,GAAA,MAAA,UACvB,IACF;CACA,MAAM,CAAC,eAAe,qBAAA,GAAA,MAAA,UAAoD,IAAI;CAC9E,MAAM,EAAE,MAAM,UAAU,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Ac;MACd,SAAS,aAAa;KACxB;IACF,CAAC;GACH;GACA,yBAAyB,EAAE,UAAU,SAAS,YAAY;IACxD,MAAM,EAAE,uBAAuB,MAAM,UAAU,CAAC;IAChD,IAAI,CAAC,sBAAsB,MAAM,aAAa,YAAY,aAAa,SACrE,OAAO,QAAQ;IAEjB,kBAAkB,sBAAsB;IACxC,OAAO,SAAS;KACd,GAAG;KACH,IAAA,GAAA,YAAA,uBAAyB;MACvB,YAAY,GAAG,YAAY,qBAAqB,mBAAmB,SAAS,GAAG;MAC/E,WAAW,MAAM;MACjB,MAAM,MAAM;MACZ,SAAS,aAAa;KACxB,CAAC;KACD,aAAa,KAAA;IACf,CAAC;GACH;EACF;CACF;AACF"}
1
+ {"version":3,"file":"emojis.js","names":[],"sources":["../../src/plugins/Emojis/EmojiPicker.tsx","../../src/plugins/Emojis/middleware/textComposerEmojiMiddleware.ts"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport PickerImport from '@emoji-mart/react';\n\nimport { useMessageComposerContext, useTranslationContext } from '../../context';\nimport {\n Button,\n IconEmoji,\n type PopperLikePlacement,\n useMessageComposerController,\n} from '../../components';\nimport { usePopoverPosition } from '../../components/Dialog/hooks/usePopoverPosition';\nimport { useIsCooldownActive } from '../../components/MessageComposer/hooks/useIsCooldownActive';\n\n// @emoji-mart/react ships as CJS with the component on `exports.default`. Under\n// spec-strict ESM interop (e.g. Vite 8 / Rolldown, native Node ESM) a default\n// import yields the module namespace `{ default }` instead of the component,\n// which makes React throw \"Element type is invalid ... got: object\". Unwrap the\n// default defensively so it works regardless of interop.\nconst Picker =\n (PickerImport as unknown as { default?: typeof PickerImport }).default ?? PickerImport;\n\nconst isShadowRoot = (node: Node): node is ShadowRoot => !!(node as ShadowRoot).host;\n\nexport type EmojiPickerProps = {\n ButtonIconComponent?: React.ComponentType;\n buttonClassName?: string;\n pickerContainerClassName?: string;\n wrapperClassName?: string;\n closeOnEmojiSelect?: boolean;\n /**\n * Untyped [properties](https://github.com/missive/emoji-mart/tree/v5.5.2#options--props) to be\n * passed down to the [emoji-mart `Picker`](https://github.com/missive/emoji-mart/tree/v5.5.2#-picker) component\n */\n pickerProps?: Partial<{ theme: 'auto' | 'light' | 'dark' } & Record<string, unknown>>;\n /**\n * Floating UI placement (default: 'top-end') for the picker popover\n */\n placement?: PopperLikePlacement;\n};\n\nconst defaultButtonClassName = 'str-chat__emoji-picker-button';\n\nconst classNames: Pick<\n EmojiPickerProps,\n 'pickerContainerClassName' | 'wrapperClassName'\n> = {\n pickerContainerClassName: 'str-chat__message-textarea-emoji-picker-container',\n wrapperClassName: 'str-chat__message-textarea-emoji-picker',\n};\n\nexport const EmojiPicker = (props: EmojiPickerProps) => {\n const { t } = useTranslationContext('EmojiPicker');\n const { textareaRef } = useMessageComposerContext('EmojiPicker');\n const { textComposer } = useMessageComposerController();\n const isCooldownActive = useIsCooldownActive();\n const [displayPicker, setDisplayPicker] = useState(false);\n const [referenceElement, setReferenceElement] = useState<HTMLButtonElement | null>(\n null,\n );\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n const { refs, strategy, x, y } = usePopoverPosition({\n offset: 8,\n placement: props.placement ?? 'top-end',\n });\n\n useEffect(() => {\n refs.setReference(referenceElement);\n }, [referenceElement, refs]);\n useEffect(() => {\n refs.setFloating(popperElement);\n }, [popperElement, refs]);\n\n const { pickerContainerClassName, wrapperClassName } = classNames;\n\n const { ButtonIconComponent = IconEmoji } = props;\n const pickerStyle = props.pickerProps?.style as React.CSSProperties | undefined;\n\n useEffect(() => {\n if (!popperElement || !referenceElement) return;\n\n const handlePointerDown = (e: PointerEvent) => {\n const target = e.target as HTMLElement;\n\n const rootNode = target.getRootNode();\n\n if (\n popperElement.contains(isShadowRoot(rootNode) ? rootNode.host : target) ||\n referenceElement.contains(target)\n ) {\n return;\n }\n\n setDisplayPicker(false);\n };\n\n window.addEventListener('pointerdown', handlePointerDown);\n return () => window.removeEventListener('pointerdown', handlePointerDown);\n }, [referenceElement, popperElement]);\n\n return (\n <div className={props.wrapperClassName ?? wrapperClassName}>\n {displayPicker && (\n <div\n className={props.pickerContainerClassName ?? pickerContainerClassName}\n ref={setPopperElement}\n style={{ left: x ?? 0, position: strategy, top: y ?? 0 }}\n >\n <Picker\n data={async () => (await import('@emoji-mart/data')).default}\n onEmojiSelect={(e: { native: string }) => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n textComposer.insertText({ text: e.native });\n textarea.focus();\n if (props.closeOnEmojiSelect) {\n setDisplayPicker(false);\n }\n }}\n {...props.pickerProps}\n style={{ ...pickerStyle, '--shadow': 'none' }}\n />\n </div>\n )}\n <Button\n appearance='ghost'\n aria-expanded={displayPicker}\n aria-label={t('aria/Emoji picker')}\n circular\n className={props.buttonClassName ?? defaultButtonClassName}\n disabled={isCooldownActive}\n onClick={() => setDisplayPicker((cv) => !cv)}\n ref={setReferenceElement}\n size='sm'\n type='button'\n variant='secondary'\n >\n {ButtonIconComponent && <ButtonIconComponent />}\n </Button>\n </div>\n );\n};\n","import mergeWith from 'lodash.mergewith';\nimport type {\n Middleware,\n SearchSourceOptions,\n SearchSourceType,\n TextComposerMiddlewareExecutorState,\n TextComposerMiddlewareOptions,\n TextComposerSuggestion,\n} from 'stream-chat';\nimport {\n BaseSearchSource,\n getTokenizedSuggestionDisplayName,\n getTriggerCharWithToken,\n insertItemWithTrigger,\n replaceWordWithEntity,\n} from 'stream-chat';\nimport type {\n EmojiSearchIndex,\n EmojiSearchIndexResult,\n} from '../../../components/MessageComposer';\n\nexport type EmojiSuggestion<T extends EmojiSearchIndexResult = EmojiSearchIndexResult> =\n TextComposerSuggestion<T>;\n\nclass EmojiSearchSource<\n T extends TextComposerSuggestion<EmojiSearchIndexResult>,\n> extends BaseSearchSource<T> {\n readonly type: SearchSourceType = 'emoji';\n private emojiSearchIndex: EmojiSearchIndex;\n\n constructor(emojiSearchIndex: EmojiSearchIndex, options?: SearchSourceOptions) {\n super(options);\n this.emojiSearchIndex = emojiSearchIndex;\n }\n\n async query(searchQuery: string) {\n if (searchQuery.length === 0) {\n return { items: [] as T[], next: null };\n }\n const emojis = (await this.emojiSearchIndex.search(searchQuery)) ?? [];\n\n // emojiIndex.search sometimes returns undefined values, so filter those out first\n return {\n items: emojis\n .filter(Boolean)\n .slice(0, 7)\n .map(({ emoticons = [], id, name, native, skins = [] }) => {\n const [firstSkin] = skins;\n\n return {\n emoticons,\n id,\n name,\n native: native ?? firstSkin.native,\n };\n }) as T[],\n next: null, // todo: generate cursor\n };\n }\n\n protected filterQueryResults(items: T[]): T[] | Promise<T[]> {\n return items.map((item) => ({\n ...item,\n ...getTokenizedSuggestionDisplayName({\n displayName: item.id,\n searchToken: this.searchQuery,\n }),\n }));\n }\n}\n\nconst DEFAULT_OPTIONS: TextComposerMiddlewareOptions = { minChars: 1, trigger: ':' };\n\nexport type EmojiMiddleware<T extends EmojiSearchIndexResult = EmojiSearchIndexResult> =\n Middleware<\n TextComposerMiddlewareExecutorState<EmojiSuggestion<T>>,\n 'onChange' | 'onSuggestionItemSelect'\n >;\n\n/**\n * TextComposer middleware for mentions\n * Usage:\n *\n * const textComposer = new TextComposer(options);\n *\n * textComposer.use(new createTextComposerEmojiMiddleware(emojiSearchIndex, {\n * minChars: 2\n * }));\n *\n * @param emojiSearchIndex\n * @param {{\n * minChars: number;\n * trigger: string;\n * }} options\n * @returns\n */\nexport const createTextComposerEmojiMiddleware = (\n emojiSearchIndex: EmojiSearchIndex,\n options?: Partial<TextComposerMiddlewareOptions>,\n): EmojiMiddleware => {\n const finalOptions = mergeWith(DEFAULT_OPTIONS, options ?? {});\n const emojiSearchSource = new EmojiSearchSource(emojiSearchIndex);\n emojiSearchSource.activate();\n\n return {\n id: 'stream-io/emoji-middleware',\n // eslint-disable-next-line sort-keys\n handlers: {\n onChange: async ({ complete, forward, next, state }) => {\n if (!state.selection) return forward();\n\n const triggerWithToken = getTriggerCharWithToken({\n acceptTrailingSpaces: false,\n text: state.text.slice(0, state.selection.end),\n trigger: finalOptions.trigger,\n });\n\n const triggerWasRemoved =\n !triggerWithToken || triggerWithToken.length < finalOptions.minChars;\n\n if (triggerWasRemoved) {\n const hasSuggestionsForTrigger =\n state.suggestions?.trigger === finalOptions.trigger;\n const newState = { ...state };\n if (hasSuggestionsForTrigger && newState.suggestions) {\n delete newState.suggestions;\n }\n return next(newState);\n }\n\n const newSearchTriggerred =\n triggerWithToken && triggerWithToken === finalOptions.trigger;\n\n if (newSearchTriggerred) {\n emojiSearchSource.resetStateAndActivate();\n }\n\n const textWithReplacedWord = await replaceWordWithEntity({\n caretPosition: state.selection.end,\n getEntityString: async (word: string) => {\n const { items } = await emojiSearchSource.query(word);\n\n const emoji = items\n .filter(Boolean)\n .slice(0, 10)\n .find(({ emoticons }) => !!emoticons?.includes(word));\n\n if (!emoji) return null;\n\n const [firstSkin] = emoji.skins ?? [];\n\n return emoji.native ?? firstSkin.native;\n },\n text: state.text,\n });\n\n if (textWithReplacedWord !== state.text) {\n return complete({\n ...state,\n suggestions: undefined, // to prevent the TextComposerMiddlewareExecutor to run the first page query\n text: textWithReplacedWord,\n });\n }\n\n return complete({\n ...state,\n suggestions: {\n query: triggerWithToken.slice(1),\n searchSource: emojiSearchSource,\n trigger: finalOptions.trigger,\n },\n });\n },\n onSuggestionItemSelect: ({ complete, forward, state }) => {\n const { selectedSuggestion } = state.change ?? {};\n if (!selectedSuggestion || state.suggestions?.trigger !== finalOptions.trigger)\n return forward();\n\n emojiSearchSource.resetStateAndActivate();\n return complete({\n ...state,\n ...insertItemWithTrigger({\n insertText: `${'native' in selectedSuggestion ? selectedSuggestion.native : ''} `,\n selection: state.selection,\n text: state.text,\n trigger: finalOptions.trigger,\n }),\n suggestions: undefined, // Clear suggestions after selection\n });\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,IAAM,SACH,kBAAA,QAA8D,WAAW,kBAAA;AAE5E,IAAM,gBAAgB,SAAmC,CAAC,CAAE,KAAoB;AAmBhF,IAAM,yBAAyB;AAE/B,IAAM,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BAAA,CAA4B;KACvD,eAAe,MAAM,UAAU;KAC/B,iBAAiB,OAAO,SAAiB;MACvC,MAAM,EAAE,UAAU,MAAM,kBAAkB,MAAM,IAAI;MAEpD,MAAM,QAAQ,MACX,OAAO,OAAO,CAAC,CACf,MAAM,GAAG,EAAE,CAAC,CACZ,MAAM,EAAE,gBAAgB,CAAC,CAAC,WAAW,SAAS,IAAI,CAAC;MAEtD,IAAI,CAAC,OAAO,OAAO;MAEnB,MAAM,CAAC,aAAa,MAAM,SAAS,CAAC;MAEpC,OAAO,MAAM,UAAU,UAAU;KACnC;KACA,MAAM,MAAM;IACd,CAAC;IAED,IAAI,yBAAyB,MAAM,MACjC,OAAO,SAAS;KACd,GAAG;KACH,aAAa,KAAA;KACb,MAAM;IACR,CAAC;IAGH,OAAO,SAAS;KACd,GAAG;KACH,aAAa;MACX,OAAO,iBAAiB,MAAM,CAAC;MAC/B,cAAc;MACd,SAAS,aAAa;KACxB;IACF,CAAC;GACH;GACA,yBAAyB,EAAE,UAAU,SAAS,YAAY;IACxD,MAAM,EAAE,uBAAuB,MAAM,UAAU,CAAC;IAChD,IAAI,CAAC,sBAAsB,MAAM,aAAa,YAAY,aAAa,SACrE,OAAO,QAAQ;IAEjB,kBAAkB,sBAAsB;IACxC,OAAO,SAAS;KACd,GAAG;KACH,IAAA,GAAA,YAAA,sBAAA,CAAyB;MACvB,YAAY,GAAG,YAAY,qBAAqB,mBAAmB,SAAS,GAAG;MAC/E,WAAW,MAAM;MACjB,MAAM,MAAM;MACZ,SAAS,aAAa;KACxB,CAAC;KACD,aAAa,KAAA;IACf,CAAC;GACH;EACF;CACF;AACF"}
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_useNotificationApi = require("./useNotificationApi.eb753f31.js");
3
- const require_useChannelHeaderOnlineStatus = require("./useChannelHeaderOnlineStatus.6546ac83.js");
4
- const require_useMessageComposerController = require("./useMessageComposerController.c0dad9bc.js");
2
+ const require_useNotificationApi = require("./useNotificationApi.87ba0b39.js");
3
+ const require_useChannelHeaderOnlineStatus = require("./useChannelHeaderOnlineStatus.d39ede24.js");
4
+ const require_useMessageComposerController = require("./useMessageComposerController.f1a3d182.js");
5
5
  const require_audioProcessing = require("./audioProcessing.22303d69.js");
6
6
  let react = require("react");
7
7
  react = require_useNotificationApi.__toESM(react);
@@ -13,40 +13,40 @@ clsx = require_useNotificationApi.__toESM(clsx);
13
13
  let use_sync_external_store_shim = require("use-sync-external-store/shim");
14
14
  let dayjs = require("dayjs");
15
15
  dayjs = require_useNotificationApi.__toESM(dayjs);
16
- let dayjs_plugin_calendar = require("dayjs/plugin/calendar");
17
- dayjs_plugin_calendar = require_useNotificationApi.__toESM(dayjs_plugin_calendar);
18
- let dayjs_plugin_localizedFormat = require("dayjs/plugin/localizedFormat");
19
- dayjs_plugin_localizedFormat = require_useNotificationApi.__toESM(dayjs_plugin_localizedFormat);
16
+ let dayjs_plugin_calendar_js = require("dayjs/plugin/calendar.js");
17
+ dayjs_plugin_calendar_js = require_useNotificationApi.__toESM(dayjs_plugin_calendar_js);
18
+ let dayjs_plugin_localizedFormat_js = require("dayjs/plugin/localizedFormat.js");
19
+ dayjs_plugin_localizedFormat_js = require_useNotificationApi.__toESM(dayjs_plugin_localizedFormat_js);
20
20
  let lodash_debounce = require("lodash.debounce");
21
21
  lodash_debounce = require_useNotificationApi.__toESM(lodash_debounce);
22
22
  let lodash_throttle = require("lodash.throttle");
23
23
  lodash_throttle = require_useNotificationApi.__toESM(lodash_throttle);
24
24
  let i18next = require("i18next");
25
25
  i18next = require_useNotificationApi.__toESM(i18next);
26
- let dayjs_plugin_updateLocale = require("dayjs/plugin/updateLocale");
27
- dayjs_plugin_updateLocale = require_useNotificationApi.__toESM(dayjs_plugin_updateLocale);
28
- let dayjs_plugin_localeData = require("dayjs/plugin/localeData");
29
- dayjs_plugin_localeData = require_useNotificationApi.__toESM(dayjs_plugin_localeData);
30
- let dayjs_plugin_relativeTime = require("dayjs/plugin/relativeTime");
31
- dayjs_plugin_relativeTime = require_useNotificationApi.__toESM(dayjs_plugin_relativeTime);
32
- let dayjs_plugin_duration = require("dayjs/plugin/duration");
33
- dayjs_plugin_duration = require_useNotificationApi.__toESM(dayjs_plugin_duration);
34
- let dayjs_plugin_utc = require("dayjs/plugin/utc");
35
- dayjs_plugin_utc = require_useNotificationApi.__toESM(dayjs_plugin_utc);
36
- let dayjs_plugin_timezone = require("dayjs/plugin/timezone");
37
- dayjs_plugin_timezone = require_useNotificationApi.__toESM(dayjs_plugin_timezone);
38
- require("dayjs/locale/de");
39
- require("dayjs/locale/es");
40
- require("dayjs/locale/fr");
41
- require("dayjs/locale/hi");
42
- require("dayjs/locale/it");
43
- require("dayjs/locale/ja");
44
- require("dayjs/locale/ko");
45
- require("dayjs/locale/nl");
46
- require("dayjs/locale/pt");
47
- require("dayjs/locale/ru");
48
- require("dayjs/locale/tr");
49
- require("dayjs/locale/en");
26
+ let dayjs_plugin_updateLocale_js = require("dayjs/plugin/updateLocale.js");
27
+ dayjs_plugin_updateLocale_js = require_useNotificationApi.__toESM(dayjs_plugin_updateLocale_js);
28
+ let dayjs_plugin_localeData_js = require("dayjs/plugin/localeData.js");
29
+ dayjs_plugin_localeData_js = require_useNotificationApi.__toESM(dayjs_plugin_localeData_js);
30
+ let dayjs_plugin_relativeTime_js = require("dayjs/plugin/relativeTime.js");
31
+ dayjs_plugin_relativeTime_js = require_useNotificationApi.__toESM(dayjs_plugin_relativeTime_js);
32
+ let dayjs_plugin_duration_js = require("dayjs/plugin/duration.js");
33
+ dayjs_plugin_duration_js = require_useNotificationApi.__toESM(dayjs_plugin_duration_js);
34
+ let dayjs_plugin_utc_js = require("dayjs/plugin/utc.js");
35
+ dayjs_plugin_utc_js = require_useNotificationApi.__toESM(dayjs_plugin_utc_js);
36
+ let dayjs_plugin_timezone_js = require("dayjs/plugin/timezone.js");
37
+ dayjs_plugin_timezone_js = require_useNotificationApi.__toESM(dayjs_plugin_timezone_js);
38
+ require("dayjs/locale/de.js");
39
+ require("dayjs/locale/es.js");
40
+ require("dayjs/locale/fr.js");
41
+ require("dayjs/locale/hi.js");
42
+ require("dayjs/locale/it.js");
43
+ require("dayjs/locale/ja.js");
44
+ require("dayjs/locale/ko.js");
45
+ require("dayjs/locale/nl.js");
46
+ require("dayjs/locale/pt.js");
47
+ require("dayjs/locale/ru.js");
48
+ require("dayjs/locale/tr.js");
49
+ require("dayjs/locale/en.js");
50
50
  let _react_aria_focus = require("@react-aria/focus");
51
51
  let hast_util_find_and_replace = require("hast-util-find-and-replace");
52
52
  let unist_builder = require("unist-builder");
@@ -8284,9 +8284,9 @@ var NotificationTranslationTopic = class extends TranslationTopic {
8284
8284
  //#region src/i18n/Streami18n.ts
8285
8285
  var defaultNS = "translation";
8286
8286
  var defaultLng = "en";
8287
- dayjs.default.extend(dayjs_plugin_updateLocale.default);
8288
- dayjs.default.extend(dayjs_plugin_utc.default);
8289
- dayjs.default.extend(dayjs_plugin_timezone.default);
8287
+ dayjs.default.extend(dayjs_plugin_updateLocale_js.default);
8288
+ dayjs.default.extend(dayjs_plugin_utc_js.default);
8289
+ dayjs.default.extend(dayjs_plugin_timezone_js.default);
8290
8290
  dayjs.default.updateLocale("de", { calendar: {
8291
8291
  lastDay: "[gestern um] LT",
8292
8292
  lastWeek: "[letzten] dddd [um] LT",
@@ -8558,10 +8558,8 @@ var supportsTz = (dateTimeParser) => dateTimeParser.tz !== void 0;
8558
8558
  * ```js
8559
8559
  * import Dayjs from 'dayjs'
8560
8560
  *
8561
- * import 'dayjs/locale/nl';
8562
- * import 'dayjs/locale/it';
8563
- * // or if you want to include all locales
8564
- * import 'dayjs/min/locales';
8561
+ * import 'dayjs/locale/nl.js';
8562
+ * import 'dayjs/locale/it.js';
8565
8563
  *
8566
8564
  * const i18n = new Streami18n({
8567
8565
  * language: 'nl',
@@ -8671,11 +8669,11 @@ var Streami18n = class {
8671
8669
  };
8672
8670
  try {
8673
8671
  if (this.DateTimeParser && isDayJs(this.DateTimeParser)) {
8674
- this.DateTimeParser.extend(dayjs_plugin_localizedFormat.default);
8675
- this.DateTimeParser.extend(dayjs_plugin_calendar.default);
8676
- this.DateTimeParser.extend(dayjs_plugin_localeData.default);
8677
- this.DateTimeParser.extend(dayjs_plugin_relativeTime.default);
8678
- this.DateTimeParser.extend(dayjs_plugin_duration.default);
8672
+ this.DateTimeParser.extend(dayjs_plugin_localizedFormat_js.default);
8673
+ this.DateTimeParser.extend(dayjs_plugin_calendar_js.default);
8674
+ this.DateTimeParser.extend(dayjs_plugin_localeData_js.default);
8675
+ this.DateTimeParser.extend(dayjs_plugin_relativeTime_js.default);
8676
+ this.DateTimeParser.extend(dayjs_plugin_duration_js.default);
8679
8677
  }
8680
8678
  } catch (error) {
8681
8679
  throw Error(`Streami18n: Looks like you wanted to provide Dayjs instance, but something went wrong while adding plugins ${error}`);
@@ -8759,7 +8757,7 @@ var Streami18n = class {
8759
8757
  if (!this.translations[language]) this.translations[language] = { [defaultNS]: translation };
8760
8758
  else this.translations[language][defaultNS] = translation;
8761
8759
  if (customDayjsLocale) this.dayjsLocales[language] = { ...customDayjsLocale };
8762
- else if (!this.localeExists(language)) this.logger(`Streami18n: registerTranslation(language, translation, customDayjsLocale) - Locale config for ${language} does not exist in Dayjs.Please import the locale file using "import 'dayjs/locale/${language}';" in your app or register the locale config with Streami18n using registerTranslation(language, translation, customDayjsLocale)`);
8760
+ else if (!this.localeExists(language)) this.logger(`Streami18n: registerTranslation(language, translation, customDayjsLocale) - Locale config for ${language} does not exist in Dayjs.Please import the locale file using "import 'dayjs/locale/${language}.js';" in your app or register the locale config with Streami18n using registerTranslation(language, translation, customDayjsLocale)`);
8763
8761
  if (this.initialized) this.i18nInstance.addResources(language, defaultNS, translation);
8764
8762
  }
8765
8763
  addOrUpdateLocale(key, config) {
@@ -9875,7 +9873,7 @@ var MessageStatus = react.default.memo(UnMemoizedMessageStatus);
9875
9873
  function escapeRegExp(text) {
9876
9874
  return text.replace(/[-[\]{}()*+?.,/\\^$|#]/g, "\\$&");
9877
9875
  }
9878
- var detectHttp = /(http(s?):\/\/)?(www\.)?/;
9876
+ var detectHttp = /(http(s?):\/\/)?(www\.)?/i;
9879
9877
  var codeRegex = /```[a-z]*\n[\s\S]*?\n```|`[a-z]*[\s\S]*?`/gm;
9880
9878
  var regexMdLinks = /\[([^[]+)\](\(.*\))/gm;
9881
9879
  var singleMatch = /\[([^[]+)\]\((.*)\)/;
@@ -10063,7 +10061,7 @@ var remarkIgnoreMarkdown = () => (tree, file) => {
10063
10061
  //#region src/components/Message/renderText/componentRenderers/Anchor.tsx
10064
10062
  var Anchor = ({ children, href }) => {
10065
10063
  const isEmail = href?.startsWith("mailto:");
10066
- const isUrl = href?.startsWith("http");
10064
+ const isUrl = href?.toLowerCase().startsWith("http");
10067
10065
  if (!href || !isEmail && !isUrl) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
10068
10066
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
10069
10067
  className: (0, clsx.default)({ "str-chat__message-url-link": isUrl }),
@@ -20086,7 +20084,7 @@ var useMarkRead = ({ isMessageListScrolledToBottom, messageListIsThread, wasMark
20086
20084
  if (shouldMarkRead()) markRead();
20087
20085
  };
20088
20086
  const handleMessageNew = (event) => {
20089
- const mainChannelUpdated = !event.message?.parent_id || event.message?.show_in_channel;
20087
+ if (!(!event.message?.parent_id || event.message?.show_in_channel)) return;
20090
20088
  if (!isMessageListScrolledToBottom || wasMarkedUnread || document.hidden) setChannelUnreadUiState((prev) => {
20091
20089
  const previousUnreadCount = prev?.unread_messages ?? 0;
20092
20090
  const previousLastMessage = getPreviousLastMessage(channel.state.messages, event.message);
@@ -20096,7 +20094,7 @@ var useMarkRead = ({ isMessageListScrolledToBottom, messageListIsThread, wasMark
20096
20094
  unread_messages: previousUnreadCount + 1
20097
20095
  };
20098
20096
  });
20099
- else if (mainChannelUpdated && shouldMarkRead()) markRead();
20097
+ else if (shouldMarkRead()) markRead();
20100
20098
  };
20101
20099
  channel.on("message.new", handleMessageNew);
20102
20100
  document.addEventListener("visibilitychange", onVisibilityChange);
@@ -21750,6 +21748,7 @@ var useChannelListShapeDefaults = () => {
21750
21748
  const handleNotificationMessageNew = (0, react.useCallback)(async ({ allowNewMessagesFromUnfilteredChannels, customHandler, event, filters, setChannels, sort }) => {
21751
21749
  if (typeof customHandler === "function") return customHandler(setChannels, event);
21752
21750
  if (!event.channel) return;
21751
+ if (!allowNewMessagesFromUnfilteredChannels) return;
21753
21752
  const channel = await require_useNotificationApi.getChannel({
21754
21753
  client,
21755
21754
  id: event.channel.id,
@@ -21757,7 +21756,6 @@ var useChannelListShapeDefaults = () => {
21757
21756
  });
21758
21757
  const considerArchivedChannels = shouldConsiderArchivedChannels(filters);
21759
21758
  if (isChannelArchived(channel) && considerArchivedChannels && !filters.archived) return;
21760
- if (!allowNewMessagesFromUnfilteredChannels) return;
21761
21759
  setChannels((channels) => moveChannelUpwards({
21762
21760
  channels,
21763
21761
  channelToMove: channel,
@@ -24036,7 +24034,7 @@ var useChat = ({ client, defaultLanguage = "en", i18nInstance }) => {
24036
24034
  };
24037
24035
  (0, react.useEffect)(() => {
24038
24036
  if (!client) return;
24039
- const version = "14.6.0";
24037
+ const version = "14.6.1";
24040
24038
  const userAgent = client.getUserAgent();
24041
24039
  if (!userAgent.includes("stream-chat-react")) client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
24042
24040
  client.threads.registerSubscriptions();