@planningcenter/chat-react-native 3.18.0-rc.5 → 3.18.0-rc.7
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/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +2 -1
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +2 -3
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/hooks/use_conversation_messages_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversation_messages_jolt_events.js +23 -70
- package/build/hooks/use_conversation_messages_jolt_events.js.map +1 -1
- package/build/hooks/use_message_create_or_update.d.ts +0 -2
- package/build/hooks/use_message_create_or_update.d.ts.map +1 -1
- package/build/hooks/use_message_create_or_update.js +10 -8
- package/build/hooks/use_message_create_or_update.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +3 -4
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_new/components/form_list.d.ts +2 -2
- package/build/screens/conversation_new/components/form_list.d.ts.map +1 -1
- package/build/screens/conversation_new/components/form_list.js +2 -3
- package/build/screens/conversation_new/components/form_list.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +2 -3
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +2 -3
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
- package/build/types/jolt_events/reaction_events.d.ts +1 -0
- package/build/types/jolt_events/reaction_events.d.ts.map +1 -1
- package/build/types/jolt_events/reaction_events.js.map +1 -1
- package/build/utils/cache/messages_cache.d.ts +9 -0
- package/build/utils/cache/messages_cache.d.ts.map +1 -0
- package/build/utils/cache/messages_cache.js +89 -0
- package/build/utils/cache/messages_cache.js.map +1 -0
- package/build/utils/cache/optimistically_create_message.d.ts +2 -1
- package/build/utils/cache/optimistically_create_message.d.ts.map +1 -1
- package/build/utils/cache/optimistically_create_message.js +6 -3
- package/build/utils/cache/optimistically_create_message.js.map +1 -1
- package/package.json +2 -3
- package/src/components/conversation/message.tsx +2 -1
- package/src/components/conversations/conversations.tsx +7 -9
- package/src/hooks/use_conversation_messages_jolt_events.ts +39 -81
- package/src/hooks/use_message_create_or_update.ts +10 -9
- package/src/screens/conversation_details_screen.tsx +3 -4
- package/src/screens/conversation_new/components/form_list.tsx +3 -5
- package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +2 -4
- package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +2 -4
- package/src/types/jolt_events/reaction_events.ts +1 -0
- package/src/utils/cache/messages_cache.ts +113 -0
- package/src/utils/cache/optimistically_create_message.ts +7 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_details_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_details_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,KAAK,EAAE,EACZ,WAAW,EACX,SAAS,EACT,QAAQ,EAIR,MAAM,GACP,MAAM,OAAO,CAAA;AACd,OAAO,EACL,UAAU,EACV,SAAS,EACT,IAAI,EAGJ,SAAS,EACT,KAAK,EACL,QAAQ,GACT,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,WAAW,IAAI,mBAAmB,EAAoB,MAAM,4BAA4B,CAAA;AACjG,OAAO,EACL,KAAK,EACL,WAAW,EACX,OAAO,EACP,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,UAAU,GAEX,MAAM,eAAe,CA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AE;YACd,UAAU,EAAE,EAAE;SACf;QACD,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,QAAQ,EAAE,MAAM;SACjB;QACD,gBAAgB,EAAE;YAChB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;YACxE,SAAS,EAAE,CAAC;SACb;QACD,oBAAoB,EAAE;YACpB,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;SAC1E;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, {\n useCallback,\n useEffect,\n useState,\n type SetStateAction,\n type Dispatch,\n type ReactNode,\n useRef,\n} from 'react'\nimport {\n StyleSheet,\n TextInput,\n View,\n type ViewStyle,\n type ViewProps,\n Pressable,\n Alert,\n Platform,\n} from 'react-native'\nimport { HeaderTitle as ElementsHeaderTitle, HeaderTitleProps } from '@react-navigation/elements'\nimport {\n Badge,\n ChildNotice,\n Heading,\n Icon,\n Person,\n Switch,\n Text,\n TextButton,\n type TextStyle,\n} from '../components'\nimport { useSuspensePaginator, useTheme } from '../hooks'\nimport {\n useConversation,\n useConversationDelete,\n useConversationDisableReplies,\n useConversationMute,\n useConversationUpdate,\n} from '../hooks/use_conversation'\nimport { MemberResource, isDefined } from '../types'\nimport { HeaderTextButton } from '../components/display/platform_modal_header_buttons'\nimport { FlashList } from '@shopify/flash-list'\nimport { tokens } from '../vendor/tapestry/tokens'\nimport { ButtonAppearanceUnion } from '../components/display/utils/button_colors'\nimport { GroupResource } from '../types/resources/group_resource'\n\n// =========================================\n// ====== Factory Constants & Types ========\n// =========================================\n\nenum SectionTypes {\n header,\n hidden,\n members,\n loadingMembers,\n setting,\n view,\n}\n\ntype SectionListData = Array<\n | DataItem<{ title: string }, SectionTypes.header>\n | DataItem<MemberResource, SectionTypes.members>\n | DataItem<any, SectionTypes.loadingMembers>\n | DataItem<ViewProps, SectionTypes.view>\n | DataItem<SettingRowProps, SectionTypes.setting>\n | DataItem<any, SectionTypes.hidden>\n>\n\ninterface DataItem<T, TName extends SectionTypes> {\n type: TName\n data: T\n sectionOuterStyle?: ViewStyle\n sectionInnerStyle?: ViewStyle\n showBottomBorder?: boolean\n}\n\n// =================================\n// ====== Components ===============\n// =================================\n\nexport type ConversationDetailsScreenProps = StaticScreenProps<{\n conversation_id: number\n}>\n\nexport function ConversationDetailsScreen({ route }: ConversationDetailsScreenProps) {\n const navigation = useNavigation()\n const styles = useStyles()\n\n const { data: conversation } = useConversation(route.params)\n const [title, setTitle] = useState(conversation.title)\n const { muted, setMuted } = useConversationMute(route.params)\n const { repliesDisabled, setRepliesDisabled } = useConversationDisableReplies(route.params)\n const { mutate: saveTitle } = useConversationUpdate(route.params)\n const { mutate: deleteConversation } = useConversationDelete(route.params)\n\n const trimmedTitle = title.trim()\n const emptyTitle = trimmedTitle === '' || title === null\n\n const canUpdate = conversation.memberAbility?.canUpdate || false\n const canDelete = conversation.memberAbility?.canDelete || false\n const isLeader = conversation.memberAbility?.leader || false\n\n const {\n data: members,\n fetchNextPage: fetchNextPageOfMembers,\n isFetchingNextPage: isLoadingMembers,\n } = useSuspensePaginator<MemberResource>({\n url: `/me/conversations/${route.params.conversation_id}/members`,\n data: {\n include: ['person'],\n fields: {\n Member: ['avatar', 'name', 'first_name', 'last_name', 'child', 'badges'],\n },\n },\n })\n\n const memberSectionStyleMap = {\n first: styles.sectionInnerFirstMember,\n middle: styles.sectionInnerMiddleMiddle,\n last: styles.sectionInnerLastMember,\n }\n\n const memberItems = members.map((data, index) => {\n const isFirst = index === 0\n const isLast = index === members.length - 1\n const memberPosition = isFirst ? 'first' : isLast ? 'last' : 'middle'\n const memberSectionStyle = memberSectionStyleMap[memberPosition]\n\n return {\n type: data.child ? SectionTypes.hidden : SectionTypes.members,\n data,\n sectionInnerStyle: memberSectionStyle,\n }\n })\n\n const loadingMemberItems = isLoadingMembers\n ? [\n {\n type: SectionTypes.loadingMembers,\n data: {},\n sectionInnerStyle: styles.sectionInnerFirstMember,\n },\n ]\n : []\n\n const childMembers = members.filter(member => member.child)\n const hasChildren = childMembers.length > 0\n\n const teamsGroup =\n conversation.groups\n ?.filter(g => g.sourceAppName === 'Services')\n ?.filter(g => ['Team', 'PlanTeam'].includes(g.sourceType))\n ?.filter(g => g.name !== null) || []\n const hasTeams = teamsGroup.length > 0\n\n const badge = conversation.badges?.[0]\n const resourceType = badge?.pcoResourceType || ''\n const productName = badge?.appName\n const name = badge?.text || undefined\n\n const handleDelete = useCallback(() => {\n Alert.alert(\n 'Delete conversation',\n `All messages in ${title} will be deleted for everyone. This action cannot be undone.`,\n [\n {\n text: 'Cancel',\n style: 'cancel',\n },\n {\n text: 'Delete',\n style: 'destructive',\n onPress: () => {\n deleteConversation()\n navigation.dispatch(StackActions.popToTop())\n },\n },\n ]\n )\n }, [deleteConversation, navigation, title])\n\n const HeaderTitle = useCallback(\n (props: HeaderTitleProps) => {\n return (\n <View style={styles.headerTitleContainer}>\n <ElementsHeaderTitle maxFontSizeMultiplier={1} {...props} />\n <Badge\n variant=\"metaSubtle\"\n label={resourceType}\n metaLabel={name}\n style={styles.headerTitleBadge}\n productLogoName={productName}\n maxFontSizeMultiplier={1}\n />\n </View>\n )\n },\n [name, productName, resourceType, styles.headerTitleBadge, styles.headerTitleContainer]\n )\n\n const HeaderRight = useCallback(() => {\n return (\n <HeaderTextButton\n onPress={() => {\n saveTitle({ title: trimmedTitle || conversation.title })\n navigation.goBack()\n }}\n title=\"Done\"\n />\n )\n }, [conversation.title, navigation, saveTitle, trimmedTitle])\n\n useEffect(() => {\n navigation.setOptions({\n headerRight: HeaderRight,\n headerTitle: HeaderTitle,\n })\n }, [HeaderRight, HeaderTitle, navigation])\n\n const listData = [\n {\n type: SectionTypes.view,\n data: {\n children: (\n <TitleInput\n canUpdate={canUpdate}\n title={title}\n setTitle={setTitle}\n isEmpty={emptyTitle}\n />\n ),\n },\n sectionInnerStyle: styles.sectionInnerTitleInput,\n },\n {\n type: SectionTypes.header,\n data: { title: 'Settings' },\n showBottomBorder: true,\n sectionInnerStyle: styles.sectionInnerHeaderWithBottomBorder,\n },\n {\n type: SectionTypes.setting,\n data: {\n title: 'Mute',\n rightItem: <Switch value={muted} onChange={() => setMuted(!muted)} />,\n },\n showBottomBorder: true,\n },\n {\n type: canUpdate ? SectionTypes.setting : SectionTypes.hidden,\n data: {\n title: 'Freeze conversation',\n subtitle: 'Disables replies for everyone except leaders.',\n rightItem: (\n <Switch value={repliesDisabled} onChange={() => setRepliesDisabled(!repliesDisabled)} />\n ),\n },\n showBottomBorder: true,\n },\n {\n type: canDelete ? SectionTypes.setting : SectionTypes.hidden,\n data: {\n title: 'Delete conversation…',\n buttonTextStyle: styles.deleteButtonText,\n appearance: 'danger',\n onPress: handleDelete,\n },\n },\n {\n type: hasTeams ? SectionTypes.header : SectionTypes.hidden,\n data: { title: 'Teams' },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: hasTeams ? SectionTypes.view : SectionTypes.hidden,\n data: {\n children: <TeamsGroup teams={teamsGroup} />,\n },\n },\n {\n type: SectionTypes.header,\n data: { title: 'People' },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: hasChildren && isLeader ? SectionTypes.view : SectionTypes.hidden,\n data: {\n children: <ChildNotice childMembers={childMembers} />,\n },\n sectionInnerStyle: styles.sectionInnerChildNotice,\n },\n ...memberItems,\n ...loadingMemberItems,\n ].filter(item => item.type !== SectionTypes.hidden)\n\n const headerIndices = listData\n .map(({ type }, index) => (type === SectionTypes.header ? index : undefined))\n .filter(isDefined)\n\n return (\n <View style={styles.listContainer}>\n <FlashList\n data={listData as SectionListData}\n estimatedItemSize={52}\n contentContainerStyle={styles.contentContainer}\n renderItem={({ item, index }) => {\n const [isStart, isEnd] = [\n index === 0 || headerIndices.includes(index),\n index === listData.length - 1 || headerIndices.includes(index + 1),\n ]\n\n switch (item.type) {\n case SectionTypes.header:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <Heading variant=\"h3\">{item.data.title}</Heading>\n </ListSection>\n )\n case SectionTypes.members:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <Person person={{ ...item.data }} />\n </ListSection>\n )\n case SectionTypes.loadingMembers:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <Text>Loading more...</Text>\n </ListSection>\n )\n case SectionTypes.setting:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <SettingRow {...item.data} />\n </ListSection>\n )\n case SectionTypes.view:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <View {...item.data} style={item.data.style} />\n </ListSection>\n )\n default:\n return null\n }\n }}\n onEndReached={fetchNextPageOfMembers}\n />\n </View>\n )\n}\n\ninterface ListSectionProps {\n isStart?: boolean\n isEnd?: boolean\n showBottomBorder?: boolean\n outerStyle?: ViewStyle\n innerStyle?: ViewStyle\n children: ReactNode\n}\n\nfunction ListSection({\n isStart,\n isEnd,\n showBottomBorder,\n outerStyle,\n innerStyle,\n children,\n}: ListSectionProps) {\n const styles = useStyles({ isStart, isEnd })\n const bottomBorder = showBottomBorder ? styles.sectionInnerBottomBorder : {}\n\n return (\n <View style={[styles.sectionOuterBase, outerStyle]}>\n <View style={[styles.sectionInnerBase, bottomBorder, innerStyle]}>{children}</View>\n </View>\n )\n}\n\ninterface InputProps {\n canUpdate: boolean\n title: string\n setTitle: Dispatch<SetStateAction<string>>\n style?: ViewStyle\n isEmpty: boolean\n}\n\nfunction TitleInput({ canUpdate, title, setTitle, style, isEmpty }: InputProps) {\n const styles = useStyles()\n const textRef = useRef<TextInput>(null)\n\n const handleFocus = () => {\n if (textRef.current) {\n textRef.current.focus()\n }\n }\n\n return (\n <Pressable style={[styles.titleContainer, style]} onPress={() => handleFocus()}>\n <View style={styles.titleLabelContainer}>\n <Text variant=\"tertiary\" style={styles.titleLabel}>\n Title\n </Text>\n {!canUpdate && <Icon name=\"general.lock\" style={styles.titleDisabledIcon} />}\n </View>\n <TextInput\n ref={textRef}\n editable={canUpdate}\n onChangeText={setTitle}\n style={[styles.titleInput, !canUpdate && styles.titleInputDisabled]}\n value={title}\n multiline\n maxLength={255} // Matches Chat Web\n enterKeyHint=\"done\"\n submitBehavior=\"blurAndSubmit\"\n />\n {isEmpty && (\n <View style={styles.inputValidationContainer}>\n <Text variant=\"footnote\" style={styles.inputValidationText}>\n A title is required for your conversation.\n </Text>\n </View>\n )}\n </Pressable>\n )\n}\n\ninterface SettingRowProps {\n title: string\n style?: ViewStyle\n rightItem?: ReactNode\n titleStyle?: TextStyle\n buttonTextStyle?: TextStyle\n subtitle?: string\n rightItemStyle?: ViewStyle\n appearance?: ButtonAppearanceUnion\n onPress?: () => void\n}\n\nfunction SettingRow({\n title,\n style,\n titleStyle = {},\n buttonTextStyle = {},\n subtitle,\n rightItem,\n rightItemStyle = {},\n appearance,\n onPress,\n}: SettingRowProps) {\n const styles = useStyles()\n\n if (onPress) {\n return (\n <TextButton\n style={[styles.settingRow, style]}\n textStyle={buttonTextStyle}\n appearance={appearance}\n onPress={onPress}\n >\n {title}\n </TextButton>\n )\n }\n\n return (\n <View style={[styles.settingRow, style]}>\n <View style={styles.settingRowContent}>\n <Text variant=\"plain\" style={[styles.settingRowText, titleStyle]}>\n {title}\n </Text>\n {Boolean(subtitle) && <Text variant=\"footnote\">{subtitle}</Text>}\n </View>\n {Boolean(rightItem) && <View style={rightItemStyle}>{rightItem}</View>}\n </View>\n )\n}\n\nfunction TeamsGroup({ teams }: { teams: GroupResource[] }) {\n const styles = useStyles()\n\n if (teams.length === 0) return null\n\n return (\n <View style={styles.teamGroup}>\n {teams.map((team, index) => (\n <Badge key={index} label={team.name as string} />\n ))}\n </View>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({ isStart, isEnd }: { isStart?: boolean; isEnd?: boolean } = {}) => {\n const { colors } = useTheme()\n const headerBottomPadding = 4\n const sectionBorderRadius = 8\n\n return StyleSheet.create({\n listContainer: {\n flex: 1,\n backgroundColor: colors.surfaceColor080,\n },\n contentContainer: {\n padding: 16,\n },\n sectionOuterBase: {\n paddingLeft: 16,\n backgroundColor: colors.surfaceColor100,\n borderTopLeftRadius: isStart ? sectionBorderRadius : 0,\n borderTopRightRadius: isStart ? sectionBorderRadius : 0,\n borderBottomLeftRadius: isEnd ? sectionBorderRadius : 0,\n borderBottomRightRadius: isEnd ? sectionBorderRadius : 0,\n marginBottom: isEnd ? 16 : 0,\n },\n sectionInnerBase: {\n paddingRight: 16,\n paddingTop: isStart ? 16 : 12,\n paddingBottom: isEnd ? 16 : 12,\n },\n sectionInnerHeader: {\n paddingBottom: headerBottomPadding,\n },\n sectionInnerHeaderWithBottomBorder: {\n paddingBottom: 16,\n },\n sectionInnerBottomBorder: {\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: isEnd ? 0 : 1,\n },\n sectionInnerTitleInput: {\n paddingTop: 12, // paddingVertical doesn't override the sectionInner padding\n paddingBottom: 12,\n },\n sectionInnerChildNotice: {\n paddingBottom: headerBottomPadding,\n },\n sectionInnerMiddleMiddle: {\n paddingTop: 0,\n paddingBottom: 12,\n },\n sectionInnerFirstMember: {\n paddingTop: 12,\n paddingBottom: 12,\n },\n sectionInnerLastMember: {\n paddingTop: 0,\n paddingBottom: 16,\n },\n titleContainer: {\n gap: 4,\n },\n titleLabelContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n titleLabel: {\n color: colors.textColorDefaultSecondary,\n },\n titleDisabledIcon: {\n color: colors.iconColorDefaultSecondary,\n },\n titleInput: {\n color: colors.textColorDefaultPrimary,\n fontSize: tokens.fontSizeMd,\n },\n titleInputDisabled: {\n color: colors.textColorDefaultSecondary,\n },\n inputValidationContainer: {\n paddingTop: 8,\n borderTopWidth: 1,\n borderColor: colors.statusErrorBorder,\n },\n inputValidationText: {\n color: colors.statusErrorText,\n },\n settingRow: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n gap: 8,\n },\n settingRowContent: {\n flex: 1,\n },\n deleteButtonText: {\n fontWeight: 'normal',\n },\n settingRowText: {\n lineHeight: 20,\n },\n teamGroup: {\n flexDirection: 'row',\n gap: 4,\n flexWrap: 'wrap',\n },\n headerTitleBadge: {\n alignSelf: Platform.select({ android: 'flex-start', default: 'center' }),\n marginTop: 2,\n },\n headerTitleContainer: {\n alignItems: Platform.select({ android: 'flex-start', default: 'center' }),\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"conversation_details_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_details_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,KAAK,EAAE,EACZ,WAAW,EACX,SAAS,EACT,QAAQ,EAIR,MAAM,GACP,MAAM,OAAO,CAAA;AACd,OAAO,EACL,QAAQ,EACR,UAAU,EACV,SAAS,EACT,IAAI,EAGJ,SAAS,EACT,KAAK,EACL,QAAQ,GACT,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,WAAW,IAAI,mBAAmB,EAAoB,MAAM,4B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SACR;QACD,gBAAgB,EAAE;YAChB,UAAU,EAAE,QAAQ;SACrB;QACD,cAAc,EAAE;YACd,UAAU,EAAE,EAAE;SACf;QACD,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,QAAQ,EAAE,MAAM;SACjB;QACD,gBAAgB,EAAE;YAChB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;YACxE,SAAS,EAAE,CAAC;SACb;QACD,oBAAoB,EAAE;YACpB,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;SAC1E;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, {\n useCallback,\n useEffect,\n useState,\n type SetStateAction,\n type Dispatch,\n type ReactNode,\n useRef,\n} from 'react'\nimport {\n FlatList,\n StyleSheet,\n TextInput,\n View,\n type ViewStyle,\n type ViewProps,\n Pressable,\n Alert,\n Platform,\n} from 'react-native'\nimport { HeaderTitle as ElementsHeaderTitle, HeaderTitleProps } from '@react-navigation/elements'\nimport {\n Badge,\n ChildNotice,\n Heading,\n Icon,\n Person,\n Switch,\n Text,\n TextButton,\n type TextStyle,\n} from '../components'\nimport { useSuspensePaginator, useTheme } from '../hooks'\nimport {\n useConversation,\n useConversationDelete,\n useConversationDisableReplies,\n useConversationMute,\n useConversationUpdate,\n} from '../hooks/use_conversation'\nimport { MemberResource, isDefined } from '../types'\nimport { HeaderTextButton } from '../components/display/platform_modal_header_buttons'\nimport { tokens } from '../vendor/tapestry/tokens'\nimport { ButtonAppearanceUnion } from '../components/display/utils/button_colors'\nimport { GroupResource } from '../types/resources/group_resource'\n\n// =========================================\n// ====== Factory Constants & Types ========\n// =========================================\n\nenum SectionTypes {\n header,\n hidden,\n members,\n loadingMembers,\n setting,\n view,\n}\n\ntype SectionListData = Array<\n | DataItem<{ title: string }, SectionTypes.header>\n | DataItem<MemberResource, SectionTypes.members>\n | DataItem<any, SectionTypes.loadingMembers>\n | DataItem<ViewProps, SectionTypes.view>\n | DataItem<SettingRowProps, SectionTypes.setting>\n | DataItem<any, SectionTypes.hidden>\n>\n\ninterface DataItem<T, TName extends SectionTypes> {\n type: TName\n data: T\n sectionOuterStyle?: ViewStyle\n sectionInnerStyle?: ViewStyle\n showBottomBorder?: boolean\n}\n\n// =================================\n// ====== Components ===============\n// =================================\n\nexport type ConversationDetailsScreenProps = StaticScreenProps<{\n conversation_id: number\n}>\n\nexport function ConversationDetailsScreen({ route }: ConversationDetailsScreenProps) {\n const navigation = useNavigation()\n const styles = useStyles()\n\n const { data: conversation } = useConversation(route.params)\n const [title, setTitle] = useState(conversation.title)\n const { muted, setMuted } = useConversationMute(route.params)\n const { repliesDisabled, setRepliesDisabled } = useConversationDisableReplies(route.params)\n const { mutate: saveTitle } = useConversationUpdate(route.params)\n const { mutate: deleteConversation } = useConversationDelete(route.params)\n\n const trimmedTitle = title.trim()\n const emptyTitle = trimmedTitle === '' || title === null\n\n const canUpdate = conversation.memberAbility?.canUpdate || false\n const canDelete = conversation.memberAbility?.canDelete || false\n const isLeader = conversation.memberAbility?.leader || false\n\n const {\n data: members,\n fetchNextPage: fetchNextPageOfMembers,\n isFetchingNextPage: isLoadingMembers,\n } = useSuspensePaginator<MemberResource>({\n url: `/me/conversations/${route.params.conversation_id}/members`,\n data: {\n include: ['person'],\n fields: {\n Member: ['avatar', 'name', 'first_name', 'last_name', 'child', 'badges'],\n },\n },\n })\n\n const memberSectionStyleMap = {\n first: styles.sectionInnerFirstMember,\n middle: styles.sectionInnerMiddleMiddle,\n last: styles.sectionInnerLastMember,\n }\n\n const memberItems = members.map((data, index) => {\n const isFirst = index === 0\n const isLast = index === members.length - 1\n const memberPosition = isFirst ? 'first' : isLast ? 'last' : 'middle'\n const memberSectionStyle = memberSectionStyleMap[memberPosition]\n\n return {\n type: data.child ? SectionTypes.hidden : SectionTypes.members,\n data,\n sectionInnerStyle: memberSectionStyle,\n }\n })\n\n const loadingMemberItems = isLoadingMembers\n ? [\n {\n type: SectionTypes.loadingMembers,\n data: {},\n sectionInnerStyle: styles.sectionInnerFirstMember,\n },\n ]\n : []\n\n const childMembers = members.filter(member => member.child)\n const hasChildren = childMembers.length > 0\n\n const teamsGroup =\n conversation.groups\n ?.filter(g => g.sourceAppName === 'Services')\n ?.filter(g => ['Team', 'PlanTeam'].includes(g.sourceType))\n ?.filter(g => g.name !== null) || []\n const hasTeams = teamsGroup.length > 0\n\n const badge = conversation.badges?.[0]\n const resourceType = badge?.pcoResourceType || ''\n const productName = badge?.appName\n const name = badge?.text || undefined\n\n const handleDelete = useCallback(() => {\n Alert.alert(\n 'Delete conversation',\n `All messages in ${title} will be deleted for everyone. This action cannot be undone.`,\n [\n {\n text: 'Cancel',\n style: 'cancel',\n },\n {\n text: 'Delete',\n style: 'destructive',\n onPress: () => {\n deleteConversation()\n navigation.dispatch(StackActions.popToTop())\n },\n },\n ]\n )\n }, [deleteConversation, navigation, title])\n\n const HeaderTitle = useCallback(\n (props: HeaderTitleProps) => {\n return (\n <View style={styles.headerTitleContainer}>\n <ElementsHeaderTitle maxFontSizeMultiplier={1} {...props} />\n <Badge\n variant=\"metaSubtle\"\n label={resourceType}\n metaLabel={name}\n style={styles.headerTitleBadge}\n productLogoName={productName}\n maxFontSizeMultiplier={1}\n />\n </View>\n )\n },\n [name, productName, resourceType, styles.headerTitleBadge, styles.headerTitleContainer]\n )\n\n const HeaderRight = useCallback(() => {\n return (\n <HeaderTextButton\n onPress={() => {\n saveTitle({ title: trimmedTitle || conversation.title })\n navigation.goBack()\n }}\n title=\"Done\"\n />\n )\n }, [conversation.title, navigation, saveTitle, trimmedTitle])\n\n useEffect(() => {\n navigation.setOptions({\n headerRight: HeaderRight,\n headerTitle: HeaderTitle,\n })\n }, [HeaderRight, HeaderTitle, navigation])\n\n const listData = [\n {\n type: SectionTypes.view,\n data: {\n children: (\n <TitleInput\n canUpdate={canUpdate}\n title={title}\n setTitle={setTitle}\n isEmpty={emptyTitle}\n />\n ),\n },\n sectionInnerStyle: styles.sectionInnerTitleInput,\n },\n {\n type: SectionTypes.header,\n data: { title: 'Settings' },\n showBottomBorder: true,\n sectionInnerStyle: styles.sectionInnerHeaderWithBottomBorder,\n },\n {\n type: SectionTypes.setting,\n data: {\n title: 'Mute',\n rightItem: <Switch value={muted} onChange={() => setMuted(!muted)} />,\n },\n showBottomBorder: true,\n },\n {\n type: canUpdate ? SectionTypes.setting : SectionTypes.hidden,\n data: {\n title: 'Freeze conversation',\n subtitle: 'Disables replies for everyone except leaders.',\n rightItem: (\n <Switch value={repliesDisabled} onChange={() => setRepliesDisabled(!repliesDisabled)} />\n ),\n },\n showBottomBorder: true,\n },\n {\n type: canDelete ? SectionTypes.setting : SectionTypes.hidden,\n data: {\n title: 'Delete conversation…',\n buttonTextStyle: styles.deleteButtonText,\n appearance: 'danger',\n onPress: handleDelete,\n },\n },\n {\n type: hasTeams ? SectionTypes.header : SectionTypes.hidden,\n data: { title: 'Teams' },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: hasTeams ? SectionTypes.view : SectionTypes.hidden,\n data: {\n children: <TeamsGroup teams={teamsGroup} />,\n },\n },\n {\n type: SectionTypes.header,\n data: { title: 'People' },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: hasChildren && isLeader ? SectionTypes.view : SectionTypes.hidden,\n data: {\n children: <ChildNotice childMembers={childMembers} />,\n },\n sectionInnerStyle: styles.sectionInnerChildNotice,\n },\n ...memberItems,\n ...loadingMemberItems,\n ].filter(item => item.type !== SectionTypes.hidden)\n\n const headerIndices = listData\n .map(({ type }, index) => (type === SectionTypes.header ? index : undefined))\n .filter(isDefined)\n\n return (\n <View style={styles.listContainer}>\n <FlatList\n data={listData as SectionListData}\n contentContainerStyle={styles.contentContainer}\n renderItem={({ item, index }) => {\n const [isStart, isEnd] = [\n index === 0 || headerIndices.includes(index),\n index === listData.length - 1 || headerIndices.includes(index + 1),\n ]\n\n switch (item.type) {\n case SectionTypes.header:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <Heading variant=\"h3\">{item.data.title}</Heading>\n </ListSection>\n )\n case SectionTypes.members:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <Person person={{ ...item.data }} />\n </ListSection>\n )\n case SectionTypes.loadingMembers:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <Text>Loading more...</Text>\n </ListSection>\n )\n case SectionTypes.setting:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <SettingRow {...item.data} />\n </ListSection>\n )\n case SectionTypes.view:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <View {...item.data} style={item.data.style} />\n </ListSection>\n )\n default:\n return null\n }\n }}\n onEndReached={() => fetchNextPageOfMembers()}\n />\n </View>\n )\n}\n\ninterface ListSectionProps {\n isStart?: boolean\n isEnd?: boolean\n showBottomBorder?: boolean\n outerStyle?: ViewStyle\n innerStyle?: ViewStyle\n children: ReactNode\n}\n\nfunction ListSection({\n isStart,\n isEnd,\n showBottomBorder,\n outerStyle,\n innerStyle,\n children,\n}: ListSectionProps) {\n const styles = useStyles({ isStart, isEnd })\n const bottomBorder = showBottomBorder ? styles.sectionInnerBottomBorder : {}\n\n return (\n <View style={[styles.sectionOuterBase, outerStyle]}>\n <View style={[styles.sectionInnerBase, bottomBorder, innerStyle]}>{children}</View>\n </View>\n )\n}\n\ninterface InputProps {\n canUpdate: boolean\n title: string\n setTitle: Dispatch<SetStateAction<string>>\n style?: ViewStyle\n isEmpty: boolean\n}\n\nfunction TitleInput({ canUpdate, title, setTitle, style, isEmpty }: InputProps) {\n const styles = useStyles()\n const textRef = useRef<TextInput>(null)\n\n const handleFocus = () => {\n if (textRef.current) {\n textRef.current.focus()\n }\n }\n\n return (\n <Pressable style={[styles.titleContainer, style]} onPress={() => handleFocus()}>\n <View style={styles.titleLabelContainer}>\n <Text variant=\"tertiary\" style={styles.titleLabel}>\n Title\n </Text>\n {!canUpdate && <Icon name=\"general.lock\" style={styles.titleDisabledIcon} />}\n </View>\n <TextInput\n ref={textRef}\n editable={canUpdate}\n onChangeText={setTitle}\n style={[styles.titleInput, !canUpdate && styles.titleInputDisabled]}\n value={title}\n multiline\n maxLength={255} // Matches Chat Web\n enterKeyHint=\"done\"\n submitBehavior=\"blurAndSubmit\"\n />\n {isEmpty && (\n <View style={styles.inputValidationContainer}>\n <Text variant=\"footnote\" style={styles.inputValidationText}>\n A title is required for your conversation.\n </Text>\n </View>\n )}\n </Pressable>\n )\n}\n\ninterface SettingRowProps {\n title: string\n style?: ViewStyle\n rightItem?: ReactNode\n titleStyle?: TextStyle\n buttonTextStyle?: TextStyle\n subtitle?: string\n rightItemStyle?: ViewStyle\n appearance?: ButtonAppearanceUnion\n onPress?: () => void\n}\n\nfunction SettingRow({\n title,\n style,\n titleStyle = {},\n buttonTextStyle = {},\n subtitle,\n rightItem,\n rightItemStyle = {},\n appearance,\n onPress,\n}: SettingRowProps) {\n const styles = useStyles()\n\n if (onPress) {\n return (\n <TextButton\n style={[styles.settingRow, style]}\n textStyle={buttonTextStyle}\n appearance={appearance}\n onPress={onPress}\n >\n {title}\n </TextButton>\n )\n }\n\n return (\n <View style={[styles.settingRow, style]}>\n <View style={styles.settingRowContent}>\n <Text variant=\"plain\" style={[styles.settingRowText, titleStyle]}>\n {title}\n </Text>\n {Boolean(subtitle) && <Text variant=\"footnote\">{subtitle}</Text>}\n </View>\n {Boolean(rightItem) && <View style={rightItemStyle}>{rightItem}</View>}\n </View>\n )\n}\n\nfunction TeamsGroup({ teams }: { teams: GroupResource[] }) {\n const styles = useStyles()\n\n if (teams.length === 0) return null\n\n return (\n <View style={styles.teamGroup}>\n {teams.map((team, index) => (\n <Badge key={index} label={team.name as string} />\n ))}\n </View>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({ isStart, isEnd }: { isStart?: boolean; isEnd?: boolean } = {}) => {\n const { colors } = useTheme()\n const headerBottomPadding = 4\n const sectionBorderRadius = 8\n\n return StyleSheet.create({\n listContainer: {\n flex: 1,\n backgroundColor: colors.surfaceColor080,\n },\n contentContainer: {\n padding: 16,\n },\n sectionOuterBase: {\n paddingLeft: 16,\n backgroundColor: colors.surfaceColor100,\n borderTopLeftRadius: isStart ? sectionBorderRadius : 0,\n borderTopRightRadius: isStart ? sectionBorderRadius : 0,\n borderBottomLeftRadius: isEnd ? sectionBorderRadius : 0,\n borderBottomRightRadius: isEnd ? sectionBorderRadius : 0,\n marginBottom: isEnd ? 16 : 0,\n },\n sectionInnerBase: {\n paddingRight: 16,\n paddingTop: isStart ? 16 : 12,\n paddingBottom: isEnd ? 16 : 12,\n },\n sectionInnerHeader: {\n paddingBottom: headerBottomPadding,\n },\n sectionInnerHeaderWithBottomBorder: {\n paddingBottom: 16,\n },\n sectionInnerBottomBorder: {\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: isEnd ? 0 : 1,\n },\n sectionInnerTitleInput: {\n paddingTop: 12, // paddingVertical doesn't override the sectionInner padding\n paddingBottom: 12,\n },\n sectionInnerChildNotice: {\n paddingBottom: headerBottomPadding,\n },\n sectionInnerMiddleMiddle: {\n paddingTop: 0,\n paddingBottom: 12,\n },\n sectionInnerFirstMember: {\n paddingTop: 12,\n paddingBottom: 12,\n },\n sectionInnerLastMember: {\n paddingTop: 0,\n paddingBottom: 16,\n },\n titleContainer: {\n gap: 4,\n },\n titleLabelContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n titleLabel: {\n color: colors.textColorDefaultSecondary,\n },\n titleDisabledIcon: {\n color: colors.iconColorDefaultSecondary,\n },\n titleInput: {\n color: colors.textColorDefaultPrimary,\n fontSize: tokens.fontSizeMd,\n },\n titleInputDisabled: {\n color: colors.textColorDefaultSecondary,\n },\n inputValidationContainer: {\n paddingTop: 8,\n borderTopWidth: 1,\n borderColor: colors.statusErrorBorder,\n },\n inputValidationText: {\n color: colors.statusErrorText,\n },\n settingRow: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n gap: 8,\n },\n settingRowContent: {\n flex: 1,\n },\n deleteButtonText: {\n fontWeight: 'normal',\n },\n settingRowText: {\n lineHeight: 20,\n },\n teamGroup: {\n flexDirection: 'row',\n gap: 4,\n flexWrap: 'wrap',\n },\n headerTitleBadge: {\n alignSelf: Platform.select({ android: 'flex-start', default: 'center' }),\n marginTop: 2,\n },\n headerTitleContainer: {\n alignItems: Platform.select({ android: 'flex-start', default: 'center' }),\n },\n })\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type FlatListProps } from 'react-native';
|
|
3
3
|
import { MemberResource } from '../../../types';
|
|
4
4
|
interface FormListProps {
|
|
5
5
|
memberData: MemberResource[];
|
|
6
6
|
loadingMore?: boolean;
|
|
7
|
-
FormContent?:
|
|
7
|
+
FormContent?: FlatListProps<MemberResource>['ListHeaderComponent'];
|
|
8
8
|
listEmptyText?: string;
|
|
9
9
|
onEndReached?: () => void;
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form_list.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_new/components/form_list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"form_list.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_new/components/form_list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAY,KAAK,aAAa,EAAoB,MAAM,cAAc,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAI/C,UAAU,aAAa;IACrB,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC,qBAAqB,CAAC,CAAA;IAClE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;CAC1B;AAED,eAAO,MAAM,QAAQ,2EAMlB,aAAa,sBAgBf,CAAA;AAYD,eAAO,MAAM,OAAO,yBAInB,CAAA"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import { FlashList } from '@shopify/flash-list';
|
|
2
|
+
import { FlatList, StyleSheet, View } from 'react-native';
|
|
4
3
|
import { Person, Text } from '../../../components/display';
|
|
5
4
|
import { useTheme } from '../../../hooks';
|
|
6
5
|
export const FormList = ({ memberData, loadingMore, FormContent, listEmptyText, onEndReached, }) => {
|
|
7
6
|
const styles = useStyles();
|
|
8
|
-
return (<
|
|
7
|
+
return (<FlatList data={memberData} ListHeaderComponent={FormContent} renderItem={({ item }) => <Person person={item} style={styles.person}/>} ListFooterComponent={loadingMore ? <Text style={styles.loadingMore}>Loading more...</Text> : null} keyExtractor={item => item.id.toString()} ListEmptyComponent={<ListEmptyText text={listEmptyText || 'No members found'}/>} onEndReached={onEndReached}/>);
|
|
9
8
|
};
|
|
10
9
|
const ListEmptyText = ({ text }) => {
|
|
11
10
|
const styles = useStyles();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form_list.js","sourceRoot":"","sources":["../../../../src/screens/conversation_new/components/form_list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"form_list.js","sourceRoot":"","sources":["../../../../src/screens/conversation_new/components/form_list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAsB,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAE7E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAUzC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,YAAY,GACE,EAAE,EAAE;IAClB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,CAAC,QAAQ,CACP,IAAI,CAAC,CAAC,UAAU,CAAC,CACjB,mBAAmB,CAAC,CAAC,WAAW,CAAC,CACjC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAG,CAAC,CACzE,mBAAmB,CAAC,CAClB,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAC1E,CAAC,CACD,Y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MAAM,CAAC,yBAAyB;SACxC;QACD,OAAO,EAAE;YACP,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,MAAM,CAAC,uBAAuB;SAClD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { FlatList, type FlatListProps, StyleSheet, View } from 'react-native'\nimport { MemberResource } from '../../../types'\nimport { Person, Text } from '../../../components/display'\nimport { useTheme } from '../../../hooks'\n\ninterface FormListProps {\n memberData: MemberResource[]\n loadingMore?: boolean\n FormContent?: FlatListProps<MemberResource>['ListHeaderComponent']\n listEmptyText?: string\n onEndReached?: () => void\n}\n\nexport const FormList = ({\n memberData,\n loadingMore,\n FormContent,\n listEmptyText,\n onEndReached,\n}: FormListProps) => {\n const styles = useStyles()\n\n return (\n <FlatList\n data={memberData}\n ListHeaderComponent={FormContent}\n renderItem={({ item }) => <Person person={item} style={styles.person} />}\n ListFooterComponent={\n loadingMore ? <Text style={styles.loadingMore}>Loading more...</Text> : null\n }\n keyExtractor={item => item.id.toString()}\n ListEmptyComponent={<ListEmptyText text={listEmptyText || 'No members found'} />}\n onEndReached={onEndReached}\n />\n )\n}\n\nconst ListEmptyText = ({ text }: { text: string }) => {\n const styles = useStyles()\n\n return (\n <View style={styles.emptyTextContainer}>\n <Text style={styles.emptyText}>{text}</Text>\n </View>\n )\n}\n\nexport const Divider = () => {\n const styles = useStyles()\n\n return <View style={styles.divider} />\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n person: {\n paddingHorizontal: 16,\n paddingBottom: 12,\n },\n loadingMore: {\n paddingHorizontal: 16,\n paddingBottom: 12,\n },\n emptyTextContainer: {\n alignItems: 'center',\n justifyContent: 'center',\n padding: 32,\n },\n emptyText: {\n textAlign: 'center',\n color: colors.textColorDefaultSecondary,\n },\n divider: {\n borderBottomWidth: 1,\n borderBottomColor: colors.fillColorNeutral050Base,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_select_group_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation_select_group_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAA;AAI9E,eAAO,MAAM,uCAAuC,eAEjD,uCAAuC,sBAwCzC,CAAA"}
|
package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useNavigation } from '@react-navigation/native';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { StyleSheet, View } from 'react-native';
|
|
4
|
-
import { FlashList } from '@shopify/flash-list';
|
|
3
|
+
import { FlatList, StyleSheet, View } from 'react-native';
|
|
5
4
|
import { Heading } from '../../components';
|
|
6
5
|
import { useGroupsGroups } from '../../hooks/use_groups_groups';
|
|
7
6
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -23,7 +22,7 @@ export const ConversationSelectGroupRecipientsScreen = ({ route, }) => {
|
|
|
23
22
|
},
|
|
24
23
|
});
|
|
25
24
|
};
|
|
26
|
-
return (<
|
|
25
|
+
return (<FlatList data={groupsWithCreatePermission} keyExtractor={item => item.id.toString()} contentContainerStyle={styles.contentContainer} ListHeaderComponent={<View style={styles.sectionHeader}>
|
|
27
26
|
<Heading variant="h3">All my groups</Heading>
|
|
28
27
|
</View>} renderItem={({ item: group }) => {
|
|
29
28
|
return (<GroupsRecipientRow key={group.id} group={group} onPress={handleNavigateToConversationNew}/>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_select_group_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation_select_group_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAA;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAEtE,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,EACtD,KAAK,GACmC,EAAE,EAAE;IAC5C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,eAAe,EAAE,CAAA;IAC/C,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAA;IAC9E,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,GAAG,0BAA0B,CAAC,MAAM,CAAA;IAE9E,MAAM,+BAA+B,GAAG,CAAC,KAA0B,EAAE,EA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AAE;YACb,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,CAAC;SACjB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { FlatList, StyleSheet, View } from 'react-native'\nimport { Heading } from '../../components'\nimport { GroupsGroupResource } from '../../types'\nimport { useGroupsGroups } from '../../hooks/use_groups_groups'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { ConversationSelectRecipientsScreenProps } from './types/screen_props'\nimport { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row'\nimport { GroupsRecipientRow } from './components/groups_recipient_row'\n\nexport const ConversationSelectGroupRecipientsScreen = ({\n route,\n}: ConversationSelectRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation()\n const { data: groups = [] } = useGroupsGroups()\n const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)\n const showGroupsDisclaimer = groups.length > groupsWithCreatePermission.length\n\n const handleNavigateToConversationNew = (group: GroupsGroupResource) => {\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n group_id: group.id,\n source_app_name: 'Groups',\n ...route.params,\n },\n })\n }\n\n return (\n <FlatList\n data={groupsWithCreatePermission}\n keyExtractor={item => item.id.toString()}\n contentContainerStyle={styles.contentContainer}\n ListHeaderComponent={\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">All my groups</Heading>\n </View>\n }\n renderItem={({ item: group }: { item: GroupsGroupResource }) => {\n return (\n <GroupsRecipientRow\n key={group.id}\n group={group}\n onPress={handleNavigateToConversationNew}\n />\n )\n }}\n ListFooterComponent={showGroupsDisclaimer ? <GroupsWithoutChatDisclaimerRow /> : null}\n />\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n contentContainer: {\n paddingBottom: bottom,\n },\n sectionHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 16,\n paddingBottom: 4,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_select_teams_i_lead_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation_select_teams_i_lead_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAA;AAK9E,eAAO,MAAM,4CAA4C,eAEtD,uCAAuC,sBAuCzC,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useNavigation } from '@react-navigation/native';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { StyleSheet, View } from 'react-native';
|
|
4
|
-
import { FlashList } from '@shopify/flash-list';
|
|
3
|
+
import { FlatList, StyleSheet, View } from 'react-native';
|
|
5
4
|
import { Heading } from '../../components';
|
|
6
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
7
6
|
import { useServiceTypesWithTeams } from '../conversation_filter_recipients/hooks/use_service_types_with_teams';
|
|
@@ -21,7 +20,7 @@ export const ConversationSelectTeamsILeadRecipientsScreen = ({ route, }) => {
|
|
|
21
20
|
},
|
|
22
21
|
});
|
|
23
22
|
};
|
|
24
|
-
return (<
|
|
23
|
+
return (<FlatList data={serviceTypes} keyExtractor={item => item.id.toString()} contentContainerStyle={styles.contentContainer} ListHeaderComponent={<View style={styles.sectionHeader}>
|
|
25
24
|
<Heading variant="h3">All teams I lead</Heading>
|
|
26
25
|
</View>} renderItem={({ item: serviceType }) => {
|
|
27
26
|
return (<TeamRecipientRow key={serviceType.id} serviceType={serviceType} onPress={handleNavigateToConversationNew}/>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_select_teams_i_lead_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation_select_teams_i_lead_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sEAAsE,CAAA;AAE/G,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAElE,MAAM,CAAC,MAAM,4CAA4C,GAAG,CAAC,EAC3D,KAAK,GACmC,EAAE,EAAE;IAC5C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,EAAE,YAAY,EAAE,GAAG,wBAAwB,EAAE,CAAA;IAEnD,MAAM,+BAA+B,GAAG,CAAC,KAAoC,EAAE,EAAE;QAC/E,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAE1C,UAAU,CA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ent":["import { useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { FlatList, StyleSheet, View } from 'react-native'\nimport { Heading } from '../../components'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { ConversationSelectRecipientsScreenProps } from './types/screen_props'\nimport { useServiceTypesWithTeams } from '../conversation_filter_recipients/hooks/use_service_types_with_teams'\nimport { ServiceTypeWithTeams } from '../conversation_filter_recipients/types'\nimport { TeamRecipientRow } from './components/team_recipient_row'\n\nexport const ConversationSelectTeamsILeadRecipientsScreen = ({\n route,\n}: ConversationSelectRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation()\n const { serviceTypes } = useServiceTypesWithTeams()\n\n const handleNavigateToConversationNew = (teams: ServiceTypeWithTeams['teams']) => {\n const teamIds = teams.map(team => team.id)\n\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n team_ids: teamIds,\n source_app_name: 'Services',\n ...route.params,\n },\n })\n }\n\n return (\n <FlatList\n data={serviceTypes}\n keyExtractor={item => item.id.toString()}\n contentContainerStyle={styles.contentContainer}\n ListHeaderComponent={\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">All teams I lead</Heading>\n </View>\n }\n renderItem={({ item: serviceType }: { item: ServiceTypeWithTeams }) => {\n return (\n <TeamRecipientRow\n key={serviceType.id}\n serviceType={serviceType}\n onPress={handleNavigateToConversationNew}\n />\n )\n }}\n />\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n contentContainer: {\n paddingBottom: bottom,\n },\n sectionHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 16,\n paddingBottom: 4,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reaction_events.d.ts","sourceRoot":"","sources":["../../../src/types/jolt_events/reaction_events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAA;AAC1F,OAAO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EAAE,MAAM,CAAA;QACpB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF;AAED,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,KAAK,EAAE,kBAAkB,CAAA;IACzB,IAAI,EAAE,qBAAqB,CAAA;CAC5B;AAED,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,KAAK,EAAE,oBAAoB,CAAA;IAC3B,IAAI,EAAE,qBAAqB,CAAA;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reaction_events.js","sourceRoot":"","sources":["../../../src/types/jolt_events/reaction_events.ts"],"names":[],"mappings":"","sourcesContent":["import type { CustomMessage } from '@planningcenter/jolt-client/dist/types/JoltConnection'\nimport { ReactionCountResource } from '../resources/reaction'\n\ninterface BaseReactionEventData extends Record<string, unknown> {\n data: {\n author_id: number\n conversation_id: number\n message_sort_key: string\n created_at: string\n organization_id: number\n value: ReactionCountResource['value']\n author_name?: string\n author_avatar?: string\n count: number\n }\n}\n\nexport interface ReactionCreatedEvent extends CustomMessage {\n event: 'reaction.created'\n data: BaseReactionEventData\n}\n\nexport interface ReactionDeletedEvent extends CustomMessage {\n event: 'reaction.destroyed'\n data: BaseReactionEventData\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reaction_events.js","sourceRoot":"","sources":["../../../src/types/jolt_events/reaction_events.ts"],"names":[],"mappings":"","sourcesContent":["import type { CustomMessage } from '@planningcenter/jolt-client/dist/types/JoltConnection'\nimport { ReactionCountResource } from '../resources/reaction'\n\ninterface BaseReactionEventData extends Record<string, unknown> {\n data: {\n author_id: number\n conversation_id: number\n message_sort_key: string\n reply_root_id?: string | null\n created_at: string\n organization_id: number\n value: ReactionCountResource['value']\n author_name?: string\n author_avatar?: string\n count: number\n }\n}\n\nexport interface ReactionCreatedEvent extends CustomMessage {\n event: 'reaction.created'\n data: BaseReactionEventData\n}\n\nexport interface ReactionDeletedEvent extends CustomMessage {\n event: 'reaction.destroyed'\n data: BaseReactionEventData\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { MessageResource } from '../../types';
|
|
3
|
+
import { JoltReactionEvent } from '../../types/jolt_events';
|
|
4
|
+
export declare function updateCacheWithMessage(queryClient: QueryClient, queryKey: unknown[], message: MessageResource, event: 'message.created' | 'message.updated'): void;
|
|
5
|
+
export declare function updateCacheWithReaction(queryClient: QueryClient, queryKey: unknown[], event: JoltReactionEvent, currentPersonId: number): void;
|
|
6
|
+
export declare function isTemporaryMessageId(messageId?: string | null): boolean;
|
|
7
|
+
export declare function isNewMessage(message?: MessageResource): boolean;
|
|
8
|
+
export declare function getThreadedMessagesQueryKey(conversationId: number, replyRootId: string): import("../../hooks/use_suspense_api").RequestQueryKey;
|
|
9
|
+
//# sourceMappingURL=messages_cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages_cache.d.ts","sourceRoot":"","sources":["../../../src/utils/cache/messages_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAiB,eAAe,EAAE,MAAM,aAAa,CAAA;AAG5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAK3D,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,iBAAiB,GAAG,iBAAiB,QAsC7C;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,iBAAiB,EACxB,eAAe,EAAE,MAAM,QAuCxB;AAGD,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAEvE;AACD,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAE/D;AAED,wBAAgB,2BAA2B,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,0DAMtF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { deleteRecordInPagesData } from './page_mutations';
|
|
2
|
+
import { updateOrCreateRecordInPagesData, updateRecordInPagesData } from './page_mutations';
|
|
3
|
+
import { transformReactionEventDataToReactionCountResource } from '../jolt/transform_reaction_event_data_to_reaction_count_resource';
|
|
4
|
+
import { getMessagesRequestArgs } from '../request/get_messages';
|
|
5
|
+
import { getRequestQueryKey } from '../../hooks/use_suspense_api';
|
|
6
|
+
export function updateCacheWithMessage(queryClient, queryKey, message, event) {
|
|
7
|
+
queryClient.setQueryData(queryKey, prev => {
|
|
8
|
+
if (event === 'message.created') {
|
|
9
|
+
// Before adding the new message, remove any pending temporary messages
|
|
10
|
+
// with matching text to prevent duplicates from race conditions
|
|
11
|
+
let dataAfterTempRemoval = prev;
|
|
12
|
+
if (prev && message.text && message.mine) {
|
|
13
|
+
dataAfterTempRemoval = deleteRecordInPagesData({
|
|
14
|
+
data: prev,
|
|
15
|
+
record: message,
|
|
16
|
+
matchFn: (existingMessage, _record) => {
|
|
17
|
+
return (isTemporaryMessageId(existingMessage.id) &&
|
|
18
|
+
existingMessage.text === message.text &&
|
|
19
|
+
existingMessage.mine);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return updateOrCreateRecordInPagesData({
|
|
24
|
+
data: dataAfterTempRemoval,
|
|
25
|
+
record: message,
|
|
26
|
+
processRecord: (record, current) => {
|
|
27
|
+
return { ...current, ...record };
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return updateRecordInPagesData({
|
|
33
|
+
data: prev,
|
|
34
|
+
record: message,
|
|
35
|
+
processRecord: (record, current) => {
|
|
36
|
+
return { ...current, ...record };
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function updateCacheWithReaction(queryClient, queryKey, event, currentPersonId) {
|
|
43
|
+
const message = { id: event.data.data.message_sort_key };
|
|
44
|
+
queryClient.setQueryData(queryKey, prev => updateRecordInPagesData({
|
|
45
|
+
data: prev,
|
|
46
|
+
record: message,
|
|
47
|
+
processRecord: (record, oldMessage) => {
|
|
48
|
+
const reactionCounts = oldMessage.reactionCounts || [];
|
|
49
|
+
let foundMatch = false;
|
|
50
|
+
let newReactionCounts = reactionCounts.map(reactionCount => {
|
|
51
|
+
if (reactionCount.value === event.data.data.value) {
|
|
52
|
+
foundMatch = true;
|
|
53
|
+
return transformReactionEventDataToReactionCountResource({
|
|
54
|
+
data: event.data.data,
|
|
55
|
+
oldData: reactionCount,
|
|
56
|
+
event: event.event,
|
|
57
|
+
currentPersonId,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return reactionCount;
|
|
61
|
+
});
|
|
62
|
+
if (!foundMatch) {
|
|
63
|
+
const newReactionCount = transformReactionEventDataToReactionCountResource({
|
|
64
|
+
data: event.data.data,
|
|
65
|
+
event: event.event,
|
|
66
|
+
currentPersonId,
|
|
67
|
+
});
|
|
68
|
+
if (newReactionCount?.count) {
|
|
69
|
+
newReactionCounts = [...newReactionCounts, newReactionCount];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return { ...oldMessage, reactionCounts: newReactionCounts };
|
|
73
|
+
},
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
export function isTemporaryMessageId(messageId) {
|
|
77
|
+
return !!messageId && messageId.endsWith('-temp');
|
|
78
|
+
}
|
|
79
|
+
export function isNewMessage(message) {
|
|
80
|
+
return !message?.id || isTemporaryMessageId(message.id);
|
|
81
|
+
}
|
|
82
|
+
export function getThreadedMessagesQueryKey(conversationId, replyRootId) {
|
|
83
|
+
const requestArgs = getMessagesRequestArgs({
|
|
84
|
+
conversation_id: conversationId,
|
|
85
|
+
reply_root_id: replyRootId,
|
|
86
|
+
});
|
|
87
|
+
return getRequestQueryKey(requestArgs);
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=messages_cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages_cache.js","sourceRoot":"","sources":["../../../src/utils/cache/messages_cache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,+BAA+B,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAE3F,OAAO,EAAE,iDAAiD,EAAE,MAAM,kEAAkE,CAAA;AACpI,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAEjE,MAAM,UAAU,sBAAsB,CACpC,WAAwB,EACxB,QAAmB,EACnB,OAAwB,EACxB,KAA4C;IAE5C,WAAW,CAAC,YAAY,CAAoB,QAAQ,EAAE,IAAI,CAAC,EAAE;QAC3D,IAAI,KAAK,KAAK,iBAAiB,EAAE,CAAC;YAChC,uEAAuE;YACvE,gEAAgE;YAChE,IAAI,oBAAoB,GAAG,IAAI,CAAA;YAC/B,IAAI,IAAI,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;gBACzC,oBAAoB,GAAG,uBAAuB,CAAC;oBAC7C,IAAI,EAAE,IAAI;oBACV,MAAM,EAAE,OAAO;oBACf,OAAO,EAAE,CAAC,eAAe,EAAE,OAAO,EAAE,EAAE;wBACpC,OAAO,CACL,oBAAoB,CAAC,eAAe,CAAC,EAAE,CAAC;4BACxC,eAAe,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI;4BACrC,eAAe,CAAC,IAAI,CACrB,CAAA;oBACH,CAAC;iBACF,CAAC,CAAA;YACJ,CAAC;YAED,OAAO,+BAA+B,CAAC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AO,EAAE,aAAa;wBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;wBAClB,eAAe;qBAChB,CAAC,CAAA;gBACJ,CAAC;gBACD,OAAO,aAAa,CAAA;YACtB,CAAC,CAAC,CAAA;YAEF,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,MAAM,gBAAgB,GAAG,iDAAiD,CAAC;oBACzE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI;oBACrB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,eAAe;iBAChB,CAAC,CAAA;gBAEF,IAAI,gBAAgB,EAAE,KAAK,EAAE,CAAC;oBAC5B,iBAAiB,GAAG,CAAC,GAAG,iBAAiB,EAAE,gBAAgB,CAAC,CAAA;gBAC9D,CAAC;YACH,CAAC;YAED,OAAO,EAAE,GAAG,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAA;QAC7D,CAAC;KACF,CAAC,CACH,CAAA;AACH,CAAC;AAGD,MAAM,UAAU,oBAAoB,CAAC,SAAyB;IAC5D,OAAO,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AACnD,CAAC;AACD,MAAM,UAAU,YAAY,CAAC,OAAyB;IACpD,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;AACzD,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,cAAsB,EAAE,WAAmB;IACrF,MAAM,WAAW,GAAG,sBAAsB,CAAC;QACzC,eAAe,EAAE,cAAc;QAC/B,aAAa,EAAE,WAAW;KAC3B,CAAC,CAAA;IACF,OAAO,kBAAkB,CAAC,WAAW,CAAC,CAAA;AACxC,CAAC","sourcesContent":["import { InfiniteData, QueryClient } from '@tanstack/react-query'\nimport { ApiCollection, MessageResource } from '../../types'\nimport { deleteRecordInPagesData } from './page_mutations'\nimport { updateOrCreateRecordInPagesData, updateRecordInPagesData } from './page_mutations'\nimport { JoltReactionEvent } from '../../types/jolt_events'\nimport { transformReactionEventDataToReactionCountResource } from '../jolt/transform_reaction_event_data_to_reaction_count_resource'\nimport { getMessagesRequestArgs } from '../request/get_messages'\nimport { getRequestQueryKey } from '../../hooks/use_suspense_api'\n\nexport function updateCacheWithMessage(\n queryClient: QueryClient,\n queryKey: unknown[],\n message: MessageResource,\n event: 'message.created' | 'message.updated'\n) {\n queryClient.setQueryData<MessagesQueryData>(queryKey, prev => {\n if (event === 'message.created') {\n // Before adding the new message, remove any pending temporary messages\n // with matching text to prevent duplicates from race conditions\n let dataAfterTempRemoval = prev\n if (prev && message.text && message.mine) {\n dataAfterTempRemoval = deleteRecordInPagesData({\n data: prev,\n record: message,\n matchFn: (existingMessage, _record) => {\n return (\n isTemporaryMessageId(existingMessage.id) &&\n existingMessage.text === message.text &&\n existingMessage.mine\n )\n },\n })\n }\n\n return updateOrCreateRecordInPagesData({\n data: dataAfterTempRemoval,\n record: message,\n processRecord: (record, current) => {\n return { ...current, ...record }\n },\n })\n } else {\n return updateRecordInPagesData({\n data: prev,\n record: message,\n processRecord: (record, current) => {\n return { ...current, ...record }\n },\n })\n }\n })\n}\n\nexport function updateCacheWithReaction(\n queryClient: QueryClient,\n queryKey: unknown[],\n event: JoltReactionEvent,\n currentPersonId: number\n) {\n const message = { id: event.data.data.message_sort_key } as MessageResource\n queryClient.setQueryData<MessagesQueryData>(queryKey, prev =>\n updateRecordInPagesData({\n data: prev,\n record: message,\n processRecord: (record, oldMessage) => {\n const reactionCounts = oldMessage.reactionCounts || []\n let foundMatch = false\n let newReactionCounts = reactionCounts.map(reactionCount => {\n if (reactionCount.value === event.data.data.value) {\n foundMatch = true\n return transformReactionEventDataToReactionCountResource({\n data: event.data.data,\n oldData: reactionCount,\n event: event.event,\n currentPersonId,\n })\n }\n return reactionCount\n })\n\n if (!foundMatch) {\n const newReactionCount = transformReactionEventDataToReactionCountResource({\n data: event.data.data,\n event: event.event,\n currentPersonId,\n })\n\n if (newReactionCount?.count) {\n newReactionCounts = [...newReactionCounts, newReactionCount]\n }\n }\n\n return { ...oldMessage, reactionCounts: newReactionCounts }\n },\n })\n )\n}\n\ntype MessagesQueryData = InfiniteData<ApiCollection<MessageResource>>\nexport function isTemporaryMessageId(messageId?: string | null): boolean {\n return !!messageId && messageId.endsWith('-temp')\n}\nexport function isNewMessage(message?: MessageResource): boolean {\n return !message?.id || isTemporaryMessageId(message.id)\n}\n\nexport function getThreadedMessagesQueryKey(conversationId: number, replyRootId: string) {\n const requestArgs = getMessagesRequestArgs({\n conversation_id: conversationId,\n reply_root_id: replyRootId,\n })\n return getRequestQueryKey(requestArgs)\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { CurrentPersonResource, MessageResource } from '../../types';
|
|
2
2
|
import { DenormalizedAttachmentResourceForCreate } from '../../types/resources/denormalized_attachment_resource_for_create';
|
|
3
|
-
export declare function optimisticallyCreateMessage({ conversationId, text, attachments, currentPerson, message, }: {
|
|
3
|
+
export declare function optimisticallyCreateMessage({ conversationId, text, attachments, currentPerson, message, replyRootId, }: {
|
|
4
4
|
conversationId: number;
|
|
5
5
|
text: string;
|
|
6
6
|
attachments?: DenormalizedAttachmentResourceForCreate[];
|
|
7
7
|
currentPerson: CurrentPersonResource;
|
|
8
8
|
message?: MessageResource;
|
|
9
|
+
replyRootId?: string | null;
|
|
9
10
|
}): MessageResource;
|
|
10
11
|
//# sourceMappingURL=optimistically_create_message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optimistically_create_message.d.ts","sourceRoot":"","sources":["../../../src/utils/cache/optimistically_create_message.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,qBAAqB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAKnF,OAAO,EAAE,uCAAuC,EAAE,MAAM,mEAAmE,CAAA;AAI3H,wBAAgB,2BAA2B,CAAC,EAC1C,cAAc,EACd,IAAI,EACJ,WAAW,EACX,aAAa,EACb,OAAO,
|
|
1
|
+
{"version":3,"file":"optimistically_create_message.d.ts","sourceRoot":"","sources":["../../../src/utils/cache/optimistically_create_message.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,qBAAqB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAKnF,OAAO,EAAE,uCAAuC,EAAE,MAAM,mEAAmE,CAAA;AAI3H,wBAAgB,2BAA2B,CAAC,EAC1C,cAAc,EACd,IAAI,EACJ,WAAW,EACX,aAAa,EACb,OAAO,EACP,WAAW,GACZ,EAAE;IACD,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,uCAAuC,EAAE,CAAA;IACvD,aAAa,EAAE,qBAAqB,CAAA;IACpC,OAAO,CAAC,EAAE,eAAe,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,mBA+CA"}
|
|
@@ -3,7 +3,7 @@ import { chatQueryClient } from '../../contexts/api_provider';
|
|
|
3
3
|
import { updateOrCreateRecordInPagesData } from './page_mutations';
|
|
4
4
|
import { convertAttachmentsForCreate } from '../convert_attachments_for_create';
|
|
5
5
|
import { generatePlaceholderUlid } from '../generate_placeholder_ulid';
|
|
6
|
-
export function optimisticallyCreateMessage({ conversationId, text, attachments, currentPerson, message, }) {
|
|
6
|
+
export function optimisticallyCreateMessage({ conversationId, text, attachments, currentPerson, message, replyRootId, }) {
|
|
7
7
|
const id = message?.id || generateTempMessageId();
|
|
8
8
|
// Convert attachments to denormalized format for optimistic UI
|
|
9
9
|
const decoratedAttachments = convertAttachmentsForCreate(attachments || []);
|
|
@@ -28,9 +28,12 @@ export function optimisticallyCreateMessage({ conversationId, text, attachments,
|
|
|
28
28
|
lastInGroup: true,
|
|
29
29
|
pending: true,
|
|
30
30
|
replyCount: 0,
|
|
31
|
-
replyRootId: null,
|
|
31
|
+
replyRootId: replyRootId || null,
|
|
32
32
|
};
|
|
33
|
-
const queryKey = getMessagesQueryKey({
|
|
33
|
+
const queryKey = getMessagesQueryKey({
|
|
34
|
+
conversation_id: conversationId,
|
|
35
|
+
reply_root_id: replyRootId,
|
|
36
|
+
});
|
|
34
37
|
chatQueryClient.setQueryData(queryKey, data => updateOrCreateRecordInPagesData({
|
|
35
38
|
data,
|
|
36
39
|
record: optimisticMessage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optimistically_create_message.js","sourceRoot":"","sources":["../../../src/utils/cache/optimistically_create_message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AAG/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAEtE,MAAM,UAAU,2BAA2B,CAAC,EAC1C,cAAc,EACd,IAAI,EACJ,WAAW,EACX,aAAa,EACb,OAAO,
|
|
1
|
+
{"version":3,"file":"optimistically_create_message.js","sourceRoot":"","sources":["../../../src/utils/cache/optimistically_create_message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AAG/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAEtE,MAAM,UAAU,2BAA2B,CAAC,EAC1C,cAAc,EACd,IAAI,EACJ,WAAW,EACX,aAAa,EACb,OAAO,EACP,WAAW,GAQZ;IACC,MAAM,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,qBAAqB,EAAE,CAAA;IAEjD,+DAA+D;IAC/D,MAAM,oBAAoB,GAAqC,2BAA2B,CACxF,WAAW,IAAI,EAAE,CAClB,CAAA;IAED,+BAA+B;IAC/B,MAAM,iBAAiB,GAAoB;QACzC,GAAG,OAAO;QACV,IAAI,EAAE,SAAS;QACf,EAAE;QACF,IAAI;QACJ,IAAI,EAAE,EAAE,EAAE,2BAA2B;QACrC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,oBAAoB;QACjC,oBAAoB,EAAE,WAAW,IAAI,EAAE;QACvC,MAAM,EAAE,aAAa;QACrB,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,IAAI;QAChB,sBAAsB,EAAE,IAAI;QAC5B,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,CAAC;QACb,WAAW,EAAE,WAAW,IAAI,IAAI;KACjC,CAAA;IAID,MAAM,QAAQ,GAAG,mBAAmB,CAAC;QACnC,eAAe,EAAE,cAAc;QAC/B,aAAa,EAAE,WAAW;KAC3B,CAAC,CAAA;IAEF,eAAe,CAAC,YAAY,CAAY,QAAQ,EAAE,IAAI,CAAC,EAAE,CACvD,+BAA+B,CAAC;QAC9B,IAAI;QACJ,MAAM,EAAE,iBAAoC;KAC7C,CAAC,CACH,CAAA;IAED,OAAO,iBAAiB,CAAA;AAC1B,CAAC;AAED,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACjC,0FAA0F;IAC1F,sEAAsE;IACtE,OAAO,GAAG,uBAAuB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,CAAA;AAC9D,CAAC,CAAA","sourcesContent":["import { InfiniteData } from '@tanstack/react-query'\nimport { ApiCollection, CurrentPersonResource, MessageResource } from '../../types'\nimport { getMessagesQueryKey } from '../../utils/request/get_messages'\nimport { chatQueryClient } from '../../contexts/api_provider'\nimport { updateOrCreateRecordInPagesData } from './page_mutations'\nimport { convertAttachmentsForCreate } from '../convert_attachments_for_create'\nimport { DenormalizedAttachmentResourceForCreate } from '../../types/resources/denormalized_attachment_resource_for_create'\nimport { DenormalizedAttachmentResource } from '../../types/resources/denormalized_attachment_resource'\nimport { generatePlaceholderUlid } from '../generate_placeholder_ulid'\n\nexport function optimisticallyCreateMessage({\n conversationId,\n text,\n attachments,\n currentPerson,\n message,\n replyRootId,\n}: {\n conversationId: number\n text: string\n attachments?: DenormalizedAttachmentResourceForCreate[]\n currentPerson: CurrentPersonResource\n message?: MessageResource\n replyRootId?: string | null\n}) {\n const id = message?.id || generateTempMessageId()\n\n // Convert attachments to denormalized format for optimistic UI\n const decoratedAttachments: DenormalizedAttachmentResource[] = convertAttachmentsForCreate(\n attachments || []\n )\n\n // Create an optimistic message\n const optimisticMessage: MessageResource = {\n ...message,\n type: 'Message',\n id,\n text,\n html: '', // Will be filled by server\n createdAt: new Date().toISOString(),\n deletedAt: null,\n textEditedAt: null,\n mine: true,\n attachments: decoratedAttachments,\n attachmentsForCreate: attachments || [],\n author: currentPerson,\n reactionCounts: [],\n renderAuthor: false,\n renderTime: true,\n myLatestInConversation: true,\n lastInGroup: true,\n pending: true,\n replyCount: 0,\n replyRootId: replyRootId || null,\n }\n\n // Add the optimistic message to the cache\n type QueryData = InfiniteData<ApiCollection<MessageResource>>\n const queryKey = getMessagesQueryKey({\n conversation_id: conversationId,\n reply_root_id: replyRootId,\n })\n\n chatQueryClient.setQueryData<QueryData>(queryKey, data =>\n updateOrCreateRecordInPagesData({\n data,\n record: optimisticMessage as MessageResource,\n })\n )\n\n return optimisticMessage\n}\n\nconst generateTempMessageId = () => {\n // Put it 5 seconds in the future to account for server lag of previously created messages\n // that are still pending. This gets overwritten by the server anyway.\n return `${generatePlaceholderUlid({ offsetMs: 5000 })}-temp`\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.18.0-rc.
|
|
3
|
+
"version": "3.18.0-rc.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"@react-navigation/elements": "*",
|
|
30
30
|
"@react-navigation/native": ">=7.0.0",
|
|
31
31
|
"@react-navigation/native-stack": ">=7.0.0",
|
|
32
|
-
"@shopify/flash-list": "<2.0.0",
|
|
33
32
|
"@tanstack/react-query": "^5.0.0",
|
|
34
33
|
"color": "^3.1.2",
|
|
35
34
|
"lodash": "*",
|
|
@@ -59,5 +58,5 @@
|
|
|
59
58
|
"react-native-url-polyfill": "^2.0.0",
|
|
60
59
|
"typescript": "<5.6.0"
|
|
61
60
|
},
|
|
62
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "6d7c028cd363cb5e85d262ff1e8f9df72f1cd9e7"
|
|
63
62
|
}
|
|
@@ -22,11 +22,12 @@ import {
|
|
|
22
22
|
import Animated from 'react-native-reanimated'
|
|
23
23
|
import { useLiveRelativeTime } from '../../hooks/use_live_relative_time'
|
|
24
24
|
import { MessageReadReceipts } from './message_read_receipts'
|
|
25
|
-
import {
|
|
25
|
+
import { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'
|
|
26
26
|
import { Haptic } from '../../utils/native_adapters'
|
|
27
27
|
import { TheirReplyConnector, MyReplyConnector, AVATAR_CONNECTOR_SPACING } from './reply_connectors'
|
|
28
28
|
import { pluralize } from '../../utils'
|
|
29
29
|
import { useConversationMessage } from '../../hooks/use_conversation_message'
|
|
30
|
+
import { isNewMessage } from '../../utils/cache/messages_cache'
|
|
30
31
|
|
|
31
32
|
/** Message
|
|
32
33
|
* Component for display of a message within a conversation list
|