stream-chat-react 14.6.0 → 14.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ReactPlayerWrapper.30240f76.js → ReactPlayerWrapper.c340ab05.js} +2 -2
- package/dist/cjs/{ReactPlayerWrapper.30240f76.js.map → ReactPlayerWrapper.c340ab05.js.map} +1 -1
- package/dist/cjs/audioProcessing.22303d69.js.map +1 -1
- package/dist/cjs/channel-detail.js +2 -2
- package/dist/cjs/channel-detail.js.map +1 -1
- package/dist/cjs/emojis.js +2 -2
- package/dist/cjs/emojis.js.map +1 -1
- package/dist/cjs/index.js +50 -52
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mp3-encoder.js.map +1 -1
- package/dist/cjs/{useChannelHeaderOnlineStatus.6546ac83.js → useChannelHeaderOnlineStatus.d39ede24.js} +25 -9
- package/dist/cjs/{useChannelHeaderOnlineStatus.6546ac83.js.map → useChannelHeaderOnlineStatus.d39ede24.js.map} +1 -1
- package/dist/cjs/{useMessageComposerController.c0dad9bc.js → useMessageComposerController.f1a3d182.js} +2 -2
- package/dist/cjs/{useMessageComposerController.c0dad9bc.js.map → useMessageComposerController.f1a3d182.js.map} +1 -1
- package/dist/cjs/{useNotificationApi.eb753f31.js → useNotificationApi.87ba0b39.js} +13 -13
- package/dist/cjs/useNotificationApi.87ba0b39.js.map +1 -0
- package/dist/css/index.css +3 -3
- package/dist/css/index.css.map +1 -1
- package/dist/es/audioProcessing.766ca76c.mjs.map +1 -1
- package/dist/es/channel-detail.mjs +2 -2
- package/dist/es/channel-detail.mjs.map +1 -1
- package/dist/es/emojis.mjs +2 -2
- package/dist/es/emojis.mjs.map +1 -1
- package/dist/es/index.mjs +34 -36
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/mp3-encoder.mjs.map +1 -1
- package/dist/es/{useChannelHeaderOnlineStatus.c5215b13.mjs → useChannelHeaderOnlineStatus.b3a51ca7.mjs} +24 -8
- package/dist/es/{useChannelHeaderOnlineStatus.c5215b13.mjs.map → useChannelHeaderOnlineStatus.b3a51ca7.mjs.map} +1 -1
- package/dist/es/{useMessageComposerController.29f189b4.mjs → useMessageComposerController.2309f433.mjs} +2 -2
- package/dist/es/{useMessageComposerController.29f189b4.mjs.map → useMessageComposerController.2309f433.mjs.map} +1 -1
- package/dist/es/{useNotificationApi.fa5cddf9.mjs → useNotificationApi.eff88f29.mjs} +9 -9
- package/dist/es/useNotificationApi.eff88f29.mjs.map +1 -0
- package/dist/types/components/Channel/Channel.d.ts.map +1 -1
- package/dist/types/components/Channel/hooks/useCreateChannelStateContext.d.ts.map +1 -1
- package/dist/types/components/ChannelList/ChannelList.d.ts.map +1 -1
- package/dist/types/components/ChannelList/hooks/useChannelListShape.d.ts.map +1 -1
- package/dist/types/components/ChannelListItem/hooks/useIsChannelMuted.d.ts.map +1 -1
- package/dist/types/components/Message/renderText/regex.d.ts.map +1 -1
- package/dist/types/components/MessageList/hooks/useMarkRead.d.ts.map +1 -1
- package/dist/types/context/ComponentContext.d.ts +2 -0
- package/dist/types/context/ComponentContext.d.ts.map +1 -1
- package/dist/types/i18n/Streami18n.d.ts +12 -12
- package/dist/types/i18n/Streami18n.d.ts.map +1 -1
- package/dist/types/i18n/types.d.ts +1 -1
- package/package.json +8 -7
- package/dist/cjs/useNotificationApi.eb753f31.js.map +0 -1
- package/dist/es/useNotificationApi.fa5cddf9.mjs.map +0 -1
package/dist/es/emojis.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as usePopoverPosition, Ut as IconEmoji, Zn as Button, ur as useTranslationContext } from "./useNotificationApi.
|
|
2
|
-
import { a as useMessageComposerContext, n as useIsCooldownActive, t as useMessageComposerController } from "./useMessageComposerController.
|
|
1
|
+
import { R as usePopoverPosition, Ut as IconEmoji, Zn as Button, ur as useTranslationContext } from "./useNotificationApi.eff88f29.mjs";
|
|
2
|
+
import { a as useMessageComposerContext, n as useIsCooldownActive, t as useMessageComposerController } from "./useMessageComposerController.2309f433.mjs";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { BaseSearchSource, getTokenizedSuggestionDisplayName, getTriggerCharWithToken, insertItemWithTrigger, replaceWordWithEntity } from "stream-chat";
|
package/dist/es/emojis.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emojis.mjs","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,aAA8D,WAAW;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,sBAAsB,aAAa;CACjD,MAAM,EAAE,gBAAgB,0BAA0B,aAAa;CAC/D,MAAM,EAAE,iBAAiB,6BAA6B;CACtD,MAAM,mBAAmB,oBA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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,GAAG,sBAAsB;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.mjs","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,aAA8D,WAAW;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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a,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,GAAG,sBAAsB;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/es/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as isMessageErrorRetryable, $n as addNotificationTargetTag, $r as useChannelActionContext, $t as IconGiphy, A as WithAudioPlayback, An as IconSend, Ar as useDialogIsOpen, At as IconCamera, B as MESSAGE_ACTIONS, Bn as IconUserAdd, Br as ComponentProvider, Bt as IconDelete, C as insertIntro, Cn as IconPoll, Cr as useModalDialogManager, Ct as IconAttachment, D as makeDateMessageId, Dn as IconReply, Dr as Portal, Dt as IconBolt, E as isLocalMessage, En as IconReorder, Er as DialogPortalEntry, Et as IconBellOff, F as elementIsPlaying, Fn as IconTrophy, Fr as useModalDialogIsTopmost, Ft as IconChevronLeft, G as getImages, Gn as IconVideoFill, Gr as ChannelStateContext, Gt as IconExclamationCircleFill, H as areMessagePropsEqual, Hn as IconUserRemove, Hr as ChatContext, Ht as IconEdit, I as LegacyThreadContext, In as IconUnpin, Ir as useOpenedDialogCount, It as IconChevronRight, J as getReadByTooltipText, Jn as IconXmark, Jr as ChannelListContext, Jt as IconExclamationTriangleFill, K as getMessageActions, Kn as IconVoice, Kr as ChannelStateProvider, Kt as IconExclamationMark, L as useLegacyThreadContext, Ln as IconUnsupportedAttachment, Lr as useStateStore, Lt as IconClock, M as useAudioPlayer, Mn as IconThread, Mr as useDialogOnNearestManager, Mt as IconCheckmark1Small, N as AudioPlayer, Nn as IconThreadFill, Nr as useModalDialog, Nt as IconChecks, O as makeIntroMessage, On as IconRetry, Or as modalDialogId, Ot as IconBookmark, P as defaultRegisterAudioPlayerError, Pn as IconTranslate, Pr as useModalDialogIsOpen, Pt as IconChevronDown, Q as isMessageEdited, Qn as useStableId, Qr as ChannelActionProvider, Qt as IconFolder, R as usePopoverPosition, Rn as IconUpload, Rr as DialogManager, Rt as IconCommand, S as hasMoreMessagesProbably, Sn as IconPlusSmall, Sr as useDialogManager, St as IconArrowUpRight, T as isIntroMessage, Tn as IconRefresh, Tr as DialogPortalDestination, Tt as IconBell, U as areMessageUIPropsEqual, Un as IconUsers, Ur as ChatProvider, Ut as IconEmoji, V as OPTIONAL_MESSAGE_ACTIONS, Vn as IconUserCheck, Vr as useComponentContext, Vt as IconDownload, W as countEmojis, Wn as IconVideo, Wr as useChatContext, Wt as IconEmojiAdd, X as isMessageBounced, Xn as createIcon, Xr as useChannelListContext, Xt as IconFile, Y as isMessageBlocked, Yn as IconXmarkSmall, Yr as ChannelListContextProvider, Yt as IconEyeFill, Z as isMessageDeleted, Zn as Button, Zr as ChannelActionContext, Zt as IconFlag, _ as Channel, _n as IconNotification, _r as isNumberOrString, _t as IconArchive, a as ChatView, an as IconLocation, ar as TypingContext, at as messageHasQuotedMessage, b as getIsFirstUnreadMessage, bn as IconPlayFill, br as ModalDialogManagerProvider, bt as IconArrowLeft, c as ChatViewSelectorButton, cn as IconMessageBubble, cr as TranslationContext, ct as messageTextHasEmojisOnly, d as useActiveThread, dn as IconMicrophoneSolid, dr as defaultDateTimeParser, dt as CHANNEL_CONTAINER_ID, en as IconImage, er as getNotificationTargetPanel, et as isNetworkSendFailure, f as useChatViewContext, fn as IconMinus, fr as defaultTranslatorFunction, ft as LoadingErrorIndicator, g as useThreadContext, gn as IconNoSign, gr as isLanguageSupported, gt as EmptyStateIndicator, h as ThreadProvider, hn as IconMute, hr as isDayOrMoment, ht as useEditMessageHandler, i as useNotificationTarget, in as IconLoading, ir as isNotificationTargetPanel, it as messageHasGiphyAttachment, j as useActiveAudioPlayer, jn as IconShield, jr as useDialogIsTopmost, jt as IconCheckmark, k as processMessages, kn as IconSearch, kr as useDialog, kt as IconBookmarkRemove, l as ChatViewThreadsSelectorButton, ln as IconMessageBubbleFill, lr as TranslationProvider, lt as validateAndGetMessage, m as ThreadContext, mn as IconMore, mr as isDate, mt as useMentionsHandlers, n as hasSystemNotificationTag, nn as IconLeave, nr as getNotificationTargetTag, nt as mapToUserNameOrId, o as ChatViewChannelsSelectorButton, on as IconMegaphone, or as TypingProvider, ot as messageHasReactions, p as useThreadsViewContext, pn as IconMinusCircle, pr as getDateString, pt as LoadingChannel, q as getNonImageAttachments, qn as IconXCircle, qr as useChannelStateContext, qt as IconExclamationMarkFill, r as useNotificationApi, rn as IconLink, rr as isNotificationForPanel, rt as messageHasAttachments, s as ChatViewContext, sn as IconMenu, sr as useTypingContext, st as messageHasSingleAttachment, t as SYSTEM_NOTIFICATION_TAG, tn as IconInfo, tr as getNotificationTargetPanels, tt as isUserMuted, u as defaultChatViewSelectorItemSet, un as IconMessageBubbles, ur as useTranslationContext, ut as EMOJI_REGEX, v as getChannel, vn as IconPauseFill, vr as predefinedFormatters, vt as IconArrowDown, w as isDateSeparatorMessage, wn as IconQuote, wr as useNearestDialogManagerContext, wt as IconAudio, x as getLastReceived, xn as IconPlus, xr as modalDialogManagerId, xt as IconArrowUp, y as getGroupStyles, yn as IconPin, yr as DialogManagerProvider, yt as IconArrowDownCircle, z as ACTIONS_NOT_WORKING_IN_THREAD, zn as IconUser, zr as ComponentContext, zt as IconCopy } from "./useNotificationApi.
|
|
2
|
-
import { $ as ContextMenuBackButton, A as GalleryUI, At as MessageTranslationViewContext, B as FileIcon, C as Checkmark, Ct as LoadingIndicator, D as SwitchFieldLabel, Dt as ModalContext, E as SwitchFieldDescription, Et as useNotificationConfigurationContext, F as useGalleryContext, Ft as MessageProvider, G as Timestamp, H as FILE_ICON_NO_LABEL_CLASSNAME, I as toBaseImageDescriptors, It as useMessageContext, J as htmlToTextPlugin, K as plusPlusToEmphasis, L as BaseImage, M as VideoPlayer, Mt as getTranslatedMessageText, N as GalleryContext, Nt as useMessageTranslationViewContext, O as SwitchFieldTitle, Ot as ModalContextProvider, P as toGalleryItemDescriptors, Pt as MessageContext, Q as ContextMenu, R as ImagePlaceholder, S as Checkbox, St as FileSizeIndicator, T as SwitchField, Tt as NotificationConfigurationProvider, U as DownloadButton, V as FILE_ICON_GRAPHIC_CLASSNAME, W as MessageTimestamp, X as Prompt, Y as GlobalModal, Z as BaseContextMenuButton, _ as getLatestMessagePreview, _t as Alert, a as pickNewest, at as DEFAULT_CONTEXT_MENU_KEYBOARD_NAVIGATION_ITEM_SELECTOR, b as ListItemLayoutContent, bt as useAriaIdentifiers, c as useIsUserMuted, ct as useContextMenuContext, d as useSelectedChannelState, dt as ChannelAvatar, et as ContextMenuBody, f as isDmChannel, ft as Badge, g as getGroupChannelDisplayInfo, gt as useDialogAnchor, h as getChannelDisplayImage, ht as DialogAnchor, i as createDefaultPickNext, it as ContextMenuRoot, j as VideoThumbnail, jt as MessageTranslationViewProvider, k as Gallery, kt as useModalContext, l as useIsChannelMuted, lt as createRovingFocusKeyDownHandler, m as useChannelDisplayName, mt as Avatar, nt as ContextMenuContent, o as pickOldest, ot as EmojiContextMenuButton, p as useChannelPreviewInfo, pt as ErrorBadge, q as imageToLink, r as NotificationList, rt as ContextMenuHeader, s as Notification, st as UserContextMenuButton, t as useChannelHeaderOnlineStatus, tt as ContextMenuButton, u as useChannelMembershipState, ut as GroupAvatar, v as renderPreviewText, vt as Header, w as Switch, wt as useNotifications, x as TextInput, xt as useStableCallback, y as ListItemLayout, yt as Root, z as formatTime } from "./useChannelHeaderOnlineStatus.
|
|
3
|
-
import { a as useMessageComposerContext, i as MessageComposerContextProvider, n as useIsCooldownActive, r as MessageComposerContext, t as useMessageComposerController } from "./useMessageComposerController.
|
|
1
|
+
import { $ as isMessageErrorRetryable, $n as addNotificationTargetTag, $r as useChannelActionContext, $t as IconGiphy, A as WithAudioPlayback, An as IconSend, Ar as useDialogIsOpen, At as IconCamera, B as MESSAGE_ACTIONS, Bn as IconUserAdd, Br as ComponentProvider, Bt as IconDelete, C as insertIntro, Cn as IconPoll, Cr as useModalDialogManager, Ct as IconAttachment, D as makeDateMessageId, Dn as IconReply, Dr as Portal, Dt as IconBolt, E as isLocalMessage, En as IconReorder, Er as DialogPortalEntry, Et as IconBellOff, F as elementIsPlaying, Fn as IconTrophy, Fr as useModalDialogIsTopmost, Ft as IconChevronLeft, G as getImages, Gn as IconVideoFill, Gr as ChannelStateContext, Gt as IconExclamationCircleFill, H as areMessagePropsEqual, Hn as IconUserRemove, Hr as ChatContext, Ht as IconEdit, I as LegacyThreadContext, In as IconUnpin, Ir as useOpenedDialogCount, It as IconChevronRight, J as getReadByTooltipText, Jn as IconXmark, Jr as ChannelListContext, Jt as IconExclamationTriangleFill, K as getMessageActions, Kn as IconVoice, Kr as ChannelStateProvider, Kt as IconExclamationMark, L as useLegacyThreadContext, Ln as IconUnsupportedAttachment, Lr as useStateStore, Lt as IconClock, M as useAudioPlayer, Mn as IconThread, Mr as useDialogOnNearestManager, Mt as IconCheckmark1Small, N as AudioPlayer, Nn as IconThreadFill, Nr as useModalDialog, Nt as IconChecks, O as makeIntroMessage, On as IconRetry, Or as modalDialogId, Ot as IconBookmark, P as defaultRegisterAudioPlayerError, Pn as IconTranslate, Pr as useModalDialogIsOpen, Pt as IconChevronDown, Q as isMessageEdited, Qn as useStableId, Qr as ChannelActionProvider, Qt as IconFolder, R as usePopoverPosition, Rn as IconUpload, Rr as DialogManager, Rt as IconCommand, S as hasMoreMessagesProbably, Sn as IconPlusSmall, Sr as useDialogManager, St as IconArrowUpRight, T as isIntroMessage, Tn as IconRefresh, Tr as DialogPortalDestination, Tt as IconBell, U as areMessageUIPropsEqual, Un as IconUsers, Ur as ChatProvider, Ut as IconEmoji, V as OPTIONAL_MESSAGE_ACTIONS, Vn as IconUserCheck, Vr as useComponentContext, Vt as IconDownload, W as countEmojis, Wn as IconVideo, Wr as useChatContext, Wt as IconEmojiAdd, X as isMessageBounced, Xn as createIcon, Xr as useChannelListContext, Xt as IconFile, Y as isMessageBlocked, Yn as IconXmarkSmall, Yr as ChannelListContextProvider, Yt as IconEyeFill, Z as isMessageDeleted, Zn as Button, Zr as ChannelActionContext, Zt as IconFlag, _ as Channel, _n as IconNotification, _r as isNumberOrString, _t as IconArchive, a as ChatView, an as IconLocation, ar as TypingContext, at as messageHasQuotedMessage, b as getIsFirstUnreadMessage, bn as IconPlayFill, br as ModalDialogManagerProvider, bt as IconArrowLeft, c as ChatViewSelectorButton, cn as IconMessageBubble, cr as TranslationContext, ct as messageTextHasEmojisOnly, d as useActiveThread, dn as IconMicrophoneSolid, dr as defaultDateTimeParser, dt as CHANNEL_CONTAINER_ID, en as IconImage, er as getNotificationTargetPanel, et as isNetworkSendFailure, f as useChatViewContext, fn as IconMinus, fr as defaultTranslatorFunction, ft as LoadingErrorIndicator, g as useThreadContext, gn as IconNoSign, gr as isLanguageSupported, gt as EmptyStateIndicator, h as ThreadProvider, hn as IconMute, hr as isDayOrMoment, ht as useEditMessageHandler, i as useNotificationTarget, in as IconLoading, ir as isNotificationTargetPanel, it as messageHasGiphyAttachment, j as useActiveAudioPlayer, jn as IconShield, jr as useDialogIsTopmost, jt as IconCheckmark, k as processMessages, kn as IconSearch, kr as useDialog, kt as IconBookmarkRemove, l as ChatViewThreadsSelectorButton, ln as IconMessageBubbleFill, lr as TranslationProvider, lt as validateAndGetMessage, m as ThreadContext, mn as IconMore, mr as isDate, mt as useMentionsHandlers, n as hasSystemNotificationTag, nn as IconLeave, nr as getNotificationTargetTag, nt as mapToUserNameOrId, o as ChatViewChannelsSelectorButton, on as IconMegaphone, or as TypingProvider, ot as messageHasReactions, p as useThreadsViewContext, pn as IconMinusCircle, pr as getDateString, pt as LoadingChannel, q as getNonImageAttachments, qn as IconXCircle, qr as useChannelStateContext, qt as IconExclamationMarkFill, r as useNotificationApi, rn as IconLink, rr as isNotificationForPanel, rt as messageHasAttachments, s as ChatViewContext, sn as IconMenu, sr as useTypingContext, st as messageHasSingleAttachment, t as SYSTEM_NOTIFICATION_TAG, tn as IconInfo, tr as getNotificationTargetPanels, tt as isUserMuted, u as defaultChatViewSelectorItemSet, un as IconMessageBubbles, ur as useTranslationContext, ut as EMOJI_REGEX, v as getChannel, vn as IconPauseFill, vr as predefinedFormatters, vt as IconArrowDown, w as isDateSeparatorMessage, wn as IconQuote, wr as useNearestDialogManagerContext, wt as IconAudio, x as getLastReceived, xn as IconPlus, xr as modalDialogManagerId, xt as IconArrowUp, y as getGroupStyles, yn as IconPin, yr as DialogManagerProvider, yt as IconArrowDownCircle, z as ACTIONS_NOT_WORKING_IN_THREAD, zn as IconUser, zr as ComponentContext, zt as IconCopy } from "./useNotificationApi.eff88f29.mjs";
|
|
2
|
+
import { $ as ContextMenuBackButton, A as GalleryUI, At as MessageTranslationViewContext, B as FileIcon, C as Checkmark, Ct as LoadingIndicator, D as SwitchFieldLabel, Dt as ModalContext, E as SwitchFieldDescription, Et as useNotificationConfigurationContext, F as useGalleryContext, Ft as MessageProvider, G as Timestamp, H as FILE_ICON_NO_LABEL_CLASSNAME, I as toBaseImageDescriptors, It as useMessageContext, J as htmlToTextPlugin, K as plusPlusToEmphasis, L as BaseImage, M as VideoPlayer, Mt as getTranslatedMessageText, N as GalleryContext, Nt as useMessageTranslationViewContext, O as SwitchFieldTitle, Ot as ModalContextProvider, P as toGalleryItemDescriptors, Pt as MessageContext, Q as ContextMenu, R as ImagePlaceholder, S as Checkbox, St as FileSizeIndicator, T as SwitchField, Tt as NotificationConfigurationProvider, U as DownloadButton, V as FILE_ICON_GRAPHIC_CLASSNAME, W as MessageTimestamp, X as Prompt, Y as GlobalModal, Z as BaseContextMenuButton, _ as getLatestMessagePreview, _t as Alert, a as pickNewest, at as DEFAULT_CONTEXT_MENU_KEYBOARD_NAVIGATION_ITEM_SELECTOR, b as ListItemLayoutContent, bt as useAriaIdentifiers, c as useIsUserMuted, ct as useContextMenuContext, d as useSelectedChannelState, dt as ChannelAvatar, et as ContextMenuBody, f as isDmChannel, ft as Badge, g as getGroupChannelDisplayInfo, gt as useDialogAnchor, h as getChannelDisplayImage, ht as DialogAnchor, i as createDefaultPickNext, it as ContextMenuRoot, j as VideoThumbnail, jt as MessageTranslationViewProvider, k as Gallery, kt as useModalContext, l as useIsChannelMuted, lt as createRovingFocusKeyDownHandler, m as useChannelDisplayName, mt as Avatar, nt as ContextMenuContent, o as pickOldest, ot as EmojiContextMenuButton, p as useChannelPreviewInfo, pt as ErrorBadge, q as imageToLink, r as NotificationList, rt as ContextMenuHeader, s as Notification, st as UserContextMenuButton, t as useChannelHeaderOnlineStatus, tt as ContextMenuButton, u as useChannelMembershipState, ut as GroupAvatar, v as renderPreviewText, vt as Header, w as Switch, wt as useNotifications, x as TextInput, xt as useStableCallback, y as ListItemLayout, yt as Root, z as formatTime } from "./useChannelHeaderOnlineStatus.b3a51ca7.mjs";
|
|
3
|
+
import { a as useMessageComposerContext, i as MessageComposerContextProvider, n as useIsCooldownActive, r as MessageComposerContext, t as useMessageComposerController } from "./useMessageComposerController.2309f433.mjs";
|
|
4
4
|
import { a as getExtensionFromMimeType, i as dataTransferItemsToFiles, n as toAudioBuffer, o as getRecordedMediaTypeFromMimeType, r as createFileFromBlobs, s as useHandleFileChangeWrapper, t as renderAudio } from "./audioProcessing.766ca76c.mjs";
|
|
5
5
|
import React, { Component, Fragment, createContext, createElement, forwardRef, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -9,29 +9,29 @@ import { nanoid } from "nanoid";
|
|
|
9
9
|
import clsx from "clsx";
|
|
10
10
|
import { useSyncExternalStore } from "use-sync-external-store/shim";
|
|
11
11
|
import Dayjs from "dayjs";
|
|
12
|
-
import calendar from "dayjs/plugin/calendar";
|
|
13
|
-
import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
12
|
+
import calendar from "dayjs/plugin/calendar.js";
|
|
13
|
+
import localizedFormat from "dayjs/plugin/localizedFormat.js";
|
|
14
14
|
import debounce from "lodash.debounce";
|
|
15
15
|
import throttle from "lodash.throttle";
|
|
16
16
|
import i18n from "i18next";
|
|
17
|
-
import updateLocale from "dayjs/plugin/updateLocale";
|
|
18
|
-
import localeData from "dayjs/plugin/localeData";
|
|
19
|
-
import relativeTime from "dayjs/plugin/relativeTime";
|
|
20
|
-
import duration from "dayjs/plugin/duration";
|
|
21
|
-
import utc from "dayjs/plugin/utc";
|
|
22
|
-
import timezone from "dayjs/plugin/timezone";
|
|
23
|
-
import "dayjs/locale/de";
|
|
24
|
-
import "dayjs/locale/es";
|
|
25
|
-
import "dayjs/locale/fr";
|
|
26
|
-
import "dayjs/locale/hi";
|
|
27
|
-
import "dayjs/locale/it";
|
|
28
|
-
import "dayjs/locale/ja";
|
|
29
|
-
import "dayjs/locale/ko";
|
|
30
|
-
import "dayjs/locale/nl";
|
|
31
|
-
import "dayjs/locale/pt";
|
|
32
|
-
import "dayjs/locale/ru";
|
|
33
|
-
import "dayjs/locale/tr";
|
|
34
|
-
import "dayjs/locale/en";
|
|
17
|
+
import updateLocale from "dayjs/plugin/updateLocale.js";
|
|
18
|
+
import localeData from "dayjs/plugin/localeData.js";
|
|
19
|
+
import relativeTime from "dayjs/plugin/relativeTime.js";
|
|
20
|
+
import duration from "dayjs/plugin/duration.js";
|
|
21
|
+
import utc from "dayjs/plugin/utc.js";
|
|
22
|
+
import timezone from "dayjs/plugin/timezone.js";
|
|
23
|
+
import "dayjs/locale/de.js";
|
|
24
|
+
import "dayjs/locale/es.js";
|
|
25
|
+
import "dayjs/locale/fr.js";
|
|
26
|
+
import "dayjs/locale/hi.js";
|
|
27
|
+
import "dayjs/locale/it.js";
|
|
28
|
+
import "dayjs/locale/ja.js";
|
|
29
|
+
import "dayjs/locale/ko.js";
|
|
30
|
+
import "dayjs/locale/nl.js";
|
|
31
|
+
import "dayjs/locale/pt.js";
|
|
32
|
+
import "dayjs/locale/ru.js";
|
|
33
|
+
import "dayjs/locale/tr.js";
|
|
34
|
+
import "dayjs/locale/en.js";
|
|
35
35
|
import { FocusScope } from "@react-aria/focus";
|
|
36
36
|
import { findAndReplace } from "hast-util-find-and-replace";
|
|
37
37
|
import { u } from "unist-builder";
|
|
@@ -8537,10 +8537,8 @@ var supportsTz = (dateTimeParser) => dateTimeParser.tz !== void 0;
|
|
|
8537
8537
|
* ```js
|
|
8538
8538
|
* import Dayjs from 'dayjs'
|
|
8539
8539
|
*
|
|
8540
|
-
* import 'dayjs/locale/nl';
|
|
8541
|
-
* import 'dayjs/locale/it';
|
|
8542
|
-
* // or if you want to include all locales
|
|
8543
|
-
* import 'dayjs/min/locales';
|
|
8540
|
+
* import 'dayjs/locale/nl.js';
|
|
8541
|
+
* import 'dayjs/locale/it.js';
|
|
8544
8542
|
*
|
|
8545
8543
|
* const i18n = new Streami18n({
|
|
8546
8544
|
* language: 'nl',
|
|
@@ -8738,7 +8736,7 @@ var Streami18n = class {
|
|
|
8738
8736
|
if (!this.translations[language]) this.translations[language] = { [defaultNS]: translation };
|
|
8739
8737
|
else this.translations[language][defaultNS] = translation;
|
|
8740
8738
|
if (customDayjsLocale) this.dayjsLocales[language] = { ...customDayjsLocale };
|
|
8741
|
-
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)`);
|
|
8739
|
+
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)`);
|
|
8742
8740
|
if (this.initialized) this.i18nInstance.addResources(language, defaultNS, translation);
|
|
8743
8741
|
}
|
|
8744
8742
|
addOrUpdateLocale(key, config) {
|
|
@@ -9854,7 +9852,7 @@ var MessageStatus = React.memo(UnMemoizedMessageStatus);
|
|
|
9854
9852
|
function escapeRegExp(text) {
|
|
9855
9853
|
return text.replace(/[-[\]{}()*+?.,/\\^$|#]/g, "\\$&");
|
|
9856
9854
|
}
|
|
9857
|
-
var detectHttp = /(http(s?):\/\/)?(www\.)
|
|
9855
|
+
var detectHttp = /(http(s?):\/\/)?(www\.)?/i;
|
|
9858
9856
|
var codeRegex = /```[a-z]*\n[\s\S]*?\n```|`[a-z]*[\s\S]*?`/gm;
|
|
9859
9857
|
var regexMdLinks = /\[([^[]+)\](\(.*\))/gm;
|
|
9860
9858
|
var singleMatch = /\[([^[]+)\]\((.*)\)/;
|
|
@@ -10042,7 +10040,7 @@ var remarkIgnoreMarkdown = () => (tree, file) => {
|
|
|
10042
10040
|
//#region src/components/Message/renderText/componentRenderers/Anchor.tsx
|
|
10043
10041
|
var Anchor = ({ children, href }) => {
|
|
10044
10042
|
const isEmail = href?.startsWith("mailto:");
|
|
10045
|
-
const isUrl = href?.startsWith("http");
|
|
10043
|
+
const isUrl = href?.toLowerCase().startsWith("http");
|
|
10046
10044
|
if (!href || !isEmail && !isUrl) return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
10047
10045
|
return /* @__PURE__ */ jsx("a", {
|
|
10048
10046
|
className: clsx({ "str-chat__message-url-link": isUrl }),
|
|
@@ -20065,7 +20063,7 @@ var useMarkRead = ({ isMessageListScrolledToBottom, messageListIsThread, wasMark
|
|
|
20065
20063
|
if (shouldMarkRead()) markRead();
|
|
20066
20064
|
};
|
|
20067
20065
|
const handleMessageNew = (event) => {
|
|
20068
|
-
|
|
20066
|
+
if (!(!event.message?.parent_id || event.message?.show_in_channel)) return;
|
|
20069
20067
|
if (!isMessageListScrolledToBottom || wasMarkedUnread || document.hidden) setChannelUnreadUiState((prev) => {
|
|
20070
20068
|
const previousUnreadCount = prev?.unread_messages ?? 0;
|
|
20071
20069
|
const previousLastMessage = getPreviousLastMessage(channel.state.messages, event.message);
|
|
@@ -20075,7 +20073,7 @@ var useMarkRead = ({ isMessageListScrolledToBottom, messageListIsThread, wasMark
|
|
|
20075
20073
|
unread_messages: previousUnreadCount + 1
|
|
20076
20074
|
};
|
|
20077
20075
|
});
|
|
20078
|
-
else if (
|
|
20076
|
+
else if (shouldMarkRead()) markRead();
|
|
20079
20077
|
};
|
|
20080
20078
|
channel.on("message.new", handleMessageNew);
|
|
20081
20079
|
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
@@ -21729,6 +21727,7 @@ var useChannelListShapeDefaults = () => {
|
|
|
21729
21727
|
const handleNotificationMessageNew = useCallback(async ({ allowNewMessagesFromUnfilteredChannels, customHandler, event, filters, setChannels, sort }) => {
|
|
21730
21728
|
if (typeof customHandler === "function") return customHandler(setChannels, event);
|
|
21731
21729
|
if (!event.channel) return;
|
|
21730
|
+
if (!allowNewMessagesFromUnfilteredChannels) return;
|
|
21732
21731
|
const channel = await getChannel({
|
|
21733
21732
|
client,
|
|
21734
21733
|
id: event.channel.id,
|
|
@@ -21736,7 +21735,6 @@ var useChannelListShapeDefaults = () => {
|
|
|
21736
21735
|
});
|
|
21737
21736
|
const considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
21738
21737
|
if (isChannelArchived(channel) && considerArchivedChannels && !filters.archived) return;
|
|
21739
|
-
if (!allowNewMessagesFromUnfilteredChannels) return;
|
|
21740
21738
|
setChannels((channels) => moveChannelUpwards({
|
|
21741
21739
|
channels,
|
|
21742
21740
|
channelToMove: channel,
|
|
@@ -22465,7 +22463,7 @@ var UnMemoizedChannelList = (props) => {
|
|
|
22465
22463
|
const { allowNewMessagesFromUnfilteredChannels = true, channelRenderFilterFn, customActiveChannel, customQueryChannels, EmptyStateIndicator: EmptyStateIndicator$1 = EmptyStateIndicator, filters = {}, getLatestMessagePreview, lockChannelOrder = false, onAddedToChannel, onChannelDeleted, onChannelHidden, onChannelTruncated, onChannelUpdated, onChannelVisible, onMessageNew, onMessageNewHandler, onRemovedFromChannel, options, Paginator = LoadMorePaginator, recoveryThrottleIntervalMs, renderChannels, sendChannelsToList = false, setActiveChannelOnMount = true, showChannelSearch = false, sort = DEFAULT_SORT, watchers = {} } = props;
|
|
22466
22464
|
const stableId = useStableId();
|
|
22467
22465
|
const { channel, channelsQueryState, client, customClasses, searchController, setActiveChannel, theme, useImageFlagEmojisOnWindows } = useChatContext("ChannelList");
|
|
22468
|
-
const { ChannelListUI: ChannelListUI$1 = ChannelListUI, NotificationList: NotificationList$1 = NotificationList, Search: Search$13 = Search } = useComponentContext();
|
|
22466
|
+
const { ChannelListHeader: ChannelListHeader$1 = ChannelListHeader, ChannelListUI: ChannelListUI$1 = ChannelListUI, NotificationList: NotificationList$1 = NotificationList, Search: Search$13 = Search } = useComponentContext();
|
|
22469
22467
|
const channelListRef = useRef(null);
|
|
22470
22468
|
const [channelUpdateCount, setChannelUpdateCount] = useState(0);
|
|
22471
22469
|
const { searchIsActive } = useStateStore(searchController.state, searchControllerStateSelector);
|
|
@@ -22551,7 +22549,7 @@ var UnMemoizedChannelList = (props) => {
|
|
|
22551
22549
|
children: /* @__PURE__ */ jsxs(DialogManagerProvider, {
|
|
22552
22550
|
id: `channel-list-dialog-manager-${stableId}`,
|
|
22553
22551
|
children: [
|
|
22554
|
-
/* @__PURE__ */ jsx(ChannelListHeader, {}),
|
|
22552
|
+
/* @__PURE__ */ jsx(ChannelListHeader$1, {}),
|
|
22555
22553
|
showChannelSearch && /* @__PURE__ */ jsx(Search$13, {}),
|
|
22556
22554
|
showChannelList && /* @__PURE__ */ jsx(ChannelListUI$1, {
|
|
22557
22555
|
error: channelsQueryState.error,
|
|
@@ -24015,7 +24013,7 @@ var useChat = ({ client, defaultLanguage = "en", i18nInstance }) => {
|
|
|
24015
24013
|
};
|
|
24016
24014
|
useEffect(() => {
|
|
24017
24015
|
if (!client) return;
|
|
24018
|
-
const version = "14.
|
|
24016
|
+
const version = "14.7.0";
|
|
24019
24017
|
const userAgent = client.getUserAgent();
|
|
24020
24018
|
if (!userAgent.includes("stream-chat-react")) client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
|
|
24021
24019
|
client.threads.registerSubscriptions();
|