@planningcenter/chat-react-native 3.24.0-rc.0 → 3.24.0-rc.10

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 (142) hide show
  1. package/build/components/conversations/conversation_actions.d.ts.map +1 -1
  2. package/build/components/conversations/conversation_actions.js +5 -1
  3. package/build/components/conversations/conversation_actions.js.map +1 -1
  4. package/build/components/conversations/conversations.d.ts.map +1 -1
  5. package/build/components/conversations/conversations.js +5 -1
  6. package/build/components/conversations/conversations.js.map +1 -1
  7. package/build/components/display/platform_modal_header_buttons.d.ts +8 -0
  8. package/build/components/display/platform_modal_header_buttons.d.ts.map +1 -1
  9. package/build/components/display/platform_modal_header_buttons.js +8 -0
  10. package/build/components/display/platform_modal_header_buttons.js.map +1 -1
  11. package/build/components/primitive/form_sheet.d.ts +1 -1
  12. package/build/components/primitive/form_sheet.d.ts.map +1 -1
  13. package/build/components/primitive/form_sheet.js +1 -1
  14. package/build/components/primitive/form_sheet.js.map +1 -1
  15. package/build/hooks/index.d.ts +1 -0
  16. package/build/hooks/index.d.ts.map +1 -1
  17. package/build/hooks/index.js +1 -0
  18. package/build/hooks/index.js.map +1 -1
  19. package/build/hooks/use_features.d.ts +1 -0
  20. package/build/hooks/use_features.d.ts.map +1 -1
  21. package/build/hooks/use_features.js +1 -0
  22. package/build/hooks/use_features.js.map +1 -1
  23. package/build/hooks/use_new_conversation_entry.d.ts +3 -0
  24. package/build/hooks/use_new_conversation_entry.d.ts.map +1 -0
  25. package/build/hooks/use_new_conversation_entry.js +20 -0
  26. package/build/hooks/use_new_conversation_entry.js.map +1 -0
  27. package/build/hooks/use_report_message.d.ts +6 -0
  28. package/build/hooks/use_report_message.d.ts.map +1 -0
  29. package/build/hooks/use_report_message.js +28 -0
  30. package/build/hooks/use_report_message.js.map +1 -0
  31. package/build/hooks/use_teams.d.ts.map +1 -1
  32. package/build/hooks/use_teams.js +1 -0
  33. package/build/hooks/use_teams.js.map +1 -1
  34. package/build/navigation/index.d.ts +52 -10
  35. package/build/navigation/index.d.ts.map +1 -1
  36. package/build/navigation/index.js +41 -7
  37. package/build/navigation/index.js.map +1 -1
  38. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +5 -3
  39. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
  40. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts +4 -0
  41. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts.map +1 -0
  42. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js +67 -0
  43. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js.map +1 -0
  44. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
  45. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +17 -2
  46. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
  47. package/build/screens/conversation_select_type_screen.d.ts +11 -0
  48. package/build/screens/conversation_select_type_screen.d.ts.map +1 -0
  49. package/build/screens/conversation_select_type_screen.js +38 -0
  50. package/build/screens/conversation_select_type_screen.js.map +1 -0
  51. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  52. package/build/screens/conversations/components/list_header_component.js +18 -7
  53. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  54. package/build/screens/group_notification_settings_screen.d.ts +8 -0
  55. package/build/screens/group_notification_settings_screen.d.ts.map +1 -0
  56. package/build/screens/group_notification_settings_screen.js +79 -0
  57. package/build/screens/group_notification_settings_screen.js.map +1 -0
  58. package/build/screens/index.d.ts +4 -1
  59. package/build/screens/index.d.ts.map +1 -1
  60. package/build/screens/index.js +4 -1
  61. package/build/screens/index.js.map +1 -1
  62. package/build/screens/message_actions_screen.js +14 -2
  63. package/build/screens/message_actions_screen.js.map +1 -1
  64. package/build/screens/message_report/components/message_preview.d.ts +10 -0
  65. package/build/screens/message_report/components/message_preview.d.ts.map +1 -0
  66. package/build/screens/message_report/components/message_preview.js +74 -0
  67. package/build/screens/message_report/components/message_preview.js.map +1 -0
  68. package/build/screens/message_report/components/report_reason_list.d.ts +9 -0
  69. package/build/screens/message_report/components/report_reason_list.d.ts.map +1 -0
  70. package/build/screens/message_report/components/report_reason_list.js +67 -0
  71. package/build/screens/message_report/components/report_reason_list.js.map +1 -0
  72. package/build/screens/message_report_screen.d.ts +10 -0
  73. package/build/screens/message_report_screen.d.ts.map +1 -0
  74. package/build/screens/message_report_screen.js +214 -0
  75. package/build/screens/message_report_screen.js.map +1 -0
  76. package/build/screens/notification_settings/hooks/groups.d.ts +94 -0
  77. package/build/screens/notification_settings/hooks/groups.d.ts.map +1 -0
  78. package/build/screens/notification_settings/hooks/groups.js +92 -0
  79. package/build/screens/notification_settings/hooks/groups.js.map +1 -0
  80. package/build/screens/notification_settings_screen.d.ts +5 -0
  81. package/build/screens/notification_settings_screen.d.ts.map +1 -0
  82. package/build/screens/notification_settings_screen.js +234 -0
  83. package/build/screens/notification_settings_screen.js.map +1 -0
  84. package/build/screens/preferred_app/hooks/use_chat_types.d.ts +39 -0
  85. package/build/screens/preferred_app/hooks/use_chat_types.d.ts.map +1 -0
  86. package/build/screens/preferred_app/hooks/use_chat_types.js +12 -0
  87. package/build/screens/preferred_app/hooks/use_chat_types.js.map +1 -0
  88. package/build/screens/preferred_app_selection_screen.d.ts +10 -0
  89. package/build/screens/preferred_app_selection_screen.d.ts.map +1 -0
  90. package/build/screens/preferred_app_selection_screen.js +128 -0
  91. package/build/screens/preferred_app_selection_screen.js.map +1 -0
  92. package/build/types/resources/group_membership.d.ts +6 -0
  93. package/build/types/resources/group_membership.d.ts.map +1 -0
  94. package/build/types/resources/group_membership.js +2 -0
  95. package/build/types/resources/group_membership.js.map +1 -0
  96. package/build/types/resources/group_resource.d.ts +4 -0
  97. package/build/types/resources/group_resource.d.ts.map +1 -1
  98. package/build/types/resources/group_resource.js.map +1 -1
  99. package/build/types/resources/index.d.ts +2 -0
  100. package/build/types/resources/index.d.ts.map +1 -1
  101. package/build/types/resources/index.js +2 -0
  102. package/build/types/resources/index.js.map +1 -1
  103. package/build/types/resources/message_report.d.ts +19 -0
  104. package/build/types/resources/message_report.d.ts.map +1 -0
  105. package/build/types/resources/message_report.js +9 -0
  106. package/build/types/resources/message_report.js.map +1 -0
  107. package/package.json +2 -2
  108. package/src/components/conversations/conversation_actions.tsx +6 -1
  109. package/src/components/conversations/conversations.tsx +6 -1
  110. package/src/components/display/platform_modal_header_buttons.tsx +16 -0
  111. package/src/components/primitive/form_sheet.tsx +4 -2
  112. package/src/hooks/index.ts +1 -0
  113. package/src/hooks/use_features.ts +1 -0
  114. package/src/hooks/use_new_conversation_entry.ts +31 -0
  115. package/src/hooks/use_report_message.ts +37 -0
  116. package/src/hooks/use_teams.ts +1 -0
  117. package/src/navigation/index.tsx +51 -7
  118. package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx +10 -3
  119. package/src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx +100 -0
  120. package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +23 -3
  121. package/src/screens/conversation_select_type_screen.tsx +59 -0
  122. package/src/screens/conversations/components/list_header_component.tsx +20 -7
  123. package/src/screens/group_notification_settings_screen.tsx +92 -0
  124. package/src/screens/index.ts +4 -1
  125. package/src/screens/message_actions_screen.tsx +24 -2
  126. package/src/screens/message_report/components/message_preview.tsx +92 -0
  127. package/src/screens/message_report/components/report_reason_list.tsx +106 -0
  128. package/src/screens/message_report_screen.tsx +278 -0
  129. package/src/screens/notification_settings/hooks/groups.ts +101 -0
  130. package/src/screens/notification_settings_screen.tsx +383 -0
  131. package/src/screens/preferred_app/hooks/use_chat_types.ts +25 -0
  132. package/src/screens/preferred_app_selection_screen.tsx +169 -0
  133. package/src/types/images.d.ts +14 -0
  134. package/src/types/resources/group_membership.ts +6 -0
  135. package/src/types/resources/group_resource.ts +5 -0
  136. package/src/types/resources/index.ts +2 -0
  137. package/src/types/resources/message_report.ts +20 -0
  138. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts +0 -4
  139. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +0 -1
  140. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +0 -146
  141. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +0 -1
  142. package/src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx +0 -215
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_actions.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAClF,OAAO,EAIL,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAA;AAUrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAKlD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,kBAAkB,GACnB,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,YAAY,EAAE,oBAAoB,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,qBA4HA"}
1
+ {"version":3,"file":"conversation_actions.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAClF,OAAO,EAIL,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAA;AAerB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAKlD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,kBAAkB,GACnB,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,YAAY,EAAE,oBAAoB,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,qBA4HA"}
@@ -1,6 +1,10 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
- import { Platform, Pressable, StyleSheet, View, } from 'react-native';
2
+ import { Platform, Pressable as RNPressable, StyleSheet, View, } from 'react-native';
3
+ import { Pressable as GHPressable } from 'react-native-gesture-handler';
3
4
  import ReanimatedSwipeable from 'react-native-gesture-handler/ReanimatedSwipeable';
5
+ // Use gesture-handler Pressable on Android to prevent ripple during scroll
6
+ // Use react-native Pressable on iOS for fast tap response
7
+ const Pressable = Platform.OS === 'android' ? GHPressable : RNPressable;
4
8
  import { useConversationsContext } from '../../contexts/conversations_context';
5
9
  import { useTheme, useCreateAndroidRippleColor } from '../../hooks';
6
10
  import { useConversationsMarkRead, useConversationsMute, } from '../../hooks/use_conversations_actions';
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_actions.js","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClF,OAAO,EAEL,QAAQ,EACR,SAAS,EAET,UAAU,EACV,IAAI,GAEL,MAAM,cAAc,CAAA;AACrB,OAAO,mBAEN,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,QAAQ,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,uCAAuC,CAAA;AAE9C,OAAO,EAAE,2BAA2B,EAAE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CAAC,qBAAqB,CACpB,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAC3B,QAAQ,CAAC,CAAC,mBAAmB,CAAC,CAC9B,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CACf,OAAO,CAAC,CAAC,yBAAyB,CAAC,CACnC,aAAa,CAAC,CAAC,gCAAgC,CAAC,CAChD,eAAe,CAAC,CAAC,MAAM,CAAC,gCAAgC,CAAC,EAE3D;MAAA,CAAC,qBAAqB,CACpB,OAAO,CAAC,CAAC,cAAc,CAAC,CACxB,OAAO,CAAC,CAAC,KAAK,CAAC,CACf,OAAO,CAAC,CAAC,UAAU,CAAC,CACpB,aAAa,CAAC,CAAC,iBAAiB,CAAC,CACjC,eAAe,CAAC,CAAC,MAAM,CAAC,kCAAkC,CAAC,EAE/D;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC;AAED,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAC/B,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAE7B,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,uBAAuB,EAAE;YACvB,eAAe,EAAE,MAAM,CAAC,6BAA6B;SACtD;QACD,qBAAqB,EAAE;YACrB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,mBAAmB,GAAG,mBAAmB;YAChD,YAAY,EAAE,SAAS;SACxB;QACD,kBAAkB,EAAE;YAClB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport {\n AccessibilityActionEvent,\n Platform,\n Pressable,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native'\nimport ReanimatedSwipeable, {\n SwipeableMethods,\n} from 'react-native-gesture-handler/ReanimatedSwipeable'\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme, useCreateAndroidRippleColor } from '../../hooks'\nimport {\n useConversationsMarkRead,\n useConversationsMute,\n} from '../../hooks/use_conversations_actions'\nimport { ConversationResource } from '../../types'\nimport { platformPressedOpacityStyle } from '../../utils'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { SwipeableToggleButton } from './swipeable_toggle_button'\n\nexport function ConversationActions({\n children,\n conversation,\n style,\n onPress,\n accessibilityLabel,\n}: {\n children: ReactNode\n conversation: ConversationResource\n onPress: () => void\n style?: StyleProp<ViewStyle>\n accessibilityLabel?: string\n}) {\n const swipeableRef = useRef<SwipeableMethods>(null)\n const styles = useStyles()\n const { activeConversationId, setActiveConversationId } = useConversationsContext()\n const [disabled, setDisabled] = useState(false)\n const overshootLeft = Platform.OS === 'ios'\n const androidRippleColor = useCreateAndroidRippleColor({\n color: styles.swipeableChildContainer.backgroundColor,\n })\n const { muted, setMuted, isPending: isMutedPending } = useConversationsMute({ conversation })\n const {\n read,\n markRead,\n isPending: isMarkReadPending,\n } = useConversationsMarkRead({\n conversation,\n })\n\n const isConversationEmpty = conversation.lastMessageCreatedAt === null\n\n const handleSwipeableClose = useCallback(() => {\n setDisabled(false)\n swipeableRef.current?.close()\n }, [setDisabled])\n\n const handleSwipeableOpen = () => {\n setDisabled(true)\n setActiveConversationId(conversation.id)\n }\n\n const handlePress = useCallback(() => {\n if (disabled || !onPress) return\n onPress()\n }, [disabled, onPress])\n\n const handleMute = useCallback(() => {\n setMuted(!muted)\n handleSwipeableClose()\n }, [muted, handleSwipeableClose, setMuted])\n\n const handleLatestMessageUnread = useCallback(() => {\n markRead(!read)\n handleSwipeableClose()\n }, [read, handleSwipeableClose, markRead])\n\n const readAccessibilityAction = !isConversationEmpty\n ? [\n {\n name: read ? 'markUnread' : 'markRead',\n label: read ? 'Mark unread' : 'Mark read',\n },\n ]\n : []\n\n const accessibilityActions = [\n {\n name: muted ? 'unmute' : 'mute',\n label: muted ? 'Unmute' : 'Mute',\n },\n ...readAccessibilityAction,\n ]\n\n const handleAccessibilityAction = useCallback(\n (event: AccessibilityActionEvent) => {\n switch (event.nativeEvent.actionName) {\n case 'markRead':\n handleLatestMessageUnread()\n break\n case 'markUnread':\n handleLatestMessageUnread()\n break\n case 'mute':\n handleMute()\n break\n case 'unmute':\n handleMute()\n break\n }\n },\n [handleLatestMessageUnread, handleMute]\n )\n\n useEffect(() => {\n if (activeConversationId === conversation.id) return\n\n handleSwipeableClose()\n }, [activeConversationId, conversation.id, handleSwipeableClose])\n\n return (\n <ReanimatedSwipeable\n ref={swipeableRef}\n childrenContainerStyle={styles.swipeableChildContainer}\n containerStyle={styles.swipeableContainer}\n overshootFriction={8}\n overshootLeft={overshootLeft}\n overshootRight={false}\n onSwipeableOpenStartDrag={handleSwipeableOpen}\n onSwipeableClose={() => setDisabled(false)}\n renderRightActions={() => <></>}\n renderLeftActions={() => (\n <LeftActions\n isConversationEmpty={isConversationEmpty}\n handleMute={handleMute}\n handleLatestMessageUnread={handleLatestMessageUnread}\n muted={muted}\n read={read}\n isMutedPending={isMutedPending}\n isMarkReadPending={isMarkReadPending}\n />\n )}\n >\n <Pressable\n onPress={handlePress}\n style={({ pressed }) => [style, pressed && platformPressedOpacityStyle]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"button\"\n accessibilityActions={accessibilityActions}\n onAccessibilityAction={handleAccessibilityAction}\n >\n {children}\n </Pressable>\n </ReanimatedSwipeable>\n )\n}\n\ninterface LeftActionsProps {\n isConversationEmpty: boolean\n handleMute: () => void\n handleLatestMessageUnread: () => void\n muted: boolean\n read: boolean\n isMutedPending: boolean\n isMarkReadPending: boolean\n}\n\nfunction LeftActions({\n isConversationEmpty,\n handleMute,\n handleLatestMessageUnread,\n muted,\n read,\n isMutedPending,\n isMarkReadPending,\n}: LeftActionsProps) {\n const styles = useStyles()\n\n const muteToggleContent = {\n true: { iconName: 'general.bell', label: 'Unmute' },\n false: { iconName: 'general.bellMuted', label: 'Mute' },\n } as const\n\n const latestMessageUnreadToggleContent = {\n true: { iconName: 'general.outlinedTextMessage', label: 'Mark read' },\n false: { iconName: 'general.textMessageNotifications', label: 'Mark unread' },\n } as const\n\n return (\n <View style={styles.actionButtonContainer}>\n <SwipeableToggleButton\n loading={isMarkReadPending}\n disabled={isConversationEmpty}\n toggled={!read}\n onPress={handleLatestMessageUnread}\n toggleContent={latestMessageUnreadToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeDefault}\n />\n <SwipeableToggleButton\n loading={isMutedPending}\n toggled={muted}\n onPress={handleMute}\n toggleContent={muteToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeSecondary}\n />\n </View>\n )\n}\n\nconst ACTION_BUTTON_WIDTH = 120\nconst ACTION_BUTTON_COUNT = 2\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n swipeableChildContainer: {\n backgroundColor: colors.conversationActionsBackground,\n },\n actionButtonContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n width: ACTION_BUTTON_WIDTH * ACTION_BUTTON_COUNT,\n alignContent: 'stretch',\n },\n swipeableContainer: {\n backgroundColor: colors.surfaceColor090,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"conversation_actions.js","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClF,OAAO,EAEL,QAAQ,EACR,SAAS,IAAI,WAAW,EAExB,UAAU,EACV,IAAI,GAEL,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,mBAEN,MAAM,kDAAkD,CAAA;AAEzD,2EAA2E;AAC3E,0DAA0D;AAC1D,MAAM,SAAS,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ChD,YAAY,EAAE,SAAS;SACxB;QACD,kBAAkB,EAAE;YAClB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport {\n AccessibilityActionEvent,\n Platform,\n Pressable as RNPressable,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native'\nimport { Pressable as GHPressable } from 'react-native-gesture-handler'\nimport ReanimatedSwipeable, {\n SwipeableMethods,\n} from 'react-native-gesture-handler/ReanimatedSwipeable'\n\n// Use gesture-handler Pressable on Android to prevent ripple during scroll\n// Use react-native Pressable on iOS for fast tap response\nconst Pressable = Platform.OS === 'android' ? GHPressable : RNPressable\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme, useCreateAndroidRippleColor } from '../../hooks'\nimport {\n useConversationsMarkRead,\n useConversationsMute,\n} from '../../hooks/use_conversations_actions'\nimport { ConversationResource } from '../../types'\nimport { platformPressedOpacityStyle } from '../../utils'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { SwipeableToggleButton } from './swipeable_toggle_button'\n\nexport function ConversationActions({\n children,\n conversation,\n style,\n onPress,\n accessibilityLabel,\n}: {\n children: ReactNode\n conversation: ConversationResource\n onPress: () => void\n style?: StyleProp<ViewStyle>\n accessibilityLabel?: string\n}) {\n const swipeableRef = useRef<SwipeableMethods>(null)\n const styles = useStyles()\n const { activeConversationId, setActiveConversationId } = useConversationsContext()\n const [disabled, setDisabled] = useState(false)\n const overshootLeft = Platform.OS === 'ios'\n const androidRippleColor = useCreateAndroidRippleColor({\n color: styles.swipeableChildContainer.backgroundColor,\n })\n const { muted, setMuted, isPending: isMutedPending } = useConversationsMute({ conversation })\n const {\n read,\n markRead,\n isPending: isMarkReadPending,\n } = useConversationsMarkRead({\n conversation,\n })\n\n const isConversationEmpty = conversation.lastMessageCreatedAt === null\n\n const handleSwipeableClose = useCallback(() => {\n setDisabled(false)\n swipeableRef.current?.close()\n }, [setDisabled])\n\n const handleSwipeableOpen = () => {\n setDisabled(true)\n setActiveConversationId(conversation.id)\n }\n\n const handlePress = useCallback(() => {\n if (disabled || !onPress) return\n onPress()\n }, [disabled, onPress])\n\n const handleMute = useCallback(() => {\n setMuted(!muted)\n handleSwipeableClose()\n }, [muted, handleSwipeableClose, setMuted])\n\n const handleLatestMessageUnread = useCallback(() => {\n markRead(!read)\n handleSwipeableClose()\n }, [read, handleSwipeableClose, markRead])\n\n const readAccessibilityAction = !isConversationEmpty\n ? [\n {\n name: read ? 'markUnread' : 'markRead',\n label: read ? 'Mark unread' : 'Mark read',\n },\n ]\n : []\n\n const accessibilityActions = [\n {\n name: muted ? 'unmute' : 'mute',\n label: muted ? 'Unmute' : 'Mute',\n },\n ...readAccessibilityAction,\n ]\n\n const handleAccessibilityAction = useCallback(\n (event: AccessibilityActionEvent) => {\n switch (event.nativeEvent.actionName) {\n case 'markRead':\n handleLatestMessageUnread()\n break\n case 'markUnread':\n handleLatestMessageUnread()\n break\n case 'mute':\n handleMute()\n break\n case 'unmute':\n handleMute()\n break\n }\n },\n [handleLatestMessageUnread, handleMute]\n )\n\n useEffect(() => {\n if (activeConversationId === conversation.id) return\n\n handleSwipeableClose()\n }, [activeConversationId, conversation.id, handleSwipeableClose])\n\n return (\n <ReanimatedSwipeable\n ref={swipeableRef}\n childrenContainerStyle={styles.swipeableChildContainer}\n containerStyle={styles.swipeableContainer}\n overshootFriction={8}\n overshootLeft={overshootLeft}\n overshootRight={false}\n onSwipeableOpenStartDrag={handleSwipeableOpen}\n onSwipeableClose={() => setDisabled(false)}\n renderRightActions={() => <></>}\n renderLeftActions={() => (\n <LeftActions\n isConversationEmpty={isConversationEmpty}\n handleMute={handleMute}\n handleLatestMessageUnread={handleLatestMessageUnread}\n muted={muted}\n read={read}\n isMutedPending={isMutedPending}\n isMarkReadPending={isMarkReadPending}\n />\n )}\n >\n <Pressable\n onPress={handlePress}\n style={({ pressed }) => [style, pressed && platformPressedOpacityStyle]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"button\"\n accessibilityActions={accessibilityActions}\n onAccessibilityAction={handleAccessibilityAction}\n >\n {children}\n </Pressable>\n </ReanimatedSwipeable>\n )\n}\n\ninterface LeftActionsProps {\n isConversationEmpty: boolean\n handleMute: () => void\n handleLatestMessageUnread: () => void\n muted: boolean\n read: boolean\n isMutedPending: boolean\n isMarkReadPending: boolean\n}\n\nfunction LeftActions({\n isConversationEmpty,\n handleMute,\n handleLatestMessageUnread,\n muted,\n read,\n isMutedPending,\n isMarkReadPending,\n}: LeftActionsProps) {\n const styles = useStyles()\n\n const muteToggleContent = {\n true: { iconName: 'general.bell', label: 'Unmute' },\n false: { iconName: 'general.bellMuted', label: 'Mute' },\n } as const\n\n const latestMessageUnreadToggleContent = {\n true: { iconName: 'general.outlinedTextMessage', label: 'Mark read' },\n false: { iconName: 'general.textMessageNotifications', label: 'Mark unread' },\n } as const\n\n return (\n <View style={styles.actionButtonContainer}>\n <SwipeableToggleButton\n loading={isMarkReadPending}\n disabled={isConversationEmpty}\n toggled={!read}\n onPress={handleLatestMessageUnread}\n toggleContent={latestMessageUnreadToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeDefault}\n />\n <SwipeableToggleButton\n loading={isMutedPending}\n toggled={muted}\n onPress={handleMute}\n toggleContent={muteToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeSecondary}\n />\n </View>\n )\n}\n\nconst ACTION_BUTTON_WIDTH = 120\nconst ACTION_BUTTON_COUNT = 2\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n swipeableChildContainer: {\n backgroundColor: colors.conversationActionsBackground,\n },\n actionButtonContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n width: ACTION_BUTTON_WIDTH * ACTION_BUTTON_COUNT,\n alignContent: 'stretch',\n },\n swipeableContainer: {\n backgroundColor: colors.surfaceColor090,\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAUtC,UAAU,kBAAkB;IAC1B,mBAAmB,CAAC,EAChB,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GACxB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAClE,IAAI,GACJ,SAAS,CAAA;CACd;AAED,eAAO,MAAM,aAAa,4BAA6B,kBAAkB,sBA6ExE,CAAA"}
1
+ {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAetC,UAAU,kBAAkB;IAC1B,mBAAmB,CAAC,EAChB,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GACxB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAClE,IAAI,GACJ,SAAS,CAAA;CACd;AAED,eAAO,MAAM,aAAa,4BAA6B,kBAAkB,sBA6ExE,CAAA"}
@@ -1,6 +1,10 @@
1
1
  import { useNavigation } from '@react-navigation/native';
2
2
  import React, { useMemo } from 'react';
3
- import { FlatList, StyleSheet, View } from 'react-native';
3
+ import { FlatList as RNFlatList, Platform, StyleSheet, View } from 'react-native';
4
+ import { FlatList as GHFlatList } from 'react-native-gesture-handler';
5
+ // Use gesture-handler FlatList on Android to coordinate with gesture-handler Pressable
6
+ // Use react-native FlatList on iOS for better performance and native feel
7
+ const FlatList = Platform.OS === 'android' ? GHFlatList : RNFlatList;
4
8
  import { useConversationsContext } from '../../contexts/conversations_context';
5
9
  import { useTheme } from '../../hooks';
6
10
  import { throwResponseError } from '../../utils/response_error';
@@ -1 +1 @@
1
- {"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,UAAU,MAAM,oCAAoC,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AACzF,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAA;AAUtF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,mBAAmB,EAAsB,EAAE,EAAE;IAC3E,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EACJ,aAAa,EACb,SAAS,EACT,aAAa,EACb,OAAO,EACP,YAAY,EACZ,SAAS,EACT,OAAO,EACP,KAAK,EACL,IAAI,EAAE,EAAE,mBAAmB,EAAE,GAC9B,GAAG,uBAAuB,EAAE,CAAA;IAC7B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAElC,MAAM,UAAU,GAAG,CAAC,mBAAmB,CAAA;IAEvC,MAAM,IAAI,GAAmB,OAAO,CAAC,GAAG,EAAE;QACxC,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,kBAAkB,CAAA;QAC3B,CAAC;QACD,OAAO,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YACxC,IAAI,EAAE,cAAuB;YAC7B,EAAE,EAAE,YAAY,CAAC,EAAE;YACnB,QAAQ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CAClB,CAAC,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React, { useMemo } from 'react'\nimport { FlatList, StyleSheet, View } from 'react-native'\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme } from '../../hooks'\nimport { ConversationResource } from '../../types'\nimport { throwResponseError } from '../../utils/response_error'\nimport BlankState from '../primitive/blank_state_primitive'\nimport { ConversationPreview, ConversationPreviewSkeleton } from './conversation_preview'\nimport { useConversationsJoltEvents } from '../../hooks/use_conversations_jolt_events'\n\ninterface ConversationsProps {\n ListHeaderComponent?:\n | React.ComponentType<any>\n | React.ReactElement<any, string | React.JSXElementConstructor<any>>\n | null\n | undefined\n}\n\nexport const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {\n const styles = useStyles()\n const {\n conversations,\n isLoading,\n fetchNextPage,\n refetch,\n isRefetching,\n isFetched,\n isError,\n error,\n args: { chat_group_graph_id },\n } = useConversationsContext()\n const navigation = useNavigation()\n\n const showBadges = !chat_group_graph_id\n\n const data: FlatListItem[] = useMemo(() => {\n if (isLoading) {\n return loadingPlaceholder\n }\n return conversations.map(conversation => ({\n type: 'conversation' as const,\n id: conversation.id,\n resource: conversation,\n }))\n }, [conversations, isLoading])\n\n if (isError) {\n throwResponseError(error)\n }\n\n useConversationsJoltEvents()\n\n return (\n <View style={styles.container}>\n <FlatList\n data={data}\n keyExtractor={item => item.id.toString()}\n contentContainerStyle={styles.contentContainer}\n onRefresh={refetch}\n refreshing={!isFetched && isRefetching}\n ListHeaderComponent={ListHeaderComponent}\n ListEmptyComponent={\n <View style={styles.listEmpty}>\n <BlankState.Root>\n <BlankState.Imagery name=\"general.outlinedTextMessage\" />\n <BlankState.Content>\n <BlankState.Heading>No conversations</BlankState.Heading>\n </BlankState.Content>\n </BlankState.Root>\n </View>\n }\n renderItem={({ item }) => {\n if (item.type === 'loading') {\n return <ConversationPreviewSkeleton />\n } else {\n return (\n <ConversationPreview\n conversation={item.resource}\n onPress={() =>\n navigation.navigate('Conversation', {\n conversation_id: item.resource.id,\n title: item.resource.title,\n badge: item.resource.badges?.[0],\n deleted: item.resource.deleted,\n })\n }\n showBadges={showBadges}\n />\n )\n }\n }}\n onEndReached={() => fetchNextPage()}\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: { flex: 1 },\n contentContainer: { paddingVertical: 16 },\n listItem: { color: colors.fillColorNeutral020 },\n listEmpty: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n paddingVertical: 32,\n },\n })\n}\n\ninterface FlatListLoadingItem {\n type: 'loading'\n id: string\n}\ninterface FlatListConversationItem {\n type: 'conversation'\n resource: ConversationResource\n id: number\n}\ntype FlatListItem = FlatListLoadingItem | FlatListConversationItem\n\nconst loadingPlaceholder: FlatListItem[] = Array.from({ length: 5 }, (_, i) => ({\n type: 'loading',\n id: `loading${i}`,\n}))\n"]}
1
+ {"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACjF,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAErE,uFAAuF;AACvF,0EAA0E;AAC1E,MAAM,QAAQ,GAAG,QAAQ,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAA;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OA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AA;YACH,CAAC;QACH,CAAC,CAAC,CACF,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,EAExC;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;QACtB,gBAAgB,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE;QACzC,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,mBAAmB,EAAE;QAC/C,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAaD,MAAM,kBAAkB,GAAmB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9E,IAAI,EAAE,SAAS;IACf,EAAE,EAAE,UAAU,CAAC,EAAE;CAClB,CAAC,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React, { useMemo } from 'react'\nimport { FlatList as RNFlatList, Platform, StyleSheet, View } from 'react-native'\nimport { FlatList as GHFlatList } from 'react-native-gesture-handler'\n\n// Use gesture-handler FlatList on Android to coordinate with gesture-handler Pressable\n// Use react-native FlatList on iOS for better performance and native feel\nconst FlatList = Platform.OS === 'android' ? GHFlatList : RNFlatList\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme } from '../../hooks'\nimport { ConversationResource } from '../../types'\nimport { throwResponseError } from '../../utils/response_error'\nimport BlankState from '../primitive/blank_state_primitive'\nimport { ConversationPreview, ConversationPreviewSkeleton } from './conversation_preview'\nimport { useConversationsJoltEvents } from '../../hooks/use_conversations_jolt_events'\n\ninterface ConversationsProps {\n ListHeaderComponent?:\n | React.ComponentType<any>\n | React.ReactElement<any, string | React.JSXElementConstructor<any>>\n | null\n | undefined\n}\n\nexport const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {\n const styles = useStyles()\n const {\n conversations,\n isLoading,\n fetchNextPage,\n refetch,\n isRefetching,\n isFetched,\n isError,\n error,\n args: { chat_group_graph_id },\n } = useConversationsContext()\n const navigation = useNavigation()\n\n const showBadges = !chat_group_graph_id\n\n const data: FlatListItem[] = useMemo(() => {\n if (isLoading) {\n return loadingPlaceholder\n }\n return conversations.map(conversation => ({\n type: 'conversation' as const,\n id: conversation.id,\n resource: conversation,\n }))\n }, [conversations, isLoading])\n\n if (isError) {\n throwResponseError(error)\n }\n\n useConversationsJoltEvents()\n\n return (\n <View style={styles.container}>\n <FlatList\n data={data}\n keyExtractor={item => item.id.toString()}\n contentContainerStyle={styles.contentContainer}\n onRefresh={refetch}\n refreshing={!isFetched && isRefetching}\n ListHeaderComponent={ListHeaderComponent}\n ListEmptyComponent={\n <View style={styles.listEmpty}>\n <BlankState.Root>\n <BlankState.Imagery name=\"general.outlinedTextMessage\" />\n <BlankState.Content>\n <BlankState.Heading>No conversations</BlankState.Heading>\n </BlankState.Content>\n </BlankState.Root>\n </View>\n }\n renderItem={({ item }) => {\n if (item.type === 'loading') {\n return <ConversationPreviewSkeleton />\n } else {\n return (\n <ConversationPreview\n conversation={item.resource}\n onPress={() =>\n navigation.navigate('Conversation', {\n conversation_id: item.resource.id,\n title: item.resource.title,\n badge: item.resource.badges?.[0],\n deleted: item.resource.deleted,\n })\n }\n showBadges={showBadges}\n />\n )\n }\n }}\n onEndReached={() => fetchNextPage()}\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: { flex: 1 },\n contentContainer: { paddingVertical: 16 },\n listItem: { color: colors.fillColorNeutral020 },\n listEmpty: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n paddingVertical: 32,\n },\n })\n}\n\ninterface FlatListLoadingItem {\n type: 'loading'\n id: string\n}\ninterface FlatListConversationItem {\n type: 'conversation'\n resource: ConversationResource\n id: number\n}\ntype FlatListItem = FlatListLoadingItem | FlatListConversationItem\n\nconst loadingPlaceholder: FlatListItem[] = Array.from({ length: 5 }, (_, i) => ({\n type: 'loading',\n id: `loading${i}`,\n}))\n"]}
@@ -1,4 +1,5 @@
1
1
  import { ColorValue } from 'react-native';
2
+ import type { NativeStackHeaderRightProps } from '@react-navigation/native-stack';
2
3
  interface HeaderTextButtonProps {
3
4
  onPress: () => void;
4
5
  title?: string;
@@ -11,5 +12,12 @@ interface HeaderDismissButtonProps {
11
12
  tintColor?: ColorValue;
12
13
  }
13
14
  export declare const HeaderDismissButton: ({ onPress, title, tintColor, ...props }: HeaderDismissButtonProps) => import("react").JSX.Element;
15
+ interface HeaderDoneButtonProps extends NativeStackHeaderRightProps {
16
+ navigation: {
17
+ goBack: () => void;
18
+ getState: () => any;
19
+ };
20
+ }
21
+ export declare const HeaderDoneButton: ({ navigation, ...props }: HeaderDoneButtonProps) => import("react").JSX.Element | null;
14
22
  export {};
15
23
  //# sourceMappingURL=platform_modal_header_buttons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform_modal_header_buttons.d.ts","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAA;AAM/D,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,gBAAgB,iCAI1B,qBAAqB,gCAavB,CAAA;AAED,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAED,eAAO,MAAM,mBAAmB,4CAK7B,wBAAwB,gCAoB1B,CAAA"}
1
+ {"version":3,"file":"platform_modal_header_buttons.d.ts","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAA;AAK/D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAEjF,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,gBAAgB,iCAI1B,qBAAqB,gCAavB,CAAA;AAED,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAED,eAAO,MAAM,mBAAmB,4CAK7B,wBAAwB,gCAoB1B,CAAA;AAED,UAAU,qBAAsB,SAAQ,2BAA2B;IACjE,UAAU,EAAE;QAAE,MAAM,EAAE,MAAM,IAAI,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,CAAA;KAAE,CAAA;CACxD;AAED,eAAO,MAAM,gBAAgB,6BAA8B,qBAAqB,uCAS/E,CAAA"}
@@ -20,6 +20,14 @@ export const HeaderDismissButton = ({ onPress, title = 'Cancel', tintColor, ...p
20
20
  </HeaderButton>),
21
21
  });
22
22
  };
23
+ export const HeaderDoneButton = ({ navigation, ...props }) => {
24
+ const state = navigation.getState();
25
+ const isFirstScreen = state.index === 0;
26
+ if (!isFirstScreen) {
27
+ return null;
28
+ }
29
+ return <HeaderTextButton {...props} onPress={navigation.goBack} title="Done"/>;
30
+ };
23
31
  const useStyles = () => {
24
32
  const { colors } = useTheme();
25
33
  return StyleSheet.create({
@@ -1 +1 @@
1
- {"version":3,"file":"platform_modal_header_buttons.js","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAQtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,OAAO,EACP,KAAK,GAAG,QAAQ,EAChB,GAAG,KAAK,EACc,EAAE,EAAE;IAC1B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,CAAC,UAAU,CACT,qBAAqB,CAAC,CAAC,CAAC,CAAC,CACzB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC,CAC7E,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,KAAK,CACR;IAAA,EAAE,UAAU,CAAC,CACd,CAAA;AACH,CAAC,CAAA;AAQD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,OAAO,EACP,KAAK,GAAG,QAAQ,EAChB,SAAS,EACT,GAAG,KAAK,EACiB,EAAE,EAAE;IAC7B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,QAAQ,CAAC,MAAM,CAAC;QACrB,GAAG,EAAE,CACH,CAAC,UAAU,CACT,qBAAqB,CAAC,CAAC,CAAC,CAAC,CACzB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC,CAC7D,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,KAAK,CACR;MAAA,EAAE,UAAU,CAAC,CACd;QACD,OAAO,EAAE,CACP,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAC7E;QAAA,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,EACpD;MAAA,EAAE,YAAY,CAAC,CAChB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACrB,GAAG,EAAE,MAAM,CAAC,6BAA6B;gBACzC,OAAO,EAAE,MAAM,CAAC,iCAAiC;aAClD,CAAC;SACH;QACD,mBAAmB,EAAE;YACnB,WAAW,EAAE,EAAE;SAChB;QACD,eAAe,EAAE;YACf,UAAU,EAAE,QAAQ;SACrB;QACD,aAAa,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { ColorValue, Platform, StyleSheet } from 'react-native'\nimport { TextButton } from './text_button'\nimport { HeaderButton } from '@react-navigation/elements'\nimport { Icon } from './icon'\nimport { useTheme } from '../../hooks'\n\ninterface HeaderTextButtonProps {\n onPress: () => void\n title?: string\n disabled?: boolean\n}\n\nexport const HeaderTextButton = ({\n onPress,\n title = 'Submit',\n ...props\n}: HeaderTextButtonProps) => {\n const styles = useStyles()\n\n return (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, props.disabled && styles.disabledColor]}\n {...props}\n >\n {title}\n </TextButton>\n )\n}\n\ninterface HeaderDismissButtonProps {\n onPress: () => void\n title?: string\n tintColor?: ColorValue\n}\n\nexport const HeaderDismissButton = ({\n onPress,\n title = 'Cancel',\n tintColor,\n ...props\n}: HeaderDismissButtonProps) => {\n const styles = useStyles()\n\n return Platform.select({\n ios: (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, styles.iosCancelButton]}\n {...props}\n >\n {title}\n </TextButton>\n ),\n default: (\n <HeaderButton onPress={onPress} style={[styles.androidCancelButton]} {...props}>\n <Icon name=\"general.x\" size={16} color={tintColor} />\n </HeaderButton>\n ),\n })\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n interactionColor: {\n color: Platform.select({\n ios: colors.iOSModalHeaderButtonTextColor,\n android: colors.androidModalHeaderButtonTextColor,\n }),\n },\n androidCancelButton: {\n marginRight: 16,\n },\n iosCancelButton: {\n fontWeight: 'normal',\n },\n disabledColor: {\n color: colors.textColorDefaultDisabled,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"platform_modal_header_buttons.js","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAStC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,OAAO,EACP,KAAK,GAAG,QAAQ,EAChB,GAAG,KAAK,EACc,EAAE,EAAE;IAC1B,MAAM,MAAM,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UAAU,EAAE,GAAG,KAAK,EAAyB,EAAE,EAAE;IAClF,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAA;IACnC,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,KAAK,CAAC,CAAA;IAEvC,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,EAAG,CAAA;AACjF,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACrB,GAAG,EAAE,MAAM,CAAC,6BAA6B;gBACzC,OAAO,EAAE,MAAM,CAAC,iCAAiC;aAClD,CAAC;SACH;QACD,mBAAmB,EAAE;YACnB,WAAW,EAAE,EAAE;SAChB;QACD,eAAe,EAAE;YACf,UAAU,EAAE,QAAQ;SACrB;QACD,aAAa,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { ColorValue, Platform, StyleSheet } from 'react-native'\nimport { TextButton } from './text_button'\nimport { HeaderButton } from '@react-navigation/elements'\nimport { Icon } from './icon'\nimport { useTheme } from '../../hooks'\nimport type { NativeStackHeaderRightProps } from '@react-navigation/native-stack'\n\ninterface HeaderTextButtonProps {\n onPress: () => void\n title?: string\n disabled?: boolean\n}\n\nexport const HeaderTextButton = ({\n onPress,\n title = 'Submit',\n ...props\n}: HeaderTextButtonProps) => {\n const styles = useStyles()\n\n return (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, props.disabled && styles.disabledColor]}\n {...props}\n >\n {title}\n </TextButton>\n )\n}\n\ninterface HeaderDismissButtonProps {\n onPress: () => void\n title?: string\n tintColor?: ColorValue\n}\n\nexport const HeaderDismissButton = ({\n onPress,\n title = 'Cancel',\n tintColor,\n ...props\n}: HeaderDismissButtonProps) => {\n const styles = useStyles()\n\n return Platform.select({\n ios: (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, styles.iosCancelButton]}\n {...props}\n >\n {title}\n </TextButton>\n ),\n default: (\n <HeaderButton onPress={onPress} style={[styles.androidCancelButton]} {...props}>\n <Icon name=\"general.x\" size={16} color={tintColor} />\n </HeaderButton>\n ),\n })\n}\n\ninterface HeaderDoneButtonProps extends NativeStackHeaderRightProps {\n navigation: { goBack: () => void; getState: () => any }\n}\n\nexport const HeaderDoneButton = ({ navigation, ...props }: HeaderDoneButtonProps) => {\n const state = navigation.getState()\n const isFirstScreen = state.index === 0\n\n if (!isFirstScreen) {\n return null\n }\n\n return <HeaderTextButton {...props} onPress={navigation.goBack} title=\"Done\" />\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n interactionColor: {\n color: Platform.select({\n ios: colors.iOSModalHeaderButtonTextColor,\n android: colors.androidModalHeaderButtonTextColor,\n }),\n },\n androidCancelButton: {\n marginRight: 16,\n },\n iosCancelButton: {\n fontWeight: 'normal',\n },\n disabledColor: {\n color: colors.textColorDefaultDisabled,\n },\n })\n}\n"]}
@@ -55,7 +55,7 @@ declare const FORM_SHEET_ACTION_APPEARANCES: {
55
55
  type FormSheetActionAppearanceUnion = (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES];
56
56
  interface FormSheetActionProps {
57
57
  title: string;
58
- iconName: IconString;
58
+ iconName?: IconString;
59
59
  onPress: () => void;
60
60
  accessibilityLabel?: string;
61
61
  accessibilityHint?: string;
@@ -1 +1 @@
1
- {"version":3,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AAC,EAC5B,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,uBAA8B,GAC/B,EAAE,kBAAkB,qBASpB;yBAde,aAAa;;;AAmC7B,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,SAAS,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B;AAkBD,UAAU,yBAAyB;IACjC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAsBD,UAAU,2BAA2B;IACnC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAiBD,UAAU,8BACR,SAAQ,IAAI,CAAC,eAAe,EAAE,uBAAuB,GAAG,aAAa,CAAC;IACtE,QAAQ,EAAE,MAAM,CAAA;CACjB;AAoBD,UAAU,0BACR,SAAQ,IAAI,CAAC,WAAW,EAAE,uBAAuB,GAAG,aAAa,CAAC;CAAG;AAmBvE,QAAA,MAAM,6BAA6B;;;CAGzB,CAAA;AAEV,KAAK,8BAA8B,GACjC,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAA;AAEpF,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,UAAU,CAAC,EAAE,8BAA8B,CAAA;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
@@ -89,7 +89,7 @@ const FORM_SHEET_ACTION_APPEARANCES = {
89
89
  function FormSheetAction({ title, iconName, onPress, accessibilityLabel, accessibilityHint, accessibilityRole = 'button', appearance = 'neutral', disabled = false, }) {
90
90
  const styles = useStyles({ appearance });
91
91
  return (<PlatformPressable onPress={onPress} accessibilityLabel={accessibilityLabel} accessibilityHint={accessibilityHint} accessibilityRole={accessibilityRole} style={styles.actionPressable} disabled={disabled}>
92
- <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon}/>
92
+ {iconName && (<Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon}/>)}
93
93
  <Text style={styles.actionTitle}>{title}</Text>
94
94
  </PlatformPressable>);
95
95
  }
@@ -1 +1 @@
1
- {"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE/E,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAc,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAChF,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAA;AAE/D,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,WAAW,EACX,mBAAmB,GAAG,CAAC,IAAI,CAAC,EAC5B,GAAG,IAAI,KACyB,EAAE,EAAgC,EAAE,CAAC,CAAC;IACtE,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,KAAK;IAClB,mBAAmB;IACnB,iBAAiB,EAAE,EAAE;IACrB,mBAAmB,EAAE,IAAI;IACzB,WAAW;IACX,GAAG,IAAI;CACR,CAAC,CAAA;AAEF,MAAM,SAAS,GAAG;IAChB,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,eAAe;IACvB,WAAW,E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,EAAE,MAAM,EAAE,kGAAkG;iBACtH;aACF,CAAC;SACH;QACD,MAAM,EAAE;YACN,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE;YACjB,eAAe,EAAE,MAAM,CAAC,2BAA2B;YACnD,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;SACjD;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;SAChC;QACD,WAAW,EAAE;YACX,SAAS,EAAE,MAAM;YACjB,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;QACD,WAAW,EAAE;YACX,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport type { ButtonProps, TextButtonProps } from '../display'\nimport { Button, Heading, Icon, IconString, Text, TextButton } from '../display'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n HeaderTitle: FormSheetHeaderTitle,\n HeaderActions: FormSheetHeaderActions,\n HeaderTextButton: FormSheetHeaderTextButton,\n HeaderButton: FormSheetHeaderButton,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n HeaderTitle: React.FC<FormSheetHeaderTitleProps>\n HeaderActions: React.FC<FormSheetHeaderActionsProps>\n HeaderTextButton: React.FC<FormSheetHeaderTextButtonProps>\n HeaderButton: React.FC<FormSheetHeaderButtonProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type {\n FormSheetActionProps,\n FormSheetHeaderActionsProps,\n FormSheetHeaderButtonProps,\n FormSheetHeaderProps,\n FormSheetHeaderTextButtonProps,\n FormSheetHeaderTitleProps,\n FormSheetRootProps,\n}\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n showAndroidSheetGrabber?: boolean\n}\n\nexport function FormSheetRoot({\n children,\n style,\n contentStyle,\n showAndroidSheetGrabber = true,\n}: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <View style={[styles.content, contentStyle]}>{children}</View>\n {showAndroidSheetGrabber && <AndroidSheetGrabber />}\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n}\n\nfunction FormSheetHeader({ children, style }: FormSheetHeaderProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.header, style]}>\n <View style={styles.headerContent}>{children}</View>\n </View>\n )\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== FormSheetHeaderTitle ========\n// ====================================\n\ninterface FormSheetHeaderTitleProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {\n const styles = useStyles()\n\n return (\n <Heading\n variant=\"h3\"\n style={styles.headerTitle}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n >\n {children}\n </Heading>\n )\n}\n\nFormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'\n\n// ====================================\n// ====== FormSheetHeaderActions ======\n// ====================================\n\ninterface FormSheetHeaderActionsProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {\n const styles = useStyles()\n\n return <View style={styles.headerActions}>{children}</View>\n}\n\nFormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'\n\n// ===========================================\n// ====== FormSheetHeaderTextButton ==========\n// ===========================================\n\n// We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.\n// This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.\n// Triggering this prop will display an almost full screen iOS a11y button.\ninterface FormSheetHeaderTextButtonProps\n extends Omit<TextButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {\n children: string\n}\n\nfunction FormSheetHeaderTextButton(props: FormSheetHeaderTextButtonProps) {\n return (\n <TextButton\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.children}\n />\n )\n}\n\nFormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'\n\n// =========================================\n// ====== FormSheetHeaderButton ============\n// =========================================\n\n// Same `onLongPress`note as `FormSheetHeaderTextButtonProps`\ninterface FormSheetHeaderButtonProps\n extends Omit<ButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {}\n\nfunction FormSheetHeaderButton(props: FormSheetHeaderButtonProps) {\n return (\n <Button\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.title}\n />\n )\n}\n\nFormSheetHeaderButton.displayName = 'FormSheet.HeaderButton'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n <Text style={styles.actionTitle}>{title}</Text>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n}\n\nconst useStyles = ({ appearance = 'neutral' }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n ...Platform.select({\n ios: {\n flexGrow: 1, // Ensures the FormSheet children respond to the formsheet height changing on iOS\n },\n android: {\n maxHeight: '100%', // Ensures lists to scroll on Android\n },\n }),\n },\n androidSheetGrabber: {\n position: 'absolute',\n top: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n ...Platform.select({\n android: {\n maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height\n },\n }),\n },\n header: {\n paddingHorizontal: 16,\n paddingTop: 20,\n paddingBottom: 16,\n backgroundColor: colors.fillColorNeutral100Inverted,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n flex: 1,\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: appearanceColorsMap[appearance].iconColor,\n },\n actionTitle: {\n color: appearanceColorsMap[appearance].textColor,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE/E,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAc,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAChF,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAA;AAE/D,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,WAAW,EACX,mBAAmB,GAAG,CAAC,IAAI,CAAC,EAC5B,GAAG,IAAI,KACyB,EAAE,EAAgC,EAAE,CAAC,CAAC;IACtE,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,KAAK;IAClB,mBAAmB;IACnB,iBAAiB,EAAE,EAAE;IACr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,EAAE,EAAE;YACT,MAAM,EAAE,CAAC;YACT,eAAe,EAAE,MAAM,CAAC,mBAAmB;YAC3C,YAAY,EAAE,GAAG;YACjB,SAAS,EAAE,QAAQ;SACpB;QACD,OAAO,EAAE;YACP,GAAG,QAAQ,CAAC,MAAM,CAAC;gBACjB,OAAO,EAAE;oBACP,SAAS,EAAE,MAAM,EAAE,kGAAkG;iBACtH;aACF,CAAC;SACH;QACD,MAAM,EAAE;YACN,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE;YACjB,eAAe,EAAE,MAAM,CAAC,2BAA2B;YACnD,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;SACjD;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;SAChC;QACD,WAAW,EAAE;YACX,SAAS,EAAE,MAAM;YACjB,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;QACD,WAAW,EAAE;YACX,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport type { ButtonProps, TextButtonProps } from '../display'\nimport { Button, Heading, Icon, IconString, Text, TextButton } from '../display'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n HeaderTitle: FormSheetHeaderTitle,\n HeaderActions: FormSheetHeaderActions,\n HeaderTextButton: FormSheetHeaderTextButton,\n HeaderButton: FormSheetHeaderButton,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n HeaderTitle: React.FC<FormSheetHeaderTitleProps>\n HeaderActions: React.FC<FormSheetHeaderActionsProps>\n HeaderTextButton: React.FC<FormSheetHeaderTextButtonProps>\n HeaderButton: React.FC<FormSheetHeaderButtonProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type {\n FormSheetActionProps,\n FormSheetHeaderActionsProps,\n FormSheetHeaderButtonProps,\n FormSheetHeaderProps,\n FormSheetHeaderTextButtonProps,\n FormSheetHeaderTitleProps,\n FormSheetRootProps,\n}\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n showAndroidSheetGrabber?: boolean\n}\n\nexport function FormSheetRoot({\n children,\n style,\n contentStyle,\n showAndroidSheetGrabber = true,\n}: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <View style={[styles.content, contentStyle]}>{children}</View>\n {showAndroidSheetGrabber && <AndroidSheetGrabber />}\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n}\n\nfunction FormSheetHeader({ children, style }: FormSheetHeaderProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.header, style]}>\n <View style={styles.headerContent}>{children}</View>\n </View>\n )\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== FormSheetHeaderTitle ========\n// ====================================\n\ninterface FormSheetHeaderTitleProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {\n const styles = useStyles()\n\n return (\n <Heading\n variant=\"h3\"\n style={styles.headerTitle}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n >\n {children}\n </Heading>\n )\n}\n\nFormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'\n\n// ====================================\n// ====== FormSheetHeaderActions ======\n// ====================================\n\ninterface FormSheetHeaderActionsProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {\n const styles = useStyles()\n\n return <View style={styles.headerActions}>{children}</View>\n}\n\nFormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'\n\n// ===========================================\n// ====== FormSheetHeaderTextButton ==========\n// ===========================================\n\n// We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.\n// This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.\n// Triggering this prop will display an almost full screen iOS a11y button.\ninterface FormSheetHeaderTextButtonProps\n extends Omit<TextButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {\n children: string\n}\n\nfunction FormSheetHeaderTextButton(props: FormSheetHeaderTextButtonProps) {\n return (\n <TextButton\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.children}\n />\n )\n}\n\nFormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'\n\n// =========================================\n// ====== FormSheetHeaderButton ============\n// =========================================\n\n// Same `onLongPress`note as `FormSheetHeaderTextButtonProps`\ninterface FormSheetHeaderButtonProps\n extends Omit<ButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {}\n\nfunction FormSheetHeaderButton(props: FormSheetHeaderButtonProps) {\n return (\n <Button\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.title}\n />\n )\n}\n\nFormSheetHeaderButton.displayName = 'FormSheet.HeaderButton'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName?: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n {iconName && (\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n )}\n <Text style={styles.actionTitle}>{title}</Text>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n}\n\nconst useStyles = ({ appearance = 'neutral' }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n ...Platform.select({\n ios: {\n flexGrow: 1, // Ensures the FormSheet children respond to the formsheet height changing on iOS\n },\n android: {\n maxHeight: '100%', // Ensures lists to scroll on Android\n },\n }),\n },\n androidSheetGrabber: {\n position: 'absolute',\n top: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n ...Platform.select({\n android: {\n maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height\n },\n }),\n },\n header: {\n paddingHorizontal: 16,\n paddingTop: 20,\n paddingBottom: 16,\n backgroundColor: colors.fillColorNeutral100Inverted,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n flex: 1,\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: appearanceColorsMap[appearance].iconColor,\n },\n actionTitle: {\n color: appearanceColorsMap[appearance].textColor,\n },\n })\n}\n"]}
@@ -21,4 +21,5 @@ export * from './use_submit_age_check';
21
21
  export * from './use_organization';
22
22
  export * from './use_product_analytics';
23
23
  export * from './use_people_person';
24
+ export * from './use_new_conversation_entry';
24
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,yCAAyC,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,yCAAyC,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,8BAA8B,CAAA"}
@@ -21,4 +21,5 @@ export * from './use_submit_age_check';
21
21
  export * from './use_organization';
22
22
  export * from './use_product_analytics';
23
23
  export * from './use_people_person';
24
+ export * from './use_new_conversation_entry';
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,yCAAyC,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA","sourcesContent":["export * from './use_async_storage'\nexport * from './use_animated_message_background_color'\nexport * from './use_theme'\nexport * from './use_suspense_api'\nexport * from './use_current_person'\nexport * from './use_deleting_ids'\nexport * from './use_font_scale'\nexport * from './use_create_android_ripple_color'\nexport * from './use_chat_permissions'\nexport * from './use_api_client'\nexport * from './use_groups_groups'\nexport * from './use_groups'\nexport * from './use_api'\nexport * from './use_api_client'\nexport * from './use_message_reaction_toggle'\nexport * from './use_interaction_ghost_color'\nexport * from './use_at_font_scale_breakpoint'\nexport * from './use_qualified_by_age'\nexport * from './use_scalable_number_of_lines'\nexport * from './use_submit_age_check'\nexport * from './use_organization'\nexport * from './use_product_analytics'\nexport * from './use_people_person'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,yCAAyC,CAAA;AACvD,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,8BAA8B,CAAA","sourcesContent":["export * from './use_async_storage'\nexport * from './use_animated_message_background_color'\nexport * from './use_theme'\nexport * from './use_suspense_api'\nexport * from './use_current_person'\nexport * from './use_deleting_ids'\nexport * from './use_font_scale'\nexport * from './use_create_android_ripple_color'\nexport * from './use_chat_permissions'\nexport * from './use_api_client'\nexport * from './use_groups_groups'\nexport * from './use_groups'\nexport * from './use_api'\nexport * from './use_api_client'\nexport * from './use_message_reaction_toggle'\nexport * from './use_interaction_ghost_color'\nexport * from './use_at_font_scale_breakpoint'\nexport * from './use_qualified_by_age'\nexport * from './use_scalable_number_of_lines'\nexport * from './use_submit_age_check'\nexport * from './use_organization'\nexport * from './use_product_analytics'\nexport * from './use_people_person'\nexport * from './use_new_conversation_entry'\n"]}
@@ -5,5 +5,6 @@ export declare function useFeatures(): {
5
5
  };
6
6
  export declare const availableFeatures: {
7
7
  threaded_replies: string;
8
+ message_reporting: string;
8
9
  };
9
10
  //# sourceMappingURL=use_features.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use_features.d.ts","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAG1E,wBAAgB,WAAW;;kCAiBT,MAAM;EASvB;AAED,eAAO,MAAM,iBAAiB;;CAE7B,CAAA"}
1
+ {"version":3,"file":"use_features.d.ts","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAG1E,wBAAgB,WAAW;;kCAiBT,MAAM;EASvB;AAED,eAAO,MAAM,iBAAiB;;;CAG7B,CAAA"}
@@ -23,6 +23,7 @@ export function useFeatures() {
23
23
  }
24
24
  export const availableFeatures = {
25
25
  threaded_replies: 'ROLLOUT_MOBILE_threaded_replies_v1',
26
+ message_reporting: 'ROLLOUT_MOBILE_message_reporting',
26
27
  };
27
28
  const stableEmptyFeatures = {
28
29
  data: [],
@@ -1 +1 @@
1
- {"version":3,"file":"use_features.js","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAI/C,MAAM,UAAU,WAAW;IACzB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,WAAW,GAAG,sBAAsB,EAAE,CAAA;IAE5C,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC;QAChC,QAAQ,EAAE,mBAAmB,EAAE;QAC/B,OAAO,EAAE,GAAG,EAAE;YACZ,OAAO,SAAS,CAAC,IAAI;iBAClB,GAAG,CAAiC,WAAW,CAAC;iBAChD,KAAK,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,CAAA;QACrC,CAAC;QACD,SAAS,EAAE,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,YAAY;KACvC,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAA;IAE1B,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,WAAmB,EAAE,EAAE,CACtB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,EAC3E,CAAC,QAAQ,CAAC,CACX,CAAA;IAED,OAAO;QACL,QAAQ;QACR,cAAc;KACf,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,gBAAgB,EAAE,oCAAoC;CACvD,CAAA;AAED,MAAM,mBAAmB,GAAmC;IAC1D,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,IAAI,EAAE;QACJ,KAAK,EAAE,CAAC;QACR,UAAU,EAAE,CAAC;KACd;CACF,CAAA","sourcesContent":["import { useSuspenseQuery } from '@tanstack/react-query'\nimport { useCallback } from 'react'\nimport { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'\nimport { useApiClient } from './use_api_client'\nimport type { FeatureResource } from '../types/resources/feature_resource'\nimport { ApiCollection } from '../types'\n\nexport function useFeatures() {\n const apiClient = useApiClient()\n const requestArgs = getFeaturesRequestArgs()\n\n const { data } = useSuspenseQuery({\n queryKey: getFeaturesQueryKey(),\n queryFn: () => {\n return apiClient.chat\n .get<ApiCollection<FeatureResource>>(requestArgs)\n .catch(() => stableEmptyFeatures)\n },\n staleTime: 1000 * 60 * 5, // 5 minutes\n })\n\n const features = data.data\n\n const featureEnabled = useCallback(\n (featureName: string) =>\n features.some(feature => feature.name === featureName && feature.enabled),\n [features]\n )\n\n return {\n features,\n featureEnabled,\n }\n}\n\nexport const availableFeatures = {\n threaded_replies: 'ROLLOUT_MOBILE_threaded_replies_v1',\n}\n\nconst stableEmptyFeatures: ApiCollection<FeatureResource> = {\n data: [],\n links: {},\n meta: {\n count: 0,\n totalCount: 0,\n },\n}\n"]}
1
+ {"version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AI,EAAE;QACJ,KAAK,EAAE,CAAC;QACR,UAAU,EAAE,CAAC;KACd;CACF,CAAA","sourcesContent":["import { useSuspenseQuery } from '@tanstack/react-query'\nimport { useCallback } from 'react'\nimport { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'\nimport { useApiClient } from './use_api_client'\nimport type { FeatureResource } from '../types/resources/feature_resource'\nimport { ApiCollection } from '../types'\n\nexport function useFeatures() {\n const apiClient = useApiClient()\n const requestArgs = getFeaturesRequestArgs()\n\n const { data } = useSuspenseQuery({\n queryKey: getFeaturesQueryKey(),\n queryFn: () => {\n return apiClient.chat\n .get<ApiCollection<FeatureResource>>(requestArgs)\n .catch(() => stableEmptyFeatures)\n },\n staleTime: 1000 * 60 * 5, // 5 minutes\n })\n\n const features = data.data\n\n const featureEnabled = useCallback(\n (featureName: string) =>\n features.some(feature => feature.name === featureName && feature.enabled),\n [features]\n )\n\n return {\n features,\n featureEnabled,\n }\n}\n\nexport const availableFeatures = {\n threaded_replies: 'ROLLOUT_MOBILE_threaded_replies_v1',\n message_reporting: 'ROLLOUT_MOBILE_message_reporting',\n}\n\nconst stableEmptyFeatures: ApiCollection<FeatureResource> = {\n data: [],\n links: {},\n meta: {\n count: 0,\n totalCount: 0,\n },\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export type NewConversationEntryMode = 'select_type' | 'groups' | 'teams' | 'none';
2
+ export declare function useNewConversationEntry(): NewConversationEntryMode;
3
+ //# sourceMappingURL=use_new_conversation_entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_new_conversation_entry.d.ts","sourceRoot":"","sources":["../../src/hooks/use_new_conversation_entry.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,wBAAwB,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAElF,wBAAgB,uBAAuB,IAAI,wBAAwB,CAyBlE"}
@@ -0,0 +1,20 @@
1
+ import { useMemo } from 'react';
2
+ import { useAppGrants } from './use_chat_permissions';
3
+ export function useNewConversationEntry() {
4
+ const appGrants = useAppGrants();
5
+ return useMemo(() => {
6
+ const canCreateGroupsConversations = appGrants.data?.some(g => g.createConversations && g.appName === 'Groups');
7
+ const canCreateServicesConversations = appGrants.data?.some(g => g.createConversations && g.appName === 'Services');
8
+ if (canCreateGroupsConversations && canCreateServicesConversations) {
9
+ return 'select_type';
10
+ }
11
+ if (canCreateGroupsConversations) {
12
+ return 'groups';
13
+ }
14
+ if (canCreateServicesConversations) {
15
+ return 'teams';
16
+ }
17
+ return 'none';
18
+ }, [appGrants.data]);
19
+ }
20
+ //# sourceMappingURL=use_new_conversation_entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_new_conversation_entry.js","sourceRoot":"","sources":["../../src/hooks/use_new_conversation_entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAIrD,MAAM,UAAU,uBAAuB;IACrC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,4BAA4B,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CACvD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,CAAC,OAAO,KAAK,QAAQ,CACrD,CAAA;QACD,MAAM,8BAA8B,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CACzD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,CAAC,OAAO,KAAK,UAAU,CACvD,CAAA;QAED,IAAI,4BAA4B,IAAI,8BAA8B,EAAE,CAAC;YACnE,OAAO,aAAa,CAAA;QACtB,CAAC;QAED,IAAI,4BAA4B,EAAE,CAAC;YACjC,OAAO,QAAQ,CAAA;QACjB,CAAC;QAED,IAAI,8BAA8B,EAAE,CAAC;YACnC,OAAO,OAAO,CAAA;QAChB,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;AACtB,CAAC","sourcesContent":["import { useMemo } from 'react'\nimport { useAppGrants } from './use_chat_permissions'\n\nexport type NewConversationEntryMode = 'select_type' | 'groups' | 'teams' | 'none'\n\nexport function useNewConversationEntry(): NewConversationEntryMode {\n const appGrants = useAppGrants()\n\n return useMemo(() => {\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\n if (canCreateGroupsConversations && canCreateServicesConversations) {\n return 'select_type'\n }\n\n if (canCreateGroupsConversations) {\n return 'groups'\n }\n\n if (canCreateServicesConversations) {\n return 'teams'\n }\n\n return 'none'\n }, [appGrants.data])\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { MessageReportReason } from '../types/resources/message_report';
2
+ export declare const useReportMessage: (conversationId: number, messageId: string) => import("@tanstack/react-query").UseMutationResult<import("..").ApiCollection | import("..").ApiResource, Error, {
3
+ reason: MessageReportReason;
4
+ reasonDetail?: string;
5
+ }, unknown>;
6
+ //# sourceMappingURL=use_report_message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_report_message.d.ts","sourceRoot":"","sources":["../../src/hooks/use_report_message.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAwB,MAAM,mCAAmC,CAAA;AAE7F,eAAO,MAAM,gBAAgB,mBAAoB,MAAM,aAAa,MAAM;YAQ5D,mBAAmB;mBACZ,MAAM;WAsB1B,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { useMutation } from '@tanstack/react-query';
2
+ import { useApiClient } from './use_api_client';
3
+ import { Haptic } from '../utils/native_adapters';
4
+ export const useReportMessage = (conversationId, messageId) => {
5
+ const apiClient = useApiClient();
6
+ return useMutation({
7
+ mutationFn: async ({ reason, reasonDetail, }) => {
8
+ const url = `/me/conversations/${conversationId}/messages/${messageId}/report`;
9
+ const data = {
10
+ data: {
11
+ type: 'MessageReport',
12
+ attributes: {
13
+ reason,
14
+ ...(reasonDetail && { reason_detail: reasonDetail }),
15
+ },
16
+ },
17
+ };
18
+ return apiClient.chat.post({ url, data });
19
+ },
20
+ onSuccess: () => {
21
+ Haptic.notificationSuccess();
22
+ },
23
+ onError: () => {
24
+ Haptic.notificationError();
25
+ },
26
+ });
27
+ };
28
+ //# sourceMappingURL=use_report_message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_report_message.js","sourceRoot":"","sources":["../../src/hooks/use_report_message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAGjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,cAAsB,EAAE,SAAiB,EAAE,EAAE;IAC5E,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,OAAO,WAAW,CAAC;QACjB,UAAU,EAAE,KAAK,EAAE,EACjB,MAAM,EACN,YAAY,GAIb,EAAE,EAAE;YACH,MAAM,GAAG,GAAG,qBAAqB,cAAc,aAAa,SAAS,SAAS,CAAA;YAC9E,MAAM,IAAI,GAAyB;gBACjC,IAAI,EAAE;oBACJ,IAAI,EAAE,eAAe;oBACrB,UAAU,EAAE;wBACV,MAAM;wBACN,GAAG,CAAC,YAAY,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;qBACrD;iBACF;aACF,CAAA;YAED,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAA;QAC3C,CAAC;QACD,SAAS,EAAE,GAAG,EAAE;YACd,MAAM,CAAC,mBAAmB,EAAE,CAAA;QAC9B,CAAC;QACD,OAAO,EAAE,GAAG,EAAE;YACZ,MAAM,CAAC,iBAAiB,EAAE,CAAA;QAC5B,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useMutation } from '@tanstack/react-query'\nimport { useApiClient } from './use_api_client'\nimport { Haptic } from '../utils/native_adapters'\nimport { MessageReportReason, MessageReportPayload } from '../types/resources/message_report'\n\nexport const useReportMessage = (conversationId: number, messageId: string) => {\n const apiClient = useApiClient()\n\n return useMutation({\n mutationFn: async ({\n reason,\n reasonDetail,\n }: {\n reason: MessageReportReason\n reasonDetail?: string\n }) => {\n const url = `/me/conversations/${conversationId}/messages/${messageId}/report`\n const data: MessageReportPayload = {\n data: {\n type: 'MessageReport',\n attributes: {\n reason,\n ...(reasonDetail && { reason_detail: reasonDetail }),\n },\n },\n }\n\n return apiClient.chat.post({ url, data })\n },\n onSuccess: () => {\n Haptic.notificationSuccess()\n },\n onError: () => {\n Haptic.notificationError()\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use_teams.d.ts","sourceRoot":"","sources":["../../src/hooks/use_teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAGjE,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAepB,CAAA;AAED,eAAO,MAAM,kBAAkB,eAI9B,CAAA"}
1
+ {"version":3,"file":"use_teams.d.ts","sourceRoot":"","sources":["../../src/hooks/use_teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAGjE,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBpB,CAAA;AAED,eAAO,MAAM,kBAAkB,eAI9B,CAAA"}
@@ -10,6 +10,7 @@ export const useTeams = () => {
10
10
  source_app_name: 'Services',
11
11
  source_type: 'Team',
12
12
  },
13
+ order: 'name',
13
14
  perPage: 100,
14
15
  },
15
16
  app: 'chat',
@@ -1 +1 @@
1
- {"version":3,"file":"use_teams.js","sourceRoot":"","sources":["../../src/hooks/use_teams.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,OAAO,eAAe,CAAgB;QACpC,GAAG,EAAE,YAAY;QACjB,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,KAAK,EAAE,EAAE;aACV;YACD,KAAK,EAAE;gBACL,eAAe,EAAE,UAAU;gBAC3B,WAAW,EAAE,MAAM;aACpB;YACD,OAAO,EAAE,GAAG;SACb;QACD,GAAG,EAAE,MAAM;KACZ,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,QAAQ,EAAE,CAAA;IAEvC,OAAO,KAAK,EAAE,MAAM,GAAG,CAAC,CAAA;AAC1B,CAAC,CAAA","sourcesContent":["import { GroupResource } from '../types/resources/group_resource'\nimport { useApiPaginator } from './use_api'\n\nexport const useTeams = () => {\n return useApiPaginator<GroupResource>({\n url: '/me/groups',\n data: {\n fields: {\n Group: [],\n },\n where: {\n source_app_name: 'Services',\n source_type: 'Team',\n },\n perPage: 100,\n },\n app: 'chat',\n })\n}\n\nexport const useCanDisplayTeams = () => {\n const { data: teams = [] } = useTeams()\n\n return teams?.length > 0\n}\n"]}
1
+ {"version":3,"file":"use_teams.js","sourceRoot":"","sources":["../../src/hooks/use_teams.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,OAAO,eAAe,CAAgB;QACpC,GAAG,EAAE,YAAY;QACjB,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,KAAK,EAAE,EAAE;aACV;YACD,KAAK,EAAE;gBACL,eAAe,EAAE,UAAU;gBAC3B,WAAW,EAAE,MAAM;aACpB;YACD,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,GAAG;SACb;QACD,GAAG,EAAE,MAAM;KACZ,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,QAAQ,EAAE,CAAA;IAEvC,OAAO,KAAK,EAAE,MAAM,GAAG,CAAC,CAAA;AAC1B,CAAC,CAAA","sourcesContent":["import { GroupResource } from '../types/resources/group_resource'\nimport { useApiPaginator } from './use_api'\n\nexport const useTeams = () => {\n return useApiPaginator<GroupResource>({\n url: '/me/groups',\n data: {\n fields: {\n Group: [],\n },\n where: {\n source_app_name: 'Services',\n source_type: 'Team',\n },\n order: 'name',\n perPage: 100,\n },\n app: 'chat',\n })\n}\n\nexport const useCanDisplayTeams = () => {\n const { data: teams = [] } = useTeams()\n\n return teams?.length > 0\n}\n"]}