@planningcenter/chat-react-native 3.2.0-rc.6 → 3.2.0-rc.8

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 (89) hide show
  1. package/build/components/conversations/conversation_actions.d.ts.map +1 -1
  2. package/build/components/conversations/conversation_actions.js +14 -15
  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 -8
  6. package/build/components/conversations/conversations.js.map +1 -1
  7. package/build/components/primitive/banner_primitive.js +0 -1
  8. package/build/components/primitive/banner_primitive.js.map +1 -1
  9. package/build/contexts/chat_context.d.ts +1 -0
  10. package/build/contexts/chat_context.d.ts.map +1 -1
  11. package/build/contexts/chat_context.js +3 -0
  12. package/build/contexts/chat_context.js.map +1 -1
  13. package/build/contexts/conversations_context.d.ts.map +1 -1
  14. package/build/contexts/conversations_context.js +3 -12
  15. package/build/contexts/conversations_context.js.map +1 -1
  16. package/build/hooks/use_conversations_actions.d.ts +221 -0
  17. package/build/hooks/use_conversations_actions.d.ts.map +1 -0
  18. package/build/hooks/use_conversations_actions.js +93 -0
  19. package/build/hooks/use_conversations_actions.js.map +1 -0
  20. package/build/hooks/use_conversations_cache.d.ts +18 -0
  21. package/build/hooks/use_conversations_cache.d.ts.map +1 -0
  22. package/build/hooks/{use_conversation_jolt_events.js → use_conversations_cache.js} +27 -17
  23. package/build/hooks/use_conversations_cache.js.map +1 -0
  24. package/build/hooks/use_conversations_jolt_events.d.ts +3 -0
  25. package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -0
  26. package/build/hooks/use_conversations_jolt_events.js +12 -0
  27. package/build/hooks/use_conversations_jolt_events.js.map +1 -0
  28. package/build/hooks/use_jolt.d.ts.map +1 -1
  29. package/build/hooks/use_jolt.js +39 -10
  30. package/build/hooks/use_jolt.js.map +1 -1
  31. package/build/navigation/index.d.ts +4 -0
  32. package/build/navigation/index.d.ts.map +1 -1
  33. package/build/screens/conversation_new/components/groups_form.d.ts +7 -0
  34. package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -0
  35. package/build/screens/conversation_new/components/groups_form.js +122 -0
  36. package/build/screens/conversation_new/components/groups_form.js.map +1 -0
  37. package/build/screens/conversation_new/components/source_app_error_card.d.ts +2 -0
  38. package/build/screens/conversation_new/components/source_app_error_card.d.ts.map +1 -0
  39. package/build/screens/conversation_new/components/source_app_error_card.js +16 -0
  40. package/build/screens/conversation_new/components/source_app_error_card.js.map +1 -0
  41. package/build/screens/conversation_new/components/team_form.d.ts +8 -0
  42. package/build/screens/conversation_new/components/team_form.d.ts.map +1 -0
  43. package/build/screens/conversation_new/components/team_form.js +11 -0
  44. package/build/screens/conversation_new/components/team_form.js.map +1 -0
  45. package/build/screens/conversation_new/conversation_new_screen.d.ts +3 -0
  46. package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -1
  47. package/build/screens/conversation_new/conversation_new_screen.js +13 -119
  48. package/build/screens/conversation_new/conversation_new_screen.js.map +1 -1
  49. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +1 -1
  50. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +1 -0
  51. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +1 -1
  52. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  53. package/build/screens/conversations/components/list_header_component.js +5 -1
  54. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  55. package/build/utils/cache/page_mutations.d.ts +18 -0
  56. package/build/utils/cache/page_mutations.d.ts.map +1 -1
  57. package/build/utils/cache/page_mutations.js +13 -0
  58. package/build/utils/cache/page_mutations.js.map +1 -1
  59. package/build/utils/request/conversation.d.ts +1 -3
  60. package/build/utils/request/conversation.d.ts.map +1 -1
  61. package/build/utils/request/conversation.js +37 -30
  62. package/build/utils/request/conversation.js.map +1 -1
  63. package/package.json +2 -2
  64. package/src/__tests__/utils/cache/page_mutations.ts +49 -15
  65. package/src/components/conversations/conversation_actions.tsx +21 -17
  66. package/src/components/conversations/conversations.tsx +23 -26
  67. package/src/components/primitive/banner_primitive.tsx +0 -1
  68. package/src/contexts/chat_context.tsx +4 -0
  69. package/src/contexts/conversations_context.tsx +3 -13
  70. package/src/hooks/use_conversations_actions.ts +108 -0
  71. package/src/hooks/{use_conversation_jolt_events.ts → use_conversations_cache.ts} +35 -20
  72. package/src/hooks/use_conversations_jolt_events.ts +21 -0
  73. package/src/hooks/use_jolt.ts +51 -10
  74. package/src/screens/conversation_new/components/groups_form.tsx +155 -0
  75. package/src/screens/conversation_new/components/source_app_error_card.tsx +24 -0
  76. package/src/screens/conversation_new/components/team_form.tsx +18 -0
  77. package/src/screens/conversation_new/conversation_new_screen.tsx +17 -142
  78. package/src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx +1 -0
  79. package/src/screens/conversations/components/list_header_component.tsx +6 -1
  80. package/src/utils/cache/page_mutations.ts +22 -0
  81. package/src/utils/request/conversation.ts +39 -34
  82. package/build/contexts/swipeable_active_conversation.d.ts +0 -11
  83. package/build/contexts/swipeable_active_conversation.d.ts.map +0 -1
  84. package/build/contexts/swipeable_active_conversation.js +0 -16
  85. package/build/contexts/swipeable_active_conversation.js.map +0 -1
  86. package/build/hooks/use_conversation_jolt_events.d.ts +0 -2
  87. package/build/hooks/use_conversation_jolt_events.d.ts.map +0 -1
  88. package/build/hooks/use_conversation_jolt_events.js.map +0 -1
  89. package/src/contexts/swipeable_active_conversation.tsx +0 -27
@@ -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,EAA8B,SAAS,EAAa,MAAM,cAAc,CAAA;AAO/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAGlD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,YAAY,EAAE,oBAAoB,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,qBA+CA"}
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,EAAyC,SAAS,EAAE,MAAM,cAAc,CAAA;AAU/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAIlD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,YAAY,EAAE,oBAAoB,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,qBA+CA"}
@@ -1,14 +1,15 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
- import { Platform, View, StyleSheet, Pressable } from 'react-native';
2
+ import { Platform, Pressable, StyleSheet, View } from 'react-native';
3
3
  import ReanimatedSwipeable from 'react-native-gesture-handler/ReanimatedSwipeable';
4
+ import { useConversationsContext } from '../../contexts/conversations_context';
4
5
  import { useTheme } from '../../hooks';
5
- import { ActionToggleButton } from './action_toggle_button';
6
+ import { useConversationsMarkRead, useConversationsMute, } from '../../hooks/use_conversations_actions';
6
7
  import { tokens } from '../../vendor/tapestry/tokens';
7
- import { useConversationActionsContext } from '../../contexts/swipeable_active_conversation';
8
+ import { ActionToggleButton } from './action_toggle_button';
8
9
  export function ConversationActions({ children, conversation, style, onPress, }) {
9
10
  const swipeableRef = useRef(null);
10
11
  const styles = useStyles();
11
- const { activeConversationId, setActiveConversationId } = useConversationActionsContext();
12
+ const { activeConversationId, setActiveConversationId } = useConversationsContext();
12
13
  const [disabled, setDisabled] = useState(false);
13
14
  const overshootLeft = Platform.OS === 'ios';
14
15
  const handleSwipeableClose = () => {
@@ -37,30 +38,28 @@ export function ConversationActions({ children, conversation, style, onPress, })
37
38
  }
38
39
  function LeftActions({ conversation, onClose }) {
39
40
  const styles = useStyles();
40
- const [muted, setMuted] = useState(conversation.muted);
41
- const [latestMessageUnread, setLatestMessageUnread] = useState(conversation.unreadCount > 0);
42
41
  const emptyConversation = conversation.lastMessageCreatedAt === null;
43
42
  const muteToggleContent = {
44
- true: { iconName: 'general.bellMuted', label: 'Mute' },
45
- false: { iconName: 'general.bell', label: 'Unmute' },
43
+ true: { iconName: 'general.bell', label: 'Unmute' },
44
+ false: { iconName: 'general.bellMuted', label: 'Mute' },
46
45
  };
47
46
  const latestMessageUnreadToggleContent = {
48
47
  true: { iconName: 'general.outlinedTextMessage', label: 'Mark read' },
49
48
  false: { iconName: 'general.textMessageNotifications', label: 'Mark unread' },
50
49
  };
50
+ const { muted, setMuted, isPending } = useConversationsMute({ conversation });
51
+ const { read, markRead, isPending: markReadPending } = useConversationsMarkRead({ conversation });
51
52
  const handleMute = useCallback(() => {
52
53
  setMuted(!muted);
53
54
  onClose();
54
- }, [muted, onClose]);
55
+ }, [muted, onClose, setMuted]);
55
56
  const handleLatestMessageUnread = useCallback(() => {
56
- setLatestMessageUnread(!latestMessageUnread);
57
+ markRead(!read);
57
58
  onClose();
58
- }, [latestMessageUnread, onClose]);
59
+ }, [read, onClose, markRead]);
59
60
  return (<View style={styles.actionButtonContainer}>
60
- <ActionToggleButton loading={false} // TODO: Might need this when there is data fetching
61
- disabled={emptyConversation} toggled={latestMessageUnread} onPress={() => handleLatestMessageUnread()} toggleContent={latestMessageUnreadToggleContent} backgroundColor={tokens.fillColorInteractionSwipeDefault}/>
62
- <ActionToggleButton loading={false} // TODO: Might need this when there is data fetching
63
- toggled={muted} onPress={() => handleMute()} toggleContent={muteToggleContent} backgroundColor={tokens.fillColorInteractionSwipeSecondary}/>
61
+ <ActionToggleButton loading={markReadPending} disabled={emptyConversation} toggled={!read} onPress={handleLatestMessageUnread} toggleContent={latestMessageUnreadToggleContent} backgroundColor={tokens.fillColorInteractionSwipeDefault}/>
62
+ <ActionToggleButton loading={isPending} toggled={muted} onPress={handleMute} toggleContent={muteToggleContent} backgroundColor={tokens.fillColorInteractionSwipeSecondary}/>
64
63
  </View>);
65
64
  }
66
65
  const ACTION_BUTTON_WIDTH = 120;
@@ -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,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAa,SAAS,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,mBAEN,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAErD,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAA;AAE5F,MAAM,UAAU,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,GAMR;IACC,MAAM,YAAY,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAA;IACnD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,GAAG,6BAA6B,EAAE,CAAA;IACzF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/C,MAAM,aAAa,GAA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E;YAClB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { Platform, View, StyleSheet, ViewStyle, Pressable } from 'react-native'\nimport ReanimatedSwipeable, {\n SwipeableMethods,\n} from 'react-native-gesture-handler/ReanimatedSwipeable'\nimport { useTheme } from '../../hooks'\nimport { ActionToggleButton } from './action_toggle_button'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { ConversationResource } from '../../types'\nimport { useConversationActionsContext } from '../../contexts/swipeable_active_conversation'\n\nexport function ConversationActions({\n children,\n conversation,\n style,\n onPress,\n}: {\n children: ReactNode\n conversation: ConversationResource\n onPress: () => void\n style?: ViewStyle\n}) {\n const swipeableRef = useRef<SwipeableMethods>(null)\n const styles = useStyles()\n const { activeConversationId, setActiveConversationId } = useConversationActionsContext()\n const [disabled, setDisabled] = useState(false)\n const overshootLeft = Platform.OS === 'ios'\n\n const handleSwipeableClose = () => {\n setDisabled(false)\n swipeableRef.current?.close()\n }\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 useEffect(() => {\n if (activeConversationId === conversation.id) return\n\n handleSwipeableClose()\n }, [activeConversationId, conversation.id])\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 renderLeftActions={() => (\n <LeftActions conversation={conversation} onClose={handleSwipeableClose} />\n )}\n >\n <Pressable onPress={handlePress} style={style}>\n {children}\n </Pressable>\n </ReanimatedSwipeable>\n )\n}\n\ninterface LeftActionsProps {\n conversation: ConversationResource\n onClose: () => void\n}\n\nfunction LeftActions({ conversation, onClose }: LeftActionsProps) {\n const styles = useStyles()\n const [muted, setMuted] = useState(conversation.muted)\n const [latestMessageUnread, setLatestMessageUnread] = useState(conversation.unreadCount > 0)\n const emptyConversation = conversation.lastMessageCreatedAt === null\n\n const muteToggleContent = {\n true: { iconName: 'general.bellMuted', label: 'Mute' },\n false: { iconName: 'general.bell', label: 'Unmute' },\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 const handleMute = useCallback(() => {\n setMuted(!muted)\n onClose()\n }, [muted, onClose])\n\n const handleLatestMessageUnread = useCallback(() => {\n setLatestMessageUnread(!latestMessageUnread)\n onClose()\n }, [latestMessageUnread, onClose])\n\n return (\n <View style={styles.actionButtonContainer}>\n <ActionToggleButton\n loading={false} // TODO: Might need this when there is data fetching\n disabled={emptyConversation}\n toggled={latestMessageUnread}\n onPress={() => handleLatestMessageUnread()}\n toggleContent={latestMessageUnreadToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeDefault}\n />\n <ActionToggleButton\n loading={false} // TODO: Might need this when there is data fetching\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.surfaceColor100,\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":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AC,CACf,OAAO,CAAC,CAAC,yBAAyB,CAAC,CACnC,aAAa,CAAC,CAAC,gCAAgC,CAAC,CAChD,eAAe,CAAC,CAAC,MAAM,CAAC,gCAAgC,CAAC,EAE3D;MAAA,CAAC,kBAAkB,CACjB,OAAO,CAAC,CAAC,SAAS,CAAC,CACnB,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,eAAe;SACxC;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 { Platform, Pressable, StyleSheet, View, ViewStyle } from 'react-native'\nimport ReanimatedSwipeable, {\n SwipeableMethods,\n} from 'react-native-gesture-handler/ReanimatedSwipeable'\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme } from '../../hooks'\nimport {\n useConversationsMarkRead,\n useConversationsMute,\n} from '../../hooks/use_conversations_actions'\nimport { ConversationResource } from '../../types'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { ActionToggleButton } from './action_toggle_button'\n\nexport function ConversationActions({\n children,\n conversation,\n style,\n onPress,\n}: {\n children: ReactNode\n conversation: ConversationResource\n onPress: () => void\n style?: ViewStyle\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\n const handleSwipeableClose = () => {\n setDisabled(false)\n swipeableRef.current?.close()\n }\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 useEffect(() => {\n if (activeConversationId === conversation.id) return\n\n handleSwipeableClose()\n }, [activeConversationId, conversation.id])\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 renderLeftActions={() => (\n <LeftActions conversation={conversation} onClose={handleSwipeableClose} />\n )}\n >\n <Pressable onPress={handlePress} style={style}>\n {children}\n </Pressable>\n </ReanimatedSwipeable>\n )\n}\n\ninterface LeftActionsProps {\n conversation: ConversationResource\n onClose: () => void\n}\n\nfunction LeftActions({ conversation, onClose }: LeftActionsProps) {\n const styles = useStyles()\n const emptyConversation = conversation.lastMessageCreatedAt === null\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 const { muted, setMuted, isPending } = useConversationsMute({ conversation })\n const { read, markRead, isPending: markReadPending } = useConversationsMarkRead({ conversation })\n\n const handleMute = useCallback(() => {\n setMuted(!muted)\n onClose()\n }, [muted, onClose, setMuted])\n\n const handleLatestMessageUnread = useCallback(() => {\n markRead(!read)\n onClose()\n }, [read, onClose, markRead])\n\n return (\n <View style={styles.actionButtonContainer}>\n <ActionToggleButton\n loading={markReadPending}\n disabled={emptyConversation}\n toggled={!read}\n onPress={handleLatestMessageUnread}\n toggleContent={latestMessageUnreadToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeDefault}\n />\n <ActionToggleButton\n loading={isPending}\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.surfaceColor100,\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":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,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,sBA0CxE,CAAA"}
1
+ {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,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,sBAwCxE,CAAA"}
@@ -6,19 +6,16 @@ import { useConversationsContext } from '../../contexts/conversations_context';
6
6
  import { useTheme } from '../../hooks';
7
7
  import { Text } from '../display';
8
8
  import { ConversationPreview } from './conversation_preview';
9
- import { ConversationActionsProvider } from '../../contexts/swipeable_active_conversation';
10
9
  export const Conversations = ({ ListHeaderComponent }) => {
11
10
  const styles = useStyles();
12
11
  const { conversations, fetchNextPage, refetch, isRefetching, isFetched, args: { chat_group_graph_id }, } = useConversationsContext();
13
12
  const navigation = useNavigation();
14
13
  const showBadges = !chat_group_graph_id;
15
- return (<ConversationActionsProvider>
16
- <View style={styles.container}>
17
- <FlashList data={conversations} estimatedItemSize={97} contentContainerStyle={styles.contentContainer} onRefresh={refetch} refreshing={!isFetched && isRefetching} ListHeaderComponent={ListHeaderComponent} ListEmptyComponent={<View style={styles.listEmpty}>
18
- <Text variant="secondary">No conversations found</Text>
19
- </View>} renderItem={({ item }) => (<ConversationPreview conversation={item} onPress={() => navigation.navigate('Conversation', { conversation_id: item.id })} showBadges={showBadges}/>)} onEndReached={() => fetchNextPage()}/>
20
- </View>
21
- </ConversationActionsProvider>);
14
+ return (<View style={styles.container}>
15
+ <FlashList data={conversations} estimatedItemSize={97} contentContainerStyle={styles.contentContainer} onRefresh={refetch} refreshing={!isFetched && isRefetching} ListHeaderComponent={ListHeaderComponent} ListEmptyComponent={<View style={styles.listEmpty}>
16
+ <Text variant="secondary">No conversations found</Text>
17
+ </View>} renderItem={({ item }) => (<ConversationPreview conversation={item} onPress={() => navigation.navigate('Conversation', { conversation_id: item.id })} showBadges={showBadges}/>)} onEndReached={() => fetchNextPage()}/>
18
+ </View>);
22
19
  };
23
20
  const useStyles = () => {
24
21
  const { colors } = useTheme();
@@ -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,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAA;AAU1F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,mBAAmB,EAAsB,EAAE,EAAE;IAC3E,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,MAAM,EACJ,aAAa,EACb,aAAa,EACb,OAAO,EACP,YAAY,EACZ,SAAS,EACT,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,OAAO,CACL,CAAC,2BAA2B,CAC1B;MAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAC5B;QAAA,CAAC,SAAS,CACR,IAAI,CAAC,CAAC,aAAa,CAAC,CACpB,iBAAiB,CAAC,CAAC,E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,eAAe,EAAE,EAAE;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport { FlashList } from '@shopify/flash-list'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme } from '../../hooks'\nimport { Text } from '../display'\nimport { ConversationPreview } from './conversation_preview'\nimport { ConversationActionsProvider } from '../../contexts/swipeable_active_conversation'\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\n const {\n conversations,\n fetchNextPage,\n refetch,\n isRefetching,\n isFetched,\n args: { chat_group_graph_id },\n } = useConversationsContext()\n const navigation = useNavigation()\n\n const showBadges = !chat_group_graph_id\n\n return (\n <ConversationActionsProvider>\n <View style={styles.container}>\n <FlashList\n data={conversations}\n estimatedItemSize={97}\n contentContainerStyle={styles.contentContainer}\n onRefresh={refetch}\n refreshing={!isFetched && isRefetching}\n ListHeaderComponent={ListHeaderComponent}\n ListEmptyComponent={\n <View style={styles.listEmpty}>\n <Text variant=\"secondary\">No conversations found</Text>\n </View>\n }\n renderItem={({ item }) => (\n <ConversationPreview\n conversation={item}\n onPress={() => navigation.navigate('Conversation', { conversation_id: item.id })}\n showBadges={showBadges}\n />\n )}\n onEndReached={() => fetchNextPage()}\n />\n </View>\n </ConversationActionsProvider>\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: 16,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],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I,CAAC,OAAO,CAAC,WAAW,CAAC,sBAAsB,EAAE,IAAI,CACxD;UAAA,EAAE,IAAI,CACR,CAAC,CACD,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACxB,CAAC,mBAAmB,CAClB,YAAY,CAAC,CAAC,IAAI,CAAC,CACnB,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CACjF,UAAU,CAAC,CAAC,UAAU,CAAC,EACvB,CACH,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","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport { FlashList } from '@shopify/flash-list'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme } from '../../hooks'\nimport { Text } from '../display'\nimport { ConversationPreview } from './conversation_preview'\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\n const {\n conversations,\n fetchNextPage,\n refetch,\n isRefetching,\n isFetched,\n args: { chat_group_graph_id },\n } = useConversationsContext()\n const navigation = useNavigation()\n\n const showBadges = !chat_group_graph_id\n\n return (\n <View style={styles.container}>\n <FlashList\n data={conversations}\n estimatedItemSize={97}\n contentContainerStyle={styles.contentContainer}\n onRefresh={refetch}\n refreshing={!isFetched && isRefetching}\n ListHeaderComponent={ListHeaderComponent}\n ListEmptyComponent={\n <View style={styles.listEmpty}>\n <Text variant=\"secondary\">No conversations found</Text>\n </View>\n }\n renderItem={({ item }) => (\n <ConversationPreview\n conversation={item}\n onPress={() => navigation.navigate('Conversation', { conversation_id: item.id })}\n showBadges={showBadges}\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: 16,\n },\n })\n}\n"]}
@@ -107,7 +107,6 @@ const useStyles = ({ appearance = 'neutral' } = {}) => {
107
107
  padding: space(1.5),
108
108
  gap: space(1),
109
109
  borderRadius: tokens.borderRadiusMd,
110
- flex: 1,
111
110
  },
112
111
  content: {
113
112
  gap: space(0.5),
@@ -1 +1 @@
1
- {"version":3,"file":"banner_primitive.js","sourceRoot":"","sources":["../../../src/components/primitive/banner_primitive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EACL,2BAA2B,GAE5B,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,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M,cAAc,GAAG,2BAA2B,EAAE,CAAA;IACpD,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,kBAAkB,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEhD,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,YAAY,EAAE;YACZ,aAAa,EAAE,KAAK;YACpB,eAAe,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,UAAU;YACtD,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC;YACnB,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YACb,YAAY,EAAE,MAAM,CAAC,cAAc;YACnC,IAAI,EAAE,CAAC;SACR;QACD,OAAO,EAAE;YACP,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;YACf,IAAI,EAAE,CAAC;SACR;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,IAAI;YACtC,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,GAAG,SAAS;SACzD;QACD,OAAO,EAAE;YACP,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,IAAI;YACtC,UAAU,EAAE,wBAAwB;YACpC,QAAQ,EAAE,MAAM,CAAC,UAAU;SAC5B;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,IAAI;SACvC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { createContext, FC, ReactNode, useContext } from 'react'\nimport { Pressable, StyleSheet, View } from 'react-native'\nimport {\n useStatusColorAppearanceMap,\n type StatusAppearanceUnion,\n} from '../display/utils/status_colors'\nimport {\n MAX_FONT_SIZE_MULTIPLIER,\n platformFontWeightMedium,\n platformPressedOpacityStyle,\n space,\n} from '../../utils'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { useCreateAndroidRippleColor, useFontScale } from '../../hooks'\nimport { Icon, IconString } from '../display/icon'\nimport { Heading } from '../display/heading'\nimport { Text } from '../display/text'\nimport { TextInlineButton } from '../display/text_inline_button'\n\n// ========================================\n// ====== Exports =========================\n// ========================================\n\nconst Banner = {\n Root: BannerRoot,\n StaticLayout: BannerStaticLayout,\n CollapsibleLayout: BannerCollapsibleLayout,\n Content: BannerContent,\n StatusIcon: BannerStatusIcon,\n Heading: BannerHeading,\n Text: BannerText,\n Link: BannerLink,\n} as const\n\ntype BannerComponents = {\n Root: FC<BannerRootProps>\n StaticLayout: FC<BannerStaticLayoutProps>\n CollapsibleLayout: FC<BannerCollapsibleLayoutProps>\n Content: FC<BannerContentProps>\n StatusIcon: FC<BannerStatusIconProps>\n Heading: FC<BannerHeadingProps>\n Text: FC<BannerTextProps>\n Link: FC<BannerLinkProps>\n}\n\nexport default Banner as BannerComponents\nexport type {\n BannerRootProps,\n BannerStaticLayoutProps,\n BannerCollapsibleLayoutProps,\n BannerContentProps,\n BannerStatusIconProps,\n BannerHeadingProps,\n BannerTextProps,\n BannerLinkProps,\n}\n\n// ========================================\n// ====== Context =========================\n// ========================================\n\ninterface BannerContextType {\n appearance?: StatusAppearanceUnion\n}\n\nconst BannerContext = createContext<BannerContextType | null>(null)\n\nfunction useBannerContext() {\n const context = useContext(BannerContext)\n if (!context) {\n throw new Error('Banner components must be used within Banner.Root')\n }\n return context\n}\n\n// ========================================\n// ====== BannerRoot ======================\n// ========================================\n\ninterface BannerRootProps {\n children: ReactNode\n appearance?: StatusAppearanceUnion\n}\n\nfunction BannerRoot({ children, appearance = 'neutral' }: BannerRootProps) {\n return <BannerContext.Provider value={{ appearance }}>{children}</BannerContext.Provider>\n}\n\nBannerRoot.displayName = 'Banner.Root'\n\n// ========================================\n// ====== BannerStaticLayout ==============\n// ========================================\n\ninterface BannerStaticLayoutProps {\n children: ReactNode\n}\n\nfunction BannerStaticLayout({ children }: BannerStaticLayoutProps) {\n const { appearance } = useBannerContext()\n const styles = useStyles({ appearance })\n\n return <View style={styles.staticLayout}>{children}</View>\n}\n\nBannerStaticLayout.displayName = 'Banner.StaticLayout'\n\n// ========================================\n// ====== BannerCollapsibleLayout =========\n// ========================================\n\ninterface BannerCollapsibleLayoutProps {\n children: ReactNode\n expanded?: boolean\n onPress?: () => void\n}\n\nfunction BannerCollapsibleLayout({ children, expanded, onPress }: BannerCollapsibleLayoutProps) {\n const { appearance = 'neutral' } = useBannerContext()\n const styles = useStyles({ appearance })\n const iconName = expanded ? 'general.upCaret' : 'general.downCaret'\n const statusColorMap = useStatusColorAppearanceMap()\n const androidRippleColor = useCreateAndroidRippleColor({\n color: statusColorMap[appearance].background,\n })\n\n return (\n <Pressable\n onPress={onPress}\n style={({ pressed }) => [styles.staticLayout, pressed && platformPressedOpacityStyle]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n accessibilityState={{ expanded }}\n accessibilityRole=\"button\"\n >\n {children}\n <Icon name={iconName} style={styles.icon} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER} />\n </Pressable>\n )\n}\n\nBannerCollapsibleLayout.displayName = 'Banner.CollapsibleLayout'\n\n// ========================================\n// ====== BannerContent ===================\n// ========================================\n\ninterface BannerContentProps {\n children: ReactNode\n}\n\nfunction BannerContent({ children }: BannerContentProps) {\n const styles = useStyles()\n\n return <View style={styles.content}>{children}</View>\n}\n\nBannerContent.displayName = 'Banner.Content'\n\n// ========================================\n// ====== BannerStatusIcon ================\n// ========================================\n\ninterface BannerStatusIconProps {\n iconName?: IconString\n}\n\nfunction BannerStatusIcon({ iconName }: BannerStatusIconProps) {\n const { appearance = 'neutral' } = useBannerContext()\n const styles = useStyles({ appearance })\n\n const iconNameMap = {\n error: 'general.exclamationTriangle',\n info: 'general.outlinedInfoCircle',\n neutral: 'general.outlinedInfoCircle',\n success: 'general.check',\n warning: 'general.exclamationTriangle',\n } as const\n\n return (\n <Icon\n name={iconName || iconNameMap[appearance]}\n style={styles.icon}\n maxFontSizeMultiplier={1}\n />\n )\n}\n\nBannerStatusIcon.displayName = 'Banner.StatusIcon'\n\n// ========================================\n// ====== BannerHeading ===================\n// ========================================\n\ninterface BannerHeadingProps {\n children: ReactNode\n}\n\nfunction BannerHeading({ children }: BannerHeadingProps) {\n const { appearance = 'neutral' } = useBannerContext()\n const styles = useStyles({ appearance })\n\n return (\n <Heading variant=\"h3\" style={styles.heading}>\n {children}\n </Heading>\n )\n}\n\nBannerHeading.displayName = 'Banner.Heading'\n\n// ========================================\n// ====== BannerText ======================\n// ========================================\n\ninterface BannerTextProps {\n children: ReactNode\n}\n\nfunction BannerText({ children }: BannerTextProps) {\n const { appearance = 'neutral' } = useBannerContext()\n const styles = useStyles({ appearance })\n\n return (\n <Text variant=\"tertiary\" style={styles.text}>\n {children}\n </Text>\n )\n}\n\nBannerText.displayName = 'Banner.Text'\n\n// ========================================\n// ====== BannerLink ======================\n// ========================================\n\ninterface BannerLinkProps {\n children: ReactNode\n onPress?: () => void\n}\n\nfunction BannerLink({ children, onPress }: BannerLinkProps) {\n const { appearance = 'neutral' } = useBannerContext()\n const styles = useStyles({ appearance })\n\n return (\n <TextInlineButton variant=\"tertiary\" style={styles.text} onPress={onPress}>\n {children}\n </TextInlineButton>\n )\n}\n\nBannerLink.displayName = 'Banner.Link'\n\n// ========================================\n// ====== Styles ==========================\n// ========================================\n\ninterface Styles {\n appearance?: StatusAppearanceUnion\n}\n\nconst useStyles = ({ appearance = 'neutral' }: Styles = {}) => {\n const statusColorMap = useStatusColorAppearanceMap()\n const fontScale = useFontScale()\n const LINE_HEIGHT_OFFSET = fontScale > 1 ? 0 : 1\n\n return StyleSheet.create({\n staticLayout: {\n flexDirection: 'row',\n backgroundColor: statusColorMap[appearance].background,\n padding: space(1.5),\n gap: space(1),\n borderRadius: tokens.borderRadiusMd,\n flex: 1,\n },\n content: {\n gap: space(0.5),\n flex: 1,\n },\n icon: {\n color: statusColorMap[appearance].icon,\n fontSize: tokens.fontSizeMd,\n marginTop: (space(0.5) - LINE_HEIGHT_OFFSET) * fontScale,\n },\n heading: {\n color: statusColorMap[appearance].text,\n fontWeight: platformFontWeightMedium,\n fontSize: tokens.fontSizeMd,\n },\n text: {\n color: statusColorMap[appearance].text,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"banner_primitive.js","sourceRoot":"","sources":["../../../src/components/primitive/banner_primitive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EACL,2BAA2B,GAE5B,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,2BAA2B,EAC3B,KAAK,GACN,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,2BAA2B,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACvE,OAAO,EAAE,IAAI,EAAc,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,2CAA2C;AAC3C,2CAA2C;AAC3C,2CAA2C;AAE3C,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,UAAU;IAChB,YAAY,EAAE,kBAAkB;IAChC,iBAAiB,EAAE,uBAAuB;IAC1C,OAAO,EAAE,aAAa;IACtB,UAAU,EAAE,gBAAgB;IAC5B,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACR,CAAA;AAaV,eAAe,MAA0B,CAAA;AAoBzC,MAAM,aAAa,GAAG,aAAa,CAA2B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,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,IAAI;YACtC,UAAU,EAAE,wBAAwB;YACpC,QAAQ,EAAE,MAAM,CAAC,UAAU;SAC5B;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,IAAI;SACvC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { createContext, FC, ReactNode, useContext } from 'react'\nimport { Pressable, StyleSheet, View } from 'react-native'\nimport {\n useStatusColorAppearanceMap,\n type StatusAppearanceUnion,\n} from '../display/utils/status_colors'\nimport {\n MAX_FONT_SIZE_MULTIPLIER,\n platformFontWeightMedium,\n platformPressedOpacityStyle,\n space,\n} from '../../utils'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { useCreateAndroidRippleColor, useFontScale } from '../../hooks'\nimport { Icon, IconString } from '../display/icon'\nimport { Heading } from '../display/heading'\nimport { Text } from '../display/text'\nimport { TextInlineButton } from '../display/text_inline_button'\n\n// ========================================\n// ====== Exports =========================\n// ========================================\n\nconst Banner = {\n Root: BannerRoot,\n StaticLayout: BannerStaticLayout,\n CollapsibleLayout: BannerCollapsibleLayout,\n Content: BannerContent,\n StatusIcon: BannerStatusIcon,\n Heading: BannerHeading,\n Text: BannerText,\n Link: BannerLink,\n} as const\n\ntype BannerComponents = {\n Root: FC<BannerRootProps>\n StaticLayout: FC<BannerStaticLayoutProps>\n CollapsibleLayout: FC<BannerCollapsibleLayoutProps>\n Content: FC<BannerContentProps>\n StatusIcon: FC<BannerStatusIconProps>\n Heading: FC<BannerHeadingProps>\n Text: FC<BannerTextProps>\n Link: FC<BannerLinkProps>\n}\n\nexport default Banner as BannerComponents\nexport type {\n BannerRootProps,\n BannerStaticLayoutProps,\n BannerCollapsibleLayoutProps,\n BannerContentProps,\n BannerStatusIconProps,\n BannerHeadingProps,\n BannerTextProps,\n BannerLinkProps,\n}\n\n// ========================================\n// ====== Context =========================\n// ========================================\n\ninterface BannerContextType {\n appearance?: StatusAppearanceUnion\n}\n\nconst BannerContext = createContext<BannerContextType | null>(null)\n\nfunction useBannerContext() {\n const context = useContext(BannerContext)\n if (!context) {\n throw new Error('Banner components must be used within Banner.Root')\n }\n return context\n}\n\n// ========================================\n// ====== BannerRoot ======================\n// ========================================\n\ninterface BannerRootProps {\n children: ReactNode\n appearance?: StatusAppearanceUnion\n}\n\nfunction BannerRoot({ children, appearance = 'neutral' }: BannerRootProps) {\n return <BannerContext.Provider value={{ appearance }}>{children}</BannerContext.Provider>\n}\n\nBannerRoot.displayName = 'Banner.Root'\n\n// ========================================\n// ====== BannerStaticLayout ==============\n// ========================================\n\ninterface BannerStaticLayoutProps {\n children: ReactNode\n}\n\nfunction BannerStaticLayout({ children }: BannerStaticLayoutProps) {\n const { appearance } = useBannerContext()\n const styles = useStyles({ appearance })\n\n return <View style={styles.staticLayout}>{children}</View>\n}\n\nBannerStaticLayout.displayName = 'Banner.StaticLayout'\n\n// ========================================\n// ====== BannerCollapsibleLayout =========\n// ========================================\n\ninterface BannerCollapsibleLayoutProps {\n children: ReactNode\n expanded?: boolean\n onPress?: () => void\n}\n\nfunction BannerCollapsibleLayout({ children, expanded, onPress }: BannerCollapsibleLayoutProps) {\n const { appearance = 'neutral' } = useBannerContext()\n const styles = useStyles({ appearance })\n const iconName = expanded ? 'general.upCaret' : 'general.downCaret'\n const statusColorMap = useStatusColorAppearanceMap()\n const androidRippleColor = useCreateAndroidRippleColor({\n color: statusColorMap[appearance].background,\n })\n\n return (\n <Pressable\n onPress={onPress}\n style={({ pressed }) => [styles.staticLayout, pressed && platformPressedOpacityStyle]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n accessibilityState={{ expanded }}\n accessibilityRole=\"button\"\n >\n {children}\n <Icon name={iconName} style={styles.icon} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER} />\n </Pressable>\n )\n}\n\nBannerCollapsibleLayout.displayName = 'Banner.CollapsibleLayout'\n\n// ========================================\n// ====== BannerContent ===================\n// ========================================\n\ninterface BannerContentProps {\n children: ReactNode\n}\n\nfunction BannerContent({ children }: BannerContentProps) {\n const styles = useStyles()\n\n return <View style={styles.content}>{children}</View>\n}\n\nBannerContent.displayName = 'Banner.Content'\n\n// ========================================\n// ====== BannerStatusIcon ================\n// ========================================\n\ninterface BannerStatusIconProps {\n iconName?: IconString\n}\n\nfunction BannerStatusIcon({ iconName }: BannerStatusIconProps) {\n const { appearance = 'neutral' } = useBannerContext()\n const styles = useStyles({ appearance })\n\n const iconNameMap = {\n error: 'general.exclamationTriangle',\n info: 'general.outlinedInfoCircle',\n neutral: 'general.outlinedInfoCircle',\n success: 'general.check',\n warning: 'general.exclamationTriangle',\n } as const\n\n return (\n <Icon\n name={iconName || iconNameMap[appearance]}\n style={styles.icon}\n maxFontSizeMultiplier={1}\n />\n )\n}\n\nBannerStatusIcon.displayName = 'Banner.StatusIcon'\n\n// ========================================\n// ====== BannerHeading ===================\n// ========================================\n\ninterface BannerHeadingProps {\n children: ReactNode\n}\n\nfunction BannerHeading({ children }: BannerHeadingProps) {\n const { appearance = 'neutral' } = useBannerContext()\n const styles = useStyles({ appearance })\n\n return (\n <Heading variant=\"h3\" style={styles.heading}>\n {children}\n </Heading>\n )\n}\n\nBannerHeading.displayName = 'Banner.Heading'\n\n// ========================================\n// ====== BannerText ======================\n// ========================================\n\ninterface BannerTextProps {\n children: ReactNode\n}\n\nfunction BannerText({ children }: BannerTextProps) {\n const { appearance = 'neutral' } = useBannerContext()\n const styles = useStyles({ appearance })\n\n return (\n <Text variant=\"tertiary\" style={styles.text}>\n {children}\n </Text>\n )\n}\n\nBannerText.displayName = 'Banner.Text'\n\n// ========================================\n// ====== BannerLink ======================\n// ========================================\n\ninterface BannerLinkProps {\n children: ReactNode\n onPress?: () => void\n}\n\nfunction BannerLink({ children, onPress }: BannerLinkProps) {\n const { appearance = 'neutral' } = useBannerContext()\n const styles = useStyles({ appearance })\n\n return (\n <TextInlineButton variant=\"tertiary\" style={styles.text} onPress={onPress}>\n {children}\n </TextInlineButton>\n )\n}\n\nBannerLink.displayName = 'Banner.Link'\n\n// ========================================\n// ====== Styles ==========================\n// ========================================\n\ninterface Styles {\n appearance?: StatusAppearanceUnion\n}\n\nconst useStyles = ({ appearance = 'neutral' }: Styles = {}) => {\n const statusColorMap = useStatusColorAppearanceMap()\n const fontScale = useFontScale()\n const LINE_HEIGHT_OFFSET = fontScale > 1 ? 0 : 1\n\n return StyleSheet.create({\n staticLayout: {\n flexDirection: 'row',\n backgroundColor: statusColorMap[appearance].background,\n padding: space(1.5),\n gap: space(1),\n borderRadius: tokens.borderRadiusMd,\n },\n content: {\n gap: space(0.5),\n flex: 1,\n },\n icon: {\n color: statusColorMap[appearance].icon,\n fontSize: tokens.fontSizeMd,\n marginTop: (space(0.5) - LINE_HEIGHT_OFFSET) * fontScale,\n },\n heading: {\n color: statusColorMap[appearance].text,\n fontWeight: platformFontWeightMedium,\n fontSize: tokens.fontSizeMd,\n },\n text: {\n color: statusColorMap[appearance].text,\n },\n })\n}\n"]}
@@ -23,5 +23,6 @@ export interface CreateChatThemeProps {
23
23
  theme?: DeepPartial<DefaultTheme>;
24
24
  colorScheme?: ColorSchemeName;
25
25
  }
26
+ export declare const useChatContext: () => ChatContextValue;
26
27
  export declare const useCreateChatTheme: ({ theme: customTheme, colorScheme: appColorScheme, }: CreateChatThemeProps) => ChatTheme;
27
28
  //# sourceMappingURL=chat_context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat_context.d.ts","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiC,MAAM,OAAO,CAAA;AACrD,OAAO,EAAE,eAAe,EAAkB,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACpE,OAAO,EAAE,SAAS,EAAg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AAE,YAAY,CAAA;IACpB,sBAAsB,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,IAAI,CAAA;IAC1D,KAAK,EAAE,SAAS,CAAA;IAChB,GAAG,CAAC,EAAE,GAAG,CAAA;IACT,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAC/F,KAAK,EAAE,oBAAoB,CAAA;CAC5B;AAED,eAAO,MAAM,WAAW,iCAOtB,CAAA;AAEF,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,qBAe5F;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;IACjC,WAAW,CAAC,EAAE,eAAe,CAAA;CAC9B;AAED,eAAO,MAAM,cAAc,wBAE1B,CAAA;AAED,eAAO,MAAM,kBAAkB,yDAG5B,oBAAoB,KAAG,SAYzB,CAAA"}
@@ -25,6 +25,9 @@ export function ChatProvider({ children, value }) {
25
25
  };
26
26
  return <ChatContext.Provider value={contextValue}>{children}</ChatContext.Provider>;
27
27
  }
28
+ export const useChatContext = () => {
29
+ return React.useContext(ChatContext);
30
+ };
28
31
  export const useCreateChatTheme = ({ theme: customTheme = {}, colorScheme: appColorScheme, }) => {
29
32
  const internalColorScheme = useColorScheme() || 'light';
30
33
  const colorScheme = appColorScheme || internalColorScheme;
@@ -1 +1 @@
1
- {"version":3,"file":"chat_context.js","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,OAAO,EA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AAE,IAAI,OAAO,CAAA;IACvD,MAAM,WAAW,GAAG,cAAc,IAAI,mBAAmB,CAAA;IAEzD,MAAM,KAAK,GAAG;QACZ,GAAG,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;QACpD,MAAM,EAAE;YACN,GAAG,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;SACpE;KACF,CAAA;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { merge } from 'lodash'\nimport React, { createContext, useMemo } from 'react'\nimport { ColorSchemeName, useColorScheme } from 'react-native'\nimport { DeepPartial } from '../types'\nimport { ENV, PartialToken, ResponseError, Session } from '../utils'\nimport { ChatTheme, defaultTheme, DefaultTheme } from '../utils/theme'\n\nexport type ChatContextValue = {\n token?: PartialToken\n onUnauthorizedResponse: (_response: ResponseError) => void\n theme: ChatTheme\n env?: ENV\n session: Session\n giphyApiKey?: string\n}\n\nexport interface ChatProviderProps extends Omit<ChatContextValue, 'client' | 'theme' | 'session'> {\n theme: CreateChatThemeProps\n}\n\nexport const ChatContext = createContext<ChatContextValue>({\n theme: defaultTheme('light'),\n token: undefined,\n env: undefined,\n onUnauthorizedResponse: () => {},\n session: new Session(),\n giphyApiKey: undefined,\n})\n\nexport function ChatProvider({ children, value }: { children: any; value: ChatProviderProps }) {\n const { env, token, onUnauthorizedResponse, giphyApiKey } = value\n const theme = useCreateChatTheme(value.theme || {})\n const session = useMemo(() => new Session({ token, env }), [env, token])\n\n const contextValue: ChatContextValue = {\n env,\n token,\n onUnauthorizedResponse,\n session,\n theme,\n giphyApiKey,\n }\n\n return <ChatContext.Provider value={contextValue}>{children}</ChatContext.Provider>\n}\n\nexport interface CreateChatThemeProps {\n theme?: DeepPartial<DefaultTheme>\n colorScheme?: ColorSchemeName\n}\n\nexport const useCreateChatTheme = ({\n theme: customTheme = {},\n colorScheme: appColorScheme,\n}: CreateChatThemeProps): ChatTheme => {\n const internalColorScheme = useColorScheme() || 'light'\n const colorScheme = appColorScheme || internalColorScheme\n\n const theme = {\n ...merge({}, defaultTheme(colorScheme), customTheme),\n colors: {\n ...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),\n },\n }\n\n return theme\n}\n"]}
1
+ {"version":3,"file":"chat_context.js","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,EAAmB,cAAc,EAAE,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAoC,OAAO,EAAE,MAAM,UAAU,CAAA;AACpE,OAAO,EAAa,YAAY,EAAgB,MAAM,gBAAgB,CAAA;AAetE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAmB;IACzD,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC;IAC5B,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,SAAS;IACd,sBAAsB,EAAE,GAAG,EAAE,GAAE,CAAC;IAChC,OAAO,EAAE,IAAI,OAAO,EAAE;IACtB,WAAW,EAAE,SAAS;CACvB,CAAC,CAAA;AAEF,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,KAAK,EAA+C;IAC3F,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,GAAG,KAAK,CAAA;IACjE,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;IACnD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,OAAO,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAA;IAExE,MAAM,YAAY,GAAqB;QACrC,GAAG;QACH,KAAK;QACL,sBAAsB;QACtB,OAAO;QACP,KAAK;QACL,WAAW;KACZ,CAAA;IAED,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;AACrF,CAAC;AAOD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AACtC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,KAAK,EAAE,WAAW,GAAG,EAAE,EACvB,WAAW,EAAE,cAAc,GACN,EAAa,EAAE;IACpC,MAAM,mBAAmB,GAAG,cAAc,EAAE,IAAI,OAAO,CAAA;IACvD,MAAM,WAAW,GAAG,cAAc,IAAI,mBAAmB,CAAA;IAEzD,MAAM,KAAK,GAAG;QACZ,GAAG,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;QACpD,MAAM,EAAE;YACN,GAAG,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;SACpE;KACF,CAAA;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { merge } from 'lodash'\nimport React, { createContext, useMemo } from 'react'\nimport { ColorSchemeName, useColorScheme } from 'react-native'\nimport { DeepPartial } from '../types'\nimport { ENV, PartialToken, ResponseError, Session } from '../utils'\nimport { ChatTheme, defaultTheme, DefaultTheme } from '../utils/theme'\n\nexport type ChatContextValue = {\n token?: PartialToken\n onUnauthorizedResponse: (_response: ResponseError) => void\n theme: ChatTheme\n env?: ENV\n session: Session\n giphyApiKey?: string\n}\n\nexport interface ChatProviderProps extends Omit<ChatContextValue, 'client' | 'theme' | 'session'> {\n theme: CreateChatThemeProps\n}\n\nexport const ChatContext = createContext<ChatContextValue>({\n theme: defaultTheme('light'),\n token: undefined,\n env: undefined,\n onUnauthorizedResponse: () => {},\n session: new Session(),\n giphyApiKey: undefined,\n})\n\nexport function ChatProvider({ children, value }: { children: any; value: ChatProviderProps }) {\n const { env, token, onUnauthorizedResponse, giphyApiKey } = value\n const theme = useCreateChatTheme(value.theme || {})\n const session = useMemo(() => new Session({ token, env }), [env, token])\n\n const contextValue: ChatContextValue = {\n env,\n token,\n onUnauthorizedResponse,\n session,\n theme,\n giphyApiKey,\n }\n\n return <ChatContext.Provider value={contextValue}>{children}</ChatContext.Provider>\n}\n\nexport interface CreateChatThemeProps {\n theme?: DeepPartial<DefaultTheme>\n colorScheme?: ColorSchemeName\n}\n\nexport const useChatContext = () => {\n return React.useContext(ChatContext)\n}\n\nexport const useCreateChatTheme = ({\n theme: customTheme = {},\n colorScheme: appColorScheme,\n}: CreateChatThemeProps): ChatTheme => {\n const internalColorScheme = useColorScheme() || 'light'\n const colorScheme = appColorScheme || internalColorScheme\n\n const theme = {\n ...merge({}, defaultTheme(colorScheme), customTheme),\n colors: {\n ...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),\n },\n }\n\n return theme\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"conversations_context.d.ts","sourceRoot":"","sources":["../../src/contexts/conversations_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAiC,MAAM,OAAO,CAAA;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAA;AACxF,OAAO,EAAoB,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AASpF,UAAU,yBAA0B,SAAQ,qBAAqB;IAC/D,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,IAAI,EAAE,yBAAyB,CAAA;CAChC;AAqBD,eAAO,MAAM,4BAA4B,wBAGtC,iBAAiB,CAAC;IAAE,IAAI,EAAE,yBAAyB,CAAA;CAAE,CAAC,sBA6BxD,CAAA;AAUD,eAAO,MAAM,uBAAuB,iCAAyC,CAAA"}
1
+ {"version":3,"file":"conversations_context.d.ts","sourceRoot":"","sources":["../../src/contexts/conversations_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAiC,MAAM,OAAO,CAAA;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAA;AACxF,OAAO,EAAoB,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AASpF,UAAU,yBAA0B,SAAQ,qBAAqB;IAC/D,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,IAAI,EAAE,yBAAyB,CAAA;CAChC;AAqBD,eAAO,MAAM,4BAA4B,wBAGtC,iBAAiB,CAAC;IAAE,IAAI,EAAE,yBAAyB,CAAA;CAAE,CAAC,sBAmBxD,CAAA;AAUD,eAAO,MAAM,uBAAuB,iCAAyC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import React, { createContext, useContext, useMemo, useState } from 'react';
2
2
  import { useConversations } from '../hooks/use_conversations';
3
- import { useConversationsJoltEvents } from '../hooks/use_conversation_jolt_events';
3
+ import { useConversationsJoltEvents } from '../hooks/use_conversations_jolt_events';
4
4
  const defaultQueryValue = {
5
5
  conversations: [],
6
6
  refetch: () => Promise.resolve(null),
@@ -21,23 +21,14 @@ const ConversationsContext = createContext({
21
21
  export const ConversationsContextProvider = ({ children, args, }) => {
22
22
  const [activeConversationId, setActiveConversationId] = useState();
23
23
  const { chat_group_graph_id, group_source_app_name } = args;
24
- const filter = useMemo(() => {
25
- if (chat_group_graph_id) {
26
- return 'group';
27
- }
28
- else if (group_source_app_name) {
29
- return 'group_source_app_name';
30
- }
31
- return 'mine_or_not_empty';
32
- }, [chat_group_graph_id, group_source_app_name]);
33
- const query = useConversations({ group: chat_group_graph_id, group_source_app_name, filter });
24
+ const query = useConversations({ chat_group_graph_id, group_source_app_name });
34
25
  const value = useMemo(() => ({
35
26
  args,
36
27
  activeConversationId,
37
28
  setActiveConversationId,
38
29
  ...query,
39
30
  }), [args, activeConversationId, query]);
40
- useConversationsJoltEvents();
31
+ useConversationsJoltEvents(args);
41
32
  return <ConversationsContext.Provider value={value}>{children}</ConversationsContext.Provider>;
42
33
  };
43
34
  function fetchNextPage(_options) {
@@ -1 +1 @@
1
- {"version":3,"file":"conversations_context.js","sourceRoot":"","sources":["../../src/contexts/conversations_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAqB,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE9F,OAAO,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAA;AAOpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAQlF,MAAM,iBAAiB,GAA0B;IAC/C,aAAa,EAAE,EAAE;IACjB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;IACpC,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,KAAK;IACd,aAAa;IACb,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,KAAK;CACpB,CAAA;AAED,MAAM,oBAAoB,GAAG,aAAa,CAA4B;IACpE,IAAI,EAAE,EAAE;IACR,oBAAoB,EAAE,SAAS;IAC/B,uBAAuB,EAAE,GAAG,EAAE,GAAE,CAAC;IACjC,GAAG,iBAAiB;CACrB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAC3C,QAAQ,EACR,IAAI,GACmD,EAAE,EAAE;IAC3D,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,EAAsB,CAAA;IACtF,MAAM,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAAA;IAE3D,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,IAAI,mBAAmB,EAAE,CAAC;YACxB,OAAO,OAAO,CAAA;QAChB,CAAC;aAAM,IAAI,qBAAqB,EAAE,CAAC;YACjC,OAAO,uBAAuB,CAAA;QAChC,CAAC;QAED,OAAO,mBAAmB,CAAA;IAC5B,CAAC,EAAE,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAC,CAAA;IAEhD,MAAM,KAAK,GAAG,gBAAgB,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,EAAE,CAAC,CAAA;IAE7F,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,IAAI;QACJ,oBAAoB;QACpB,uBAAuB;QACvB,GAAG,KAAK;KACT,CAAC,EACF,CAAC,IAAI,EAAE,oBAAoB,EAAE,KAAK,CAAC,CACpC,CAAA;IAED,0BAA0B,EAAE,CAAA;IAE5B,OAAO,CAAC,oBAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AAChG,CAAC,CAAA;AAED,SAAS,aAAa,CACpB,QAA+B;IAI/B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;AAC9C,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAA","sourcesContent":["import React, { createContext, PropsWithChildren, useContext, useMemo, useState } from 'react'\nimport { ConversationFiltersParams } from '../screens/conversation_filters/screen_props'\nimport { useConversations, UseConversationsValue } from '../hooks/use_conversations'\nimport {\n FetchNextPageOptions,\n InfiniteQueryObserverResult,\n InfiniteData,\n} from '@tanstack/react-query'\nimport { ApiCollection, ConversationResource } from '../types'\nimport { useConversationsJoltEvents } from '../hooks/use_conversation_jolt_events'\n\ninterface ConversationsContextValue extends UseConversationsValue {\n activeConversationId?: number\n setActiveConversationId: (_id: number) => void\n args: ConversationFiltersParams\n}\n\nconst defaultQueryValue: UseConversationsValue = {\n conversations: [],\n refetch: () => Promise.resolve(null),\n error: null,\n isError: false,\n fetchNextPage,\n hasNextPage: false,\n isFetching: false,\n isFetched: false,\n isRefetching: false,\n}\n\nconst ConversationsContext = createContext<ConversationsContextValue>({\n args: {},\n activeConversationId: undefined,\n setActiveConversationId: () => {},\n ...defaultQueryValue,\n})\n\nexport const ConversationsContextProvider = ({\n children,\n args,\n}: PropsWithChildren<{ args: ConversationFiltersParams }>) => {\n const [activeConversationId, setActiveConversationId] = useState<number | undefined>()\n const { chat_group_graph_id, group_source_app_name } = args\n\n const filter = useMemo(() => {\n if (chat_group_graph_id) {\n return 'group'\n } else if (group_source_app_name) {\n return 'group_source_app_name'\n }\n\n return 'mine_or_not_empty'\n }, [chat_group_graph_id, group_source_app_name])\n\n const query = useConversations({ group: chat_group_graph_id, group_source_app_name, filter })\n\n const value = useMemo(\n () => ({\n args,\n activeConversationId,\n setActiveConversationId,\n ...query,\n }),\n [args, activeConversationId, query]\n )\n\n useConversationsJoltEvents()\n\n return <ConversationsContext.Provider value={value}>{children}</ConversationsContext.Provider>\n}\n\nfunction fetchNextPage(\n _options?: FetchNextPageOptions\n): Promise<\n InfiniteQueryObserverResult<InfiniteData<ApiCollection<ConversationResource>, unknown>, Response>\n> {\n throw new Error('Function not implemented.')\n}\n\nexport const useConversationsContext = () => useContext(ConversationsContext)\n"]}
1
+ {"version":3,"file":"conversations_context.js","sourceRoot":"","sources":["../../src/contexts/conversations_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAqB,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE9F,OAAO,EAAE,gBAAgB,E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G,CAAC,CAAA;AAED,SAAS,aAAa,CACpB,QAA+B;IAI/B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;AAC9C,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAA","sourcesContent":["import React, { createContext, PropsWithChildren, useContext, useMemo, useState } from 'react'\nimport { ConversationFiltersParams } from '../screens/conversation_filters/screen_props'\nimport { useConversations, UseConversationsValue } from '../hooks/use_conversations'\nimport {\n FetchNextPageOptions,\n InfiniteQueryObserverResult,\n InfiniteData,\n} from '@tanstack/react-query'\nimport { ApiCollection, ConversationResource } from '../types'\nimport { useConversationsJoltEvents } from '../hooks/use_conversations_jolt_events'\n\ninterface ConversationsContextValue extends UseConversationsValue {\n activeConversationId?: number\n setActiveConversationId: (_id: number) => void\n args: ConversationFiltersParams\n}\n\nconst defaultQueryValue: UseConversationsValue = {\n conversations: [],\n refetch: () => Promise.resolve(null),\n error: null,\n isError: false,\n fetchNextPage,\n hasNextPage: false,\n isFetching: false,\n isFetched: false,\n isRefetching: false,\n}\n\nconst ConversationsContext = createContext<ConversationsContextValue>({\n args: {},\n activeConversationId: undefined,\n setActiveConversationId: () => {},\n ...defaultQueryValue,\n})\n\nexport const ConversationsContextProvider = ({\n children,\n args,\n}: PropsWithChildren<{ args: ConversationFiltersParams }>) => {\n const [activeConversationId, setActiveConversationId] = useState<number | undefined>()\n const { chat_group_graph_id, group_source_app_name } = args\n\n const query = useConversations({ chat_group_graph_id, group_source_app_name })\n\n const value = useMemo(\n () => ({\n args,\n activeConversationId,\n setActiveConversationId,\n ...query,\n }),\n [args, activeConversationId, query]\n )\n\n useConversationsJoltEvents(args)\n\n return <ConversationsContext.Provider value={value}>{children}</ConversationsContext.Provider>\n}\n\nfunction fetchNextPage(\n _options?: FetchNextPageOptions\n): Promise<\n InfiniteQueryObserverResult<InfiniteData<ApiCollection<ConversationResource>, unknown>, Response>\n> {\n throw new Error('Function not implemented.')\n}\n\nexport const useConversationsContext = () => useContext(ConversationsContext)\n"]}
@@ -0,0 +1,221 @@
1
+ import { ApiResource, ConversationResource } from '../types';
2
+ export declare const useConversationsMarkRead: ({ conversation, }: {
3
+ conversation: ConversationResource;
4
+ }) => {
5
+ data: undefined;
6
+ variables: undefined;
7
+ error: null;
8
+ isError: false;
9
+ isIdle: true;
10
+ isPending: false;
11
+ isSuccess: false;
12
+ status: "idle";
13
+ reset: () => void;
14
+ context: void | undefined;
15
+ failureCount: number;
16
+ failureReason: Error | null;
17
+ isPaused: boolean;
18
+ submittedAt: number;
19
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<ConversationResource>, Error, boolean, void>;
20
+ read: boolean;
21
+ markRead: import("@tanstack/react-query").UseMutateFunction<ApiResource<ConversationResource>, Error, boolean, void>;
22
+ } | {
23
+ data: undefined;
24
+ variables: boolean;
25
+ error: null;
26
+ isError: false;
27
+ isIdle: false;
28
+ isPending: true;
29
+ isSuccess: false;
30
+ status: "pending";
31
+ reset: () => void;
32
+ context: void | undefined;
33
+ failureCount: number;
34
+ failureReason: Error | null;
35
+ isPaused: boolean;
36
+ submittedAt: number;
37
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<ConversationResource>, Error, boolean, void>;
38
+ read: boolean;
39
+ markRead: import("@tanstack/react-query").UseMutateFunction<ApiResource<ConversationResource>, Error, boolean, void>;
40
+ } | {
41
+ data: undefined;
42
+ error: Error;
43
+ variables: boolean;
44
+ isError: true;
45
+ isIdle: false;
46
+ isPending: false;
47
+ isSuccess: false;
48
+ status: "error";
49
+ reset: () => void;
50
+ context: void | undefined;
51
+ failureCount: number;
52
+ failureReason: Error | null;
53
+ isPaused: boolean;
54
+ submittedAt: number;
55
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<ConversationResource>, Error, boolean, void>;
56
+ read: boolean;
57
+ markRead: import("@tanstack/react-query").UseMutateFunction<ApiResource<ConversationResource>, Error, boolean, void>;
58
+ } | {
59
+ data: ApiResource<ConversationResource>;
60
+ error: null;
61
+ variables: boolean;
62
+ isError: false;
63
+ isIdle: false;
64
+ isPending: false;
65
+ isSuccess: true;
66
+ status: "success";
67
+ reset: () => void;
68
+ context: void | undefined;
69
+ failureCount: number;
70
+ failureReason: Error | null;
71
+ isPaused: boolean;
72
+ submittedAt: number;
73
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<ConversationResource>, Error, boolean, void>;
74
+ read: boolean;
75
+ markRead: import("@tanstack/react-query").UseMutateFunction<ApiResource<ConversationResource>, Error, boolean, void>;
76
+ };
77
+ export declare const useConversationsMute: ({ conversation }: {
78
+ conversation: ConversationResource;
79
+ }) => {
80
+ data: undefined;
81
+ variables: undefined;
82
+ error: null;
83
+ isError: false;
84
+ isIdle: true;
85
+ isPending: false;
86
+ isSuccess: false;
87
+ status: "idle";
88
+ reset: () => void;
89
+ context: void | undefined;
90
+ failureCount: number;
91
+ failureReason: Error | null;
92
+ isPaused: boolean;
93
+ submittedAt: number;
94
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<ConversationResource>, Error, boolean, void>;
95
+ muted: boolean;
96
+ setMuted: import("@tanstack/react-query").UseMutateFunction<ApiResource<ConversationResource>, Error, boolean, void>;
97
+ } | {
98
+ data: undefined;
99
+ variables: boolean;
100
+ error: null;
101
+ isError: false;
102
+ isIdle: false;
103
+ isPending: true;
104
+ isSuccess: false;
105
+ status: "pending";
106
+ reset: () => void;
107
+ context: void | undefined;
108
+ failureCount: number;
109
+ failureReason: Error | null;
110
+ isPaused: boolean;
111
+ submittedAt: number;
112
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<ConversationResource>, Error, boolean, void>;
113
+ muted: boolean;
114
+ setMuted: import("@tanstack/react-query").UseMutateFunction<ApiResource<ConversationResource>, Error, boolean, void>;
115
+ } | {
116
+ data: undefined;
117
+ error: Error;
118
+ variables: boolean;
119
+ isError: true;
120
+ isIdle: false;
121
+ isPending: false;
122
+ isSuccess: false;
123
+ status: "error";
124
+ reset: () => void;
125
+ context: void | undefined;
126
+ failureCount: number;
127
+ failureReason: Error | null;
128
+ isPaused: boolean;
129
+ submittedAt: number;
130
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<ConversationResource>, Error, boolean, void>;
131
+ muted: boolean;
132
+ setMuted: import("@tanstack/react-query").UseMutateFunction<ApiResource<ConversationResource>, Error, boolean, void>;
133
+ } | {
134
+ data: ApiResource<ConversationResource>;
135
+ error: null;
136
+ variables: boolean;
137
+ isError: false;
138
+ isIdle: false;
139
+ isPending: false;
140
+ isSuccess: true;
141
+ status: "success";
142
+ reset: () => void;
143
+ context: void | undefined;
144
+ failureCount: number;
145
+ failureReason: Error | null;
146
+ isPaused: boolean;
147
+ submittedAt: number;
148
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<ApiResource<ConversationResource>, Error, boolean, void>;
149
+ muted: boolean;
150
+ setMuted: import("@tanstack/react-query").UseMutateFunction<ApiResource<ConversationResource>, Error, boolean, void>;
151
+ };
152
+ export declare const useMarkAllRead: () => {
153
+ data: undefined;
154
+ variables: undefined;
155
+ error: null;
156
+ isError: false;
157
+ isIdle: true;
158
+ isPending: false;
159
+ isSuccess: false;
160
+ status: "idle";
161
+ reset: () => void;
162
+ context: void | undefined;
163
+ failureCount: number;
164
+ failureReason: Error | null;
165
+ isPaused: boolean;
166
+ submittedAt: number;
167
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../types").ApiCollection | ApiResource, Error, void, void>;
168
+ markAllRead: import("@tanstack/react-query").UseMutateFunction<import("../types").ApiCollection | ApiResource, Error, void, void>;
169
+ } | {
170
+ data: undefined;
171
+ variables: void;
172
+ error: null;
173
+ isError: false;
174
+ isIdle: false;
175
+ isPending: true;
176
+ isSuccess: false;
177
+ status: "pending";
178
+ reset: () => void;
179
+ context: void | undefined;
180
+ failureCount: number;
181
+ failureReason: Error | null;
182
+ isPaused: boolean;
183
+ submittedAt: number;
184
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../types").ApiCollection | ApiResource, Error, void, void>;
185
+ markAllRead: import("@tanstack/react-query").UseMutateFunction<import("../types").ApiCollection | ApiResource, Error, void, void>;
186
+ } | {
187
+ data: undefined;
188
+ error: Error;
189
+ variables: void;
190
+ isError: true;
191
+ isIdle: false;
192
+ isPending: false;
193
+ isSuccess: false;
194
+ status: "error";
195
+ reset: () => void;
196
+ context: void | undefined;
197
+ failureCount: number;
198
+ failureReason: Error | null;
199
+ isPaused: boolean;
200
+ submittedAt: number;
201
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../types").ApiCollection | ApiResource, Error, void, void>;
202
+ markAllRead: import("@tanstack/react-query").UseMutateFunction<import("../types").ApiCollection | ApiResource, Error, void, void>;
203
+ } | {
204
+ data: import("../types").ApiCollection | ApiResource;
205
+ error: null;
206
+ variables: void;
207
+ isError: false;
208
+ isIdle: false;
209
+ isPending: false;
210
+ isSuccess: true;
211
+ status: "success";
212
+ reset: () => void;
213
+ context: void | undefined;
214
+ failureCount: number;
215
+ failureReason: Error | null;
216
+ isPaused: boolean;
217
+ submittedAt: number;
218
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../types").ApiCollection | ApiResource, Error, void, void>;
219
+ markAllRead: import("@tanstack/react-query").UseMutateFunction<import("../types").ApiCollection | ApiResource, Error, void, void>;
220
+ };
221
+ //# sourceMappingURL=use_conversations_actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_conversations_actions.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversations_actions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAI5D,eAAO,MAAM,wBAAwB,sBAElC;IACD,YAAY,EAAE,oBAAoB,CAAA;CACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCA,CAAA;AAED,eAAO,MAAM,oBAAoB,qBAAsB;IAAE,YAAY,EAAE,oBAAoB,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC5F,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsB1B,CAAA"}