@planningcenter/chat-react-native 3.21.1-rc.0 → 3.21.2-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.
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_select_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAA;AAa9E,eAAO,MAAM,kCAAkC,eAE5C,uCAAuC,sBAuJzC,CAAA"}
1
+ {"version":3,"file":"conversation_select_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAA;AAa9E,eAAO,MAAM,kCAAkC,eAE5C,uCAAuC,sBAwJzC,CAAA"}
@@ -8,6 +8,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
8
8
  import { ViewMoreLinkRow } from './components/view_more_link_row';
9
9
  import { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row';
10
10
  import { useServiceTypesWithTeams } from '../conversation_filter_recipients/hooks/use_service_types_with_teams';
11
+ import { TeamFilterTypes } from '../conversation_filter_recipients/types';
11
12
  import { TeamRecipientRow } from './components/team_recipient_row';
12
13
  import { GroupsRecipientRow } from './components/groups_recipient_row';
13
14
  import { DefaultLoading } from '../../components/page/loading';
@@ -85,15 +86,18 @@ export const ConversationSelectRecipientsScreen = ({ route, }) => {
85
86
  {canCreateServicesConversations && (<View style={styles.section}>
86
87
  <View style={styles.sectionHeader}>
87
88
  <Heading variant="h3">Teams I lead</Heading>
88
- {hasServiceTypes && (<Button style={styles.selectTeamsButton} onPress={() => {
89
- Haptic.impactLight();
90
- navigation.navigate('New', {
91
- screen: 'ConversationFilterRecipients',
92
- params: {
93
- source_app_name: 'Services',
94
- },
95
- });
96
- }} title="Select teams" variant="outline" iconNameLeft="general.search" size="sm"/>)}
89
+ <Button style={styles.selectTeamsButton} onPress={() => {
90
+ Haptic.impactLight();
91
+ navigation.navigate('New', {
92
+ screen: 'ConversationFilterRecipients',
93
+ params: {
94
+ source_app_name: 'Services',
95
+ team_filter_type: hasServiceTypes
96
+ ? TeamFilterTypes.TeamsIlead
97
+ : TeamFilterTypes.All,
98
+ },
99
+ });
100
+ }} title="Select teams" variant="outline" iconNameLeft="general.search" size="sm"/>
97
101
  </View>
98
102
  <View>
99
103
  {isServiceTypesFetching ? (<DefaultLoading />) : hasServiceTypes ? (<>
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_select_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,UAAU,MAAM,kDAAkD,CAAA;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAA;AAChG,OAAO,EAAE,wBAAwB,EAAE,MAAM,sEAAsE,CAAA;AAE/G,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE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igation/native'\nimport React from 'react'\nimport { ScrollView, StyleSheet, View } from 'react-native'\nimport { Button, Heading } from '../../components'\nimport BlankState from '../../components/primitive/blank_state_primitive'\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 { ViewMoreLinkRow } from './components/view_more_link_row'\nimport { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row'\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'\nimport { GroupsRecipientRow } from './components/groups_recipient_row'\nimport { DefaultLoading } from '../../components/page/loading'\nimport { useAppGrants } from '../../hooks'\nimport { Haptic } from '../../utils/native_adapters'\n\nconst MAX_VISIBLE_RECIPIENTS = 5\n\nexport const ConversationSelectRecipientsScreen = ({\n route,\n}: ConversationSelectRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation()\n const appGrants = useAppGrants()\n const canCreateGroupsConversations = appGrants.data?.some(\n g => g.createConversations && g.appName === 'Groups'\n )\n const canCreateServicesConversations = appGrants.data?.some(\n g => g.createConversations && g.appName === 'Services'\n )\n const { data: groups = [], isFetching: isGroupsFetching } = useGroupsGroups()\n const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)\n const visibleGroups = groupsWithCreatePermission.slice(0, MAX_VISIBLE_RECIPIENTS)\n const hasMoreGroups = groupsWithCreatePermission.length > MAX_VISIBLE_RECIPIENTS\n const hasGroupsWithoutChatPermission = groups.length > groupsWithCreatePermission.length\n const showGroupsDisclaimer = hasGroupsWithoutChatPermission && !hasMoreGroups\n\n const handleGroupsNavigateToConversationNew = (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 const handleGroupsViewMore = () => {\n navigation.navigate('New', {\n screen: 'ConversationSelectGroupRecipients',\n params: {\n ...route.params,\n },\n })\n }\n\n const { serviceTypes, isFetching: isServiceTypesFetching } = useServiceTypesWithTeams()\n const visibleServiceTypes = serviceTypes.slice(0, MAX_VISIBLE_RECIPIENTS)\n const hasMoreServiceTypes = serviceTypes.length > MAX_VISIBLE_RECIPIENTS\n const hasServiceTypes = serviceTypes.length > 0\n\n const handleTeamsNavigateToConversationNew = (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 const handleServiceTypesViewMore = () => {\n navigation.navigate('New', {\n screen: 'ConversationSelectTeamsILeadRecipients',\n params: {\n ...route.params,\n },\n })\n }\n\n return (\n <ScrollView contentContainerStyle={styles.contentContainer}>\n {canCreateGroupsConversations && (\n <View style={styles.section}>\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">My groups</Heading>\n </View>\n <View>\n {isGroupsFetching ? (\n <DefaultLoading />\n ) : groupsWithCreatePermission.length === 0 ? (\n <RecipientsBlankState subtitle=\"Join a group with chat enabled and permissions to start a new conversation.\" />\n ) : (\n <>\n {visibleGroups.map(group => {\n return (\n <GroupsRecipientRow\n key={group.id}\n group={group}\n onPress={handleGroupsNavigateToConversationNew}\n />\n )\n })}\n {hasMoreGroups && (\n <ViewMoreLinkRow\n onPress={handleGroupsViewMore}\n accessibilityHint=\"Navigate to a full list of your groups.\"\n />\n )}\n {showGroupsDisclaimer && <GroupsWithoutChatDisclaimerRow />}\n </>\n )}\n </View>\n </View>\n )}\n {canCreateServicesConversations && (\n <View style={styles.section}>\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">Teams I lead</Heading>\n {hasServiceTypes && (\n <Button\n style={styles.selectTeamsButton}\n onPress={() => {\n Haptic.impactLight()\n navigation.navigate('New', {\n screen: 'ConversationFilterRecipients',\n params: {\n source_app_name: 'Services',\n },\n })\n }}\n title=\"Select teams\"\n variant=\"outline\"\n iconNameLeft=\"general.search\"\n size=\"sm\"\n />\n )}\n </View>\n <View>\n {isServiceTypesFetching ? (\n <DefaultLoading />\n ) : hasServiceTypes ? (\n <>\n {visibleServiceTypes.map(serviceType => {\n return (\n <TeamRecipientRow\n key={serviceType.id}\n serviceType={serviceType}\n onPress={handleTeamsNavigateToConversationNew}\n />\n )\n })}\n {hasMoreServiceTypes && (\n <ViewMoreLinkRow\n onPress={handleServiceTypesViewMore}\n accessibilityHint=\"Navigate to a full list of teams you lead.\"\n />\n )}\n </>\n ) : (\n <RecipientsBlankState subtitle=\"You don't lead any teams.\" />\n )}\n </View>\n </View>\n )}\n </ScrollView>\n )\n}\n\nconst RecipientsBlankState = ({ subtitle }: { subtitle: string }) => {\n const styles = useStyles()\n\n return (\n <BlankState.Root style={styles.blankState}>\n <BlankState.Imagery name=\"general.outlinedTextMessage\" />\n <BlankState.Content>\n <BlankState.Text>{subtitle}</BlankState.Text>\n </BlankState.Content>\n </BlankState.Root>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n contentContainer: {\n gap: 24,\n paddingTop: 16,\n paddingBottom: 16 + bottom,\n },\n section: {\n flex: 1,\n },\n sectionHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n paddingHorizontal: 16,\n paddingBottom: 4,\n },\n selectTeamsButton: {},\n blankState: {\n marginTop: 24,\n marginBottom: 48,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"conversation_select_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,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AAC,OAAO,CACtB;IAAA,EAAE,UAAU,CAAC,IAAI,CAAC,CACnB,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,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE,GAAG,MAAM;SAC3B;QACD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,iBAAiB,EAAE,EAAE;YACrB,aAAa,EAAE,CAAC;SACjB;QACD,iBAAiB,EAAE,EAAE;QACrB,UAAU,EAAE;YACV,SAAS,EAAE,EAAE;YACb,YAAY,EAAE,EAAE;SACjB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { ScrollView, StyleSheet, View } from 'react-native'\nimport { Button, Heading } from '../../components'\nimport BlankState from '../../components/primitive/blank_state_primitive'\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 { ViewMoreLinkRow } from './components/view_more_link_row'\nimport { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row'\nimport { useServiceTypesWithTeams } from '../conversation_filter_recipients/hooks/use_service_types_with_teams'\nimport { ServiceTypeWithTeams, TeamFilterTypes } from '../conversation_filter_recipients/types'\nimport { TeamRecipientRow } from './components/team_recipient_row'\nimport { GroupsRecipientRow } from './components/groups_recipient_row'\nimport { DefaultLoading } from '../../components/page/loading'\nimport { useAppGrants } from '../../hooks'\nimport { Haptic } from '../../utils/native_adapters'\n\nconst MAX_VISIBLE_RECIPIENTS = 5\n\nexport const ConversationSelectRecipientsScreen = ({\n route,\n}: ConversationSelectRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation()\n const appGrants = useAppGrants()\n const canCreateGroupsConversations = appGrants.data?.some(\n g => g.createConversations && g.appName === 'Groups'\n )\n const canCreateServicesConversations = appGrants.data?.some(\n g => g.createConversations && g.appName === 'Services'\n )\n const { data: groups = [], isFetching: isGroupsFetching } = useGroupsGroups()\n const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)\n const visibleGroups = groupsWithCreatePermission.slice(0, MAX_VISIBLE_RECIPIENTS)\n const hasMoreGroups = groupsWithCreatePermission.length > MAX_VISIBLE_RECIPIENTS\n const hasGroupsWithoutChatPermission = groups.length > groupsWithCreatePermission.length\n const showGroupsDisclaimer = hasGroupsWithoutChatPermission && !hasMoreGroups\n\n const handleGroupsNavigateToConversationNew = (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 const handleGroupsViewMore = () => {\n navigation.navigate('New', {\n screen: 'ConversationSelectGroupRecipients',\n params: {\n ...route.params,\n },\n })\n }\n\n const { serviceTypes, isFetching: isServiceTypesFetching } = useServiceTypesWithTeams()\n const visibleServiceTypes = serviceTypes.slice(0, MAX_VISIBLE_RECIPIENTS)\n const hasMoreServiceTypes = serviceTypes.length > MAX_VISIBLE_RECIPIENTS\n const hasServiceTypes = serviceTypes.length > 0\n\n const handleTeamsNavigateToConversationNew = (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 const handleServiceTypesViewMore = () => {\n navigation.navigate('New', {\n screen: 'ConversationSelectTeamsILeadRecipients',\n params: {\n ...route.params,\n },\n })\n }\n\n return (\n <ScrollView contentContainerStyle={styles.contentContainer}>\n {canCreateGroupsConversations && (\n <View style={styles.section}>\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">My groups</Heading>\n </View>\n <View>\n {isGroupsFetching ? (\n <DefaultLoading />\n ) : groupsWithCreatePermission.length === 0 ? (\n <RecipientsBlankState subtitle=\"Join a group with chat enabled and permissions to start a new conversation.\" />\n ) : (\n <>\n {visibleGroups.map(group => {\n return (\n <GroupsRecipientRow\n key={group.id}\n group={group}\n onPress={handleGroupsNavigateToConversationNew}\n />\n )\n })}\n {hasMoreGroups && (\n <ViewMoreLinkRow\n onPress={handleGroupsViewMore}\n accessibilityHint=\"Navigate to a full list of your groups.\"\n />\n )}\n {showGroupsDisclaimer && <GroupsWithoutChatDisclaimerRow />}\n </>\n )}\n </View>\n </View>\n )}\n {canCreateServicesConversations && (\n <View style={styles.section}>\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">Teams I lead</Heading>\n <Button\n style={styles.selectTeamsButton}\n onPress={() => {\n Haptic.impactLight()\n navigation.navigate('New', {\n screen: 'ConversationFilterRecipients',\n params: {\n source_app_name: 'Services',\n team_filter_type: hasServiceTypes\n ? TeamFilterTypes.TeamsIlead\n : TeamFilterTypes.All,\n },\n })\n }}\n title=\"Select teams\"\n variant=\"outline\"\n iconNameLeft=\"general.search\"\n size=\"sm\"\n />\n </View>\n <View>\n {isServiceTypesFetching ? (\n <DefaultLoading />\n ) : hasServiceTypes ? (\n <>\n {visibleServiceTypes.map(serviceType => {\n return (\n <TeamRecipientRow\n key={serviceType.id}\n serviceType={serviceType}\n onPress={handleTeamsNavigateToConversationNew}\n />\n )\n })}\n {hasMoreServiceTypes && (\n <ViewMoreLinkRow\n onPress={handleServiceTypesViewMore}\n accessibilityHint=\"Navigate to a full list of teams you lead.\"\n />\n )}\n </>\n ) : (\n <RecipientsBlankState subtitle=\"You don't lead any teams.\" />\n )}\n </View>\n </View>\n )}\n </ScrollView>\n )\n}\n\nconst RecipientsBlankState = ({ subtitle }: { subtitle: string }) => {\n const styles = useStyles()\n\n return (\n <BlankState.Root style={styles.blankState}>\n <BlankState.Imagery name=\"general.outlinedTextMessage\" />\n <BlankState.Content>\n <BlankState.Text>{subtitle}</BlankState.Text>\n </BlankState.Content>\n </BlankState.Root>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n contentContainer: {\n gap: 24,\n paddingTop: 16,\n paddingBottom: 16 + bottom,\n },\n section: {\n flex: 1,\n },\n sectionHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n paddingHorizontal: 16,\n paddingBottom: 4,\n },\n selectTeamsButton: {},\n blankState: {\n marginTop: 24,\n marginBottom: 48,\n },\n })\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "3.21.1-rc.0",
3
+ "version": "3.21.2-rc.0",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -58,5 +58,5 @@
58
58
  "react-native-url-polyfill": "^2.0.0",
59
59
  "typescript": "<5.6.0"
60
60
  },
61
- "gitHead": "4a15c9851e3d8ebe1fee1874c8581d6ae096a8aa"
61
+ "gitHead": "389b3b2f68dd2353c3fddddf9aadd3d90ea60a58"
62
62
  }
@@ -10,7 +10,7 @@ import { ConversationSelectRecipientsScreenProps } from './types/screen_props'
10
10
  import { ViewMoreLinkRow } from './components/view_more_link_row'
11
11
  import { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row'
12
12
  import { useServiceTypesWithTeams } from '../conversation_filter_recipients/hooks/use_service_types_with_teams'
13
- import { ServiceTypeWithTeams } from '../conversation_filter_recipients/types'
13
+ import { ServiceTypeWithTeams, TeamFilterTypes } from '../conversation_filter_recipients/types'
14
14
  import { TeamRecipientRow } from './components/team_recipient_row'
15
15
  import { GroupsRecipientRow } from './components/groups_recipient_row'
16
16
  import { DefaultLoading } from '../../components/page/loading'
@@ -124,24 +124,25 @@ export const ConversationSelectRecipientsScreen = ({
124
124
  <View style={styles.section}>
125
125
  <View style={styles.sectionHeader}>
126
126
  <Heading variant="h3">Teams I lead</Heading>
127
- {hasServiceTypes && (
128
- <Button
129
- style={styles.selectTeamsButton}
130
- onPress={() => {
131
- Haptic.impactLight()
132
- navigation.navigate('New', {
133
- screen: 'ConversationFilterRecipients',
134
- params: {
135
- source_app_name: 'Services',
136
- },
137
- })
138
- }}
139
- title="Select teams"
140
- variant="outline"
141
- iconNameLeft="general.search"
142
- size="sm"
143
- />
144
- )}
127
+ <Button
128
+ style={styles.selectTeamsButton}
129
+ onPress={() => {
130
+ Haptic.impactLight()
131
+ navigation.navigate('New', {
132
+ screen: 'ConversationFilterRecipients',
133
+ params: {
134
+ source_app_name: 'Services',
135
+ team_filter_type: hasServiceTypes
136
+ ? TeamFilterTypes.TeamsIlead
137
+ : TeamFilterTypes.All,
138
+ },
139
+ })
140
+ }}
141
+ title="Select teams"
142
+ variant="outline"
143
+ iconNameLeft="general.search"
144
+ size="sm"
145
+ />
145
146
  </View>
146
147
  <View>
147
148
  {isServiceTypesFetching ? (
@@ -1,8 +0,0 @@
1
- import { TeamResponseItem } from '../../types';
2
- export declare function useTeamsILead(): {
3
- teamsILead: TeamResponseItem[];
4
- isFetching: boolean;
5
- isError: boolean;
6
- noServicesAccess: boolean;
7
- };
8
- //# sourceMappingURL=use_teams_i_lead.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use_teams_i_lead.d.ts","sourceRoot":"","sources":["../../../src/hooks/services/use_teams_i_lead.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9D,wBAAgB,aAAa;;;;;EAgC5B"}
@@ -1,34 +0,0 @@
1
- import { useCallback } from 'react';
2
- import { useApiGet } from '../../hooks/use_api';
3
- export function useTeamsILead() {
4
- const response = useApiGet({
5
- url: `/chat`,
6
- data: {
7
- fields: {
8
- Chat: ['teams_i_lead'],
9
- },
10
- },
11
- app: 'services',
12
- });
13
- const { data, isFetching, isError, error } = response;
14
- const teamsILead = data?.teamsILead || stableEmptyTeamResponseArray;
15
- const hasNoServicesAccess = useCallback(() => {
16
- if (isError && error) {
17
- const errorArray = error;
18
- const allErrors = errorArray.errors.map(e => e.detail);
19
- if (allErrors.some(e => e.includes(NOT_IN_APPLICATION_CODE))) {
20
- return true;
21
- }
22
- }
23
- return false;
24
- }, [isError, error]);
25
- return {
26
- teamsILead,
27
- isFetching,
28
- isError,
29
- noServicesAccess: hasNoServicesAccess(),
30
- };
31
- }
32
- const stableEmptyTeamResponseArray = [];
33
- const NOT_IN_APPLICATION_CODE = 'TRASH_PANDA';
34
- //# sourceMappingURL=use_teams_i_lead.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use_teams_i_lead.js","sourceRoot":"","sources":["../../../src/hooks/services/use_teams_i_lead.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAG/C,MAAM,UAAU,aAAa;IAC3B,MAAM,QAAQ,GAAG,SAAS,CAAuB;QAC/C,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,CAAC,cAAc,CAAC;aACvB;SACF;QACD,GAAG,EAAE,UAAU;KAChB,CAAC,CAAA;IAEF,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAA;IAErD,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,IAAI,4BAA4B,CAAA;IAEnE,MAAM,mBAAmB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC3C,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;YACrB,MAAM,UAAU,GAAG,KAAK,CAAA;YACxB,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;YACtD,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC;gBAC7D,OAAO,IAAI,CAAA;YACb,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;IAEpB,OAAO;QACL,UAAU;QACV,UAAU;QACV,OAAO;QACP,gBAAgB,EAAE,mBAAmB,EAAE;KACxC,CAAA;AACH,CAAC;AAMD,MAAM,4BAA4B,GAAuB,EAAE,CAAA;AAC3D,MAAM,uBAAuB,GAAG,aAAa,CAAA","sourcesContent":["import { useCallback } from 'react'\nimport { useApiGet } from '../../hooks/use_api'\nimport { ResourceObject, TeamResponseItem } from '../../types'\n\nexport function useTeamsILead() {\n const response = useApiGet<ServicesChatResource>({\n url: `/chat`,\n data: {\n fields: {\n Chat: ['teams_i_lead'],\n },\n },\n app: 'services',\n })\n\n const { data, isFetching, isError, error } = response\n\n const teamsILead = data?.teamsILead || stableEmptyTeamResponseArray\n\n const hasNoServicesAccess = useCallback(() => {\n if (isError && error) {\n const errorArray = error\n const allErrors = errorArray.errors.map(e => e.detail)\n if (allErrors.some(e => e.includes(NOT_IN_APPLICATION_CODE))) {\n return true\n }\n }\n return false\n }, [isError, error])\n\n return {\n teamsILead,\n isFetching,\n isError,\n noServicesAccess: hasNoServicesAccess(),\n }\n}\n\ninterface ServicesChatResource extends ResourceObject {\n teamsILead: TeamResponseItem[]\n}\n\nconst stableEmptyTeamResponseArray: TeamResponseItem[] = []\nconst NOT_IN_APPLICATION_CODE = 'TRASH_PANDA'\n"]}
@@ -1,44 +0,0 @@
1
- import { useCallback } from 'react'
2
- import { useApiGet } from '../../hooks/use_api'
3
- import { ResourceObject, TeamResponseItem } from '../../types'
4
-
5
- export function useTeamsILead() {
6
- const response = useApiGet<ServicesChatResource>({
7
- url: `/chat`,
8
- data: {
9
- fields: {
10
- Chat: ['teams_i_lead'],
11
- },
12
- },
13
- app: 'services',
14
- })
15
-
16
- const { data, isFetching, isError, error } = response
17
-
18
- const teamsILead = data?.teamsILead || stableEmptyTeamResponseArray
19
-
20
- const hasNoServicesAccess = useCallback(() => {
21
- if (isError && error) {
22
- const errorArray = error
23
- const allErrors = errorArray.errors.map(e => e.detail)
24
- if (allErrors.some(e => e.includes(NOT_IN_APPLICATION_CODE))) {
25
- return true
26
- }
27
- }
28
- return false
29
- }, [isError, error])
30
-
31
- return {
32
- teamsILead,
33
- isFetching,
34
- isError,
35
- noServicesAccess: hasNoServicesAccess(),
36
- }
37
- }
38
-
39
- interface ServicesChatResource extends ResourceObject {
40
- teamsILead: TeamResponseItem[]
41
- }
42
-
43
- const stableEmptyTeamResponseArray: TeamResponseItem[] = []
44
- const NOT_IN_APPLICATION_CODE = 'TRASH_PANDA'