@planningcenter/chat-react-native 4.7.1-qa-staging.5 → 4.8.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts +1 -11
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts.map +1 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.js +47 -92
- package/build/hooks/groups/use_group_chat_conversation_payload.js.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +25 -27
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.js +110 -125
- package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.js +31 -39
- package/build/hooks/groups/use_groups_conversation_create.js.map +1 -1
- package/build/hooks/use_features.d.ts +0 -1
- package/build/hooks/use_features.d.ts.map +1 -1
- package/build/hooks/use_features.js +1 -2
- package/build/hooks/use_features.js.map +1 -1
- package/build/hooks/use_groups_groups.d.ts.map +1 -1
- package/build/hooks/use_groups_groups.js +9 -25
- package/build/hooks/use_groups_groups.js.map +1 -1
- package/build/hooks/use_new_conversation_from_filter.d.ts.map +1 -1
- package/build/hooks/use_new_conversation_from_filter.js +1 -11
- package/build/hooks/use_new_conversation_from_filter.js.map +1 -1
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/groups_form.js +93 -96
- package/build/screens/conversation_new/components/groups_form.js.map +1 -1
- package/build/screens/get_help_screen.d.ts.map +1 -1
- package/build/screens/get_help_screen.js +20 -4
- package/build/screens/get_help_screen.js.map +1 -1
- package/build/types/resources/groups/groups_group_resource.d.ts +1 -1
- package/build/types/resources/groups/groups_group_resource.d.ts.map +1 -1
- package/build/types/resources/groups/groups_group_resource.js.map +1 -1
- package/build/types/resources/groups/index.d.ts +0 -1
- package/build/types/resources/groups/index.d.ts.map +1 -1
- package/build/types/resources/groups/index.js +0 -1
- package/build/types/resources/groups/index.js.map +1 -1
- package/build/utils/native_adapters/linking.d.ts.map +1 -1
- package/build/utils/native_adapters/linking.js +2 -48
- package/build/utils/native_adapters/linking.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/hooks/use_group_chat_conversation_payload.test.tsx +0 -31
- package/src/hooks/groups/use_group_chat_conversation_payload.ts +12 -30
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +18 -49
- package/src/hooks/groups/use_groups_conversation_create.ts +14 -10
- package/src/hooks/use_features.ts +0 -1
- package/src/hooks/use_groups_groups.ts +16 -21
- package/src/hooks/use_new_conversation_from_filter.ts +5 -13
- package/src/screens/conversation_new/components/groups_form.tsx +9 -11
- package/src/screens/get_help_screen.tsx +18 -4
- package/src/types/resources/groups/groups_group_resource.ts +1 -1
- package/src/types/resources/groups/index.ts +0 -1
- package/src/utils/native_adapters/__tests__/linking.test.ts +4 -60
- package/src/utils/native_adapters/linking.ts +2 -50
- package/build/hooks/groups/use_groups_proxy.d.ts +0 -2
- package/build/hooks/groups/use_groups_proxy.d.ts.map +0 -1
- package/build/hooks/groups/use_groups_proxy.js +0 -18
- package/build/hooks/groups/use_groups_proxy.js.map +0 -1
- package/build/types/resources/groups/groups_membership_resource.d.ts +0 -11
- package/build/types/resources/groups/groups_membership_resource.d.ts.map +0 -1
- package/build/types/resources/groups/groups_membership_resource.js +0 -2
- package/build/types/resources/groups/groups_membership_resource.js.map +0 -1
- package/src/hooks/groups/use_groups_proxy.ts +0 -6
- package/src/types/resources/groups/groups_membership_resource.ts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_help_screen.js","names":["useNavigation","useCallback","useMemo","ScrollView","StyleSheet","View","Heading","PressableRow","Text","TextInlineButton","useApiGet","useTheme","useAppName","useOrganization","Linking","jsx","_jsx","jsxs","_jsxs","useHelpUrls","$","_c","t0","Symbol","for","url","data","fields","HelpUrl","t1","t2","undefined","helpUrls","GetHelpScreen","route","params","type","styles","useStyles","appName","navigation","organization","contactPresent","contactEmail","contactPhoneNumber","t3","t4","helpUrl","product","t5","helpUrl_0","includes","filter","appSpecificHelpUrls","navigate","handleNavigateToBugReport","container","t6","length","heading","headingBottomBorder","variant","style","children","t7","map","_temp","t8","name","t9","t10","ContactRow","email","t11","t12","phone","t13","t14","t15","text","t16","contentInsetAdjustmentBehavior","contentContainerStyle","contact","sendEmail","placePhoneCall","onPress","isActive","iconPath","openURL","encodeURI","phoneNumber","colors","borderColorDefaultBase","create","flexGrow","paddingVertical","paddingHorizontal","marginLeft","paddingTop","paddingBottom","paddingLeft","borderBottomWidth","borderBottomColor","headingAux","helpUrl_1","link","title","id"],"sources":["../../src/screens/get_help_screen.tsx"],"sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useCallback, useMemo } from 'react'\nimport { ScrollView, StyleSheet, View } from 'react-native'\nimport { Heading, PressableRow, Text, TextInlineButton } from '../components'\nimport { useApiGet, useTheme } from '../hooks'\nimport { useAppName } from '../hooks/use_app_name'\nimport { useOrganization } from '../hooks/use_organization'\nimport { ResourceObject } from '../types'\nimport { Linking } from '../utils'\n\ntype GetHelpScreenRouteProps = {\n type?: 'chat' | 'general'\n}\n\ntype GetHelpScreenProps = StaticScreenProps<GetHelpScreenRouteProps>\n\ninterface HelpUrlResource extends ResourceObject {\n id: number\n link: string\n title: string\n product: 'services' | 'churchcenter'\n type: 'chat' | 'general'\n}\n\nconst useHelpUrls = () => {\n const { data: helpUrls = [] } = useApiGet<HelpUrlResource[]>({\n url: '/help_urls',\n data: {\n fields: {\n HelpUrl: [],\n },\n },\n })\n\n return helpUrls\n}\n\nexport const GetHelpScreen = ({ route }: GetHelpScreenProps) => {\n const { type = 'chat' } = route.params || {}\n const styles = useStyles()\n const appName = useAppName()\n const navigation = useNavigation()\n const { data: organization } = useOrganization()\n const contactPresent = organization?.contactEmail || organization?.contactPhoneNumber\n const helpUrls = useHelpUrls()\n const appSpecificHelpUrls = useMemo(\n () =>\n helpUrls\n .filter(helpUrl => helpUrl.product === appName)\n .filter(helpUrl => helpUrl.type.includes(type)),\n [helpUrls, appName, type]\n )\n\n const handleNavigateToBugReport = useCallback(() => {\n navigation.navigate('BugReport')\n }, [navigation])\n\n return (\n <ScrollView contentInsetAdjustmentBehavior=\"automatic\" contentContainerStyle={styles.container}>\n {appSpecificHelpUrls.length > 0 && (\n <Heading variant=\"h2\" style={[styles.heading, styles.headingBottomBorder]}>\n How-to articles\n </Heading>\n )}\n {appSpecificHelpUrls.map(helpUrl => (\n <PressableRow\n key={helpUrl.id}\n onPress={() => Linking.openURL(helpUrl.link)}\n text={helpUrl.title}\n isActive={true}\n iconPath=\"general.newWindow\"\n />\n ))}\n {contactPresent && (\n <Heading variant=\"h2\" style={[styles.heading, styles.headingBottomBorder]}>\n Contact {organization?.name}\n </Heading>\n )}\n <ContactRow email={organization?.contactEmail} />\n <ContactRow phone={organization?.contactPhoneNumber} />\n <Heading variant=\"h2\" style={[styles.heading]}>\n Report a bug\n </Heading>\n <View style={styles.text}>\n <Text>\n Having an issue?{' '}\n <TextInlineButton onPress={handleNavigateToBugReport}>\n Submit a bug report\n </TextInlineButton>{' '}\n to the development team.\n </Text>\n </View>\n </ScrollView>\n )\n}\n\nconst ContactRow = ({ email, phone }: { email?: string; phone?: string }) => {\n const contact = email || phone\n if (!contact) return null\n\n return (\n <PressableRow\n onPress={() => {\n if (email) {\n sendEmail(contact)\n } else {\n placePhoneCall(contact)\n }\n }}\n text={contact || ''}\n isActive={true}\n iconPath={email ? 'services.email' : 'general.phone'}\n />\n )\n}\n\nexport function sendEmail(email: string) {\n if (!email) return\n\n Linking.openURL(encodeURI(`mailto:${email}`))\n}\n\nexport function placePhoneCall(phoneNumber: string) {\n if (!phoneNumber) return\n\n Linking.openURL(encodeURI(`tel:${phoneNumber}`))\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n flexGrow: 1,\n },\n text: {\n paddingVertical: 4,\n paddingHorizontal: 16,\n },\n heading: {\n marginLeft: 16,\n paddingTop: 24,\n paddingBottom: 12,\n },\n headingBottomBorder: {\n marginLeft: 16,\n paddingLeft: 0,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n headingAux: {\n paddingTop: 24,\n paddingHorizontal: 16,\n },\n })\n}\n"],"mappings":";AAAA,SAA4BA,aAAa,QAAQ,0BAA0B;AAC3E,SAASC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC5C,SAASC,UAAU,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC3D,SAASC,OAAO,EAAEC,YAAY,EAAEC,IAAI,EAAEC,gBAAgB,QAAQ,eAAe;AAC7E,SAASC,SAAS,EAAEC,QAAQ,QAAQ,UAAU;AAC9C,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,eAAe,QAAQ,2BAA2B;AAE3D,SAASC,OAAO,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAgBlC,MAAMC,WAAW,GAAGA,CAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAF,CAAA,QAAAG,MAAA,CAAAC,GAAA;IAC2CF,EAAA;MAAAG,GAAA,EACtD,YAAY;MAAAC,IAAA,EACX;QAAAC,MAAA,EACI;UAAAC,OAAA,EACG;QACX;MACF;IACF,CAAC;IAAAR,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAPD;IAAAM,IAAA,EAAAG;EAAA,IAAgCnB,SAAS,CAAoBY,EAO5D,CAAC;EAAA,IAAAQ,EAAA;EAAA,IAAAV,CAAA,QAAAS,EAAA;IAPYC,EAAA,GAAAD,EAAa,KAAbE,SAAa,GAAb,EAAa,GAAbF,EAAa;IAAAT,CAAA,MAAAS,EAAA;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AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"get_help_screen.js","names":["useNavigation","useCallback","useMemo","Alert","ScrollView","StyleSheet","View","Heading","PressableRow","Text","TextInlineButton","useApiGet","useTheme","useAppName","useOrganization","Clipboard","Linking","jsx","_jsx","jsxs","_jsxs","useHelpUrls","$","_c","t0","Symbol","for","url","data","fields","HelpUrl","t1","t2","undefined","helpUrls","GetHelpScreen","route","params","type","styles","useStyles","appName","navigation","organization","contactPresent","contactEmail","contactPhoneNumber","t3","t4","helpUrl","product","t5","helpUrl_0","includes","filter","appSpecificHelpUrls","navigate","handleNavigateToBugReport","container","t6","length","heading","headingBottomBorder","variant","style","children","t7","map","_temp","t8","name","t9","t10","ContactRow","email","t11","t12","phone","t13","t14","t15","text","t16","contentInsetAdjustmentBehavior","contentContainerStyle","contact","sendEmail","placePhoneCall","onPress","isActive","iconPath","encodeURI","openURL","catch","alert","setStringAsync","phoneNumber","colors","borderColorDefaultBase","create","flexGrow","paddingVertical","paddingHorizontal","marginLeft","paddingTop","paddingBottom","paddingLeft","borderBottomWidth","borderBottomColor","headingAux","helpUrl_1","link","title","id"],"sources":["../../src/screens/get_help_screen.tsx"],"sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useCallback, useMemo } from 'react'\nimport { Alert, ScrollView, StyleSheet, View } from 'react-native'\nimport { Heading, PressableRow, Text, TextInlineButton } from '../components'\nimport { useApiGet, useTheme } from '../hooks'\nimport { useAppName } from '../hooks/use_app_name'\nimport { useOrganization } from '../hooks/use_organization'\nimport { ResourceObject } from '../types'\nimport { Clipboard, Linking } from '../utils'\n\ntype GetHelpScreenRouteProps = {\n type?: 'chat' | 'general'\n}\n\ntype GetHelpScreenProps = StaticScreenProps<GetHelpScreenRouteProps>\n\ninterface HelpUrlResource extends ResourceObject {\n id: number\n link: string\n title: string\n product: 'services' | 'churchcenter'\n type: 'chat' | 'general'\n}\n\nconst useHelpUrls = () => {\n const { data: helpUrls = [] } = useApiGet<HelpUrlResource[]>({\n url: '/help_urls',\n data: {\n fields: {\n HelpUrl: [],\n },\n },\n })\n\n return helpUrls\n}\n\nexport const GetHelpScreen = ({ route }: GetHelpScreenProps) => {\n const { type = 'chat' } = route.params || {}\n const styles = useStyles()\n const appName = useAppName()\n const navigation = useNavigation()\n const { data: organization } = useOrganization()\n const contactPresent = organization?.contactEmail || organization?.contactPhoneNumber\n const helpUrls = useHelpUrls()\n const appSpecificHelpUrls = useMemo(\n () =>\n helpUrls\n .filter(helpUrl => helpUrl.product === appName)\n .filter(helpUrl => helpUrl.type.includes(type)),\n [helpUrls, appName, type]\n )\n\n const handleNavigateToBugReport = useCallback(() => {\n navigation.navigate('BugReport')\n }, [navigation])\n\n return (\n <ScrollView contentInsetAdjustmentBehavior=\"automatic\" contentContainerStyle={styles.container}>\n {appSpecificHelpUrls.length > 0 && (\n <Heading variant=\"h2\" style={[styles.heading, styles.headingBottomBorder]}>\n How-to articles\n </Heading>\n )}\n {appSpecificHelpUrls.map(helpUrl => (\n <PressableRow\n key={helpUrl.id}\n onPress={() => Linking.openURL(helpUrl.link)}\n text={helpUrl.title}\n isActive={true}\n iconPath=\"general.newWindow\"\n />\n ))}\n {contactPresent && (\n <Heading variant=\"h2\" style={[styles.heading, styles.headingBottomBorder]}>\n Contact {organization?.name}\n </Heading>\n )}\n <ContactRow email={organization?.contactEmail} />\n <ContactRow phone={organization?.contactPhoneNumber} />\n <Heading variant=\"h2\" style={[styles.heading]}>\n Report a bug\n </Heading>\n <View style={styles.text}>\n <Text>\n Having an issue?{' '}\n <TextInlineButton onPress={handleNavigateToBugReport}>\n Submit a bug report\n </TextInlineButton>{' '}\n to the development team.\n </Text>\n </View>\n </ScrollView>\n )\n}\n\nconst ContactRow = ({ email, phone }: { email?: string; phone?: string }) => {\n const contact = email || phone\n if (!contact) return null\n\n return (\n <PressableRow\n onPress={() => {\n if (email) {\n sendEmail(contact)\n } else {\n placePhoneCall(contact)\n }\n }}\n text={contact || ''}\n isActive={true}\n iconPath={email ? 'services.email' : 'general.phone'}\n />\n )\n}\n\nexport function sendEmail(email: string) {\n if (!email) return\n\n const url = encodeURI(`mailto:${email}`)\n\n Linking.openURL(url).catch(() => {\n Alert.alert('Oops', `Unable to open: ${email}`, [\n { text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(email) },\n { text: 'OK' },\n ])\n })\n}\n\nexport function placePhoneCall(phoneNumber: string) {\n if (!phoneNumber) return\n\n const url = encodeURI(`tel:${phoneNumber}`)\n\n Linking.openURL(url).catch(() => {\n Alert.alert('Oops', `Unable to open: ${phoneNumber}`, [\n { text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(phoneNumber) },\n { text: 'OK' },\n ])\n })\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n flexGrow: 1,\n },\n text: {\n paddingVertical: 4,\n paddingHorizontal: 16,\n },\n heading: {\n marginLeft: 16,\n paddingTop: 24,\n paddingBottom: 12,\n },\n headingBottomBorder: {\n marginLeft: 16,\n paddingLeft: 0,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n headingAux: {\n paddingTop: 24,\n paddingHorizontal: 16,\n },\n })\n}\n"],"mappings":";AAAA,SAA4BA,aAAa,QAAQ,0BAA0B;AAC3E,SAASC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC5C,SAASC,KAAK,EAAEC,UAAU,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAClE,SAASC,OAAO,EAAEC,YAAY,EAAEC,IAAI,EAAEC,gBAAgB,QAAQ,eAAe;AAC7E,SAASC,SAAS,EAAEC,QAAQ,QAAQ,UAAU;AAC9C,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,eAAe,QAAQ,2BAA2B;AAE3D,SAASC,SAAS,EAAEC,OAAO,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAgB7C,MAAMC,WA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"","sources":["../../../../src/types/resources/groups/groups_group_resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"groups_group_resource.d.ts","sourceRoot":"","sources":["../../../../src/types/resources/groups/groups_group_resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE;QACX,SAAS,EAAE,MAAM,CAAA;QACjB,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,EAAE,MAAM,CAAA;IACxB,qBAAqB,EAAE,OAAO,CAAA;IAC9B,+BAA+B,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups_group_resource.js","names":[],"sources":["../../../../src/types/resources/groups/groups_group_resource.ts"],"sourcesContent":["import { ResourceObject } from '../../api_primitives'\n\nexport interface GroupsGroupResource extends ResourceObject {\n id: number\n type: 'Group'
|
|
1
|
+
{"version":3,"file":"groups_group_resource.js","names":[],"sources":["../../../../src/types/resources/groups/groups_group_resource.ts"],"sourcesContent":["import { ResourceObject } from '../../api_primitives'\n\nexport interface GroupsGroupResource extends ResourceObject {\n id: number\n type: 'Group'\n headerImage: {\n thumbnail: string\n medium: string\n original: string\n }\n name: string\n membershipsCount: number\n canCreateConversation: boolean\n canCreateConversationReasonCode: string | null\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/resources/groups/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/resources/groups/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/types/resources/groups/index.ts"],"sourcesContent":["export * from './groups_group_resource'\
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/types/resources/groups/index.ts"],"sourcesContent":["export * from './groups_group_resource'\n"],"mappings":"AAAA,cAAc,yBAAyB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/linking.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/linking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,MAAM,qBAAqB,GAAG;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC3E,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAClC,CAAA;AAED,qBAAa,cAAc;IACzB,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;IAClC,UAAU,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;gBAE5B,OAAO,EAAE,cAAc;CAIpC"}
|
|
@@ -1,54 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Clipboard, Log } from './configuration';
|
|
3
|
-
const CONTACT_SCHEME = /^(mailto|tel):/i;
|
|
1
|
+
import { Linking } from 'react-native';
|
|
4
2
|
export class LinkingAdapter {
|
|
5
3
|
constructor(methods) {
|
|
6
|
-
|
|
7
|
-
this.openURL = async (...args) => {
|
|
8
|
-
try {
|
|
9
|
-
await openURL(...args);
|
|
10
|
-
} catch (error) {
|
|
11
|
-
handleOpenFailure(args[0], error);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
4
|
+
this.openURL = methods.openURL.bind(Linking);
|
|
14
5
|
this.canOpenURL = methods.canOpenURL.bind(Linking);
|
|
15
6
|
}
|
|
16
7
|
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* mailto: and tel: links fail for ordinary reasons (no mail app, no phone),
|
|
20
|
-
* so the user gets an alert offering to copy the address. Any other failure
|
|
21
|
-
* is reported through the Log adapter so it stays visible as a handled error.
|
|
22
|
-
*/
|
|
23
|
-
function handleOpenFailure(url, error) {
|
|
24
|
-
if (CONTACT_SCHEME.test(url)) {
|
|
25
|
-
alertUnableToOpen(url);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
Log.reportError(toError(error, url), {
|
|
29
|
-
extra: {
|
|
30
|
-
url
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function alertUnableToOpen(url) {
|
|
35
|
-
const address = readableAddress(url);
|
|
36
|
-
Alert.alert('Oops', `Unable to open: ${address}`, [{
|
|
37
|
-
text: 'Copy to clipboard',
|
|
38
|
-
onPress: () => Clipboard.setStringAsync(address)
|
|
39
|
-
}, {
|
|
40
|
-
text: 'OK'
|
|
41
|
-
}]);
|
|
42
|
-
}
|
|
43
|
-
function readableAddress(url) {
|
|
44
|
-
const address = url.replace(CONTACT_SCHEME, '');
|
|
45
|
-
try {
|
|
46
|
-
return decodeURIComponent(address);
|
|
47
|
-
} catch {
|
|
48
|
-
return address;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function toError(error, url) {
|
|
52
|
-
return error instanceof Error ? error : new Error(`Unable to open URL: ${url}`);
|
|
53
|
-
}
|
|
54
8
|
//# sourceMappingURL=linking.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linking.js","names":["
|
|
1
|
+
{"version":3,"file":"linking.js","names":["Linking","LinkingAdapter","constructor","methods","openURL","bind","canOpenURL"],"sources":["../../../src/utils/native_adapters/linking.ts"],"sourcesContent":["import { Linking } from 'react-native'\n\nexport type LinkingOpenURLOptions = {\n forceOpenInBrowser?: boolean\n}\n\ntype LinkingMethods = {\n openURL: (url: string, options?: LinkingOpenURLOptions) => Promise<unknown>\n canOpenURL: Linking['canOpenURL']\n}\n\nexport class LinkingAdapter {\n openURL: LinkingMethods['openURL']\n canOpenURL: LinkingMethods['canOpenURL']\n\n constructor(methods: LinkingMethods) {\n this.openURL = methods.openURL.bind(Linking)\n this.canOpenURL = methods.canOpenURL.bind(Linking)\n }\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,cAAc;AAWtC,OAAO,MAAMC,cAAc,CAAC;EAI1BC,WAAWA,CAACC,OAAuB,EAAE;IACnC,IAAI,CAACC,OAAO,GAAGD,OAAO,CAACC,OAAO,CAACC,IAAI,CAACL,OAAO,CAAC;IAC5C,IAAI,CAACM,UAAU,GAAGH,OAAO,CAACG,UAAU,CAACD,IAAI,CAACL,OAAO,CAAC;EACpD;AACF","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0-rc.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
35
35
|
"@fortawesome/react-native-fontawesome": "^0.3.2",
|
|
36
|
-
"@planningcenter/emoji-keyboard": "4.
|
|
36
|
+
"@planningcenter/emoji-keyboard": "4.6.0",
|
|
37
37
|
"lodash-inflection": "^1.5.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"sf-symbols-typescript": "^2.2.0",
|
|
85
85
|
"typescript": "~6.0.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "87906659926b0c6fdd3bb2d12f9c4fffdf7c61df"
|
|
88
88
|
}
|
|
@@ -5,11 +5,6 @@ import { buildTestQueryClient } from '../../__utils__/query_client'
|
|
|
5
5
|
import { useGroupChatConversationPayload } from '../../hooks/groups/use_group_chat_conversation_payload'
|
|
6
6
|
import * as useApiClientModule from '../../hooks/use_api_client'
|
|
7
7
|
|
|
8
|
-
const mockGroupsProxy = jest.fn(() => false)
|
|
9
|
-
jest.mock('../../hooks/groups/use_groups_proxy', () => ({
|
|
10
|
-
useGroupsProxy: () => mockGroupsProxy(),
|
|
11
|
-
}))
|
|
12
|
-
|
|
13
8
|
const mockGroupsPost = (impl: jest.Mock) => {
|
|
14
9
|
jest.spyOn(useApiClientModule, 'useApiClient').mockReturnValue({
|
|
15
10
|
groups: { post: impl },
|
|
@@ -27,7 +22,6 @@ const resolveWith = (value: string) =>
|
|
|
27
22
|
describe('useGroupChatConversationPayload', () => {
|
|
28
23
|
afterEach(() => {
|
|
29
24
|
jest.restoreAllMocks()
|
|
30
|
-
mockGroupsProxy.mockReturnValue(false)
|
|
31
25
|
})
|
|
32
26
|
|
|
33
27
|
it('refetches on mount even when a fresh payload is already cached', async () => {
|
|
@@ -53,29 +47,4 @@ describe('useGroupChatConversationPayload', () => {
|
|
|
53
47
|
await waitFor(() => expect(post).toHaveBeenCalledTimes(1))
|
|
54
48
|
await waitFor(() => expect(result.current.payload).toBe('fresh'))
|
|
55
49
|
})
|
|
56
|
-
|
|
57
|
-
it('asks Chat for the payload when Groups loads through Chat', async () => {
|
|
58
|
-
mockGroupsProxy.mockReturnValue(true)
|
|
59
|
-
const post = resolveWith('proxied')
|
|
60
|
-
const groupsPost = jest.fn()
|
|
61
|
-
jest.spyOn(useApiClientModule, 'useApiClient').mockReturnValue({
|
|
62
|
-
chat: { post },
|
|
63
|
-
groups: { post: groupsPost },
|
|
64
|
-
} as unknown as ReturnType<typeof useApiClientModule.useApiClient>)
|
|
65
|
-
const queryClient = buildTestQueryClient()
|
|
66
|
-
const wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
67
|
-
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
const { result } = renderHook(() => useGroupChatConversationPayload({ groupId: 1 }), {
|
|
71
|
-
wrapper,
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
await waitFor(() => expect(result.current.payload).toBe('proxied'))
|
|
75
|
-
expect(post).toHaveBeenCalledWith({
|
|
76
|
-
url: '/me/groups_groups/1/chat_conversation_payload',
|
|
77
|
-
data: { data: { type: 'GroupsChatConversationPayload', attributes: { title: '' } } },
|
|
78
|
-
})
|
|
79
|
-
expect(groupsPost).not.toHaveBeenCalled()
|
|
80
|
-
})
|
|
81
50
|
})
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query'
|
|
2
2
|
import { ApiResource, ResourceObject } from '../../types'
|
|
3
3
|
import { toMs } from '../../utils/time'
|
|
4
|
-
import {
|
|
5
|
-
import { useGroupsProxy } from './use_groups_proxy'
|
|
4
|
+
import { useApiClient } from '../use_api_client'
|
|
6
5
|
|
|
7
6
|
const STALE_TIME_MS = toMs(25, 'minutes') // under Groups' 30-min server-side expiry
|
|
8
7
|
|
|
@@ -13,13 +12,20 @@ interface Props {
|
|
|
13
12
|
|
|
14
13
|
export function useGroupChatConversationPayload({ groupId, enabled = true }: Props) {
|
|
15
14
|
const apiClient = useApiClient()
|
|
16
|
-
const
|
|
17
|
-
const { app, url, data: body } = groupChatConversationPayloadRequest({ groupId, proxied })
|
|
15
|
+
const url = `/me/groups/${groupId}/chat_conversation_payload`
|
|
18
16
|
|
|
19
17
|
const { data, ...rest } = useQuery({
|
|
20
18
|
queryKey: ['groups', url],
|
|
21
19
|
queryFn: () =>
|
|
22
|
-
apiClient
|
|
20
|
+
apiClient.groups.post<ApiResource<GroupChatConversationPayload>>({
|
|
21
|
+
url,
|
|
22
|
+
data: {
|
|
23
|
+
data: {
|
|
24
|
+
type: 'GroupChatConversationPayload',
|
|
25
|
+
attributes: { title: '' },
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
23
29
|
staleTime: STALE_TIME_MS,
|
|
24
30
|
refetchOnMount: 'always',
|
|
25
31
|
enabled,
|
|
@@ -28,31 +34,7 @@ export function useGroupChatConversationPayload({ groupId, enabled = true }: Pro
|
|
|
28
34
|
return { payload: data?.data.value, ...rest }
|
|
29
35
|
}
|
|
30
36
|
|
|
31
|
-
export function groupChatConversationPayloadRequest({
|
|
32
|
-
groupId,
|
|
33
|
-
title = '',
|
|
34
|
-
proxied,
|
|
35
|
-
}: {
|
|
36
|
-
groupId: number
|
|
37
|
-
title?: string
|
|
38
|
-
proxied: boolean
|
|
39
|
-
}): { app: App; url: string; data: object } {
|
|
40
|
-
if (proxied) {
|
|
41
|
-
return {
|
|
42
|
-
app: 'chat',
|
|
43
|
-
url: `/me/groups_groups/${groupId}/chat_conversation_payload`,
|
|
44
|
-
data: { data: { type: 'GroupsChatConversationPayload', attributes: { title } } },
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
app: 'groups',
|
|
50
|
-
url: `/me/groups/${groupId}/chat_conversation_payload`,
|
|
51
|
-
data: { data: { type: 'GroupChatConversationPayload', attributes: { title } } },
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
37
|
interface GroupChatConversationPayload extends ResourceObject {
|
|
56
|
-
type: 'GroupChatConversationPayload'
|
|
38
|
+
type: 'GroupChatConversationPayload'
|
|
57
39
|
value: string
|
|
58
40
|
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { keepPreviousData } from '@tanstack/react-query'
|
|
2
2
|
import { useMemo } from 'react'
|
|
3
3
|
import { MemberResource, ResourceObject } from '../../types'
|
|
4
|
-
import { GroupsMembershipResource } from '../../types/resources/groups'
|
|
5
4
|
import { GroupsGroupMemberResource } from '../../types/resources/groups/groups_member_resource_with_person'
|
|
6
5
|
import { useApiPaginator } from '../use_api'
|
|
7
6
|
import { useEnrichPeople } from '../use_enrich_people'
|
|
8
|
-
import { useGroupsProxy } from './use_groups_proxy'
|
|
9
|
-
|
|
10
|
-
type Membership = GroupsGroupMemberResource | GroupsMembershipResource
|
|
11
7
|
|
|
12
8
|
type UseApiPaginatorResult<T extends ResourceObject> = ReturnType<typeof useApiPaginator<T>>
|
|
13
9
|
|
|
14
10
|
export type GroupMembersForNewConversationResult = Omit<
|
|
15
|
-
UseApiPaginatorResult<
|
|
11
|
+
UseApiPaginatorResult<GroupsGroupMemberResource>, // We are passing our own "members" data shape
|
|
16
12
|
'data'
|
|
17
13
|
> & {
|
|
18
14
|
data: MemberResource[]
|
|
@@ -27,41 +23,20 @@ export function useGroupMembersForNewConversation({
|
|
|
27
23
|
id: number
|
|
28
24
|
gender: string | null
|
|
29
25
|
}) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
GroupsMembership: [
|
|
40
|
-
'role',
|
|
41
|
-
'first_name',
|
|
42
|
-
'last_name',
|
|
43
|
-
'avatar_url',
|
|
44
|
-
'gender',
|
|
45
|
-
'child',
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
...where,
|
|
49
|
-
},
|
|
50
|
-
app: 'chat',
|
|
51
|
-
}
|
|
52
|
-
: {
|
|
53
|
-
url: `/me/groups/${id}/memberships`,
|
|
54
|
-
data: {
|
|
55
|
-
perPage: 100,
|
|
56
|
-
include: ['person'],
|
|
57
|
-
fields: {
|
|
58
|
-
Membership: ['person, role'],
|
|
59
|
-
Person: ['avatar_url', 'name', 'first_name', 'last_name', 'child', 'gender'],
|
|
60
|
-
},
|
|
61
|
-
...where,
|
|
62
|
-
},
|
|
63
|
-
app: 'groups',
|
|
26
|
+
const response = useApiPaginator<GroupsGroupMemberResource>(
|
|
27
|
+
{
|
|
28
|
+
url: `/me/groups/${id}/memberships`,
|
|
29
|
+
data: {
|
|
30
|
+
perPage: 100,
|
|
31
|
+
include: ['person'],
|
|
32
|
+
fields: {
|
|
33
|
+
Membership: ['person, role'],
|
|
34
|
+
Person: ['avatar_url', 'name', 'first_name', 'last_name', 'child', 'gender'],
|
|
64
35
|
},
|
|
36
|
+
...(gender ? { where: { gender } } : {}),
|
|
37
|
+
},
|
|
38
|
+
app: 'groups',
|
|
39
|
+
},
|
|
65
40
|
{
|
|
66
41
|
throwOnError: (_error, query) => query.state.data === undefined,
|
|
67
42
|
placeholderData: keepPreviousData,
|
|
@@ -69,11 +44,11 @@ export function useGroupMembersForNewConversation({
|
|
|
69
44
|
)
|
|
70
45
|
|
|
71
46
|
const { data: memberships = [] } = response
|
|
72
|
-
const
|
|
73
|
-
const personIds = useMemo(() => people.map(person => +person.id), [people])
|
|
47
|
+
const personIds = useMemo(() => memberships.map(m => +m.person.id), [memberships])
|
|
74
48
|
const enrichmentMap = useEnrichPeople({ personIds, groupId: id })
|
|
75
49
|
|
|
76
|
-
const members: MemberResource[] =
|
|
50
|
+
const members: MemberResource[] = memberships.map(membership => {
|
|
51
|
+
const { person } = membership
|
|
77
52
|
const enrichment = enrichmentMap.get(+person.id)
|
|
78
53
|
return {
|
|
79
54
|
type: 'Member',
|
|
@@ -84,7 +59,7 @@ export function useGroupMembersForNewConversation({
|
|
|
84
59
|
id: +person.id,
|
|
85
60
|
name: `${person.firstName} ${person.lastName}`,
|
|
86
61
|
source: [],
|
|
87
|
-
role:
|
|
62
|
+
role: membership.role,
|
|
88
63
|
}
|
|
89
64
|
})
|
|
90
65
|
|
|
@@ -98,9 +73,3 @@ export function useGroupMembersForNewConversation({
|
|
|
98
73
|
childMembers,
|
|
99
74
|
}
|
|
100
75
|
}
|
|
101
|
-
|
|
102
|
-
function membershipPerson(membership: Membership) {
|
|
103
|
-
if (membership.type === 'GroupsMembership') return membership
|
|
104
|
-
|
|
105
|
-
return { ...membership.person, role: membership.role }
|
|
106
|
-
}
|
|
@@ -2,8 +2,6 @@ import { useMutation } from '@tanstack/react-query'
|
|
|
2
2
|
import { ApiResource, ConversationResource, ResourceObject } from '../../types'
|
|
3
3
|
import { throwResponseError } from '../../utils/response_error'
|
|
4
4
|
import { useApiClient } from '../use_api_client'
|
|
5
|
-
import { groupChatConversationPayloadRequest } from './use_group_chat_conversation_payload'
|
|
6
|
-
import { useGroupsProxy } from './use_groups_proxy'
|
|
7
5
|
|
|
8
6
|
interface Props {
|
|
9
7
|
groupId: number
|
|
@@ -14,18 +12,25 @@ interface Props {
|
|
|
14
12
|
|
|
15
13
|
export function useGroupsConversationCreate({ groupId, title, genderId, onSuccess }: Props) {
|
|
16
14
|
const apiClient = useApiClient()
|
|
17
|
-
const proxied = useGroupsProxy()
|
|
18
15
|
|
|
19
16
|
return useMutation({
|
|
20
17
|
throwOnError: true,
|
|
21
18
|
onSuccess: result => {
|
|
22
19
|
onSuccess(result.data.id)
|
|
23
20
|
},
|
|
24
|
-
mutationFn: () =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
mutationFn: () =>
|
|
22
|
+
apiClient.groups
|
|
23
|
+
.post<ApiResource<ChatConversationPayload>>({
|
|
24
|
+
url: `/me/groups/${groupId}/chat_conversation_payload`,
|
|
25
|
+
data: {
|
|
26
|
+
data: {
|
|
27
|
+
type: 'GroupChatConversationPayload',
|
|
28
|
+
attributes: {
|
|
29
|
+
title,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
})
|
|
29
34
|
.then(res => res.data.value)
|
|
30
35
|
.then(payload =>
|
|
31
36
|
apiClient.chat.post<ApiResource<ConversationResource>>({
|
|
@@ -41,8 +46,7 @@ export function useGroupsConversationCreate({ groupId, title, genderId, onSucces
|
|
|
41
46
|
},
|
|
42
47
|
})
|
|
43
48
|
)
|
|
44
|
-
.catch(throwResponseError)
|
|
45
|
-
},
|
|
49
|
+
.catch(throwResponseError),
|
|
46
50
|
})
|
|
47
51
|
}
|
|
48
52
|
|
|
@@ -62,7 +62,6 @@ export const availableFeatures = {
|
|
|
62
62
|
manual_archiving: 'QA_MOBILE_manual_archiving',
|
|
63
63
|
manual_archiving_rollout: 'ROLLOUT_MOBILE_manual_archiving',
|
|
64
64
|
hide_conversations: 'ROLLOUT_hide_conversations',
|
|
65
|
-
groups_proxy: 'ROLLOUT_groups_proxy',
|
|
66
65
|
} as const satisfies Record<string, `${'QA' | 'ROLLOUT'}_${string}`>
|
|
67
66
|
|
|
68
67
|
const featureNames = Object.values(availableFeatures)
|
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
import { GroupsGroupResource } from '../types'
|
|
2
2
|
import { FIVE_MINUTES } from '../utils/time'
|
|
3
|
-
import { useGroupsProxy } from './groups/use_groups_proxy'
|
|
4
3
|
import { useApiPaginator } from './use_api'
|
|
5
4
|
|
|
6
|
-
const GROUP_FIELDS = [
|
|
7
|
-
'can_create_conversation',
|
|
8
|
-
'can_create_conversation_reason_code',
|
|
9
|
-
'name',
|
|
10
|
-
'header_image',
|
|
11
|
-
'memberships_count',
|
|
12
|
-
]
|
|
13
|
-
|
|
14
5
|
export const useGroupsGroups = () => {
|
|
15
|
-
const proxied = useGroupsProxy()
|
|
16
|
-
|
|
17
6
|
return useApiPaginator<GroupsGroupResource>(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
{
|
|
8
|
+
url: '/me/groups',
|
|
9
|
+
data: {
|
|
10
|
+
perPage: 100,
|
|
11
|
+
fields: {
|
|
12
|
+
Group: [
|
|
13
|
+
'can_create_conversation',
|
|
14
|
+
'can_create_conversation_reason_code',
|
|
15
|
+
'name',
|
|
16
|
+
'header_image',
|
|
17
|
+
'memberships_count',
|
|
18
|
+
],
|
|
28
19
|
},
|
|
20
|
+
order: 'name',
|
|
21
|
+
},
|
|
22
|
+
app: 'groups',
|
|
23
|
+
},
|
|
29
24
|
{ staleTime: FIVE_MINUTES }
|
|
30
25
|
)
|
|
31
26
|
}
|
|
@@ -2,7 +2,6 @@ import { useMemo } from 'react'
|
|
|
2
2
|
import { GroupResource, GraphId } from '../types/resources/group_resource'
|
|
3
3
|
import { GroupsGroupResource } from '../types/resources/groups/groups_group_resource'
|
|
4
4
|
import { destructureChatGroupGraphId } from '../utils'
|
|
5
|
-
import { useGroupsProxy } from './groups/use_groups_proxy'
|
|
6
5
|
import { useApiGet } from './use_api'
|
|
7
6
|
import { useNewConversationEntry } from './use_new_conversation_entry'
|
|
8
7
|
|
|
@@ -23,7 +22,6 @@ export function useNewConversationFromFilter(
|
|
|
23
22
|
): NewConversationFromFilter | undefined {
|
|
24
23
|
const { sourceAppName, sourceType, sourceId } = destructureChatGroupGraphId(chatGroupGraphId)
|
|
25
24
|
const entryMode = useNewConversationEntry()
|
|
26
|
-
const proxied = useGroupsProxy()
|
|
27
25
|
const isGroupsGroup = sourceAppName === 'Groups' && sourceType === 'Group'
|
|
28
26
|
const isServicesTeam = sourceAppName === 'Services' && sourceType === 'Team'
|
|
29
27
|
|
|
@@ -33,17 +31,11 @@ export function useNewConversationFromFilter(
|
|
|
33
31
|
)
|
|
34
32
|
|
|
35
33
|
const { data: groupsGroup } = useApiGet<GroupsGroupResource>(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
: {
|
|
43
|
-
url: `/me/groups/${sourceId}`,
|
|
44
|
-
data: { fields: { Group: ['can_create_conversation'] } },
|
|
45
|
-
app: 'groups',
|
|
46
|
-
},
|
|
34
|
+
{
|
|
35
|
+
url: `/me/groups/${sourceId}`,
|
|
36
|
+
data: { fields: { Group: ['can_create_conversation'] } },
|
|
37
|
+
app: 'groups',
|
|
38
|
+
},
|
|
47
39
|
{ enabled: isGroupsGroup && !!sourceId }
|
|
48
40
|
)
|
|
49
41
|
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
useGroupMembersForNewConversation,
|
|
13
13
|
} from '../../../hooks/groups/use_group_members_for_new_conversation'
|
|
14
14
|
import { useGroupsConversationCreate } from '../../../hooks/groups/use_groups_conversation_create'
|
|
15
|
-
import { useGroupsProxy } from '../../../hooks/groups/use_groups_proxy'
|
|
16
15
|
import {
|
|
17
16
|
type AvatarUpdatePayload,
|
|
18
17
|
patchConversationAvatar,
|
|
@@ -51,16 +50,15 @@ export const GroupsForm = ({ groupId, chat_group_graph_id, avatarSelection }: Gr
|
|
|
51
50
|
genderValue,
|
|
52
51
|
isFetching: genderFetching,
|
|
53
52
|
} = useMyGender()
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
)
|
|
53
|
+
const { data: group } = useSuspenseGet<GroupsGroupResource>({
|
|
54
|
+
url: `/me/groups/${groupId}`,
|
|
55
|
+
data: {
|
|
56
|
+
fields: {
|
|
57
|
+
Group: [],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
app: 'groups',
|
|
61
|
+
})
|
|
64
62
|
|
|
65
63
|
const activeGenderId = genderFilterEnabled ? genderId : null
|
|
66
64
|
const activeGenderValue = genderFilterEnabled ? genderValue : null
|