@planningcenter/chat-react-native 3.18.0-rc.4 → 3.18.0-rc.6
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 +2 -1
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +5 -5
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/message_form.js +5 -2
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversation/reply_connectors.d.ts.map +1 -1
- package/build/components/conversation/reply_connectors.js +0 -5
- package/build/components/conversation/reply_connectors.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_features.d.ts +9 -0
- package/build/hooks/use_features.d.ts.map +1 -0
- package/build/hooks/use_features.js +35 -0
- package/build/hooks/use_features.js.map +1 -0
- 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_screen.d.ts +2 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +12 -6
- package/build/screens/conversation_screen.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/screens/message_actions_screen.js +4 -2
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/types/resources/feature_resource.d.ts +7 -0
- package/build/types/resources/feature_resource.d.ts.map +1 -0
- package/build/types/resources/feature_resource.js +2 -0
- package/build/types/resources/feature_resource.js.map +1 -0
- package/build/utils/index.d.ts +0 -1
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +0 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/request/get_features.d.ts +11 -0
- package/build/utils/request/get_features.d.ts.map +1 -0
- package/build/utils/request/get_features.js +18 -0
- package/build/utils/request/get_features.js.map +1 -0
- package/package.json +2 -3
- package/src/components/conversation/message.tsx +8 -4
- package/src/components/conversation/message_form.tsx +4 -2
- package/src/components/conversation/reply_connectors.tsx +0 -3
- package/src/components/conversations/conversations.tsx +7 -9
- package/src/hooks/use_features.ts +47 -0
- package/src/screens/conversation_details_screen.tsx +3 -4
- package/src/screens/conversation_new/components/form_list.tsx +3 -5
- package/src/screens/conversation_screen.tsx +17 -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/screens/message_actions_screen.tsx +4 -2
- package/src/types/resources/feature_resource.ts +6 -0
- package/src/utils/index.ts +0 -1
- package/src/utils/request/get_features.ts +20 -0
- package/build/utils/replies_local_feature_flag.d.ts +0 -2
- package/build/utils/replies_local_feature_flag.d.ts.map +0 -1
- package/build/utils/replies_local_feature_flag.js +0 -3
- package/build/utils/replies_local_feature_flag.js.map +0 -1
- package/src/utils/replies_local_feature_flag.ts +0 -2
|
@@ -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,EAAE;QACrE,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE;YACzB,MAAM,EAAE,iBAAiB;YACzB,MAAM,EAAE;gBACN,Q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;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,CAAC,QAAQ,CAAC,KAAK,EAAE;YACzB,MAAM,EAAE,iBAAiB;YACzB,MAAM,EAAE;gBACN,QAAQ,EAAE,OAAO;gBACjB,eAAe,EAAE,UAAU;gBAC3B,GAAG,KAAK,CAAC,MAAM;aAChB;SACF,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,OAAO,CACL,CAAC,QAAQ,CACP,IAAI,CAAC,CAAC,YAAY,CAAC,CACnB,YAAY,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CACzC,qBAAqB,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAC/C,mBAAmB,CAAC,CAClB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAChC;UAAA,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CACjD;QAAA,EAAE,IAAI,CACR,CAAC,CACD,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAkC,EAAE,EAAE;YACpE,OAAO,CACL,CAAC,gBAAgB,CACf,GAAG,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CACpB,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,OAAO,CAAC,CAAC,+BAA+B,CAAC,EACzC,CACH,CAAA;QACH,CAAC,CAAC,EACF,CACH,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,aAAa,EAAE,MAAM;SACtB;QACD,aAAa,EAAE;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 { 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"]}
|
|
@@ -12,7 +12,7 @@ import { useApiClient } from '../hooks/use_api_client';
|
|
|
12
12
|
import { useConversationMessages } from '../hooks/use_conversation_messages';
|
|
13
13
|
import { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle';
|
|
14
14
|
import { Clipboard, Haptic } from '../utils/native_adapters';
|
|
15
|
-
import {
|
|
15
|
+
import { availableFeatures, useFeatures } from '../hooks/use_features';
|
|
16
16
|
export const MessageActionsScreenOptions = getFormSheetScreenOptions({
|
|
17
17
|
sheetAllowedDetents: [0.5],
|
|
18
18
|
headerTitle: 'Message actions',
|
|
@@ -29,6 +29,8 @@ function MessageActionsScreenContent({ message, conversation_id, canDeleteNonAut
|
|
|
29
29
|
const navigation = useNavigation();
|
|
30
30
|
const apiClient = useApiClient();
|
|
31
31
|
const styles = useStyles();
|
|
32
|
+
const { featureEnabled } = useFeatures();
|
|
33
|
+
const repliesEnabled = featureEnabled(availableFeatures.threaded_replies);
|
|
32
34
|
const myReactions = message?.reactionCounts
|
|
33
35
|
.filter(reaction => reaction.mine)
|
|
34
36
|
.map(reaction => reaction.value);
|
|
@@ -115,7 +117,7 @@ function MessageActionsScreenContent({ message, conversation_id, canDeleteNonAut
|
|
|
115
117
|
}}/>))}
|
|
116
118
|
</View>
|
|
117
119
|
<View style={styles.actions}>
|
|
118
|
-
{
|
|
120
|
+
{repliesEnabled && !inReplyScreen && (<FormSheet.Action onPress={handleReplyPress} title="Reply to message" iconName="registrations.undo" accessibilityHint="Navigates to the reply screen" accessibilityRole="link"/>)}
|
|
119
121
|
<FormSheet.Action onPress={handleCopyPress} title="Copy text" iconName="services.fileCopy" accessibilityHint="Copies text and links to clipboard"/>
|
|
120
122
|
{message?.mine && (<FormSheet.Action onPress={() => handleEditPress()} title="Edit message" iconName="accounts.editor" accessibilityHint="Opens existing text in the message form input."/>)}
|
|
121
123
|
{message?.mine && (<FormSheet.Action onPress={() => handleViewReadReceiptsPress()} title="View read receipts" iconName="general.checkPerson" accessibilityHint="Opens a modal with a list of people who read your message."/>)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_actions_screen.js","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,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,QAAQ;QACb,OAAO,EAAE,QAAQ,GAAG,cAAc,GAAG,CAAC;KACvC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,UAAU,EAAE,EAAE;SACf;QACD,YAAY,EAAE;YACZ,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,EAAE;YACjB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;YAChD,iBAAiB,EAAE,CAAC;SACrB;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,eAAe;YACvB,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,cAAc;YAC3B,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,QAAQ;YACxB,QAAQ,EAAE,QAAQ;SACnB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,EAAE;SACb;QACD,OAAO,EAAE;YACP,UAAU,EAAE,CAAC;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport { isNil, omitBy } from 'lodash'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, View } from 'react-native'\nimport { Text } from '../components'\nimport { REACTION_EMOJIS, useReactionStyles } from '../components/conversation/message_reaction'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { Clipboard, Haptic } from '../utils/native_adapters'\nimport { MessageResource } from '../types'\nimport { REPLIES_FEATURE_ENABLED } from '../utils'\n\nexport const MessageActionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: [0.5],\n headerTitle: 'Message actions',\n})\n\nexport type MessageActionsScreenProps = StaticScreenProps<{\n message_id: string\n reply_root_author_name?: string\n conversation_id: number\n canDeleteNonAuthoredMessages?: boolean\n inReplyScreen?: boolean\n}>\n\nexport function MessageActionsScreen({ route }: MessageActionsScreenProps) {\n const {\n conversation_id,\n message_id,\n canDeleteNonAuthoredMessages,\n inReplyScreen,\n reply_root_author_name,\n } = route.params\n\n const { messages, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n\n if (!message) return null\n\n return (\n <MessageActionsScreenContent\n message={message}\n conversation_id={conversation_id}\n canDeleteNonAuthoredMessages={canDeleteNonAuthoredMessages || false}\n refetchMessages={refetch}\n inReplyScreen={inReplyScreen}\n replyRootAuthorName={reply_root_author_name}\n />\n )\n}\n\nfunction MessageActionsScreenContent({\n message,\n conversation_id,\n canDeleteNonAuthoredMessages,\n refetchMessages,\n inReplyScreen,\n replyRootAuthorName,\n}: {\n message: MessageResource\n conversation_id: number\n canDeleteNonAuthoredMessages: boolean\n refetchMessages: () => void\n inReplyScreen?: boolean\n replyRootAuthorName?: string\n}) {\n const navigation = useNavigation()\n const apiClient = useApiClient()\n const styles = useStyles()\n\n const myReactions = message?.reactionCounts\n .filter(reaction => reaction.mine)\n .map(reaction => reaction.value)\n\n const availableReactions = Object.entries(REACTION_EMOJIS).map(([value, emoji]) => {\n return {\n value: value as ReactionCountResource['value'],\n emoji,\n mine: myReactions?.includes(value as ReactionCountResource['value']),\n }\n })\n\n const attachmentForCopy = (): string => {\n const giphyTitleLink = message?.attachments.find(\n attachment => attachment.type === 'giphy'\n )?.titleLink\n\n if (giphyTitleLink) return giphyTitleLink\n return ''\n }\n\n const handleReplyPress = useCallback(() => {\n navigation.goBack()\n // Waits for the modal to be dismissed before pushing the reply screen\n requestAnimationFrame(() => {\n navigation.navigate('ConversationReply', {\n conversation_id,\n reply_root_id: message.replyRootId || message.id,\n reply_root_author_name: replyRootAuthorName,\n })\n })\n }, [navigation, conversation_id, message.id, message.replyRootId, replyRootAuthorName])\n\n const handleCopyPress = () => {\n Clipboard.setStringAsync(message?.text || attachmentForCopy() || '')\n navigation.goBack()\n }\n\n const { handleReactionToggle, isPending } = useMessageReactionToggle({\n conversation_id,\n message,\n onSuccess: () => navigation.goBack(),\n })\n\n const deleteMessage = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message.id}/`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, message.id])\n\n const { mutate: handleDeleteMessage } = useMutation({\n mutationFn: deleteMessage,\n onSuccess: () => {\n refetchMessages()\n Haptic.notificationSuccess()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to delete this message. Please try again.')\n },\n })\n\n const handleDeleteConfirm = useCallback(() => {\n Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Delete', style: 'destructive', onPress: () => handleDeleteMessage() },\n ])\n }, [handleDeleteMessage])\n\n const handleEditPress = useCallback(() => {\n const state = navigation.getState?.()\n const targetRoute = state?.routes?.find(r => r.name === 'Conversation')\n const params = omitBy(\n {\n ...(targetRoute?.params || {}),\n conversation_id,\n editing_message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('Conversation', params))\n }, [navigation, conversation_id, message.id])\n\n const handleViewReadReceiptsPress = useCallback(() => {\n Haptic.impactLight()\n const params = omitBy(\n {\n conversation_id,\n message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('MessageReadReceipts', params))\n }, [navigation, conversation_id, message.id])\n\n return (\n <FormSheet.Root style={styles.formSheetContent}>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction\n key={index}\n reaction={reaction}\n onPress={() => {\n Haptic.impactLight()\n handleReactionToggle({\n value: reaction.value,\n mine: reaction.mine,\n })\n }}\n />\n ))}\n </View>\n <View style={styles.actions}>\n {REPLIES_FEATURE_ENABLED && !inReplyScreen && (\n <FormSheet.Action\n onPress={handleReplyPress}\n title=\"Reply to message\"\n iconName=\"registrations.undo\"\n accessibilityHint=\"Navigates to the reply screen\"\n accessibilityRole=\"link\"\n />\n )}\n <FormSheet.Action\n onPress={handleCopyPress}\n title=\"Copy text\"\n iconName=\"services.fileCopy\"\n accessibilityHint=\"Copies text and links to clipboard\"\n />\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleEditPress()}\n title=\"Edit message\"\n iconName=\"accounts.editor\"\n accessibilityHint=\"Opens existing text in the message form input.\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleViewReadReceiptsPress()}\n title=\"View read receipts\"\n iconName=\"general.checkPerson\"\n accessibilityHint=\"Opens a modal with a list of people who read your message.\"\n />\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <FormSheet.Action\n onPress={() => handleDeleteConfirm()}\n title=\"Delete message\"\n iconName=\"publishing.trash\"\n appearance=\"danger\"\n disabled={isPending}\n accessibilityHint=\"Opens a confirmation alert to delete this message permanently.\"\n />\n )}\n </View>\n </FormSheet.Root>\n )\n}\n\nconst Reaction = ({\n reaction,\n onPress,\n}: {\n reaction: { value: ReactionCountResource['value']; emoji: string; mine: boolean | undefined }\n onPress: () => void\n}) => {\n const styles = useStyles()\n const reactionStyles = useReactionStyles({ mine: reaction.mine ? 1 : 0 })\n\n const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n onPress={onPress}\n >\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n const btnBorderWidth = 1\n const baseSize = 46 * fontScale\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n reactionList: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n paddingTop: 8,\n paddingBottom: 16,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n reactionEmoji: {\n fontSize: 24,\n },\n actions: {\n paddingTop: 4,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"message_actions_screen.js","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAChG,OAAO,SAAS,EAAE,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AACzF,OAAO,EAAE,2BAA2B,EAAE,YAAY,EAAE,QAAQ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AE,EAAE;YACjB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;YAChD,iBAAiB,EAAE,CAAC;SACrB;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,eAAe;YACvB,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,cAAc;YAC3B,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,QAAQ;YACxB,QAAQ,EAAE,QAAQ;SACnB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,EAAE;SACb;QACD,OAAO,EAAE;YACP,UAAU,EAAE,CAAC;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport { isNil, omitBy } from 'lodash'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, View } from 'react-native'\nimport { Text } from '../components'\nimport { REACTION_EMOJIS, useReactionStyles } from '../components/conversation/message_reaction'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { Clipboard, Haptic } from '../utils/native_adapters'\nimport { MessageResource } from '../types'\nimport { availableFeatures, useFeatures } from '../hooks/use_features'\n\nexport const MessageActionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: [0.5],\n headerTitle: 'Message actions',\n})\n\nexport type MessageActionsScreenProps = StaticScreenProps<{\n message_id: string\n reply_root_author_name?: string\n conversation_id: number\n canDeleteNonAuthoredMessages?: boolean\n inReplyScreen?: boolean\n}>\n\nexport function MessageActionsScreen({ route }: MessageActionsScreenProps) {\n const {\n conversation_id,\n message_id,\n canDeleteNonAuthoredMessages,\n inReplyScreen,\n reply_root_author_name,\n } = route.params\n\n const { messages, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n\n if (!message) return null\n\n return (\n <MessageActionsScreenContent\n message={message}\n conversation_id={conversation_id}\n canDeleteNonAuthoredMessages={canDeleteNonAuthoredMessages || false}\n refetchMessages={refetch}\n inReplyScreen={inReplyScreen}\n replyRootAuthorName={reply_root_author_name}\n />\n )\n}\n\nfunction MessageActionsScreenContent({\n message,\n conversation_id,\n canDeleteNonAuthoredMessages,\n refetchMessages,\n inReplyScreen,\n replyRootAuthorName,\n}: {\n message: MessageResource\n conversation_id: number\n canDeleteNonAuthoredMessages: boolean\n refetchMessages: () => void\n inReplyScreen?: boolean\n replyRootAuthorName?: string\n}) {\n const navigation = useNavigation()\n const apiClient = useApiClient()\n const styles = useStyles()\n const { featureEnabled } = useFeatures()\n const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)\n\n const myReactions = message?.reactionCounts\n .filter(reaction => reaction.mine)\n .map(reaction => reaction.value)\n\n const availableReactions = Object.entries(REACTION_EMOJIS).map(([value, emoji]) => {\n return {\n value: value as ReactionCountResource['value'],\n emoji,\n mine: myReactions?.includes(value as ReactionCountResource['value']),\n }\n })\n\n const attachmentForCopy = (): string => {\n const giphyTitleLink = message?.attachments.find(\n attachment => attachment.type === 'giphy'\n )?.titleLink\n\n if (giphyTitleLink) return giphyTitleLink\n return ''\n }\n\n const handleReplyPress = useCallback(() => {\n navigation.goBack()\n // Waits for the modal to be dismissed before pushing the reply screen\n requestAnimationFrame(() => {\n navigation.navigate('ConversationReply', {\n conversation_id,\n reply_root_id: message.replyRootId || message.id,\n reply_root_author_name: replyRootAuthorName,\n })\n })\n }, [navigation, conversation_id, message.id, message.replyRootId, replyRootAuthorName])\n\n const handleCopyPress = () => {\n Clipboard.setStringAsync(message?.text || attachmentForCopy() || '')\n navigation.goBack()\n }\n\n const { handleReactionToggle, isPending } = useMessageReactionToggle({\n conversation_id,\n message,\n onSuccess: () => navigation.goBack(),\n })\n\n const deleteMessage = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message.id}/`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, message.id])\n\n const { mutate: handleDeleteMessage } = useMutation({\n mutationFn: deleteMessage,\n onSuccess: () => {\n refetchMessages()\n Haptic.notificationSuccess()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to delete this message. Please try again.')\n },\n })\n\n const handleDeleteConfirm = useCallback(() => {\n Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Delete', style: 'destructive', onPress: () => handleDeleteMessage() },\n ])\n }, [handleDeleteMessage])\n\n const handleEditPress = useCallback(() => {\n const state = navigation.getState?.()\n const targetRoute = state?.routes?.find(r => r.name === 'Conversation')\n const params = omitBy(\n {\n ...(targetRoute?.params || {}),\n conversation_id,\n editing_message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('Conversation', params))\n }, [navigation, conversation_id, message.id])\n\n const handleViewReadReceiptsPress = useCallback(() => {\n Haptic.impactLight()\n const params = omitBy(\n {\n conversation_id,\n message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('MessageReadReceipts', params))\n }, [navigation, conversation_id, message.id])\n\n return (\n <FormSheet.Root style={styles.formSheetContent}>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction\n key={index}\n reaction={reaction}\n onPress={() => {\n Haptic.impactLight()\n handleReactionToggle({\n value: reaction.value,\n mine: reaction.mine,\n })\n }}\n />\n ))}\n </View>\n <View style={styles.actions}>\n {repliesEnabled && !inReplyScreen && (\n <FormSheet.Action\n onPress={handleReplyPress}\n title=\"Reply to message\"\n iconName=\"registrations.undo\"\n accessibilityHint=\"Navigates to the reply screen\"\n accessibilityRole=\"link\"\n />\n )}\n <FormSheet.Action\n onPress={handleCopyPress}\n title=\"Copy text\"\n iconName=\"services.fileCopy\"\n accessibilityHint=\"Copies text and links to clipboard\"\n />\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleEditPress()}\n title=\"Edit message\"\n iconName=\"accounts.editor\"\n accessibilityHint=\"Opens existing text in the message form input.\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleViewReadReceiptsPress()}\n title=\"View read receipts\"\n iconName=\"general.checkPerson\"\n accessibilityHint=\"Opens a modal with a list of people who read your message.\"\n />\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <FormSheet.Action\n onPress={() => handleDeleteConfirm()}\n title=\"Delete message\"\n iconName=\"publishing.trash\"\n appearance=\"danger\"\n disabled={isPending}\n accessibilityHint=\"Opens a confirmation alert to delete this message permanently.\"\n />\n )}\n </View>\n </FormSheet.Root>\n )\n}\n\nconst Reaction = ({\n reaction,\n onPress,\n}: {\n reaction: { value: ReactionCountResource['value']; emoji: string; mine: boolean | undefined }\n onPress: () => void\n}) => {\n const styles = useStyles()\n const reactionStyles = useReactionStyles({ mine: reaction.mine ? 1 : 0 })\n\n const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n onPress={onPress}\n >\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n const btnBorderWidth = 1\n const baseSize = 46 * fontScale\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n reactionList: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n paddingTop: 8,\n paddingBottom: 16,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n reactionEmoji: {\n fontSize: 24,\n },\n actions: {\n paddingTop: 4,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature_resource.d.ts","sourceRoot":"","sources":["../../../src/types/resources/feature_resource.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAA;IACf,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature_resource.js","sourceRoot":"","sources":["../../../src/types/resources/feature_resource.ts"],"names":[],"mappings":"","sourcesContent":["export interface FeatureResource {\n type: 'Feature'\n id: string\n name: string\n enabled: boolean\n}\n"]}
|
package/build/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA"}
|
package/build/utils/index.js
CHANGED
package/build/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA","sourcesContent":["export * from './session'\nexport * from './theme'\nexport * from './styles'\nexport * from './client'\nexport * from './uri'\nexport * from './cache'\nexport * from './native_adapters'\nexport * from './pluralize'\nexport * from './destructure_chat_group_graph_id'\nexport * from './convert_attachments_for_create'\nexport * from './assert_keys_are_numbers'\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const getFeaturesRequestArgs: () => {
|
|
2
|
+
url: string;
|
|
3
|
+
data: {
|
|
4
|
+
perPage: number;
|
|
5
|
+
fields: {
|
|
6
|
+
Feature: string[];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const getFeaturesQueryKey: () => import("../../hooks/use_suspense_api").RequestQueryKey;
|
|
11
|
+
//# sourceMappingURL=get_features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_features.d.ts","sourceRoot":"","sources":["../../../src/utils/request/get_features.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB;;;;;;;;CAYlC,CAAA;AAED,eAAO,MAAM,mBAAmB,8DAG/B,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getRequestQueryKey } from '../../hooks/use_suspense_api';
|
|
2
|
+
export const getFeaturesRequestArgs = () => {
|
|
3
|
+
const url = '/me/features';
|
|
4
|
+
return {
|
|
5
|
+
url,
|
|
6
|
+
data: {
|
|
7
|
+
perPage: 100,
|
|
8
|
+
fields: {
|
|
9
|
+
Feature: ['name', 'enabled'],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export const getFeaturesQueryKey = () => {
|
|
15
|
+
const requestArgs = getFeaturesRequestArgs();
|
|
16
|
+
return getRequestQueryKey(requestArgs);
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=get_features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_features.js","sourceRoot":"","sources":["../../../src/utils/request/get_features.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAEjE,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACzC,MAAM,GAAG,GAAG,cAAc,CAAA;IAE1B,OAAO;QACL,GAAG;QACH,IAAI,EAAE;YACJ,OAAO,EAAE,GAAG;YACZ,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;aAC7B;SACF;KACF,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,WAAW,GAAG,sBAAsB,EAAE,CAAA;IAC5C,OAAO,kBAAkB,CAAC,WAAW,CAAC,CAAA;AACxC,CAAC,CAAA","sourcesContent":["import { getRequestQueryKey } from '../../hooks/use_suspense_api'\n\nexport const getFeaturesRequestArgs = () => {\n const url = '/me/features'\n\n return {\n url,\n data: {\n perPage: 100,\n fields: {\n Feature: ['name', 'enabled'],\n },\n },\n }\n}\n\nexport const getFeaturesQueryKey = () => {\n const requestArgs = getFeaturesRequestArgs()\n return getRequestQueryKey(requestArgs)\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.6",
|
|
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": "78fdeec4ebbeb3d824a7e105303831415a2c9441"
|
|
63
62
|
}
|
|
@@ -25,7 +25,7 @@ import { MessageReadReceipts } from './message_read_receipts'
|
|
|
25
25
|
import { isNewMessage, 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
|
-
import { pluralize
|
|
28
|
+
import { pluralize } from '../../utils'
|
|
29
29
|
import { useConversationMessage } from '../../hooks/use_conversation_message'
|
|
30
30
|
|
|
31
31
|
/** Message
|
|
@@ -36,6 +36,7 @@ interface MessageProps extends MessageResource {
|
|
|
36
36
|
conversation_id: number
|
|
37
37
|
latestReadMessageSortKey?: string
|
|
38
38
|
inReplyScreen?: boolean
|
|
39
|
+
repliesEnabled?: boolean
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export function Message({
|
|
@@ -43,6 +44,7 @@ export function Message({
|
|
|
43
44
|
conversation_id,
|
|
44
45
|
latestReadMessageSortKey,
|
|
45
46
|
inReplyScreen,
|
|
47
|
+
repliesEnabled,
|
|
46
48
|
...message
|
|
47
49
|
}: MessageProps) {
|
|
48
50
|
const { text, reactionCounts, pending, error } = message
|
|
@@ -73,7 +75,7 @@ export function Message({
|
|
|
73
75
|
|
|
74
76
|
const renderAuthor = (!message.mine && message.renderAuthor) || false
|
|
75
77
|
const showReplyCountButton =
|
|
76
|
-
!inReplyScreen && message.replyRootId === message.id &&
|
|
78
|
+
!inReplyScreen && message.replyRootId === message.id && repliesEnabled
|
|
77
79
|
const isReplyRootMessage = message.replyRootId === message.id
|
|
78
80
|
const isDeletedReplyRootMessage = isReplyRootMessage && !!message.deletedAt
|
|
79
81
|
|
|
@@ -181,7 +183,9 @@ export function Message({
|
|
|
181
183
|
) : (
|
|
182
184
|
<View style={styles.avatarPlaceholder} />
|
|
183
185
|
)}
|
|
184
|
-
|
|
186
|
+
{repliesEnabled && (
|
|
187
|
+
<TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />
|
|
188
|
+
)}
|
|
185
189
|
</View>
|
|
186
190
|
)}
|
|
187
191
|
<View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>
|
|
@@ -282,7 +286,7 @@ export function Message({
|
|
|
282
286
|
</View>
|
|
283
287
|
)}
|
|
284
288
|
</View>
|
|
285
|
-
{message.mine && (
|
|
289
|
+
{repliesEnabled && message.mine && (
|
|
286
290
|
<MyReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />
|
|
287
291
|
)}
|
|
288
292
|
</Animated.View>
|
|
@@ -30,10 +30,10 @@ import { ChatContext } from '../../contexts/chat_context'
|
|
|
30
30
|
import { Haptic, ImagePicker, ImagePickerResult } from '../../utils/native_adapters'
|
|
31
31
|
import {
|
|
32
32
|
MAX_FONT_SIZE_MULTIPLIER_LANDMARK,
|
|
33
|
-
REPLIES_FEATURE_ENABLED,
|
|
34
33
|
platformFontWeightMedium,
|
|
35
34
|
platformPressedOpacityStyle,
|
|
36
35
|
} from '../../utils'
|
|
36
|
+
import { availableFeatures, useFeatures } from '../../hooks/use_features'
|
|
37
37
|
import { useAttachmentUploader } from '../../hooks/use_attachment_uploader'
|
|
38
38
|
import { useMessageDraft } from '../../hooks/use_message_draft'
|
|
39
39
|
import {
|
|
@@ -566,9 +566,11 @@ function EditingIndicator() {
|
|
|
566
566
|
function ReplyIndicator() {
|
|
567
567
|
const { replyRootId, replyRootAuthorFirstName } = React.useContext(MessageFormContext)
|
|
568
568
|
const navigation = useNavigation()
|
|
569
|
+
const { featureEnabled } = useFeatures()
|
|
570
|
+
const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)
|
|
569
571
|
const title = replyRootAuthorFirstName ? `Reply to ${replyRootAuthorFirstName}` : 'Reply'
|
|
570
572
|
|
|
571
|
-
if (!
|
|
573
|
+
if (!repliesEnabled || !replyRootId) return null
|
|
572
574
|
|
|
573
575
|
return (
|
|
574
576
|
<FormIndicatorRow
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,
|
|
7
7
|
MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,
|
|
8
8
|
} from '../../utils/styles'
|
|
9
|
-
import { REPLIES_FEATURE_ENABLED } from '../../utils'
|
|
10
9
|
|
|
11
10
|
const MY_REPLY_CONNECTOR_WIDTH = 38
|
|
12
11
|
const CONNECTOR_BORDER_WIDTH = 4
|
|
@@ -22,7 +21,6 @@ export function TheirReplyConnector({ message, messageBubbleHeight }: ReplyConne
|
|
|
22
21
|
const styles = useStyles()
|
|
23
22
|
const { nextRendersAuthor, threadPosition, renderAuthor, isReplyShadowMessage } = message
|
|
24
23
|
|
|
25
|
-
if (!REPLIES_FEATURE_ENABLED) return null
|
|
26
24
|
if (messageBubbleHeight === 0) return null // Prevents UI shifting
|
|
27
25
|
|
|
28
26
|
const connectorMap: Record<string, React.ReactNode | null> = {
|
|
@@ -59,7 +57,6 @@ export function MyReplyConnector({ message, messageBubbleHeight }: ReplyConnecto
|
|
|
59
57
|
const { nextRendersAuthor, threadPosition, prevIsMyReply, nextIsMyReply, isReplyShadowMessage } =
|
|
60
58
|
message
|
|
61
59
|
|
|
62
|
-
if (!REPLIES_FEATURE_ENABLED) return null
|
|
63
60
|
if (messageBubbleHeight === 0) return null // Prevents UI shifting
|
|
64
61
|
|
|
65
62
|
const connectorMap: Record<string, React.ReactNode | null> = {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useNavigation } from '@react-navigation/native'
|
|
2
|
-
import { FlashList } from '@shopify/flash-list'
|
|
3
2
|
import React, { useMemo } from 'react'
|
|
4
|
-
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import { FlatList, StyleSheet, View } from 'react-native'
|
|
5
4
|
import { useConversationsContext } from '../../contexts/conversations_context'
|
|
6
5
|
import { useTheme } from '../../hooks'
|
|
7
6
|
import { ConversationResource } from '../../types'
|
|
@@ -35,7 +34,7 @@ export const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {
|
|
|
35
34
|
|
|
36
35
|
const showBadges = !chat_group_graph_id
|
|
37
36
|
|
|
38
|
-
const data:
|
|
37
|
+
const data: FlatListItem[] = useMemo(() => {
|
|
39
38
|
if (isLoading) {
|
|
40
39
|
return loadingPlaceholder
|
|
41
40
|
}
|
|
@@ -54,9 +53,8 @@ export const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {
|
|
|
54
53
|
|
|
55
54
|
return (
|
|
56
55
|
<View style={styles.container}>
|
|
57
|
-
<
|
|
56
|
+
<FlatList
|
|
58
57
|
data={data}
|
|
59
|
-
estimatedItemSize={97}
|
|
60
58
|
keyExtractor={item => item.id.toString()}
|
|
61
59
|
contentContainerStyle={styles.contentContainer}
|
|
62
60
|
onRefresh={refetch}
|
|
@@ -114,18 +112,18 @@ const useStyles = () => {
|
|
|
114
112
|
})
|
|
115
113
|
}
|
|
116
114
|
|
|
117
|
-
interface
|
|
115
|
+
interface FlatListLoadingItem {
|
|
118
116
|
type: 'loading'
|
|
119
117
|
id: string
|
|
120
118
|
}
|
|
121
|
-
interface
|
|
119
|
+
interface FlatListConversationItem {
|
|
122
120
|
type: 'conversation'
|
|
123
121
|
resource: ConversationResource
|
|
124
122
|
id: number
|
|
125
123
|
}
|
|
126
|
-
type
|
|
124
|
+
type FlatListItem = FlatListLoadingItem | FlatListConversationItem
|
|
127
125
|
|
|
128
|
-
const loadingPlaceholder:
|
|
126
|
+
const loadingPlaceholder: FlatListItem[] = Array.from({ length: 5 }, (_, i) => ({
|
|
129
127
|
type: 'loading',
|
|
130
128
|
id: `loading${i}`,
|
|
131
129
|
}))
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useSuspenseQuery } from '@tanstack/react-query'
|
|
2
|
+
import { useCallback } from 'react'
|
|
3
|
+
import { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'
|
|
4
|
+
import { useApiClient } from './use_api_client'
|
|
5
|
+
import type { FeatureResource } from '../types/resources/feature_resource'
|
|
6
|
+
import { ApiCollection } from '../types'
|
|
7
|
+
|
|
8
|
+
export function useFeatures() {
|
|
9
|
+
const apiClient = useApiClient()
|
|
10
|
+
const requestArgs = getFeaturesRequestArgs()
|
|
11
|
+
|
|
12
|
+
const { data } = useSuspenseQuery({
|
|
13
|
+
queryKey: getFeaturesQueryKey(),
|
|
14
|
+
queryFn: () => {
|
|
15
|
+
return apiClient.chat
|
|
16
|
+
.get<ApiCollection<FeatureResource>>(requestArgs)
|
|
17
|
+
.catch(() => stableEmptyFeatures)
|
|
18
|
+
},
|
|
19
|
+
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const features = data.data
|
|
23
|
+
|
|
24
|
+
const featureEnabled = useCallback(
|
|
25
|
+
(featureName: string) =>
|
|
26
|
+
features.some(feature => feature.name === featureName && feature.enabled),
|
|
27
|
+
[features]
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
features,
|
|
32
|
+
featureEnabled,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const availableFeatures = {
|
|
37
|
+
threaded_replies: 'QA_MOBILE_threaded_replies',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const stableEmptyFeatures: ApiCollection<FeatureResource> = {
|
|
41
|
+
data: [],
|
|
42
|
+
links: {},
|
|
43
|
+
meta: {
|
|
44
|
+
count: 0,
|
|
45
|
+
totalCount: 0,
|
|
46
|
+
},
|
|
47
|
+
}
|
|
@@ -9,6 +9,7 @@ import React, {
|
|
|
9
9
|
useRef,
|
|
10
10
|
} from 'react'
|
|
11
11
|
import {
|
|
12
|
+
FlatList,
|
|
12
13
|
StyleSheet,
|
|
13
14
|
TextInput,
|
|
14
15
|
View,
|
|
@@ -40,7 +41,6 @@ import {
|
|
|
40
41
|
} from '../hooks/use_conversation'
|
|
41
42
|
import { MemberResource, isDefined } from '../types'
|
|
42
43
|
import { HeaderTextButton } from '../components/display/platform_modal_header_buttons'
|
|
43
|
-
import { FlashList } from '@shopify/flash-list'
|
|
44
44
|
import { tokens } from '../vendor/tapestry/tokens'
|
|
45
45
|
import { ButtonAppearanceUnion } from '../components/display/utils/button_colors'
|
|
46
46
|
import { GroupResource } from '../types/resources/group_resource'
|
|
@@ -300,9 +300,8 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
300
300
|
|
|
301
301
|
return (
|
|
302
302
|
<View style={styles.listContainer}>
|
|
303
|
-
<
|
|
303
|
+
<FlatList
|
|
304
304
|
data={listData as SectionListData}
|
|
305
|
-
estimatedItemSize={52}
|
|
306
305
|
contentContainerStyle={styles.contentContainer}
|
|
307
306
|
renderItem={({ item, index }) => {
|
|
308
307
|
const [isStart, isEnd] = [
|
|
@@ -375,7 +374,7 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
375
374
|
return null
|
|
376
375
|
}
|
|
377
376
|
}}
|
|
378
|
-
onEndReached={fetchNextPageOfMembers}
|
|
377
|
+
onEndReached={() => fetchNextPageOfMembers()}
|
|
379
378
|
/>
|
|
380
379
|
</View>
|
|
381
380
|
)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { StyleSheet, View } from 'react-native'
|
|
3
|
-
import { FlashList, type FlashListProps } from '@shopify/flash-list'
|
|
2
|
+
import { FlatList, type FlatListProps, StyleSheet, View } from 'react-native'
|
|
4
3
|
import { MemberResource } from '../../../types'
|
|
5
4
|
import { Person, Text } from '../../../components/display'
|
|
6
5
|
import { useTheme } from '../../../hooks'
|
|
@@ -8,7 +7,7 @@ import { useTheme } from '../../../hooks'
|
|
|
8
7
|
interface FormListProps {
|
|
9
8
|
memberData: MemberResource[]
|
|
10
9
|
loadingMore?: boolean
|
|
11
|
-
FormContent?:
|
|
10
|
+
FormContent?: FlatListProps<MemberResource>['ListHeaderComponent']
|
|
12
11
|
listEmptyText?: string
|
|
13
12
|
onEndReached?: () => void
|
|
14
13
|
}
|
|
@@ -23,7 +22,7 @@ export const FormList = ({
|
|
|
23
22
|
const styles = useStyles()
|
|
24
23
|
|
|
25
24
|
return (
|
|
26
|
-
<
|
|
25
|
+
<FlatList
|
|
27
26
|
data={memberData}
|
|
28
27
|
ListHeaderComponent={FormContent}
|
|
29
28
|
renderItem={({ item }) => <Person person={item} style={styles.person} />}
|
|
@@ -31,7 +30,6 @@ export const FormList = ({
|
|
|
31
30
|
loadingMore ? <Text style={styles.loadingMore}>Loading more...</Text> : null
|
|
32
31
|
}
|
|
33
32
|
keyExtractor={item => item.id.toString()}
|
|
34
|
-
estimatedItemSize={45}
|
|
35
33
|
ListEmptyComponent={<ListEmptyText text={listEmptyText || 'No members found'} />}
|
|
36
34
|
onEndReached={onEndReached}
|
|
37
35
|
/>
|