@planningcenter/chat-react-native 3.24.4 → 3.25.0-rc.1

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.
Files changed (86) hide show
  1. package/build/components/conversations/conversation_actions.js +3 -3
  2. package/build/components/conversations/conversation_actions.js.map +1 -1
  3. package/build/components/conversations/conversations.d.ts.map +1 -1
  4. package/build/components/conversations/conversations.js +1 -0
  5. package/build/components/conversations/conversations.js.map +1 -1
  6. package/build/hooks/use_conversation.d.ts.map +1 -1
  7. package/build/hooks/use_conversation.js +13 -1
  8. package/build/hooks/use_conversation.js.map +1 -1
  9. package/build/hooks/use_conversation_membership.d.ts +5 -0
  10. package/build/hooks/use_conversation_membership.d.ts.map +1 -0
  11. package/build/hooks/use_conversation_membership.js +63 -0
  12. package/build/hooks/use_conversation_membership.js.map +1 -0
  13. package/build/hooks/use_conversations_actions.d.ts.map +1 -1
  14. package/build/hooks/use_conversations_actions.js +4 -0
  15. package/build/hooks/use_conversations_actions.js.map +1 -1
  16. package/build/hooks/use_features.d.ts +1 -0
  17. package/build/hooks/use_features.d.ts.map +1 -1
  18. package/build/hooks/use_features.js +1 -0
  19. package/build/hooks/use_features.js.map +1 -1
  20. package/build/navigation/index.d.ts +10 -0
  21. package/build/navigation/index.d.ts.map +1 -1
  22. package/build/navigation/index.js +12 -2
  23. package/build/navigation/index.js.map +1 -1
  24. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  25. package/build/screens/conversation_details_screen.js +50 -16
  26. package/build/screens/conversation_details_screen.js.map +1 -1
  27. package/build/screens/conversation_notification_level_select_screen.d.ts +8 -0
  28. package/build/screens/conversation_notification_level_select_screen.d.ts.map +1 -0
  29. package/build/screens/conversation_notification_level_select_screen.js +49 -0
  30. package/build/screens/conversation_notification_level_select_screen.js.map +1 -0
  31. package/build/screens/conversation_screen.d.ts +3 -1
  32. package/build/screens/conversation_screen.d.ts.map +1 -1
  33. package/build/screens/conversation_screen.js +16 -5
  34. package/build/screens/conversation_screen.js.map +1 -1
  35. package/build/screens/group_notification_level_select_screen.d.ts +8 -0
  36. package/build/screens/group_notification_level_select_screen.d.ts.map +1 -0
  37. package/build/screens/group_notification_level_select_screen.js +40 -0
  38. package/build/screens/group_notification_level_select_screen.js.map +1 -0
  39. package/build/screens/group_notification_settings_screen.d.ts.map +1 -1
  40. package/build/screens/group_notification_settings_screen.js +30 -17
  41. package/build/screens/group_notification_settings_screen.js.map +1 -1
  42. package/build/screens/notification_settings/hooks/groups.d.ts +6 -5
  43. package/build/screens/notification_settings/hooks/groups.d.ts.map +1 -1
  44. package/build/screens/notification_settings/hooks/groups.js +63 -36
  45. package/build/screens/notification_settings/hooks/groups.js.map +1 -1
  46. package/build/screens/notification_settings_screen.d.ts.map +1 -1
  47. package/build/screens/notification_settings_screen.js +25 -11
  48. package/build/screens/notification_settings_screen.js.map +1 -1
  49. package/build/types/resources/conversation.d.ts +2 -3
  50. package/build/types/resources/conversation.d.ts.map +1 -1
  51. package/build/types/resources/conversation.js.map +1 -1
  52. package/build/types/resources/conversation_membership.d.ts +16 -0
  53. package/build/types/resources/conversation_membership.d.ts.map +1 -0
  54. package/build/types/resources/conversation_membership.js +2 -0
  55. package/build/types/resources/conversation_membership.js.map +1 -0
  56. package/build/types/resources/group_membership.d.ts +7 -0
  57. package/build/types/resources/group_membership.d.ts.map +1 -1
  58. package/build/types/resources/group_membership.js.map +1 -1
  59. package/build/types/resources/index.d.ts +1 -0
  60. package/build/types/resources/index.d.ts.map +1 -1
  61. package/build/types/resources/index.js +1 -0
  62. package/build/types/resources/index.js.map +1 -1
  63. package/build/utils/deep_snake_case_keys.d.ts +4 -0
  64. package/build/utils/deep_snake_case_keys.d.ts.map +1 -0
  65. package/build/utils/deep_snake_case_keys.js +13 -0
  66. package/build/utils/deep_snake_case_keys.js.map +1 -0
  67. package/package.json +2 -2
  68. package/src/components/conversations/conversation_actions.tsx +3 -3
  69. package/src/components/conversations/conversations.tsx +1 -0
  70. package/src/hooks/use_conversation.ts +13 -1
  71. package/src/hooks/use_conversation_membership.ts +91 -0
  72. package/src/hooks/use_conversations_actions.ts +4 -0
  73. package/src/hooks/use_features.ts +1 -0
  74. package/src/navigation/index.tsx +19 -1
  75. package/src/screens/conversation_details_screen.tsx +87 -22
  76. package/src/screens/conversation_notification_level_select_screen.tsx +73 -0
  77. package/src/screens/conversation_screen.tsx +18 -4
  78. package/src/screens/group_notification_level_select_screen.tsx +62 -0
  79. package/src/screens/group_notification_settings_screen.tsx +53 -18
  80. package/src/screens/notification_settings/hooks/groups.ts +76 -37
  81. package/src/screens/notification_settings_screen.tsx +24 -21
  82. package/src/types/resources/conversation.ts +2 -3
  83. package/src/types/resources/conversation_membership.ts +17 -0
  84. package/src/types/resources/group_membership.ts +7 -0
  85. package/src/types/resources/index.ts +1 -0
  86. package/src/utils/deep_snake_case_keys.ts +16 -0
@@ -5,9 +5,13 @@ import { FlatList, Platform, StyleSheet, View } from 'react-native';
5
5
  import { Badge, Heading, Icon, Text } from '../components';
6
6
  import { HeaderTextButton } from '../components/display/platform_modal_header_buttons';
7
7
  import { useTheme } from '../hooks';
8
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
8
9
  import { isDefined } from '../types';
9
10
  import { useGroups } from './notification_settings/hooks/groups';
10
11
  import { useChatTypes } from './preferred_app/hooks/use_chat_types';
12
+ // =========================================
13
+ // ====== Factory Constants & Types ========
14
+ // =========================================
11
15
  var SectionTypes;
12
16
  (function (SectionTypes) {
13
17
  SectionTypes[SectionTypes["header"] = 0] = "header";
@@ -62,14 +66,14 @@ export function NotificationSettingsScreen({}) {
62
66
  showBottomBorder: true,
63
67
  })),
64
68
  {
65
- type: SectionTypes.header,
69
+ type: groups.length === 0 ? SectionTypes.hidden : SectionTypes.header,
66
70
  data: {
67
71
  title: 'Manage chat settings',
68
72
  },
69
73
  sectionInnerStyle: styles.sectionInnerHeader,
70
74
  },
71
75
  {
72
- type: SectionTypes.view,
76
+ type: groups.length === 0 ? SectionTypes.hidden : SectionTypes.view,
73
77
  data: {
74
78
  children: (<Text variant="tertiary" style={styles.sectionDescription}>
75
79
  Notification settings for all of your group, team and event related conversations
@@ -81,6 +85,7 @@ export function NotificationSettingsScreen({}) {
81
85
  type: SectionTypes.link,
82
86
  data: {
83
87
  title: group.name,
88
+ subtitle: group.myGroupMembership?.notificationLevelDescription,
84
89
  rightLabel: group.sourceType,
85
90
  onPress: () => navigation.navigate('GroupNotificationSettings', {
86
91
  groupId: group.id,
@@ -117,6 +122,7 @@ export function NotificationSettingsScreen({}) {
117
122
  return (<ListSection isStart={isStart} isEnd={isEnd} showBottomBorder={item?.showBottomBorder} outerStyle={item?.sectionOuterStyle} innerStyle={item?.sectionInnerStyle}>
118
123
  <LinkRow {...item.data}/>
119
124
  </ListSection>);
125
+ case SectionTypes.hidden:
120
126
  default:
121
127
  return null;
122
128
  }
@@ -142,14 +148,17 @@ function SettingRow({ title, style, rightLabel, rightItem, rightItemStyle = {} }
142
148
  {Boolean(rightItem) && <View style={rightItemStyle}>{rightItem}</View>}
143
149
  </View>);
144
150
  }
145
- function LinkRow({ title, rightLabel, onPress }) {
151
+ function LinkRow({ title, subtitle, rightLabel, onPress }) {
146
152
  const styles = useLinkRowStyles();
147
153
  const isSourceType = rightLabel === 'Team' || rightLabel === 'Group' || rightLabel === 'PlanTeam';
148
154
  return (<PlatformPressable style={styles.row} onPress={onPress} accessibilityRole="link" accessibilityLabel={title} accessibilityHint={`Navigate to ${title} settings`}>
149
155
  <View style={styles.innerContainer}>
150
- <Text style={styles.title} numberOfLines={2}>
151
- {title}
152
- </Text>
156
+ <View style={styles.leftContent}>
157
+ <Text style={styles.title} numberOfLines={2}>
158
+ {title}
159
+ </Text>
160
+ {Boolean(subtitle) && <Text variant="footnote">{subtitle}</Text>}
161
+ </View>
153
162
  <View style={styles.rightContent}>
154
163
  {isSourceType ? (<Badge label={rightLabel} appearance="neutral" variant="meta"/>) : (<Text numberOfLines={1} style={styles.rightLabelText}>
155
164
  {rightLabel}
@@ -164,12 +173,15 @@ function LinkRow({ title, rightLabel, onPress }) {
164
173
  // =================================
165
174
  const useStyles = ({} = {}) => {
166
175
  const { colors } = useTheme();
176
+ const { bottom } = useSafeAreaInsets();
167
177
  const headerBottomPadding = 0;
168
178
  return StyleSheet.create({
169
179
  listContainer: {
170
180
  flex: 1,
171
181
  },
172
- contentContainer: {},
182
+ contentContainer: {
183
+ paddingBottom: bottom,
184
+ },
173
185
  sectionOuterBase: {
174
186
  paddingLeft: 16,
175
187
  },
@@ -178,6 +190,7 @@ const useStyles = ({} = {}) => {
178
190
  paddingVertical: 16,
179
191
  },
180
192
  sectionInnerHeader: {
193
+ paddingTop: 24,
181
194
  paddingBottom: headerBottomPadding,
182
195
  },
183
196
  sectionInnerBottomBorder: {
@@ -214,15 +227,16 @@ const useLinkRowStyles = () => {
214
227
  justifyContent: 'space-between',
215
228
  gap: 12,
216
229
  },
230
+ leftContent: {
231
+ flex: 1,
232
+ gap: 4,
233
+ },
217
234
  rightContent: {
218
235
  flexDirection: 'row',
219
236
  alignItems: 'center',
220
237
  gap: 8,
221
238
  },
222
- title: {
223
- flexShrink: 1,
224
- alignSelf: 'center',
225
- },
239
+ title: {},
226
240
  rightLabelText: {
227
241
  color: theme.colors.textColorDefaultSecondary,
228
242
  },
@@ -1 +1 @@
1
- {"version":3,"file":"notification_settings_screen.js","sourceRoot":"","sources":["../../src/screens/notification_settings_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE3E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAkB,MAAM,OAAO,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAkC,MAAM,cAAc,CAAA;AACnG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MA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import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport type { NativeStackNavigationProp } from '@react-navigation/native-stack'\nimport React, { useCallback, useEffect, type ReactNode } from 'react'\nimport { FlatList, Platform, StyleSheet, View, type ViewProps, type ViewStyle } from 'react-native'\nimport { Badge, Heading, Icon, Text } from '../components'\nimport { HeaderTextButton } from '../components/display/platform_modal_header_buttons'\nimport { useTheme } from '../hooks'\nimport { isDefined } from '../types'\nimport type { GroupNotificationSettingsScreenProps } from './group_notification_settings_screen'\nimport { useGroups } from './notification_settings/hooks/groups'\nimport { useChatTypes } from './preferred_app/hooks/use_chat_types'\nimport type { PreferredAppSelectionScreenProps } from './preferred_app_selection_screen'\n\n// =========================================\n// ====== Factory Constants & Types ========\n// =========================================\n\ntype NotificationSettingsStackParamList = {\n NotificationSettings: {}\n PreferredAppSelection: PreferredAppSelectionScreenProps['route']['params']\n GroupNotificationSettings: GroupNotificationSettingsScreenProps['route']['params']\n}\n\nenum SectionTypes {\n header,\n hidden,\n setting,\n view,\n link,\n}\n\ntype SectionListData = Array<\n | DataItem<{ title: string }, SectionTypes.header>\n | DataItem<ViewProps, SectionTypes.view>\n | DataItem<SettingRowProps, SectionTypes.setting>\n | DataItem<LinkRowProps, SectionTypes.link>\n | DataItem<any, SectionTypes.hidden>\n>\n\ninterface DataItem<T, TName extends SectionTypes> {\n type: TName\n data: T\n sectionOuterStyle?: ViewStyle\n sectionInnerStyle?: ViewStyle\n showBottomBorder?: boolean\n}\n\n// =================================\n// ====== Components ===============\n// =================================\n\nexport type NotificationSettingsScreenProps = StaticScreenProps<{}>\n\nexport function NotificationSettingsScreen({}: NotificationSettingsScreenProps) {\n const navigation = useNavigation<NativeStackNavigationProp<NotificationSettingsStackParamList>>()\n const styles = useStyles()\n const { data: chatTypes } = useChatTypes()\n const { data: groups } = useGroups()\n\n // Header configuration\n const HeaderRight = useCallback(() => {\n return (\n <HeaderTextButton\n onPress={() => {\n // Save settings logic would go here\n navigation.goBack()\n }}\n title=\"Done\"\n />\n )\n }, [navigation])\n\n useEffect(() => {\n navigation.setOptions({\n headerRight: HeaderRight,\n })\n }, [HeaderRight, navigation])\n\n // Build section data\n const listData = [\n {\n type: SectionTypes.header,\n data: { title: 'Preferred app' },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: SectionTypes.view,\n data: {\n children: (\n <Text variant=\"tertiary\" style={styles.sectionDescription}>\n Choose which app receives each type of chat notification\n </Text>\n ),\n },\n showBottomBorder: true,\n },\n ...chatTypes.map(type => ({\n type: SectionTypes.link,\n data: {\n title: `${type.title} Conversations`,\n rightLabel: type.preferredApp,\n onPress: () =>\n navigation.navigate('PreferredAppSelection', {\n chatTypeId: type.id,\n }),\n },\n sectionInnerStyle: { paddingVertical: 0 },\n showBottomBorder: true,\n })),\n {\n type: SectionTypes.header,\n data: {\n title: 'Manage chat settings',\n },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: SectionTypes.view,\n data: {\n children: (\n <Text variant=\"tertiary\" style={styles.sectionDescription}>\n Notification settings for all of your group, team and event related conversations\n </Text>\n ),\n },\n showBottomBorder: true,\n },\n ...groups.map(group => ({\n type: SectionTypes.link,\n data: {\n title: group.name,\n rightLabel: group.sourceType,\n onPress: () =>\n navigation.navigate('GroupNotificationSettings', {\n groupId: group.id,\n title: group.name || 'Group',\n }),\n },\n sectionInnerStyle: { paddingVertical: 0 },\n showBottomBorder: true,\n })),\n ].filter(item => item.type !== SectionTypes.hidden)\n\n const headerIndices = listData\n .map(({ type }, index) => (type === SectionTypes.header ? index : undefined))\n .filter(isDefined)\n\n return (\n <View style={styles.listContainer}>\n <FlatList\n data={listData as SectionListData}\n contentContainerStyle={styles.contentContainer}\n renderItem={({ item, index }) => {\n const [isStart, isEnd] = [\n index === 0 || headerIndices.includes(index),\n index === listData.length - 1 || headerIndices.includes(index + 1),\n ]\n\n switch (item.type) {\n case SectionTypes.header:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <Heading variant=\"h2\">{item.data.title}</Heading>\n </ListSection>\n )\n case SectionTypes.setting:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <SettingRow {...item.data} />\n </ListSection>\n )\n case SectionTypes.view:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <View {...item.data} style={item.data.style} />\n </ListSection>\n )\n case SectionTypes.link:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <LinkRow {...item.data} />\n </ListSection>\n )\n default:\n return null\n }\n }}\n />\n </View>\n )\n}\n\ninterface ListSectionProps {\n isStart?: boolean\n isEnd?: boolean\n showBottomBorder?: boolean\n outerStyle?: ViewStyle\n innerStyle?: ViewStyle\n children: ReactNode\n}\n\nfunction ListSection({\n isStart,\n isEnd,\n showBottomBorder,\n outerStyle,\n innerStyle,\n children,\n}: ListSectionProps) {\n const styles = useStyles({ isStart, isEnd })\n const bottomBorder = showBottomBorder ? styles.sectionInnerBottomBorder : {}\n\n return (\n <View style={[styles.sectionOuterBase, outerStyle]}>\n <View style={[styles.sectionInnerBase, bottomBorder, innerStyle]}>{children}</View>\n </View>\n )\n}\n\ninterface SettingRowProps {\n title: string\n style?: ViewStyle\n rightItem?: ReactNode\n rightLabel?: string\n rightItemStyle?: ViewStyle\n}\n\nfunction SettingRow({ title, style, rightLabel, rightItem, rightItemStyle = {} }: SettingRowProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.settingRow, style]}>\n <View style={styles.settingRowContent}>\n <Text variant=\"plain\" style={styles.settingRowText}>\n {title}\n </Text>\n {Boolean(rightLabel) && <Text variant=\"footnote\">{rightLabel}</Text>}\n </View>\n {Boolean(rightItem) && <View style={rightItemStyle}>{rightItem}</View>}\n </View>\n )\n}\n\ninterface LinkRowProps {\n title: string\n rightLabel: string\n onPress: () => void\n}\n\nfunction LinkRow({ title, rightLabel, onPress }: LinkRowProps) {\n const styles = useLinkRowStyles()\n const isSourceType = rightLabel === 'Team' || rightLabel === 'Group' || rightLabel === 'PlanTeam'\n\n return (\n <PlatformPressable\n style={styles.row}\n onPress={onPress}\n accessibilityRole=\"link\"\n accessibilityLabel={title}\n accessibilityHint={`Navigate to ${title} settings`}\n >\n <View style={styles.innerContainer}>\n <Text style={styles.title} numberOfLines={2}>\n {title}\n </Text>\n <View style={styles.rightContent}>\n {isSourceType ? (\n <Badge label={rightLabel} appearance=\"neutral\" variant=\"meta\" />\n ) : (\n <Text numberOfLines={1} style={styles.rightLabelText}>\n {rightLabel}\n </Text>\n )}\n {Platform.OS === 'ios' && (\n <Icon name=\"general.rightChevron\" size={16} style={styles.icon} />\n )}\n </View>\n </View>\n </PlatformPressable>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({}: { isStart?: boolean; isEnd?: boolean } = {}) => {\n const { colors } = useTheme()\n const headerBottomPadding = 0\n\n return StyleSheet.create({\n listContainer: {\n flex: 1,\n },\n contentContainer: {},\n sectionOuterBase: {\n paddingLeft: 16,\n },\n sectionInnerBase: {\n paddingRight: 16,\n paddingVertical: 16,\n },\n sectionInnerHeader: {\n paddingBottom: headerBottomPadding,\n },\n sectionInnerBottomBorder: {\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n sectionDescription: {\n color: colors.textColorDefaultSecondary,\n },\n settingRow: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n gap: 8,\n },\n settingRowContent: {\n flex: 1,\n },\n settingRowText: {\n lineHeight: 20,\n },\n })\n}\n\nconst useLinkRowStyles = () => {\n const theme = useTheme()\n\n return StyleSheet.create({\n row: {\n paddingLeft: 0,\n paddingVertical: 16,\n },\n innerContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 12,\n },\n rightContent: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n title: {\n flexShrink: 1,\n alignSelf: 'center',\n },\n rightLabelText: {\n color: theme.colors.textColorDefaultSecondary,\n },\n icon: {\n color: theme.colors.iconColorDefaultDisabled,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"notification_settings_screen.js","sourceRoot":"","sources":["../../src/screens/notification_settings_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAkB,MAAM,OAAO,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAkC,MAAM,cAAc,CAAA;AACnG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAA;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AAEnE,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAK,YAMJ;AAND,WAAK,YAAY;IACf,mDAAM,CAAA;IACN,mDAAM,CAAA;IACN,qDAAO,CAAA;IACP,+CAA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;SACP;QACD,KAAK,EAAE,EAAE;QACT,cAAc,EAAE;YACd,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,yBAAyB;SAC9C;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,wBAAwB;SAC7C;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, { useCallback, useEffect, type ReactNode } from 'react'\nimport { FlatList, Platform, StyleSheet, View, type ViewProps, type ViewStyle } from 'react-native'\nimport { Badge, Heading, Icon, Text } from '../components'\nimport { HeaderTextButton } from '../components/display/platform_modal_header_buttons'\nimport { useTheme } from '../hooks'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { isDefined } from '../types'\nimport { useGroups } from './notification_settings/hooks/groups'\nimport { useChatTypes } from './preferred_app/hooks/use_chat_types'\n\n// =========================================\n// ====== Factory Constants & Types ========\n// =========================================\n\nenum SectionTypes {\n header,\n hidden,\n setting,\n view,\n link,\n}\n\ntype SectionListData = Array<\n | DataItem<{ title: string }, SectionTypes.header>\n | DataItem<ViewProps, SectionTypes.view>\n | DataItem<SettingRowProps, SectionTypes.setting>\n | DataItem<LinkRowProps, SectionTypes.link>\n | DataItem<any, SectionTypes.hidden>\n>\n\ninterface DataItem<T, TName extends SectionTypes> {\n type: TName\n data: T\n sectionOuterStyle?: ViewStyle\n sectionInnerStyle?: ViewStyle\n showBottomBorder?: boolean\n}\n\n// =================================\n// ====== Components ===============\n// =================================\n\nexport type NotificationSettingsScreenProps = StaticScreenProps<{}>\n\nexport function NotificationSettingsScreen({}: NotificationSettingsScreenProps) {\n const navigation = useNavigation()\n const styles = useStyles()\n const { data: chatTypes } = useChatTypes()\n const { data: groups } = useGroups()\n\n // Header configuration\n const HeaderRight = useCallback(() => {\n return (\n <HeaderTextButton\n onPress={() => {\n // Save settings logic would go here\n navigation.goBack()\n }}\n title=\"Done\"\n />\n )\n }, [navigation])\n\n useEffect(() => {\n navigation.setOptions({\n headerRight: HeaderRight,\n })\n }, [HeaderRight, navigation])\n\n // Build section data\n const listData = [\n {\n type: SectionTypes.header,\n data: { title: 'Preferred app' },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: SectionTypes.view,\n data: {\n children: (\n <Text variant=\"tertiary\" style={styles.sectionDescription}>\n Choose which app receives each type of chat notification\n </Text>\n ),\n },\n showBottomBorder: true,\n },\n ...chatTypes.map(type => ({\n type: SectionTypes.link,\n data: {\n title: `${type.title} Conversations`,\n rightLabel: type.preferredApp,\n onPress: () =>\n navigation.navigate('PreferredAppSelection', {\n chatTypeId: type.id,\n }),\n },\n sectionInnerStyle: { paddingVertical: 0 },\n showBottomBorder: true,\n })),\n {\n type: groups.length === 0 ? SectionTypes.hidden : SectionTypes.header,\n data: {\n title: 'Manage chat settings',\n },\n sectionInnerStyle: styles.sectionInnerHeader,\n },\n {\n type: groups.length === 0 ? SectionTypes.hidden : SectionTypes.view,\n data: {\n children: (\n <Text variant=\"tertiary\" style={styles.sectionDescription}>\n Notification settings for all of your group, team and event related conversations\n </Text>\n ),\n },\n showBottomBorder: true,\n },\n ...groups.map(group => ({\n type: SectionTypes.link,\n data: {\n title: group.name,\n subtitle: group.myGroupMembership?.notificationLevelDescription,\n rightLabel: group.sourceType,\n onPress: () =>\n navigation.navigate('GroupNotificationSettings', {\n groupId: group.id,\n title: group.name || 'Group',\n }),\n },\n sectionInnerStyle: { paddingVertical: 0 },\n showBottomBorder: true,\n })),\n ].filter(item => item.type !== SectionTypes.hidden)\n\n const headerIndices = listData\n .map(({ type }, index) => (type === SectionTypes.header ? index : undefined))\n .filter(isDefined)\n\n return (\n <View style={styles.listContainer}>\n <FlatList\n data={listData as SectionListData}\n contentContainerStyle={styles.contentContainer}\n renderItem={({ item, index }) => {\n const [isStart, isEnd] = [\n index === 0 || headerIndices.includes(index),\n index === listData.length - 1 || headerIndices.includes(index + 1),\n ]\n\n switch (item.type) {\n case SectionTypes.header:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <Heading variant=\"h2\">{item.data.title}</Heading>\n </ListSection>\n )\n case SectionTypes.setting:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <SettingRow {...item.data} />\n </ListSection>\n )\n case SectionTypes.view:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <View {...item.data} style={item.data.style} />\n </ListSection>\n )\n case SectionTypes.link:\n return (\n <ListSection\n isStart={isStart}\n isEnd={isEnd}\n showBottomBorder={item?.showBottomBorder}\n outerStyle={item?.sectionOuterStyle}\n innerStyle={item?.sectionInnerStyle}\n >\n <LinkRow {...item.data} />\n </ListSection>\n )\n case SectionTypes.hidden:\n default:\n return null\n }\n }}\n />\n </View>\n )\n}\n\ninterface ListSectionProps {\n isStart?: boolean\n isEnd?: boolean\n showBottomBorder?: boolean\n outerStyle?: ViewStyle\n innerStyle?: ViewStyle\n children: ReactNode\n}\n\nfunction ListSection({\n isStart,\n isEnd,\n showBottomBorder,\n outerStyle,\n innerStyle,\n children,\n}: ListSectionProps) {\n const styles = useStyles({ isStart, isEnd })\n const bottomBorder = showBottomBorder ? styles.sectionInnerBottomBorder : {}\n\n return (\n <View style={[styles.sectionOuterBase, outerStyle]}>\n <View style={[styles.sectionInnerBase, bottomBorder, innerStyle]}>{children}</View>\n </View>\n )\n}\n\ninterface SettingRowProps {\n title: string\n style?: ViewStyle\n rightItem?: ReactNode\n rightLabel?: string\n rightItemStyle?: ViewStyle\n}\n\nfunction SettingRow({ title, style, rightLabel, rightItem, rightItemStyle = {} }: SettingRowProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.settingRow, style]}>\n <View style={styles.settingRowContent}>\n <Text variant=\"plain\" style={styles.settingRowText}>\n {title}\n </Text>\n {Boolean(rightLabel) && <Text variant=\"footnote\">{rightLabel}</Text>}\n </View>\n {Boolean(rightItem) && <View style={rightItemStyle}>{rightItem}</View>}\n </View>\n )\n}\n\ninterface LinkRowProps {\n title: string\n subtitle?: string\n rightLabel: string\n onPress: () => void\n}\n\nfunction LinkRow({ title, subtitle, rightLabel, onPress }: LinkRowProps) {\n const styles = useLinkRowStyles()\n const isSourceType = rightLabel === 'Team' || rightLabel === 'Group' || rightLabel === 'PlanTeam'\n\n return (\n <PlatformPressable\n style={styles.row}\n onPress={onPress}\n accessibilityRole=\"link\"\n accessibilityLabel={title}\n accessibilityHint={`Navigate to ${title} settings`}\n >\n <View style={styles.innerContainer}>\n <View style={styles.leftContent}>\n <Text style={styles.title} numberOfLines={2}>\n {title}\n </Text>\n {Boolean(subtitle) && <Text variant=\"footnote\">{subtitle}</Text>}\n </View>\n <View style={styles.rightContent}>\n {isSourceType ? (\n <Badge label={rightLabel} appearance=\"neutral\" variant=\"meta\" />\n ) : (\n <Text numberOfLines={1} style={styles.rightLabelText}>\n {rightLabel}\n </Text>\n )}\n {Platform.OS === 'ios' && (\n <Icon name=\"general.rightChevron\" size={16} style={styles.icon} />\n )}\n </View>\n </View>\n </PlatformPressable>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({}: { isStart?: boolean; isEnd?: boolean } = {}) => {\n const { colors } = useTheme()\n const { bottom } = useSafeAreaInsets()\n const headerBottomPadding = 0\n\n return StyleSheet.create({\n listContainer: {\n flex: 1,\n },\n contentContainer: {\n paddingBottom: bottom,\n },\n sectionOuterBase: {\n paddingLeft: 16,\n },\n sectionInnerBase: {\n paddingRight: 16,\n paddingVertical: 16,\n },\n sectionInnerHeader: {\n paddingTop: 24,\n paddingBottom: headerBottomPadding,\n },\n sectionInnerBottomBorder: {\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n sectionDescription: {\n color: colors.textColorDefaultSecondary,\n },\n settingRow: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n gap: 8,\n },\n settingRowContent: {\n flex: 1,\n },\n settingRowText: {\n lineHeight: 20,\n },\n })\n}\n\nconst useLinkRowStyles = () => {\n const theme = useTheme()\n\n return StyleSheet.create({\n row: {\n paddingLeft: 0,\n paddingVertical: 16,\n },\n innerContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 12,\n },\n leftContent: {\n flex: 1,\n gap: 4,\n },\n rightContent: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n title: {},\n rightLabelText: {\n color: theme.colors.textColorDefaultSecondary,\n },\n icon: {\n color: theme.colors.iconColorDefaultDisabled,\n },\n })\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { AnalyticsMetadataResource } from './analytics_metadata';
2
2
  import { ConversationBadgeResource } from './conversation_badge';
3
+ import { ConversationMembershipResource } from './conversation_membership';
3
4
  import { GroupResource } from './group_resource';
4
5
  import { MemberAbilityResource } from './member_ability';
5
6
  export interface ConversationResource {
@@ -7,9 +8,7 @@ export interface ConversationResource {
7
8
  id: number;
8
9
  badges?: ConversationBadgeResource[];
9
10
  analyticsMetadata?: AnalyticsMetadataResource;
10
- conversationMembership?: {
11
- lastReadMessageSortKey: string;
12
- };
11
+ conversationMembership?: Partial<ConversationMembershipResource>;
13
12
  createdAt: string;
14
13
  deleted?: boolean;
15
14
  groups?: GroupResource[];
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/types/resources/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AA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AAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAExD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,cAAc,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,yBAAyB,EAAE,CAAA;IACpC,iBAAiB,CAAC,EAAE,yBAAyB,CAAA;IAC7C,sBAAsB,CAAC,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAA;IAChE,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,aAAa,EAAE,CAAA;IACxB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,aAAa,CAAC,EAAE,qBAAqB,CAAA;IACrC,KAAK,EAAE,OAAO,CAAA;IACd,eAAe,EAAE,OAAO,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,SAAS,EAAE,MAAM,CAAA;CAClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/types/resources/conversation.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnalyticsMetadataResource } from './analytics_metadata'\nimport { ConversationBadgeResource } from './conversation_badge'\nimport { GroupResource } from './group_resource'\nimport { MemberAbilityResource } from './member_ability'\n\nexport interface ConversationResource {\n type: 'Conversation'\n id: number\n badges?: ConversationBadgeResource[]\n analyticsMetadata?: AnalyticsMetadataResource\n conversationMembership?: {\n lastReadMessageSortKey: string\n }\n createdAt: string\n deleted?: boolean\n groups?: GroupResource[]\n previewAvatarUrls?: string[]\n lastMessageAuthorId?: string\n lastMessageAuthorName?: string\n lastMessageCreatedAt?: string\n lastMessageTextPreview?: string\n latestReadMessageSortKey?: string\n memberAbility?: MemberAbilityResource\n muted: boolean\n repliesDisabled: boolean\n title: string\n unreadCount: number\n unreadReactionCount?: number // Derived from Jolt events\n updatedAt: string\n}\n"]}
1
+ {"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/types/resources/conversation.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnalyticsMetadataResource } from './analytics_metadata'\nimport { ConversationBadgeResource } from './conversation_badge'\nimport { ConversationMembershipResource } from './conversation_membership'\nimport { GroupResource } from './group_resource'\nimport { MemberAbilityResource } from './member_ability'\n\nexport interface ConversationResource {\n type: 'Conversation'\n id: number\n badges?: ConversationBadgeResource[]\n analyticsMetadata?: AnalyticsMetadataResource\n conversationMembership?: Partial<ConversationMembershipResource>\n createdAt: string\n deleted?: boolean\n groups?: GroupResource[]\n previewAvatarUrls?: string[]\n lastMessageAuthorId?: string\n lastMessageAuthorName?: string\n lastMessageCreatedAt?: string\n lastMessageTextPreview?: string\n latestReadMessageSortKey?: string\n memberAbility?: MemberAbilityResource\n muted: boolean\n repliesDisabled: boolean\n title: string\n unreadCount: number\n unreadReactionCount?: number // Derived from Jolt events\n updatedAt: string\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { ResourceObject } from '../api_primitives';
2
+ export type NotificationLevelValue = 'everything' | 'nothing';
3
+ export type NotificationLevelDescription = string;
4
+ export interface ConversationMembershipResource extends ResourceObject {
5
+ type: 'ConversationMembership';
6
+ lastReadMessageSortKey: string;
7
+ muted: boolean;
8
+ notificationLevel: NotificationLevelValue;
9
+ notificationLevelDescription: NotificationLevelDescription;
10
+ notificationLevelOptions: Array<{
11
+ description: NotificationLevelDescription;
12
+ enabled: boolean;
13
+ value: NotificationLevelValue;
14
+ }>;
15
+ }
16
+ //# sourceMappingURL=conversation_membership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation_membership.d.ts","sourceRoot":"","sources":["../../../src/types/resources/conversation_membership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG,SAAS,CAAA;AAC7D,MAAM,MAAM,4BAA4B,GAAG,MAAM,CAAA;AAEjD,MAAM,WAAW,8BAA+B,SAAQ,cAAc;IACpE,IAAI,EAAE,wBAAwB,CAAA;IAC9B,sBAAsB,EAAE,MAAM,CAAA;IAC9B,KAAK,EAAE,OAAO,CAAA;IACd,iBAAiB,EAAE,sBAAsB,CAAA;IACzC,4BAA4B,EAAE,4BAA4B,CAAA;IAC1D,wBAAwB,EAAE,KAAK,CAAC;QAC9B,WAAW,EAAE,4BAA4B,CAAA;QACzC,OAAO,EAAE,OAAO,CAAA;QAChB,KAAK,EAAE,sBAAsB,CAAA;KAC9B,CAAC,CAAA;CACH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=conversation_membership.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation_membership.js","sourceRoot":"","sources":["../../../src/types/resources/conversation_membership.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport type NotificationLevelValue = 'everything' | 'nothing'\nexport type NotificationLevelDescription = string\n\nexport interface ConversationMembershipResource extends ResourceObject {\n type: 'ConversationMembership'\n lastReadMessageSortKey: string\n muted: boolean\n notificationLevel: NotificationLevelValue\n notificationLevelDescription: NotificationLevelDescription\n notificationLevelOptions: Array<{\n description: NotificationLevelDescription\n enabled: boolean\n value: NotificationLevelValue\n }>\n}\n"]}
@@ -1,6 +1,13 @@
1
1
  import { ResourceObject } from '../api_primitives';
2
+ interface GroupNotificationLevelOption {
3
+ value: string;
4
+ description: string;
5
+ enabled: boolean;
6
+ }
2
7
  export interface GroupMembership extends ResourceObject {
3
8
  notificationLevel: string;
4
9
  notificationLevelDescription: string;
10
+ notificationLevelOptions: GroupNotificationLevelOption[];
5
11
  }
12
+ export {};
6
13
  //# sourceMappingURL=group_membership.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"group_membership.d.ts","sourceRoot":"","sources":["../../../src/types/resources/group_membership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,iBAAiB,EAAE,MAAM,CAAA;IACzB,4BAA4B,EAAE,MAAM,CAAA;CACrC"}
1
+ {"version":3,"file":"group_membership.d.ts","sourceRoot":"","sources":["../../../src/types/resources/group_membership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,UAAU,4BAA4B;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,iBAAiB,EAAE,MAAM,CAAA;IACzB,4BAA4B,EAAE,MAAM,CAAA;IACpC,wBAAwB,EAAE,4BAA4B,EAAE,CAAA;CACzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"group_membership.js","sourceRoot":"","sources":["../../../src/types/resources/group_membership.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport interface GroupMembership extends ResourceObject {\n notificationLevel: string\n notificationLevelDescription: string\n}\n"]}
1
+ {"version":3,"file":"group_membership.js","sourceRoot":"","sources":["../../../src/types/resources/group_membership.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\ninterface GroupNotificationLevelOption {\n value: string\n description: string\n enabled: boolean\n}\n\nexport interface GroupMembership extends ResourceObject {\n notificationLevel: string\n notificationLevelDescription: string\n notificationLevelOptions: GroupNotificationLevelOption[]\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  export * from './analytics_metadata';
2
2
  export * from './conversation';
3
+ export * from './conversation_membership';
3
4
  export * from './member';
4
5
  export * from './message';
5
6
  export * from './oauth_token';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  export * from './analytics_metadata';
2
2
  export * from './conversation';
3
+ export * from './conversation_membership';
3
4
  export * from './member';
4
5
  export * from './message';
5
6
  export * from './oauth_token';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './analytics_metadata'\nexport * from './conversation'\nexport * from './member'\nexport * from './message'\nexport * from './oauth_token'\nexport * from './person'\nexport * from './groups'\nexport * from './app_grant'\nexport * from './services'\nexport * from './organization'\nexport * from './group_membership'\nexport * from './group_resource'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './analytics_metadata'\nexport * from './conversation'\nexport * from './conversation_membership'\nexport * from './member'\nexport * from './message'\nexport * from './oauth_token'\nexport * from './person'\nexport * from './groups'\nexport * from './app_grant'\nexport * from './services'\nexport * from './organization'\nexport * from './group_membership'\nexport * from './group_resource'\n"]}
@@ -0,0 +1,4 @@
1
+ type ObjType = Record<string, unknown> | unknown[] | unknown;
2
+ export declare function deepSnakeCaseKeys<T extends ObjType>(obj: T): T;
3
+ export {};
4
+ //# sourceMappingURL=deep_snake_case_keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep_snake_case_keys.d.ts","sourceRoot":"","sources":["../../src/utils/deep_snake_case_keys.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,CAAA;AAE5D,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAW9D"}
@@ -0,0 +1,13 @@
1
+ import { isArray, isObject, mapKeys, mapValues, snakeCase } from 'lodash';
2
+ export function deepSnakeCaseKeys(obj) {
3
+ if (isArray(obj)) {
4
+ return obj.map(deepSnakeCaseKeys);
5
+ }
6
+ else if (isObject(obj)) {
7
+ return mapValues(
8
+ // @ts-ignore This mutates the object, but we don't care about the type here
9
+ mapKeys(obj, (_value, key) => snakeCase(key)), deepSnakeCaseKeys);
10
+ }
11
+ return obj;
12
+ }
13
+ //# sourceMappingURL=deep_snake_case_keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep_snake_case_keys.js","sourceRoot":"","sources":["../../src/utils/deep_snake_case_keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAIzE,MAAM,UAAU,iBAAiB,CAAoB,GAAM;IACzD,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACjB,OAAO,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAM,CAAA;IACxC,CAAC;SAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,SAAS;QACd,4EAA4E;QAC5E,OAAO,CAAC,GAAG,EAAE,CAAC,MAAc,EAAE,GAAW,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAC7D,iBAAiB,CACb,CAAA;IACR,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import { isArray, isObject, mapKeys, mapValues, snakeCase } from 'lodash'\n\ntype ObjType = Record<string, unknown> | unknown[] | unknown\n\nexport function deepSnakeCaseKeys<T extends ObjType>(obj: T): T {\n if (isArray(obj)) {\n return obj.map(deepSnakeCaseKeys) as T\n } else if (isObject(obj)) {\n return mapValues(\n // @ts-ignore This mutates the object, but we don't care about the type here\n mapKeys(obj, (_value: string, key: string) => snakeCase(key)),\n deepSnakeCaseKeys\n ) as T\n }\n return obj\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "3.24.4",
3
+ "version": "3.25.0-rc.1",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -59,5 +59,5 @@
59
59
  "react-native-url-polyfill": "^2.0.0",
60
60
  "typescript": "<5.6.0"
61
61
  },
62
- "gitHead": "008a3095c7b14e6e2dfa2bb537c9f1d85a976ea1"
62
+ "gitHead": "245da5d5cfed01cadb58ef407ed9c8d514c1e9cc"
63
63
  }
@@ -91,7 +91,7 @@ export function ConversationActions({
91
91
  const accessibilityActions = [
92
92
  {
93
93
  name: muted ? 'unmute' : 'mute',
94
- label: muted ? 'Unmute' : 'Mute',
94
+ label: muted ? 'Enable' : 'Silence',
95
95
  },
96
96
  ...readAccessibilityAction,
97
97
  ]
@@ -182,8 +182,8 @@ function LeftActions({
182
182
  const styles = useStyles()
183
183
 
184
184
  const muteToggleContent = {
185
- true: { iconName: 'general.bell', label: 'Unmute' },
186
- false: { iconName: 'general.bellMuted', label: 'Mute' },
185
+ true: { iconName: 'general.bell', label: 'Enable' },
186
+ false: { iconName: 'general.bellMuted', label: 'Silence' },
187
187
  } as const
188
188
 
189
189
  const latestMessageUnreadToggleContent = {
@@ -83,6 +83,7 @@ export const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {
83
83
  title: item.resource.title,
84
84
  badge: item.resource.badges?.[0],
85
85
  deleted: item.resource.deleted,
86
+ muted: item.resource.muted,
86
87
  })
87
88
  }
88
89
  showBadges={showBadges}
@@ -38,7 +38,13 @@ export const getConversationRequestArgs = ({ conversation_id }: { conversation_i
38
38
  'can_reply',
39
39
  'can_delete_non_authored_messages',
40
40
  ],
41
- ConversationMembership: ['last_read_message_sort_key'],
41
+ ConversationMembership: [
42
+ 'last_read_message_sort_key',
43
+ 'notification_level',
44
+ 'notification_level_description',
45
+ 'notification_level_options',
46
+ 'muted',
47
+ ],
42
48
  ConversationBadge: ['app_name', 'pco_resource_type', 'text'],
43
49
  Group: ['type', 'id', 'links', 'name', 'source_app_name', 'source_type'],
44
50
  },
@@ -72,6 +78,9 @@ export const useConversationMute = ({ conversation_id }: { conversation_id: numb
72
78
  if (!prev?.data) return prev
73
79
  setValue(muted)
74
80
  prev.data.muted = muted
81
+ if (prev.data.conversationMembership) {
82
+ prev.data.conversationMembership.muted = muted
83
+ }
75
84
 
76
85
  return prev
77
86
  })
@@ -93,6 +102,9 @@ export const useConversationMute = ({ conversation_id }: { conversation_id: numb
93
102
  // Posting to the mute action endpoint can't return all the fields
94
103
  // so we need to set only the fields we require
95
104
  prev.data.muted = response.data.muted
105
+ if (prev.data.conversationMembership) {
106
+ prev.data.conversationMembership.muted = response.data.muted
107
+ }
96
108
  setValue(response.data.muted)
97
109
 
98
110
  return prev
@@ -0,0 +1,91 @@
1
+ import { Updater, useMutation, useQueryClient } from '@tanstack/react-query'
2
+ import { ApiResource, ConversationMembershipResource, ConversationResource } from '../types'
3
+ import { useApiClient } from './use_api_client'
4
+ import { getConversationRequestArgs } from './use_conversation'
5
+ import { getRequestQueryKey } from './use_suspense_api'
6
+ import { deepSnakeCaseKeys } from '../utils/deep_snake_case_keys'
7
+ import { throwResponseError } from '../utils/response_error'
8
+
9
+ export const useConversationMembershipUpdate = ({
10
+ conversation_id,
11
+ }: {
12
+ conversation_id: number
13
+ }) => {
14
+ const apiClient = useApiClient()
15
+ const queryClient = useQueryClient()
16
+ const requestArgs = getConversationRequestArgs({ conversation_id })
17
+ const conversationMembershipFields = requestArgs.data.fields.ConversationMembership.join(',')
18
+ const queryKey = getRequestQueryKey(requestArgs)
19
+
20
+ return useMutation({
21
+ throwOnError: true,
22
+ onMutate: async (attributes: Partial<ConversationMembershipResource>) => {
23
+ queryClient.setQueryData<ApiResource<ConversationResource>>(
24
+ queryKey,
25
+ updateConversationMembershipAttributes(attributes)
26
+ )
27
+ },
28
+ mutationKey: ['updateConversationMembership', conversation_id],
29
+ mutationFn: async (attributes: Partial<ConversationMembershipResource>) => {
30
+ return apiClient.chat
31
+ .patch<ApiResource<ConversationMembershipResource>>({
32
+ url: `/me/conversations/${conversation_id}/conversation_membership`,
33
+ data: {
34
+ data: {
35
+ type: 'ConversationMembership',
36
+ attributes: deepSnakeCaseKeys(attributes),
37
+ },
38
+ fields: {
39
+ ConversationMembership: conversationMembershipFields,
40
+ },
41
+ },
42
+ })
43
+ .catch(throwResponseError)
44
+ },
45
+ onSuccess: response => {
46
+ const membership = response.data
47
+
48
+ queryClient.setQueryData<ApiResource<ConversationResource>>(
49
+ queryKey,
50
+ updateConversationMembershipAttributes(membership)
51
+ )
52
+ },
53
+ })
54
+ }
55
+
56
+ const updateConversationMembershipAttributes =
57
+ (
58
+ membership: Partial<ConversationMembershipResource>
59
+ ): Updater<
60
+ ApiResource<ConversationResource> | undefined,
61
+ ApiResource<ConversationResource> | undefined
62
+ > =>
63
+ conversationData =>
64
+ mergeConversationMembership(conversationData, membership)
65
+
66
+ const mergeConversationMembership = (
67
+ conversationData: ApiResource<ConversationResource> | undefined,
68
+ membership: Partial<ConversationMembershipResource>
69
+ ) => {
70
+ if (!conversationData) return undefined
71
+ if (!conversationData.data) return conversationData
72
+ if (!conversationData.data.conversationMembership) return conversationData
73
+
74
+ const previousMembership: Partial<ConversationMembershipResource> =
75
+ conversationData.data.conversationMembership || {}
76
+
77
+ const mergedMembership: Partial<ConversationMembershipResource> = {
78
+ ...previousMembership,
79
+ ...membership,
80
+ }
81
+
82
+ const data: ConversationResource = {
83
+ ...conversationData.data,
84
+ conversationMembership: mergedMembership,
85
+ }
86
+
87
+ return {
88
+ ...conversationData,
89
+ data,
90
+ }
91
+ }
@@ -67,6 +67,10 @@ export const useConversationsMute = ({ conversation }: { conversation: Conversat
67
67
  update({
68
68
  ...conversation,
69
69
  muted,
70
+ conversationMembership: {
71
+ ...conversation?.conversationMembership,
72
+ muted,
73
+ },
70
74
  })
71
75
  },
72
76
  mutationKey: ['muteConversation'],
@@ -36,6 +36,7 @@ export function useFeatures() {
36
36
  export const availableFeatures = {
37
37
  threaded_replies: 'ROLLOUT_MOBILE_threaded_replies_v1',
38
38
  message_reporting: 'ROLLOUT_MOBILE_message_reporting',
39
+ granular_notifications_ui: 'ROLLOUT_granular_notification_preferences_ui',
39
40
  }
40
41
 
41
42
  const stableEmptyFeatures: ApiCollection<FeatureResource> = {
@@ -56,6 +56,14 @@ import { NotFound } from '../screens/not_found'
56
56
  import { NotificationSettingsScreen } from '../screens/notification_settings_screen'
57
57
  import { PreferredAppSelectionScreen } from '../screens/preferred_app_selection_screen'
58
58
  import { GroupNotificationSettingsScreen } from '../screens/group_notification_settings_screen'
59
+ import {
60
+ GroupNotificationLevelSelectScreen,
61
+ GroupNotificationLevelSelectScreenOptions,
62
+ } from '../screens/group_notification_level_select_screen'
63
+ import {
64
+ ConversationNotificationLevelSelectScreen,
65
+ ConversationNotificationLevelSelectScreenOptions,
66
+ } from '../screens/conversation_notification_level_select_screen'
59
67
  import { ReactionsScreen, ReactionsScreenOptions } from '../screens/reactions_screen'
60
68
  import { ScreenLayoutWithChatAccessGate } from './screenLayout'
61
69
  import { SendGiphyScreen, SendGiphyScreenOptions } from '../screens/send_giphy_screen'
@@ -163,13 +171,15 @@ export const ChatStack = createNativeStackNavigator({
163
171
  screen: ConversationScreen,
164
172
  options: ({ route, navigation }) => ({
165
173
  headerTitle: (props: NativeStackHeaderRightProps) => {
166
- const { conversation_id, title, badge, deleted } = route.params as ConversationRouteProps
174
+ const { conversation_id, title, badge, deleted, muted } =
175
+ route.params as ConversationRouteProps
167
176
 
168
177
  return (
169
178
  <ConversationScreenTitle
170
179
  conversation_id={conversation_id}
171
180
  badge={badge}
172
181
  deleted={deleted}
182
+ muted={muted}
173
183
  {...props}
174
184
  >
175
185
  {title ?? 'Conversation'}
@@ -259,6 +269,14 @@ export const ChatStack = createNativeStackNavigator({
259
269
  ),
260
270
  }),
261
271
  },
272
+ GroupNotificationLevelSelect: {
273
+ screen: GroupNotificationLevelSelectScreen,
274
+ options: GroupNotificationLevelSelectScreenOptions,
275
+ },
276
+ ConversationNotificationLevelSelect: {
277
+ screen: ConversationNotificationLevelSelectScreen,
278
+ options: ConversationNotificationLevelSelectScreenOptions,
279
+ },
262
280
  New: {
263
281
  screen: NewConversationStack,
264
282
  if: useQualifiedByAge,