@planningcenter/chat-react-native 3.2.0-rc.1 → 3.2.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/message_form.d.ts +2 -2
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +95 -41
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversation/message_reaction.d.ts +2 -2
- package/build/components/conversations/action_toggle_button.d.ts +21 -0
- package/build/components/conversations/action_toggle_button.d.ts.map +1 -0
- package/build/components/conversations/action_toggle_button.js +48 -0
- package/build/components/conversations/action_toggle_button.js.map +1 -0
- package/build/components/conversations/conversation_actions.d.ts +10 -0
- package/build/components/conversations/conversation_actions.d.ts.map +1 -0
- package/build/components/conversations/conversation_actions.js +84 -0
- package/build/components/conversations/conversation_actions.js.map +1 -0
- package/build/components/conversations/conversation_preview.d.ts +2 -1
- package/build/components/conversations/conversation_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +27 -9
- package/build/components/conversations/conversation_preview.js.map +1 -1
- package/build/components/conversations/conversations.d.ts +2 -3
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +5 -11
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/components/conversations/mute_indicator.d.ts +5 -0
- package/build/components/conversations/mute_indicator.d.ts.map +1 -0
- package/build/components/conversations/mute_indicator.js +19 -0
- package/build/components/conversations/mute_indicator.js.map +1 -0
- package/build/components/conversations/unread_count_badge.d.ts +2 -1
- package/build/components/conversations/unread_count_badge.d.ts.map +1 -1
- package/build/components/conversations/unread_count_badge.js +9 -1
- package/build/components/conversations/unread_count_badge.js.map +1 -1
- package/build/components/display/action_button.d.ts +2 -1
- package/build/components/display/action_button.d.ts.map +1 -1
- package/build/components/display/action_button.js +3 -4
- package/build/components/display/action_button.js.map +1 -1
- package/build/components/display/badge.d.ts +5 -4
- package/build/components/display/badge.d.ts.map +1 -1
- package/build/components/display/badge.js +5 -2
- package/build/components/display/badge.js.map +1 -1
- package/build/components/display/button.d.ts +3 -2
- package/build/components/display/button.d.ts.map +1 -1
- package/build/components/display/button.js.map +1 -1
- package/build/components/display/icon.d.ts +14 -1
- package/build/components/display/icon.d.ts.map +1 -1
- package/build/components/display/icon.js +9 -0
- package/build/components/display/icon.js.map +1 -1
- package/build/components/display/icon_button.d.ts +2 -2
- package/build/components/display/icon_button.d.ts.map +1 -1
- package/build/components/display/icon_button.js.map +1 -1
- package/build/components/display/person.d.ts +3 -1
- package/build/components/display/person.d.ts.map +1 -1
- package/build/components/display/person.js +2 -2
- package/build/components/display/person.js.map +1 -1
- package/build/components/display/text.js.map +1 -1
- package/build/components/display/toggle_button.d.ts +3 -2
- package/build/components/display/toggle_button.d.ts.map +1 -1
- package/build/components/display/toggle_button.js.map +1 -1
- package/build/components/display/utils/button_colors.d.ts +3 -3
- package/build/components/display/utils/button_colors.d.ts.map +1 -1
- package/build/components/display/utils/button_colors.js +1 -1
- package/build/components/display/utils/button_colors.js.map +1 -1
- package/build/components/page/error_boundary.d.ts +1 -1
- package/build/components/primitive/avatar_primitive.d.ts.map +1 -1
- package/build/components/primitive/avatar_primitive.js +3 -2
- package/build/components/primitive/avatar_primitive.js.map +1 -1
- package/build/components/primitive/banner_primitive.d.ts +2 -1
- package/build/components/primitive/banner_primitive.d.ts.map +1 -1
- package/build/components/primitive/banner_primitive.js +0 -1
- package/build/components/primitive/banner_primitive.js.map +1 -1
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/chat_context.d.ts +2 -0
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +6 -1
- package/build/contexts/chat_context.js.map +1 -1
- package/build/contexts/conversations_context.d.ts +14 -0
- package/build/contexts/conversations_context.d.ts.map +1 -0
- package/build/contexts/conversations_context.js +38 -0
- package/build/contexts/conversations_context.js.map +1 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +214 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.js +50 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -0
- package/build/hooks/groups/use_groups_conversation_create.d.ts +9 -0
- package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -0
- package/build/hooks/groups/use_groups_conversation_create.js +36 -0
- package/build/hooks/groups/use_groups_conversation_create.js.map +1 -0
- package/build/hooks/use_conversation.d.ts +1 -1
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +1 -1
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_conversations.d.ts +6 -32
- package/build/hooks/use_conversations.d.ts.map +1 -1
- package/build/hooks/use_conversations.js +15 -14
- package/build/hooks/use_conversations.js.map +1 -1
- package/build/hooks/use_conversations_actions.d.ts +221 -0
- package/build/hooks/use_conversations_actions.d.ts.map +1 -0
- package/build/hooks/use_conversations_actions.js +93 -0
- package/build/hooks/use_conversations_actions.js.map +1 -0
- package/build/hooks/use_conversations_cache.d.ts +18 -0
- package/build/hooks/use_conversations_cache.d.ts.map +1 -0
- package/build/hooks/{use_conversation_jolt_events.js → use_conversations_cache.js} +27 -17
- package/build/hooks/use_conversations_cache.js.map +1 -0
- package/build/hooks/use_conversations_jolt_events.d.ts +3 -0
- package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -0
- package/build/hooks/use_conversations_jolt_events.js +12 -0
- package/build/hooks/use_conversations_jolt_events.js.map +1 -0
- package/build/hooks/use_create_android_ripple_color.d.ts +1 -1
- package/build/hooks/use_create_android_ripple_color.d.ts.map +1 -1
- package/build/hooks/use_giphy.d.ts +9 -0
- package/build/hooks/use_giphy.d.ts.map +1 -0
- package/build/hooks/use_giphy.js +63 -0
- package/build/hooks/use_giphy.js.map +1 -0
- package/build/hooks/use_jolt.d.ts.map +1 -1
- package/build/hooks/use_jolt.js +39 -10
- package/build/hooks/use_jolt.js.map +1 -1
- package/build/hooks/use_message_create.d.ts +11 -0
- package/build/hooks/use_message_create.d.ts.map +1 -0
- package/build/hooks/use_message_create.js +35 -0
- package/build/hooks/use_message_create.js.map +1 -0
- package/build/navigation/index.d.ts +23 -6
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +25 -8
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -0
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
- package/build/screens/conversation_filters/components/rows.d.ts +2 -1
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/rows.js +19 -14
- package/build/screens/conversation_filters/components/rows.js.map +1 -1
- package/build/screens/conversation_filters/hooks/filters.js +1 -1
- package/build/screens/conversation_filters/hooks/filters.js.map +1 -1
- package/build/screens/conversation_new/components/form_list.d.ts +12 -0
- package/build/screens/conversation_new/components/form_list.d.ts.map +1 -0
- package/build/screens/conversation_new/components/form_list.js +42 -0
- package/build/screens/conversation_new/components/form_list.js.map +1 -0
- package/build/screens/conversation_new/components/groups_form.d.ts +7 -0
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -0
- package/build/screens/conversation_new/components/groups_form.js +101 -0
- package/build/screens/conversation_new/components/groups_form.js.map +1 -0
- package/build/screens/conversation_new/components/member_error_card.d.ts +5 -0
- package/build/screens/conversation_new/components/member_error_card.d.ts.map +1 -0
- package/build/screens/conversation_new/components/member_error_card.js +17 -0
- package/build/screens/conversation_new/components/member_error_card.js.map +1 -0
- package/build/screens/conversation_new/components/source_app_error_card.d.ts +2 -0
- package/build/screens/conversation_new/components/source_app_error_card.d.ts.map +1 -0
- package/build/screens/conversation_new/components/source_app_error_card.js +16 -0
- package/build/screens/conversation_new/components/source_app_error_card.js.map +1 -0
- package/build/screens/conversation_new/components/team_form.d.ts +8 -0
- package/build/screens/conversation_new/components/team_form.d.ts.map +1 -0
- package/build/screens/conversation_new/components/team_form.js +11 -0
- package/build/screens/conversation_new/components/team_form.js.map +1 -0
- package/build/screens/conversation_new/conversation_new_screen.d.ts +12 -0
- package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -0
- package/build/screens/conversation_new/conversation_new_screen.js +16 -0
- package/build/screens/conversation_new/conversation_new_screen.js.map +1 -0
- package/build/screens/conversation_new/utils/fake_member_data.d.ts +3 -0
- package/build/screens/conversation_new/utils/fake_member_data.d.ts.map +1 -0
- package/build/screens/conversation_new/utils/fake_member_data.js +129 -0
- package/build/screens/conversation_new/utils/fake_member_data.js.map +1 -0
- package/build/screens/conversation_screen.d.ts +1 -0
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +1 -1
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +1 -0
- package/build/screens/{create → conversation_select_recipients}/conversation_select_recipients_screen.js +6 -5
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +1 -0
- package/build/screens/conversations/components/chat_group_badge.js +1 -1
- package/build/screens/conversations/components/chat_group_badge.js.map +1 -1
- package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +6 -2
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js +6 -13
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/screens/design_system_screen.js +1 -0
- package/build/screens/design_system_screen.js.map +1 -1
- package/build/screens/message_actions_screen.d.ts +2 -2
- package/build/screens/message_actions_screen.d.ts.map +1 -1
- package/build/screens/message_actions_screen.js +1 -1
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/screens/send_giphy_screen.d.ts +10 -0
- package/build/screens/send_giphy_screen.d.ts.map +1 -0
- package/build/screens/send_giphy_screen.js +98 -0
- package/build/screens/send_giphy_screen.js.map +1 -0
- package/build/types/resources/groups/groups_group_resource.d.ts +1 -1
- package/build/types/resources/groups/groups_group_resource.js.map +1 -1
- package/build/types/resources/groups/groups_member_resource_with_person.d.ts +14 -0
- package/build/types/resources/groups/groups_member_resource_with_person.d.ts.map +1 -0
- package/build/types/resources/groups/groups_member_resource_with_person.js +2 -0
- package/build/types/resources/groups/groups_member_resource_with_person.js.map +1 -0
- package/build/types/resources/member.d.ts +0 -10
- package/build/types/resources/member.d.ts.map +1 -1
- package/build/types/resources/member.js.map +1 -1
- package/build/utils/cache/page_mutations.d.ts +18 -0
- package/build/utils/cache/page_mutations.d.ts.map +1 -1
- package/build/utils/cache/page_mutations.js +13 -0
- package/build/utils/cache/page_mutations.js.map +1 -1
- package/build/utils/client/client.d.ts +2 -2
- package/build/utils/client/client.d.ts.map +1 -1
- package/build/utils/client/client.js +12 -4
- package/build/utils/client/client.js.map +1 -1
- package/build/utils/client/request_helpers.d.ts +15 -8
- package/build/utils/client/request_helpers.d.ts.map +1 -1
- package/build/utils/client/request_helpers.js +2 -1
- package/build/utils/client/request_helpers.js.map +1 -1
- package/build/utils/client/transform_request_data.d.ts +11 -6
- package/build/utils/client/transform_request_data.d.ts.map +1 -1
- package/build/utils/client/transform_request_data.js +1 -1
- package/build/utils/client/transform_request_data.js.map +1 -1
- package/build/utils/client/transform_response.d.ts +1 -1
- package/build/utils/client/transform_response.d.ts.map +1 -1
- package/build/utils/client/transform_response.js +2 -0
- package/build/utils/client/transform_response.js.map +1 -1
- package/build/utils/client/utils.d.ts +3 -3
- package/build/utils/client/utils.d.ts.map +1 -1
- package/build/utils/client/utils.js +6 -6
- package/build/utils/client/utils.js.map +1 -1
- package/build/utils/date.d.ts.map +1 -1
- package/build/utils/date.js +1 -0
- package/build/utils/date.js.map +1 -1
- package/build/utils/deepCamelCaseKeys.d.ts.map +1 -1
- package/build/utils/deepCamelCaseKeys.js +3 -1
- package/build/utils/deepCamelCaseKeys.js.map +1 -1
- package/build/utils/parse_simple_markdown.d.ts +1 -1
- package/build/utils/parse_simple_markdown.d.ts.map +1 -1
- package/build/utils/parse_simple_markdown.js +2 -1
- package/build/utils/parse_simple_markdown.js.map +1 -1
- package/build/utils/request/conversation.d.ts +1 -3
- package/build/utils/request/conversation.d.ts.map +1 -1
- package/build/utils/request/conversation.js +37 -30
- package/build/utils/request/conversation.js.map +1 -1
- package/build/utils/space.js.map +1 -1
- package/build/utils/uri.d.ts +2 -2
- package/build/utils/uri.d.ts.map +1 -1
- package/build/utils/uri.js +2 -2
- package/build/utils/uri.js.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts +8 -0
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.js +8 -0
- package/build/vendor/tapestry/alias_tokens_color_map.js.map +1 -1
- package/build/vendor/tapestry/tokens.d.ts +2 -0
- package/build/vendor/tapestry/tokens.d.ts.map +1 -1
- package/build/vendor/tapestry/tokens.js +2 -0
- package/build/vendor/tapestry/tokens.js.map +1 -1
- package/package.json +8 -6
- package/src/__tests__/utils/cache/page_mutations.ts +49 -15
- package/src/components/conversation/message_form.tsx +127 -58
- package/src/components/conversations/action_toggle_button.tsx +84 -0
- package/src/components/conversations/conversation_actions.tsx +146 -0
- package/src/components/conversations/conversation_preview.tsx +46 -16
- package/src/components/conversations/conversations.tsx +13 -18
- package/src/components/conversations/mute_indicator.tsx +21 -0
- package/src/components/conversations/unread_count_badge.tsx +8 -1
- package/src/components/display/action_button.tsx +4 -3
- package/src/components/display/badge.tsx +12 -8
- package/src/components/display/button.tsx +3 -3
- package/src/components/display/icon.tsx +16 -3
- package/src/components/display/icon_button.tsx +2 -2
- package/src/components/display/person.tsx +4 -3
- package/src/components/display/text.tsx +1 -1
- package/src/components/display/toggle_button.tsx +3 -3
- package/src/components/display/utils/button_colors.ts +8 -3
- package/src/components/primitive/avatar_primitive.tsx +5 -3
- package/src/components/primitive/banner_primitive.tsx +2 -3
- package/src/contexts/api_provider.tsx +1 -1
- package/src/contexts/chat_context.tsx +8 -1
- package/src/contexts/conversations_context.tsx +69 -0
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +57 -0
- package/src/hooks/groups/use_groups_conversation_create.ts +50 -0
- package/src/hooks/use_conversation.ts +5 -5
- package/src/hooks/use_conversations.ts +34 -16
- package/src/hooks/use_conversations_actions.ts +108 -0
- package/src/hooks/{use_conversation_jolt_events.ts → use_conversations_cache.ts} +35 -20
- package/src/hooks/use_conversations_jolt_events.ts +21 -0
- package/src/hooks/use_giphy.ts +97 -0
- package/src/hooks/use_jolt.ts +53 -12
- package/src/hooks/use_message_create.ts +55 -0
- package/src/navigation/index.tsx +31 -8
- package/src/screens/conversation_filters/components/conversation_filters.tsx +1 -1
- package/src/screens/conversation_filters/components/rows.tsx +44 -14
- package/src/screens/conversation_filters/hooks/filters.ts +1 -1
- package/src/screens/conversation_new/components/form_list.tsx +67 -0
- package/src/screens/conversation_new/components/groups_form.tsx +153 -0
- package/src/screens/conversation_new/components/member_error_card.tsx +20 -0
- package/src/screens/conversation_new/components/source_app_error_card.tsx +24 -0
- package/src/screens/conversation_new/components/team_form.tsx +18 -0
- package/src/screens/conversation_new/conversation_new_screen.tsx +26 -0
- package/src/screens/conversation_new/utils/fake_member_data.ts +130 -0
- package/src/screens/conversation_screen.tsx +2 -1
- package/src/screens/{create → conversation_select_recipients}/conversation_select_recipients_screen.tsx +6 -5
- package/src/screens/conversations/components/chat_group_badge.tsx +1 -1
- package/src/screens/conversations/components/list_header_component.tsx +7 -2
- package/src/screens/conversations/conversations_screen.tsx +6 -19
- package/src/screens/design_system_screen.tsx +1 -0
- package/src/screens/message_actions_screen.tsx +4 -4
- package/src/screens/send_giphy_screen.tsx +155 -0
- package/src/types/resources/groups/groups_group_resource.ts +1 -1
- package/src/types/resources/groups/groups_member_resource_with_person.ts +13 -0
- package/src/types/resources/member.ts +0 -11
- package/src/utils/cache/page_mutations.ts +22 -0
- package/src/utils/client/client.ts +15 -7
- package/src/utils/client/request_helpers.ts +15 -6
- package/src/utils/client/transform_request_data.ts +13 -4
- package/src/utils/client/transform_response.ts +3 -0
- package/src/utils/client/types.d.ts +2 -1
- package/src/utils/client/utils.ts +13 -12
- package/src/utils/date.ts +1 -0
- package/src/utils/deepCamelCaseKeys.ts +3 -2
- package/src/utils/parse_simple_markdown.ts +3 -1
- package/src/utils/request/conversation.ts +39 -34
- package/src/utils/space.ts +1 -1
- package/src/utils/uri.ts +2 -2
- package/src/vendor/tapestry/alias_tokens_color_map.ts +12 -0
- package/src/vendor/tapestry/tokens.ts +2 -0
- package/build/hooks/use_conversation_jolt_events.d.ts +0 -2
- package/build/hooks/use_conversation_jolt_events.d.ts.map +0 -1
- package/build/hooks/use_conversation_jolt_events.js.map +0 -1
- package/build/screens/create/conversation_create_screen.d.ts +0 -9
- package/build/screens/create/conversation_create_screen.d.ts.map +0 -1
- package/build/screens/create/conversation_create_screen.js +0 -123
- package/build/screens/create/conversation_create_screen.js.map +0 -1
- package/build/screens/create/conversation_filter_recipients_screen.d.ts.map +0 -1
- package/build/screens/create/conversation_filter_recipients_screen.js.map +0 -1
- package/build/screens/create/conversation_select_recipients_screen.d.ts.map +0 -1
- package/build/screens/create/conversation_select_recipients_screen.js.map +0 -1
- package/src/screens/create/conversation_create_screen.tsx +0 -148
- /package/build/screens/{create → conversation_filter_recipients}/conversation_filter_recipients_screen.d.ts +0 -0
- /package/build/screens/{create → conversation_filter_recipients}/conversation_filter_recipients_screen.js +0 -0
- /package/build/screens/{create → conversation_select_recipients}/conversation_select_recipients_screen.d.ts +0 -0
- /package/src/screens/{create → conversation_filter_recipients}/conversation_filter_recipients_screen.tsx +0 -0
|
@@ -2,7 +2,7 @@ import _ from 'lodash'
|
|
|
2
2
|
import URI from 'urijs'
|
|
3
3
|
import { transformRequestData } from './transform_request_data'
|
|
4
4
|
import transformResponse from './transform_response'
|
|
5
|
-
import { Accumulator, GetRequest, PostRequest, RequestData } from './types'
|
|
5
|
+
import { Accumulator, GetRequest, PostRequest, RequestData, WalkRequest } from './types'
|
|
6
6
|
|
|
7
7
|
export type MakeRequestArgs = {
|
|
8
8
|
action: 'GET' | 'POST' | 'PATCH' | 'DELETE'
|
|
@@ -21,6 +21,7 @@ export const makeRequest = ({ action = 'GET', url, data = {}, headers = {} }: Ma
|
|
|
21
21
|
const combinedQuery = Object.entries({ ...query, ...urlQuery })
|
|
22
22
|
.sort()
|
|
23
23
|
.reduce((obj, [key, value]) => {
|
|
24
|
+
// @ts-ignore
|
|
24
25
|
obj[key] = value
|
|
25
26
|
return obj
|
|
26
27
|
}, {})
|
|
@@ -64,7 +65,14 @@ export const concatRecords = (records: Accumulator, moreRecords: Accumulator) =>
|
|
|
64
65
|
meta: _.pick(moreRecords.meta, STANDARD_META_ATTRIBUTES),
|
|
65
66
|
})
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
type Walk = (args: MakeRequestArgs | WalkRequest) => Promise<any>
|
|
69
|
+
type WalkArgs = MakeRequestArgs & {
|
|
70
|
+
data?: {
|
|
71
|
+
fields?: Record<string, any>
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const throwErrorIfFieldsMissing = async (walk: Walk, args: WalkArgs) => {
|
|
68
76
|
const fields = args?.data?.fields
|
|
69
77
|
|
|
70
78
|
if (!fields) {
|
|
@@ -89,23 +97,24 @@ export const throwErrorIfFieldsMissing = async (walk, args) => {
|
|
|
89
97
|
return transformResponse(response)
|
|
90
98
|
}
|
|
91
99
|
|
|
92
|
-
export const friendlyErrors = (walk, args) =>
|
|
100
|
+
export const friendlyErrors = (walk: Walk, args: WalkArgs) =>
|
|
93
101
|
throwErrorIfQueryParams(args.url)
|
|
94
102
|
.then(() => throwErrorIfFieldsMissing(walk, args))
|
|
95
103
|
.then(transformResponse)
|
|
96
104
|
|
|
97
|
-
export const noQueryParamsFriendlyErrors = (request, args) =>
|
|
105
|
+
export const noQueryParamsFriendlyErrors = (request: typeof makeRequest, args: WalkArgs) =>
|
|
98
106
|
throwErrorIfQueryParams(args.url)
|
|
99
107
|
.then(() => request(args))
|
|
100
108
|
.then(transformResponse)
|
|
101
109
|
|
|
102
|
-
const passthrough = async (walk
|
|
110
|
+
const passthrough = async <T, R>(walk: (args: T) => Promise<R>, args: T) =>
|
|
111
|
+
Promise.resolve(transformResponse(await walk(args)))
|
|
103
112
|
|
|
104
113
|
export const ensureFieldsInDev = __DEV__ ? friendlyErrors : passthrough
|
|
105
114
|
|
|
106
115
|
export const ensureNoQueryParamsInDev = __DEV__ ? noQueryParamsFriendlyErrors : passthrough
|
|
107
116
|
|
|
108
|
-
export const throwErrorIfQueryParams = url => {
|
|
117
|
+
export const throwErrorIfQueryParams = (url: string) => {
|
|
109
118
|
if (new URI(url).search().length) {
|
|
110
119
|
throw new Error('Must pass query params as data arg')
|
|
111
120
|
}
|
|
@@ -17,7 +17,10 @@ export const transformRequestData = ({
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export function flattenAttribute
|
|
20
|
+
export function flattenAttribute<T extends Record<string, string | string[]>>(
|
|
21
|
+
obj: T | undefined,
|
|
22
|
+
key: keyof T
|
|
23
|
+
) {
|
|
21
24
|
if (!isObject(obj)) return { [key]: obj }
|
|
22
25
|
|
|
23
26
|
return reduce(
|
|
@@ -25,17 +28,23 @@ export function flattenAttribute(obj, key) {
|
|
|
25
28
|
(acc, value, attr) => {
|
|
26
29
|
return {
|
|
27
30
|
...acc,
|
|
28
|
-
...buildQuery({ key: `${key}[${attr}]`, value }),
|
|
31
|
+
...buildQuery({ key: `${String(key)}[${attr}]`, value }),
|
|
29
32
|
}
|
|
30
33
|
},
|
|
31
34
|
{}
|
|
32
35
|
)
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
type QueryArgs = {
|
|
39
|
+
key: string
|
|
40
|
+
value: string | number | boolean | object | any[]
|
|
41
|
+
}
|
|
42
|
+
type QueryReturn = Record<string, string | number | boolean>
|
|
43
|
+
|
|
44
|
+
export function buildQuery({ key, value }: QueryArgs): QueryReturn {
|
|
36
45
|
if (isArray(value)) return { [key]: value.join(',') }
|
|
37
46
|
if (isObject(value)) {
|
|
38
|
-
const keys = Object.keys(value)
|
|
47
|
+
const keys = Object.keys(value) as Array<keyof typeof value>
|
|
39
48
|
return keys.reduce(
|
|
40
49
|
(acc, subKey) => ({
|
|
41
50
|
...acc,
|
|
@@ -34,6 +34,7 @@ export interface Relationship {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export type Relationships = Record<string, Relationship | Relationship[]>
|
|
37
38
|
export interface PostRequest extends GenericRequest {
|
|
38
39
|
data?: {
|
|
39
40
|
fields?: Record<string, string> // value should be comma separated string
|
|
@@ -41,7 +42,7 @@ export interface PostRequest extends GenericRequest {
|
|
|
41
42
|
data?: {
|
|
42
43
|
type: string
|
|
43
44
|
attributes: Record<string, unknown>
|
|
44
|
-
relationships?:
|
|
45
|
+
relationships?: Relationships
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
}
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
import _ from 'lodash'
|
|
2
2
|
|
|
3
|
-
const toSentence = (words, lastWordConnector = 'and') => {
|
|
3
|
+
const toSentence = (words: string[], lastWordConnector = 'and') => {
|
|
4
4
|
lastWordConnector = `${words.length > 2 ? ',' : ''} ${lastWordConnector}`
|
|
5
5
|
return words.join(', ').replace(/,\s([^,]+$)/, `${lastWordConnector} $1`)
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
const toCamel = s
|
|
8
|
+
const toCamel = (s: string) =>
|
|
9
|
+
s.replace(/(_[a-z])/g, (m: string) => m.toUpperCase().replace('_', ''))
|
|
9
10
|
|
|
10
|
-
const toSnake = s => (s.startsWith('_') ? `_${_.snakeCase(s)}` : _.snakeCase(s))
|
|
11
|
+
const toSnake = (s: string) => (s.startsWith('_') ? `_${_.snakeCase(s)}` : _.snakeCase(s))
|
|
11
12
|
|
|
12
|
-
const actualObject = elem => {
|
|
13
|
+
const actualObject = (elem: unknown): elem is Object => {
|
|
13
14
|
return !((_.isObject(elem) && (_.isArray(elem) || _.isFunction(elem))) || !_.isObject(elem))
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
// map over tree (object) and apply f to each key
|
|
17
|
-
const walker = f => {
|
|
18
|
-
const seen = new WeakMap()
|
|
18
|
+
const walker = (f: (key: string) => string) => {
|
|
19
|
+
const seen = new WeakMap<object, object>()
|
|
19
20
|
|
|
20
|
-
const convert = elem => {
|
|
21
|
+
const convert = (elem: object): object => {
|
|
21
22
|
if (actualObject(elem)) {
|
|
22
23
|
return _.reduce(
|
|
23
|
-
elem,
|
|
24
|
-
(memo, obj, key) => {
|
|
24
|
+
elem as Record<string, unknown>,
|
|
25
|
+
(memo: Record<string, unknown>, obj: unknown, key: string) => {
|
|
25
26
|
if (!seen.has(elem)) {
|
|
26
27
|
seen.set(elem, memo)
|
|
27
28
|
}
|
|
28
|
-
memo[f(key)] = seen.get(obj) || convert(obj)
|
|
29
|
+
memo[f(key)] = seen.get(obj as object) || convert(obj as object)
|
|
29
30
|
return memo
|
|
30
31
|
},
|
|
31
|
-
{}
|
|
32
|
+
{} as Record<string, unknown>
|
|
32
33
|
)
|
|
33
34
|
} else if (_.isArray(elem)) {
|
|
34
35
|
return _.map(elem, convert)
|
|
@@ -40,6 +41,6 @@ const walker = f => {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
const keysToCamelCase = walker(toCamel)
|
|
43
|
-
const keysToSnakeCase = walker(k => (k
|
|
44
|
+
const keysToSnakeCase = walker(k => (typeof k !== 'string' ? k : toSnake(k)))
|
|
44
45
|
|
|
45
46
|
export { keysToCamelCase, keysToSnakeCase, toSentence }
|
package/src/utils/date.ts
CHANGED
|
@@ -4,10 +4,11 @@ type ObjType = Record<string, unknown> | unknown[] | unknown
|
|
|
4
4
|
|
|
5
5
|
export function deepCamelCaseKeys<T extends ObjType>(obj: T): T {
|
|
6
6
|
if (isArray(obj)) {
|
|
7
|
-
return
|
|
7
|
+
return obj.map(deepCamelCaseKeys) as T
|
|
8
8
|
} else if (isObject(obj)) {
|
|
9
9
|
return mapValues(
|
|
10
|
-
|
|
10
|
+
// @ts-ignore This mutates the object, but we don't care about the type here
|
|
11
|
+
mapKeys(obj, (_value: string, key: string) => camelCase(key)),
|
|
11
12
|
deepCamelCaseKeys
|
|
12
13
|
) as T
|
|
13
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Supports bold, italic, and links
|
|
2
|
-
export const parseSimpleMarkdown = input => {
|
|
2
|
+
export const parseSimpleMarkdown = (input: string) => {
|
|
3
3
|
const parts: MarkdownPart[] = []
|
|
4
4
|
|
|
5
5
|
const pattern = /(\*\*|__)(.+?)\1|(?<!\*)\*(.+?)\*|(?<!_)_(.+?)_|(https?:\/\/[^\s]+)/g
|
|
@@ -25,6 +25,8 @@ export const parseSimpleMarkdown = input => {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
lastIndex = offset + match.length
|
|
28
|
+
|
|
29
|
+
return match
|
|
28
30
|
})
|
|
29
31
|
|
|
30
32
|
if (lastIndex < input.length) {
|
|
@@ -1,46 +1,51 @@
|
|
|
1
1
|
import { GetRequest } from '../client/types'
|
|
2
2
|
|
|
3
3
|
export interface ConversationRequestArgs {
|
|
4
|
-
filter: string
|
|
5
4
|
gids: string
|
|
6
|
-
group: string
|
|
7
5
|
chat_group_graph_id?: string
|
|
8
6
|
group_source_app_name?: string
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
export const getConversationsRequestArgs = ({
|
|
12
|
-
filter,
|
|
13
10
|
gids,
|
|
14
|
-
|
|
11
|
+
chat_group_graph_id,
|
|
15
12
|
group_source_app_name,
|
|
16
|
-
}: Partial<ConversationRequestArgs> = {}): GetRequest =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
13
|
+
}: Partial<ConversationRequestArgs> = {}): GetRequest => {
|
|
14
|
+
const filter = chat_group_graph_id
|
|
15
|
+
? 'group'
|
|
16
|
+
: group_source_app_name
|
|
17
|
+
? 'group_source_app_name'
|
|
18
|
+
: 'mine_or_not_empty'
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
url: '/me/conversations',
|
|
22
|
+
data: {
|
|
23
|
+
perPage: 20,
|
|
24
|
+
order: '-last_message',
|
|
25
|
+
filter,
|
|
26
|
+
gids,
|
|
27
|
+
group: chat_group_graph_id,
|
|
28
|
+
group_source_app_name,
|
|
29
|
+
fields: {
|
|
30
|
+
Conversation: [
|
|
31
|
+
'created_at',
|
|
32
|
+
'badges',
|
|
33
|
+
'groups',
|
|
34
|
+
'last_message_author_id',
|
|
35
|
+
'last_message_author_name',
|
|
36
|
+
'last_message_created_at',
|
|
37
|
+
'last_message_text_preview',
|
|
38
|
+
'preview_avatar_urls',
|
|
39
|
+
'member_ability',
|
|
40
|
+
'muted',
|
|
41
|
+
'replies_disabled',
|
|
42
|
+
'title',
|
|
43
|
+
'unread_count',
|
|
44
|
+
'updated_at',
|
|
45
|
+
],
|
|
46
|
+
ConversationBadge: ['app_name', 'pco_resource_type', 'text'],
|
|
47
|
+
},
|
|
48
|
+
include: ['badges'],
|
|
43
49
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/utils/space.ts
CHANGED
|
@@ -24,7 +24,7 @@ export function space(value: SpacingValues): number {
|
|
|
24
24
|
if (value < 1 || value > 7.5) return handleInvalidSpace(value)
|
|
25
25
|
|
|
26
26
|
// Reject fractional values that are not 0 or 0.5
|
|
27
|
-
const wholeValue = Math.floor(value)
|
|
27
|
+
const wholeValue = Math.floor(value) as 1 | 2 | 3 | 4 | 5 | 6 | 7
|
|
28
28
|
const fractionalValue = value % 1
|
|
29
29
|
if (fractionalValue !== 0 && fractionalValue !== 0.5) return handleInvalidSpace(value)
|
|
30
30
|
|
package/src/utils/uri.ts
CHANGED
|
@@ -56,13 +56,13 @@ export class Uri {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
appUrl = path => {
|
|
59
|
+
appUrl = (path: string) => {
|
|
60
60
|
if (path.startsWith(`${this.schema}://`)) return path
|
|
61
61
|
|
|
62
62
|
return `${this.baseUrl}${this.directory}${path || '/'}`
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
api = path => {
|
|
65
|
+
api = (path: string) => {
|
|
66
66
|
if (path.startsWith(`${this.schema}://`)) return path
|
|
67
67
|
|
|
68
68
|
return `${this.baseUrl}${path || '/'}`
|
|
@@ -73,6 +73,10 @@ interface SemanticAliasesColors {
|
|
|
73
73
|
fillColorStatusErrorMedium: string
|
|
74
74
|
fillColorButtonNeutralSolidDisabled: string
|
|
75
75
|
androidRippleNeutral: string
|
|
76
|
+
surfaceColorCard: string
|
|
77
|
+
surfaceColorCanvas: string
|
|
78
|
+
surfaceColor100: string
|
|
79
|
+
surfaceColor090: string
|
|
76
80
|
needsDesignPass: string
|
|
77
81
|
}
|
|
78
82
|
|
|
@@ -100,6 +104,10 @@ const semanticAliasesLight: SemanticAliasesColors = {
|
|
|
100
104
|
fillColorStatusErrorMedium: tokens.fillColorStatusErrorMedium,
|
|
101
105
|
fillColorButtonNeutralSolidDisabled: neutralsLight.fillColorNeutral070,
|
|
102
106
|
androidRippleNeutral: tokens.fillColorTransparencyDark020,
|
|
107
|
+
surfaceColorCard: neutralsLight.fillColorNeutral100Inverted,
|
|
108
|
+
surfaceColorCanvas: neutralsLight.fillColorNeutral090,
|
|
109
|
+
surfaceColor100: neutralsLight.fillColorNeutral100Inverted,
|
|
110
|
+
surfaceColor090: neutralsLight.fillColorNeutral090,
|
|
103
111
|
needsDesignPass: 'hotpink',
|
|
104
112
|
} as const
|
|
105
113
|
|
|
@@ -127,6 +135,10 @@ const semanticAliasesDark: SemanticAliasesColors = {
|
|
|
127
135
|
fillColorStatusErrorMedium: tokens.fillColorStatusErrorMedium,
|
|
128
136
|
fillColorButtonNeutralSolidDisabled: neutralsDark.fillColorNeutral070,
|
|
129
137
|
androidRippleNeutral: tokens.fillColorTransparencyLight020,
|
|
138
|
+
surfaceColorCard: neutralsDark.fillColorNeutral100Inverted,
|
|
139
|
+
surfaceColorCanvas: neutralsDark.fillColorNeutral090,
|
|
140
|
+
surfaceColor100: neutralsDark.fillColorNeutral100Inverted,
|
|
141
|
+
surfaceColor090: neutralsDark.fillColorNeutral090,
|
|
130
142
|
needsDesignPass: 'pink',
|
|
131
143
|
}
|
|
132
144
|
|
|
@@ -24,6 +24,8 @@ const colorPrimitives = {
|
|
|
24
24
|
borderColorStatusErrorDark: 'hsl(8, 60%, 55%)',
|
|
25
25
|
colorNeutral100White: 'hsl(0, 0%, 100%)',
|
|
26
26
|
fillColorInteractionDefault: 'hsl(204, 100%, 40%)',
|
|
27
|
+
fillColorInteractionSwipeDefault: 'hsl(204, 100%, 40%)',
|
|
28
|
+
fillColorInteractionSwipeSecondary: 'hsl(0, 0%, 24%)',
|
|
27
29
|
fillColorStatusNeutralGhost: 'hsl(0, 0%, 93%)',
|
|
28
30
|
fillColorStatusNeutralGhostDark: 'hsl(0, 0%, 18%)',
|
|
29
31
|
textColorStatusNeutral: 'hsl(0, 0%, 24%)',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use_conversation_jolt_events.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_jolt_events.ts"],"names":[],"mappings":"AAaA,wBAAgB,0BAA0B,SAiDzC"}
|
|
@@ -1 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ACb,CAAC,CAAA;IAED,MAAM,gCAAgC,GAAG,KAAK,EAAE,CAAwB,EAAE,EAAE;QAC1E,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,CAAA;QACvB,MAAM,YAAY,GAAyB,MAAM,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAEzF,WAAW,CAAC,YAAY,CAAY,oBAAoB,EAAE,IAAI,CAAC,EAAE,CAC/D,+BAA+B,CAAC;YAC9B,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,YAAY;YACpB,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;gBACjC,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,EAAE,CAAA;YAClC,CAAC;SACF,CAAC,CACH,CAAA;IACH,CAAC,CAAA;IAED,MAAM,yBAAyB,GAAG,CAAC,CAA2B,EAAE,EAAE;QAChE,WAAW,CAAC,YAAY,CAAY,oBAAoB,EAAE,IAAI,CAAC,EAAE,CAC/D,uBAAuB,CAAC;YACtB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;SAC/B,CAAC,CACH,CAAA;IACH,CAAC,CAAA;IAED,YAAY,CAAC,WAAW,EAAE,sBAAsB,EAAE,gCAAgC,CAAC,CAAA;IACnF,YAAY,CAAC,WAAW,EAAE,sBAAsB,EAAE,gCAAgC,CAAC,CAAA;IACnF,YAAY,CAAC,WAAW,EAAE,wBAAwB,EAAE,yBAAyB,CAAC,CAAA;AAChF,CAAC","sourcesContent":["import { InfiniteData, useQueryClient } from '@tanstack/react-query'\nimport { ApiCollection, ApiResource, ConversationResource } from '../types'\nimport { deleteRecordInPagesData, updateOrCreateRecordInPagesData } from '../utils'\nimport { useApiClient } from './use_api_client'\nimport { useCurrentPerson } from './use_current_person'\nimport { useJoltChannel, useJoltEvent } from './use_jolt'\nimport { getRequestQueryKey } from './use_suspense_api'\nimport { JoltConversationEvent } from '../types/jolt_events'\nimport { ConversationDeletedEvent } from '../types/jolt_events/conversation_events'\nimport { getConversationsRequestArgs } from '../utils/request/conversation'\n\ntype QueryData = InfiniteData<ApiCollection<ConversationResource>>\n\nexport function useConversationsJoltEvents() {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const currentPerson = useCurrentPerson()\n const joltChannel = useJoltChannel(`chat.people.${currentPerson.id}`)\n\n const conversationsRequestArgs = getConversationsRequestArgs()\n const conversationQueryKey = getRequestQueryKey(conversationsRequestArgs)\n\n const fetchConversation = async (id: number) => {\n const { data: argsData } = conversationsRequestArgs\n const { data } = await apiClient.chat.get<ApiResource<ConversationResource>>({\n url: `/me/conversations/${id}`,\n data: {\n fields: argsData.fields,\n include: argsData.include,\n },\n })\n\n return data\n }\n\n const handleConversationUpdateOrCreate = async (e: JoltConversationEvent) => {\n const { data } = e.data\n const conversation: ConversationResource = await fetchConversation(data.id).catch(c => c)\n\n queryClient.setQueryData<QueryData>(conversationQueryKey, prev =>\n updateOrCreateRecordInPagesData({\n data: prev,\n record: conversation,\n processRecord: (record, current) => {\n return { ...current, ...record }\n },\n })\n )\n }\n\n const handleConversationDestroy = (e: ConversationDeletedEvent) => {\n queryClient.setQueryData<QueryData>(conversationQueryKey, prev =>\n deleteRecordInPagesData({\n data: prev,\n record: { id: e.data.data.id },\n })\n )\n }\n\n useJoltEvent(joltChannel, 'conversation.updated', handleConversationUpdateOrCreate)\n useJoltEvent(joltChannel, 'conversation.created', handleConversationUpdateOrCreate)\n useJoltEvent(joltChannel, 'conversation.destroyed', handleConversationDestroy)\n}\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StaticScreenProps } from '@react-navigation/native';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
type ConversationCreateScreenProps = StaticScreenProps<{
|
|
4
|
-
group_id?: string;
|
|
5
|
-
team_ids?: string[];
|
|
6
|
-
}>;
|
|
7
|
-
export declare const ConversationCreateScreen: ({ route }: ConversationCreateScreenProps) => React.JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=conversation_create_screen.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_create_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/create/conversation_create_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AACzF,OAAO,KAAgC,MAAM,OAAO,CAAA;AAUpD,KAAK,6BAA6B,GAAG,iBAAiB,CAAC;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB,CAAC,CAAA;AAEF,eAAO,MAAM,wBAAwB,cAAe,6BAA6B,sBAsFhF,CAAA"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { StackActions, useNavigation } from '@react-navigation/native';
|
|
2
|
-
import React, { useCallback, useState } from 'react';
|
|
3
|
-
import { StyleSheet, TextInput, View } from 'react-native';
|
|
4
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
-
import { Text } from '../../components';
|
|
6
|
-
import { ActionButton } from '../../components/display/action_button';
|
|
7
|
-
import { useSuspenseGet, useTheme } from '../../hooks';
|
|
8
|
-
import { useApiClient } from '../../hooks/use_api_client';
|
|
9
|
-
import { useMutation } from '@tanstack/react-query';
|
|
10
|
-
export const ConversationCreateScreen = ({ route }) => {
|
|
11
|
-
const styles = useStyles();
|
|
12
|
-
const navigation = useNavigation();
|
|
13
|
-
const [title, setTitle] = useState();
|
|
14
|
-
const apiClient = useApiClient();
|
|
15
|
-
const { data: group } = useSuspenseGet({
|
|
16
|
-
url: `/me/groups/${route.params.group_id}`,
|
|
17
|
-
data: {
|
|
18
|
-
fields: {
|
|
19
|
-
Group: [],
|
|
20
|
-
},
|
|
21
|
-
include: ['location'],
|
|
22
|
-
},
|
|
23
|
-
app: 'groups',
|
|
24
|
-
});
|
|
25
|
-
const { mutate: handleSave } = useMutation({
|
|
26
|
-
throwOnError: true,
|
|
27
|
-
onSuccess: result => {
|
|
28
|
-
handleRedirectToConversation({ conversation_id: result.data.id });
|
|
29
|
-
},
|
|
30
|
-
mutationFn: () => apiClient.groups
|
|
31
|
-
.post({
|
|
32
|
-
url: `/me/groups/${route.params.group_id}/chat_conversation_payload`,
|
|
33
|
-
data: {
|
|
34
|
-
data: {
|
|
35
|
-
type: '',
|
|
36
|
-
attributes: {
|
|
37
|
-
title,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
.then(res => res.data.value)
|
|
43
|
-
.then(payload => apiClient.chat.post({
|
|
44
|
-
url: '/me/conversations',
|
|
45
|
-
data: {
|
|
46
|
-
data: {
|
|
47
|
-
type: 'Conversation',
|
|
48
|
-
attributes: {
|
|
49
|
-
payload,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
})),
|
|
54
|
-
});
|
|
55
|
-
const handleRedirectToConversation = useCallback(({ conversation_id }) => {
|
|
56
|
-
// exit from the create stack
|
|
57
|
-
navigation.getParent()?.goBack();
|
|
58
|
-
// navigate to the conversation screen
|
|
59
|
-
navigation.dispatch(StackActions.push('Conversation', {
|
|
60
|
-
conversation_id,
|
|
61
|
-
}));
|
|
62
|
-
}, [navigation]);
|
|
63
|
-
return (<View style={styles.container}>
|
|
64
|
-
<View style={styles.section}>
|
|
65
|
-
<View style={styles.to}>
|
|
66
|
-
<Text>To:</Text>
|
|
67
|
-
<View>
|
|
68
|
-
<Text>{group.name}</Text>
|
|
69
|
-
<Text>{group.membershipsCount} members</Text>
|
|
70
|
-
</View>
|
|
71
|
-
</View>
|
|
72
|
-
<View style={styles.titleContainer}>
|
|
73
|
-
<Text style={styles.titleLabel}>Title</Text>
|
|
74
|
-
<TextInput placeholder="Topic of conversation (required)" value={title} onChangeText={setTitle} style={styles.titleInput}/>
|
|
75
|
-
</View>
|
|
76
|
-
</View>
|
|
77
|
-
<ActionButton title="Start Conversation" onPress={() => handleSave()}/>
|
|
78
|
-
</View>);
|
|
79
|
-
};
|
|
80
|
-
const useStyles = () => {
|
|
81
|
-
const { bottom } = useSafeAreaInsets();
|
|
82
|
-
const theme = useTheme();
|
|
83
|
-
return StyleSheet.create({
|
|
84
|
-
container: {
|
|
85
|
-
flex: 1,
|
|
86
|
-
gap: 8,
|
|
87
|
-
},
|
|
88
|
-
section: {
|
|
89
|
-
padding: 16,
|
|
90
|
-
flex: 1,
|
|
91
|
-
},
|
|
92
|
-
sectionHeader: {
|
|
93
|
-
flexDirection: 'row',
|
|
94
|
-
justifyContent: 'space-between',
|
|
95
|
-
},
|
|
96
|
-
selectTeamsButton: {},
|
|
97
|
-
routeDebug: {
|
|
98
|
-
alignContent: 'center',
|
|
99
|
-
padding: 16,
|
|
100
|
-
paddingBottom: bottom,
|
|
101
|
-
borderTopWidth: 1,
|
|
102
|
-
borderTopColor: theme.colors.fillColorNeutral050Base,
|
|
103
|
-
},
|
|
104
|
-
titleContainer: {
|
|
105
|
-
paddingVertical: 12,
|
|
106
|
-
borderBottomWidth: 1,
|
|
107
|
-
borderBottomColor: theme.colors.fillColorNeutral050Base,
|
|
108
|
-
gap: 8,
|
|
109
|
-
},
|
|
110
|
-
titleInput: {
|
|
111
|
-
fontSize: 18,
|
|
112
|
-
},
|
|
113
|
-
titleLabel: {},
|
|
114
|
-
to: {
|
|
115
|
-
flexDirection: 'row',
|
|
116
|
-
gap: 8,
|
|
117
|
-
paddingVertical: 12,
|
|
118
|
-
borderBottomWidth: 1,
|
|
119
|
-
borderBottomColor: theme.colors.fillColorNeutral050Base,
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
//# sourceMappingURL=conversation_create_screen.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file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AE;QACrB,UAAU,EAAE;YACV,YAAY,EAAE,QAAQ;YACtB,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,MAAM;YACrB,cAAc,EAAE,CAAC;YACjB,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;SACrD;QACD,cAAc,EAAE;YACd,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;YACvD,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,QAAQ,EAAE,EAAE;SACb;QACD,UAAU,EAAE,EAAE;QACd,EAAE,EAAE;YACF,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;SACxD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, { useCallback, useState } from 'react'\nimport { StyleSheet, TextInput, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Text } from '../../components'\nimport { ActionButton } from '../../components/display/action_button'\nimport { useSuspenseGet, useTheme } from '../../hooks'\nimport { useApiClient } from '../../hooks/use_api_client'\nimport { useMutation } from '@tanstack/react-query'\nimport { GroupsGroupResource } from '../../types'\n\ntype ConversationCreateScreenProps = StaticScreenProps<{\n group_id?: string\n team_ids?: string[]\n}>\n\nexport const ConversationCreateScreen = ({ route }: ConversationCreateScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation()\n const [title, setTitle] = useState<string>()\n const apiClient = useApiClient()\n const { data: group } = useSuspenseGet<GroupsGroupResource>({\n url: `/me/groups/${route.params.group_id}`,\n data: {\n fields: {\n Group: [],\n },\n include: ['location'],\n },\n app: 'groups',\n })\n const { mutate: handleSave } = useMutation({\n throwOnError: true,\n onSuccess: result => {\n handleRedirectToConversation({ conversation_id: result.data.id })\n },\n mutationFn: () =>\n apiClient.groups\n .post({\n url: `/me/groups/${route.params.group_id}/chat_conversation_payload`,\n data: {\n data: {\n type: '',\n attributes: {\n title,\n },\n },\n },\n })\n .then(res => res.data.value)\n .then(payload =>\n apiClient.chat.post({\n url: '/me/conversations',\n data: {\n data: {\n type: 'Conversation',\n attributes: {\n payload,\n },\n },\n },\n })\n ),\n })\n\n const handleRedirectToConversation = useCallback(\n ({ conversation_id }: { conversation_id: number }) => {\n // exit from the create stack\n navigation.getParent()?.goBack()\n // navigate to the conversation screen\n navigation.dispatch(\n StackActions.push('Conversation', {\n conversation_id,\n })\n )\n },\n [navigation]\n )\n\n return (\n <View style={styles.container}>\n <View style={styles.section}>\n <View style={styles.to}>\n <Text>To:</Text>\n <View>\n <Text>{group.name}</Text>\n <Text>{group.membershipsCount} members</Text>\n </View>\n </View>\n <View style={styles.titleContainer}>\n <Text style={styles.titleLabel}>Title</Text>\n <TextInput\n placeholder=\"Topic of conversation (required)\"\n value={title}\n onChangeText={setTitle}\n style={styles.titleInput}\n />\n </View>\n </View>\n <ActionButton title=\"Start Conversation\" onPress={() => handleSave()} />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n const theme = useTheme()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n gap: 8,\n },\n section: {\n padding: 16,\n flex: 1,\n },\n sectionHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n selectTeamsButton: {},\n routeDebug: {\n alignContent: 'center',\n padding: 16,\n paddingBottom: bottom,\n borderTopWidth: 1,\n borderTopColor: theme.colors.fillColorNeutral050Base,\n },\n titleContainer: {\n paddingVertical: 12,\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.fillColorNeutral050Base,\n gap: 8,\n },\n titleInput: {\n fontSize: 18,\n },\n titleLabel: {},\n to: {\n flexDirection: 'row',\n gap: 8,\n paddingVertical: 12,\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.fillColorNeutral050Base,\n },\n })\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_filter_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/create/conversation_filter_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,eAAO,MAAM,0CAA0C,EAAE,4BAKxD,CAAA;AAED,KAAK,uCAAuC,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAA;AAEpE,eAAO,MAAM,kCAAkC,OAAQ,uCAAuC,sBAmC7F,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_filter_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/create/conversation_filter_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAEzF,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,MAAM,CAAC,MAAM,0CAA0C,GAAiC;IACtF,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,KAAK;IAClB,mBAAmB,EAAE,CAAC,IAAI,CAAC;IAC3B,mBAAmB,EAAE,IAAI;CAC1B,CAAA;AAID,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,EAA2C,EAAE,EAAE;IAChG,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,U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AY,EAAE,QAAQ;YACtB,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,MAAM;YACrB,cAAc,EAAE,CAAC;YACjB,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;SACrD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Button } from '../../components'\nimport { useTheme } from '../../hooks'\n\nexport const ConversationFilterReceipientsScreenOptions: NativeStackNavigationOptions = {\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents: [0.75],\n sheetGrabberVisible: true,\n}\n\ntype ConversationFilterRecipientsScreenProps = StaticScreenProps<{}>\n\nexport const ConversationFilterRecipientsScreen = ({}: ConversationFilterRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation()\n\n return (\n <View style={styles.container}>\n <View style={styles.section}>\n <Button\n style={styles.selectTeamsButton}\n onPress={() =>\n navigation.dispatch(\n StackActions.popTo('ConversationSelectRecipients', {\n chat_group_graph_id: 'TBD',\n })\n )\n }\n title=\"Redirect to select\"\n variant=\"outline\"\n />\n\n <Button\n style={styles.selectTeamsButton}\n onPress={() =>\n navigation.dispatch(\n StackActions.popTo('ConversationCreate', {\n chat_group_graph_id: 'TBD',\n })\n )\n }\n title=\"Redirect to form\"\n variant=\"outline\"\n />\n </View>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n const theme = useTheme()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n gap: 8,\n },\n section: {\n padding: 16,\n flexDirection: 'row',\n justifyContent: 'space-between',\n flex: 1,\n },\n selectTeamsButton: {},\n routeDebug: {\n alignContent: 'center',\n padding: 16,\n paddingBottom: bottom,\n borderTopWidth: 1,\n borderTopColor: theme.colors.fillColorNeutral050Base,\n },\n })\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_select_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/create/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,KAAK,uCAAuC,GAAG,iBAAiB,CAAC;IAC/D,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B,CAAC,CAAA;AAMF,eAAO,MAAM,kCAAkC,OAAQ,uCAAuC,sBAgE7F,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_select_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/create/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAM/D,MAAM,YAAY,GAAG,EAAE,GAAG,CAAC,CAAA;AAC3B,MAAM,eAAe,GAAG,EAAE,CAAA;AAC1B,MAAM,gBAAgB,GAAG,eAAe,GAAG,YAAY,CAAA;AAEvD,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,EAA2C,EAAE,EAAE;IAChG,MAAM,MAAM,GA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MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;SACP;QACD,OAAO,EAAE;YACP,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;SAChC;QACD,iBAAiB,EAAE,EAAE;QACrB,GAAG,EAAE;YACH,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;YACP,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,CAAC;YACpB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;SAClD;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE,gBAAgB;YACxB,YAAY,EAAE,CAAC;SAChB;QACD,YAAY,EAAE;YACZ,UAAU,EAAE,MAAM;YAClB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB;SACxC;QACD,UAAU,EAAE;YACV,YAAY,EAAE,QAAQ;YACtB,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,MAAM;YACrB,cAAc,EAAE,CAAC;YACjB,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;SACrD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { ScrollView, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Button, Heading, Icon, Image, Text } from '../../components'\nimport { useTheme } from '../../hooks'\nimport { GroupsGroupResource } from '../../types'\nimport { useGroupsGroups } from '../../hooks/use_groups_groups'\n\ntype ConversationSelectRecipientsScreenProps = StaticScreenProps<{\n chat_group_graph_id?: string\n}>\n\nconst ASPECT_RATIO = 16 / 9\nconst THUMBNAIL_WIDTH = 80\nconst THUMBNAIL_HEIGHT = THUMBNAIL_WIDTH / ASPECT_RATIO\n\nexport const ConversationSelectRecipientsScreen = ({}: ConversationSelectRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation()\n const { data: groups = [] } = useGroupsGroups()\n const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)\n\n const handleNavigateToCreateConversation = (group: GroupsGroupResource) => {\n navigation.navigate('Create', {\n screen: 'ConversationCreate',\n params: {\n group_id: group.id,\n },\n })\n }\n\n return (\n <ScrollView style={styles.container}>\n <View style={styles.section}>\n <View style={styles.sectionHeader}>\n <Heading>My groups</Heading>\n </View>\n <View>\n {groupsWithCreatePermission.map(group => (\n <PlatformPressable\n key={group.id}\n style={styles.row}\n onPress={() => handleNavigateToCreateConversation(group)}\n >\n <Image\n source={{ uri: group.headerImage?.thumbnail }}\n resizeMode=\"cover\"\n style={styles.rowImage}\n alt={`Image for ${group.name}`}\n />\n <View>\n <Heading variant=\"h3\">{group.name}</Heading>\n <Text>{group.membershipsCount} members</Text>\n </View>\n <Icon name=\"general.rightChevron\" size={16} style={styles.rowIconRight} />\n </PlatformPressable>\n ))}\n </View>\n </View>\n <View style={styles.section}>\n <View style={styles.sectionHeader}>\n <Heading>Teams I lead</Heading>\n <Button\n style={styles.selectTeamsButton}\n onPress={() =>\n navigation.navigate('Create', {\n screen: 'ConversationFilterRecipients',\n params: {\n conversation_id: '2196252',\n },\n })\n }\n title=\"Select teams\"\n variant=\"outline\"\n iconNameLeft=\"general.search\"\n />\n </View>\n </View>\n </ScrollView>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n const theme = useTheme()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n gap: 8,\n },\n section: {\n padding: 16,\n flex: 1,\n },\n sectionHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n selectTeamsButton: {},\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n paddingVertical: 16,\n borderBottomWidth: 1,\n borderColor: theme.colors.fillColorNeutral050Base,\n },\n rowImage: {\n width: THUMBNAIL_WIDTH,\n height: THUMBNAIL_HEIGHT,\n borderRadius: 4,\n },\n rowIconRight: {\n marginLeft: 'auto',\n color: theme.colors.fillColorNeutral030,\n },\n routeDebug: {\n alignContent: 'center',\n padding: 16,\n paddingBottom: bottom,\n borderTopWidth: 1,\n borderTopColor: theme.colors.fillColorNeutral050Base,\n },\n })\n}\n"]}
|