@planningcenter/chat-react-native 3.29.0 → 3.30.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/attachments/attachment_card.js +2 -2
- package/build/components/conversation/attachments/attachment_card.js.map +1 -1
- package/build/components/conversation/attachments/attachment_deleting_overlay.js +1 -1
- package/build/components/conversation/attachments/attachment_deleting_overlay.js.map +1 -1
- package/build/components/conversation/attachments/audio_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/audio_attachment.js +3 -3
- package/build/components/conversation/attachments/audio_attachment.js.map +1 -1
- package/build/components/conversation/attachments/expanded_link.d.ts.map +1 -1
- package/build/components/conversation/attachments/expanded_link.js +2 -2
- package/build/components/conversation/attachments/expanded_link.js.map +1 -1
- package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/generic_file_attachment.js +4 -4
- package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -1
- package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/giphy_attachment.js +3 -3
- package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
- package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/image_attachment.js +6 -6
- package/build/components/conversation/attachments/image_attachment.js.map +1 -1
- package/build/components/conversation/attachments/video_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/video_attachment.js +4 -4
- package/build/components/conversation/attachments/video_attachment.js.map +1 -1
- package/build/components/conversation/jump_to_bottom_button.js +1 -1
- package/build/components/conversation/jump_to_bottom_button.js.map +1 -1
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +11 -11
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/message_attachments.d.ts.map +1 -1
- package/build/components/conversation/message_attachments.js +4 -4
- package/build/components/conversation/message_attachments.js.map +1 -1
- package/build/components/conversation/message_form/message_form_attachment_image.d.ts.map +1 -1
- package/build/components/conversation/message_form/message_form_attachment_image.js.map +1 -1
- package/build/components/conversation/message_form/message_form_attachment_video.d.ts.map +1 -1
- package/build/components/conversation/message_form/message_form_attachment_video.js.map +1 -1
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +9 -9
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversation/message_markdown.js +2 -2
- package/build/components/conversation/message_markdown.js.map +1 -1
- package/build/components/conversation/message_reaction.d.ts +1 -1
- package/build/components/conversation/message_reaction.d.ts.map +1 -1
- package/build/components/conversation/message_reaction.js +2 -2
- package/build/components/conversation/message_reaction.js.map +1 -1
- package/build/components/conversation/message_read_receipts.d.ts.map +1 -1
- package/build/components/conversation/message_read_receipts.js +1 -1
- package/build/components/conversation/message_read_receipts.js.map +1 -1
- package/build/components/conversation/messages_disabled_banners.js +1 -1
- package/build/components/conversation/messages_disabled_banners.js.map +1 -1
- package/build/components/conversation/reply_shadow_message.d.ts.map +1 -1
- package/build/components/conversation/reply_shadow_message.js +7 -7
- package/build/components/conversation/reply_shadow_message.js.map +1 -1
- package/build/components/conversation/typing_indicator.js +1 -1
- package/build/components/conversation/typing_indicator.js.map +1 -1
- package/build/components/conversations/conversation_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +3 -3
- package/build/components/conversations/conversation_preview.js.map +1 -1
- package/build/components/conversations/conversations.js +1 -1
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/components/conversations/mute_indicator.js +1 -1
- package/build/components/conversations/mute_indicator.js.map +1 -1
- package/build/components/conversations/swipeable_toggle_button.d.ts.map +1 -1
- package/build/components/conversations/swipeable_toggle_button.js +2 -2
- package/build/components/conversations/swipeable_toggle_button.js.map +1 -1
- package/build/components/conversations/unread_count_badge.js +1 -1
- package/build/components/conversations/unread_count_badge.js.map +1 -1
- package/build/components/display/action_button.js +3 -3
- package/build/components/display/action_button.js.map +1 -1
- package/build/components/display/banner.d.ts +1 -1
- package/build/components/display/banner.d.ts.map +1 -1
- package/build/components/display/banner.js.map +1 -1
- package/build/components/display/banner_collapsible.d.ts.map +1 -1
- package/build/components/display/banner_collapsible.js +1 -1
- package/build/components/display/banner_collapsible.js.map +1 -1
- package/build/components/display/button.d.ts.map +1 -1
- package/build/components/display/button.js +2 -2
- package/build/components/display/button.js.map +1 -1
- package/build/components/display/child_notice.d.ts +1 -1
- package/build/components/display/child_notice.d.ts.map +1 -1
- package/build/components/display/child_notice.js +3 -3
- package/build/components/display/child_notice.js.map +1 -1
- package/build/components/display/heading.d.ts.map +1 -1
- package/build/components/display/heading.js +2 -2
- package/build/components/display/heading.js.map +1 -1
- package/build/components/display/icon.d.ts +4 -4
- package/build/components/display/icon.d.ts.map +1 -1
- package/build/components/display/icon.js +5 -5
- package/build/components/display/icon.js.map +1 -1
- package/build/components/display/icon_button.d.ts.map +1 -1
- package/build/components/display/icon_button.js +1 -1
- package/build/components/display/icon_button.js.map +1 -1
- package/build/components/display/image_attachment_preview.js +3 -3
- package/build/components/display/image_attachment_preview.js.map +1 -1
- package/build/components/display/person.d.ts.map +1 -1
- package/build/components/display/person.js +1 -1
- package/build/components/display/person.js.map +1 -1
- package/build/components/display/platform_modal_header_buttons.d.ts +1 -1
- package/build/components/display/platform_modal_header_buttons.d.ts.map +1 -1
- package/build/components/display/platform_modal_header_buttons.js +3 -3
- package/build/components/display/platform_modal_header_buttons.js.map +1 -1
- package/build/components/display/text.d.ts.map +1 -1
- package/build/components/display/text.js +1 -1
- package/build/components/display/text.js.map +1 -1
- package/build/components/display/text_inline_button.d.ts.map +1 -1
- package/build/components/display/text_inline_button.js +2 -2
- package/build/components/display/text_inline_button.js.map +1 -1
- package/build/components/display/toggle_button.d.ts.map +1 -1
- package/build/components/display/toggle_button.js +3 -3
- package/build/components/display/toggle_button.js.map +1 -1
- package/build/components/display/video_attachment_preview.js +4 -4
- package/build/components/display/video_attachment_preview.js.map +1 -1
- package/build/components/group_conversation_list.d.ts.map +1 -1
- package/build/components/group_conversation_list.js +2 -2
- package/build/components/group_conversation_list.js.map +1 -1
- package/build/components/primitive/avatar_primitive.d.ts.map +1 -1
- package/build/components/primitive/avatar_primitive.js +1 -1
- package/build/components/primitive/avatar_primitive.js.map +1 -1
- package/build/components/primitive/banner_primitive.d.ts +1 -1
- package/build/components/primitive/banner_primitive.d.ts.map +1 -1
- package/build/components/primitive/banner_primitive.js +3 -3
- package/build/components/primitive/banner_primitive.js.map +1 -1
- package/build/components/primitive/form_sheet.d.ts.map +1 -1
- package/build/components/primitive/form_sheet.js +1 -1
- package/build/components/primitive/form_sheet.js.map +1 -1
- package/build/components/safe_area_modal.js +1 -1
- package/build/components/safe_area_modal.js.map +1 -1
- package/build/contexts/api_provider.js +3 -3
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/chat_context.d.ts +3 -3
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +1 -1
- package/build/contexts/chat_context.js.map +1 -1
- package/build/contexts/conversations_context.d.ts +1 -1
- package/build/contexts/conversations_context.d.ts.map +1 -1
- package/build/contexts/conversations_context.js.map +1 -1
- package/build/contexts/session_context.d.ts.map +1 -1
- package/build/contexts/session_context.js +1 -1
- package/build/contexts/session_context.js.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.d.ts +2 -1
- package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.js +3 -2
- package/build/hooks/groups/use_groups_conversation_create.js.map +1 -1
- package/build/hooks/services/use_find_or_create_services_conversation.d.ts.map +1 -1
- package/build/hooks/services/use_find_or_create_services_conversation.js +2 -2
- package/build/hooks/services/use_find_or_create_services_conversation.js.map +1 -1
- package/build/hooks/services/use_team_members_for_new_conversation.js +1 -1
- package/build/hooks/services/use_team_members_for_new_conversation.js.map +1 -1
- package/build/hooks/services/use_team_plans.js +2 -2
- package/build/hooks/services/use_team_plans.js.map +1 -1
- package/build/hooks/use_api_client.d.ts.map +1 -1
- package/build/hooks/use_api_client.js +1 -1
- package/build/hooks/use_api_client.js.map +1 -1
- package/build/hooks/use_attachment_uploader.d.ts.map +1 -1
- package/build/hooks/use_attachment_uploader.js +1 -1
- package/build/hooks/use_attachment_uploader.js.map +1 -1
- package/build/hooks/use_broadcast_typing_status.js +1 -1
- package/build/hooks/use_broadcast_typing_status.js.map +1 -1
- package/build/hooks/use_conversation.js +2 -2
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_conversation_membership.js +2 -2
- package/build/hooks/use_conversation_membership.js.map +1 -1
- package/build/hooks/use_conversation_message.js +1 -1
- package/build/hooks/use_conversation_message.js.map +1 -1
- package/build/hooks/use_conversation_messages.d.ts.map +1 -1
- package/build/hooks/use_conversation_messages.js +1 -1
- package/build/hooks/use_conversation_messages.js.map +1 -1
- package/build/hooks/use_conversation_messages_jolt_events.js +8 -8
- package/build/hooks/use_conversation_messages_jolt_events.js.map +1 -1
- package/build/hooks/use_create_android_ripple_color.js +1 -1
- package/build/hooks/use_create_android_ripple_color.js.map +1 -1
- package/build/hooks/use_current_person.js.map +1 -1
- package/build/hooks/use_features.d.ts +1 -0
- package/build/hooks/use_features.d.ts.map +1 -1
- package/build/hooks/use_features.js +1 -0
- package/build/hooks/use_features.js.map +1 -1
- package/build/hooks/use_font_scale.js +1 -1
- package/build/hooks/use_font_scale.js.map +1 -1
- package/build/hooks/use_giphy.d.ts.map +1 -1
- package/build/hooks/use_giphy.js.map +1 -1
- package/build/hooks/use_interaction_ghost_color.js +1 -1
- package/build/hooks/use_interaction_ghost_color.js.map +1 -1
- package/build/hooks/use_live_relative_time.d.ts.map +1 -1
- package/build/hooks/use_live_relative_time.js +1 -1
- package/build/hooks/use_live_relative_time.js.map +1 -1
- package/build/hooks/use_message_create_or_update.d.ts.map +1 -1
- package/build/hooks/use_message_create_or_update.js +5 -5
- package/build/hooks/use_message_create_or_update.js.map +1 -1
- package/build/hooks/use_message_draft.js +1 -1
- package/build/hooks/use_message_draft.js.map +1 -1
- package/build/hooks/use_message_reaction_toggle.d.ts.map +1 -1
- package/build/hooks/use_message_reaction_toggle.js +2 -2
- package/build/hooks/use_message_reaction_toggle.js.map +1 -1
- package/build/hooks/use_my_gender.d.ts +7 -0
- package/build/hooks/use_my_gender.d.ts.map +1 -0
- package/build/hooks/use_my_gender.js +28 -0
- package/build/hooks/use_my_gender.js.map +1 -0
- package/build/hooks/use_organization.d.ts.map +1 -1
- package/build/hooks/use_organization.js.map +1 -1
- package/build/hooks/use_product_analytics.d.ts.map +1 -1
- package/build/hooks/use_product_analytics.js +1 -1
- package/build/hooks/use_product_analytics.js.map +1 -1
- package/build/hooks/use_report_message.d.ts.map +1 -1
- package/build/hooks/use_report_message.js +1 -1
- package/build/hooks/use_report_message.js.map +1 -1
- package/build/hooks/use_submit_age_check.d.ts.map +1 -1
- package/build/hooks/use_submit_age_check.js +2 -2
- package/build/hooks/use_submit_age_check.js.map +1 -1
- package/build/hooks/use_suspense_api.d.ts +1 -1
- package/build/hooks/use_suspense_api.d.ts.map +1 -1
- package/build/hooks/use_suspense_api.js +1 -1
- package/build/hooks/use_suspense_api.js.map +1 -1
- package/build/hooks/use_typing_indicators.d.ts.map +1 -1
- package/build/hooks/use_typing_indicators.js +1 -1
- package/build/hooks/use_typing_indicators.js.map +1 -1
- package/build/navigation/chat_access_gate.js +4 -4
- package/build/navigation/chat_access_gate.js.map +1 -1
- package/build/navigation/index.d.ts +4 -4
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +6 -6
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/screenLayout.js +1 -1
- package/build/navigation/screenLayout.js.map +1 -1
- package/build/polyfills/events/Event.d.ts +0 -4
- package/build/polyfills/events/Event.d.ts.map +1 -1
- package/build/polyfills/events/Event.js +5 -1
- package/build/polyfills/events/Event.js.map +1 -1
- package/build/polyfills/events/EventTarget.d.ts +0 -3
- package/build/polyfills/events/EventTarget.d.ts.map +1 -1
- package/build/polyfills/events/EventTarget.js +1 -1
- package/build/polyfills/events/EventTarget.js.map +1 -1
- package/build/screens/age_check/age_check_required_screen.d.ts.map +1 -1
- package/build/screens/age_check/age_check_required_screen.js +5 -5
- package/build/screens/age_check/age_check_required_screen.js.map +1 -1
- package/build/screens/age_check/age_check_underage_screen.d.ts.map +1 -1
- package/build/screens/age_check/age_check_underage_screen.js +1 -1
- package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
- package/build/screens/age_check/components/age_check_select_birthdate_modal.d.ts.map +1 -1
- package/build/screens/age_check/components/age_check_select_birthdate_modal.js +2 -2
- package/build/screens/age_check/components/age_check_select_birthdate_modal.js.map +1 -1
- package/build/screens/attachment_actions/hooks/useDeleteAttachment.js +2 -2
- package/build/screens/attachment_actions/hooks/useDeleteAttachment.js.map +1 -1
- package/build/screens/bug_report_screen.d.ts +1 -1
- package/build/screens/bug_report_screen.d.ts.map +1 -1
- package/build/screens/bug_report_screen.js +9 -9
- package/build/screens/bug_report_screen.js.map +1 -1
- package/build/screens/conversation/message_read_receipts_screen.js +2 -2
- package/build/screens/conversation/message_read_receipts_screen.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts.map +1 -1
- package/build/screens/conversation_filter_recipients/components/checkbox_row.js +2 -2
- package/build/screens/conversation_filter_recipients/components/checkbox_row.js.map +1 -1
- package/build/screens/conversation_filter_recipients/components/header_row.d.ts.map +1 -1
- package/build/screens/conversation_filter_recipients/components/header_row.js +3 -3
- package/build/screens/conversation_filter_recipients/components/header_row.js.map +1 -1
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +1 -1
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
- package/build/screens/conversation_filter_recipients/types.d.ts +1 -1
- package/build/screens/conversation_filter_recipients/types.d.ts.map +1 -1
- package/build/screens/conversation_filter_recipients/types.js.map +1 -1
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/rows.js +1 -1
- package/build/screens/conversation_filters/components/rows.js.map +1 -1
- package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -1
- package/build/screens/conversation_filters/context/conversation_filter_context.js +2 -2
- package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -1
- package/build/screens/conversation_filters/group_filters.d.ts +1 -1
- package/build/screens/conversation_filters/group_filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/group_filters.js +1 -1
- package/build/screens/conversation_filters/group_filters.js.map +1 -1
- package/build/screens/conversation_filters/hooks/filters.d.ts +1 -1
- package/build/screens/conversation_filters/hooks/filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/hooks/filters.js.map +1 -1
- package/build/screens/conversation_filters_screen.d.ts.map +1 -1
- package/build/screens/conversation_filters_screen.js +2 -2
- package/build/screens/conversation_filters_screen.js.map +1 -1
- package/build/screens/conversation_new/components/filter_by_plan.d.ts.map +1 -1
- package/build/screens/conversation_new/components/filter_by_plan.js +4 -4
- package/build/screens/conversation_new/components/filter_by_plan.js.map +1 -1
- package/build/screens/conversation_new/components/form_list.d.ts.map +1 -1
- package/build/screens/conversation_new/components/form_list.js.map +1 -1
- package/build/screens/conversation_new/components/gender_filter_toggle.d.ts +10 -0
- package/build/screens/conversation_new/components/gender_filter_toggle.d.ts.map +1 -0
- package/build/screens/conversation_new/components/gender_filter_toggle.js +50 -0
- package/build/screens/conversation_new/components/gender_filter_toggle.js.map +1 -0
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/groups_form.js +28 -4
- package/build/screens/conversation_new/components/groups_form.js.map +1 -1
- package/build/screens/conversation_new/components/services_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/services_form.js +6 -6
- package/build/screens/conversation_new/components/services_form.js.map +1 -1
- package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -1
- package/build/screens/conversation_new/conversation_new_screen.js.map +1 -1
- package/build/screens/conversation_notification_level_select_screen.js +1 -1
- package/build/screens/conversation_notification_level_select_screen.js.map +1 -1
- package/build/screens/conversation_screen.d.ts +1 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +9 -9
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js +1 -1
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +2 -2
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
- package/build/screens/conversation_select_type_screen.d.ts +1 -1
- package/build/screens/conversation_select_type_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_type_screen.js +1 -1
- package/build/screens/conversation_select_type_screen.js.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +4 -4
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/design_system_screen.js +3 -3
- package/build/screens/design_system_screen.js.map +1 -1
- package/build/screens/group_notification_settings_screen.js.map +1 -1
- package/build/screens/message_actions_screen.js +2 -2
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/screens/message_report/components/report_reason_list.d.ts.map +1 -1
- package/build/screens/message_report/components/report_reason_list.js +2 -2
- package/build/screens/message_report/components/report_reason_list.js.map +1 -1
- package/build/screens/message_report_screen.d.ts +2 -2
- package/build/screens/message_report_screen.d.ts.map +1 -1
- package/build/screens/message_report_screen.js +5 -5
- package/build/screens/message_report_screen.js.map +1 -1
- package/build/screens/not_found.d.ts.map +1 -1
- package/build/screens/not_found.js +1 -1
- package/build/screens/not_found.js.map +1 -1
- package/build/screens/notification_settings/hooks/groups.js +1 -1
- package/build/screens/notification_settings/hooks/groups.js.map +1 -1
- package/build/screens/notification_settings_screen.js +1 -1
- package/build/screens/notification_settings_screen.js.map +1 -1
- package/build/screens/preferred_app_selection_screen.d.ts.map +1 -1
- package/build/screens/preferred_app_selection_screen.js +1 -1
- package/build/screens/preferred_app_selection_screen.js.map +1 -1
- package/build/screens/send_giphy_screen.js +1 -1
- package/build/screens/send_giphy_screen.js.map +1 -1
- package/build/screens/team_conversation_screen.js +1 -1
- package/build/screens/team_conversation_screen.js.map +1 -1
- package/build/utils/cache/messages_cache.d.ts.map +1 -1
- package/build/utils/cache/messages_cache.js +3 -3
- package/build/utils/cache/messages_cache.js.map +1 -1
- package/build/utils/cache/optimistically_create_message.d.ts.map +1 -1
- package/build/utils/cache/optimistically_create_message.js +2 -2
- package/build/utils/cache/optimistically_create_message.js.map +1 -1
- package/build/utils/cache/optimistically_update_message.d.ts.map +1 -1
- package/build/utils/cache/optimistically_update_message.js +1 -1
- package/build/utils/cache/optimistically_update_message.js.map +1 -1
- package/build/utils/client/client.d.ts.map +1 -1
- package/build/utils/client/client.js.map +1 -1
- package/build/utils/client/transform_request_data.d.ts.map +1 -1
- package/build/utils/client/transform_request_data.js.map +1 -1
- package/build/utils/gender_display_label.d.ts +2 -0
- package/build/utils/gender_display_label.d.ts.map +1 -0
- package/build/utils/gender_display_label.js +11 -0
- package/build/utils/gender_display_label.js.map +1 -0
- package/build/utils/native_adapters/configuration.d.ts +3 -3
- package/build/utils/native_adapters/configuration.d.ts.map +1 -1
- package/build/utils/native_adapters/configuration.js +5 -5
- package/build/utils/native_adapters/configuration.js.map +1 -1
- package/build/utils/performance_tracking.js +1 -1
- package/build/utils/performance_tracking.js.map +1 -1
- package/build/utils/theme.d.ts.map +1 -1
- package/build/utils/theme.js +1 -1
- package/build/utils/theme.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/contexts/session_context.tsx +4 -4
- package/src/__tests__/event-polyfill.test.ts +2 -3
- package/src/__tests__/hooks/useTheme.tsx +3 -3
- package/src/__tests__/hooks/use_async_storage.test.tsx +2 -2
- package/src/__tests__/hooks/use_conversation_messages.ts +1 -1
- package/src/__tests__/utils/client.ts +2 -2
- package/src/__tests__/utils/native_adapters/configuration.ts +2 -2
- package/src/__utils__/handlers.ts +1 -1
- package/src/components/conversation/attachments/attachment_card.tsx +2 -2
- package/src/components/conversation/attachments/attachment_deleting_overlay.tsx +1 -1
- package/src/components/conversation/attachments/audio_attachment.tsx +3 -3
- package/src/components/conversation/attachments/expanded_link.tsx +2 -2
- package/src/components/conversation/attachments/generic_file_attachment.tsx +5 -5
- package/src/components/conversation/attachments/giphy_attachment.tsx +3 -3
- package/src/components/conversation/attachments/image_attachment.tsx +7 -7
- package/src/components/conversation/attachments/video_attachment.tsx +4 -4
- package/src/components/conversation/jump_to_bottom_button.tsx +1 -1
- package/src/components/conversation/message.tsx +13 -13
- package/src/components/conversation/message_attachments.tsx +4 -4
- package/src/components/conversation/message_form/message_form_attachment_image.tsx +1 -1
- package/src/components/conversation/message_form/message_form_attachment_video.tsx +1 -1
- package/src/components/conversation/message_form.tsx +15 -17
- package/src/components/conversation/message_markdown.tsx +2 -2
- package/src/components/conversation/message_reaction.tsx +3 -3
- package/src/components/conversation/message_read_receipts.tsx +2 -2
- package/src/components/conversation/messages_disabled_banners.tsx +1 -1
- package/src/components/conversation/reply_shadow_message.tsx +7 -7
- package/src/components/conversation/typing_indicator.tsx +1 -1
- package/src/components/conversations/conversation_preview.tsx +4 -4
- package/src/components/conversations/conversations.tsx +1 -1
- package/src/components/conversations/mute_indicator.tsx +1 -1
- package/src/components/conversations/swipeable_toggle_button.tsx +2 -2
- package/src/components/conversations/unread_count_badge.tsx +1 -1
- package/src/components/display/action_button.tsx +4 -4
- package/src/components/display/banner.tsx +1 -1
- package/src/components/display/banner_collapsible.tsx +1 -1
- package/src/components/display/button.tsx +2 -2
- package/src/components/display/child_notice.tsx +3 -3
- package/src/components/display/heading.tsx +2 -2
- package/src/components/display/icon.tsx +7 -8
- package/src/components/display/icon_button.tsx +2 -2
- package/src/components/display/image_attachment_preview.tsx +3 -3
- package/src/components/display/person.tsx +2 -2
- package/src/components/display/platform_modal_header_buttons.tsx +4 -4
- package/src/components/display/text.tsx +1 -1
- package/src/components/display/text_inline_button.tsx +2 -2
- package/src/components/display/toggle_button.tsx +3 -3
- package/src/components/display/video_attachment_preview.tsx +4 -4
- package/src/components/group_conversation_list.tsx +4 -4
- package/src/components/primitive/avatar_primitive.tsx +1 -1
- package/src/components/primitive/banner_primitive.tsx +6 -6
- package/src/components/primitive/form_sheet.tsx +1 -1
- package/src/components/safe_area_modal.tsx +1 -1
- package/src/contexts/api_provider.tsx +3 -3
- package/src/contexts/chat_context.tsx +4 -4
- package/src/contexts/conversations_context.tsx +3 -3
- package/src/contexts/session_context.tsx +2 -2
- package/src/hooks/groups/use_groups_conversation_create.ts +4 -2
- package/src/hooks/services/use_find_or_create_services_conversation.ts +2 -2
- package/src/hooks/services/use_team_members_for_new_conversation.ts +2 -2
- package/src/hooks/services/use_team_plans.ts +3 -3
- package/src/hooks/use_api_client.ts +1 -1
- package/src/hooks/use_attachment_uploader.ts +3 -3
- package/src/hooks/use_broadcast_typing_status.ts +1 -1
- package/src/hooks/use_conversation.ts +2 -2
- package/src/hooks/use_conversation_membership.ts +2 -2
- package/src/hooks/use_conversation_message.ts +1 -1
- package/src/hooks/use_conversation_messages.ts +1 -1
- package/src/hooks/use_conversation_messages_jolt_events.ts +12 -12
- package/src/hooks/use_create_android_ripple_color.ts +1 -1
- package/src/hooks/use_current_person.ts +1 -1
- package/src/hooks/use_features.ts +3 -2
- package/src/hooks/use_font_scale.ts +1 -1
- package/src/hooks/use_giphy.ts +1 -1
- package/src/hooks/use_interaction_ghost_color.ts +1 -1
- package/src/hooks/use_live_relative_time.ts +1 -1
- package/src/hooks/use_message_create_or_update.ts +7 -7
- package/src/hooks/use_message_draft.ts +2 -2
- package/src/hooks/use_message_reaction_toggle.ts +2 -2
- package/src/hooks/use_my_gender.ts +42 -0
- package/src/hooks/use_organization.ts +1 -1
- package/src/hooks/use_product_analytics.ts +2 -2
- package/src/hooks/use_report_message.ts +2 -2
- package/src/hooks/use_submit_age_check.ts +3 -3
- package/src/hooks/use_suspense_api.ts +3 -3
- package/src/hooks/use_typing_indicators.ts +2 -2
- package/src/navigation/chat_access_gate.tsx +4 -4
- package/src/navigation/index.tsx +12 -12
- package/src/navigation/screenLayout.tsx +1 -1
- package/src/polyfills/events/Event.ts +1 -1
- package/src/polyfills/events/EventTarget.ts +1 -1
- package/src/screens/age_check/age_check_required_screen.tsx +5 -5
- package/src/screens/age_check/age_check_underage_screen.tsx +1 -1
- package/src/screens/age_check/components/age_check_select_birthdate_modal.tsx +2 -2
- package/src/screens/attachment_actions/hooks/useDeleteAttachment.tsx +2 -2
- package/src/screens/bug_report_screen.tsx +13 -13
- package/src/screens/conversation/message_read_receipts_screen.tsx +3 -3
- package/src/screens/conversation_details_screen.tsx +0 -1
- package/src/screens/conversation_filter_recipients/components/checkbox_row.tsx +2 -2
- package/src/screens/conversation_filter_recipients/components/header_row.tsx +4 -4
- package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx +1 -1
- package/src/screens/conversation_filter_recipients/types.tsx +1 -1
- package/src/screens/conversation_filters/components/rows.tsx +1 -1
- package/src/screens/conversation_filters/context/conversation_filter_context.tsx +3 -3
- package/src/screens/conversation_filters/group_filters.tsx +3 -3
- package/src/screens/conversation_filters/hooks/filters.ts +1 -1
- package/src/screens/conversation_filters_screen.tsx +2 -2
- package/src/screens/conversation_new/components/filter_by_plan.tsx +4 -4
- package/src/screens/conversation_new/components/form_list.tsx +1 -1
- package/src/screens/conversation_new/components/gender_filter_toggle.tsx +92 -0
- package/src/screens/conversation_new/components/groups_form.tsx +63 -4
- package/src/screens/conversation_new/components/services_form.tsx +7 -7
- package/src/screens/conversation_new/conversation_new_screen.tsx +3 -3
- package/src/screens/conversation_notification_level_select_screen.tsx +1 -1
- package/src/screens/conversation_screen.tsx +13 -13
- package/src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx +3 -3
- package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +3 -3
- package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +3 -3
- package/src/screens/conversation_select_type_screen.tsx +2 -2
- package/src/screens/conversations/components/list_header_component.tsx +4 -4
- package/src/screens/design_system_screen.tsx +3 -3
- package/src/screens/group_notification_settings_screen.tsx +1 -1
- package/src/screens/message_actions_screen.tsx +3 -3
- package/src/screens/message_report/components/report_reason_list.tsx +2 -2
- package/src/screens/message_report_screen.tsx +8 -8
- package/src/screens/not_found.tsx +1 -1
- package/src/screens/notification_settings/hooks/groups.ts +1 -1
- package/src/screens/notification_settings_screen.tsx +1 -1
- package/src/screens/preferred_app_selection_screen.tsx +1 -1
- package/src/screens/send_giphy_screen.tsx +1 -1
- package/src/screens/team_conversation_screen.tsx +1 -1
- package/src/utils/__tests__/convert_attachments_for_create.test.ts +2 -2
- package/src/utils/cache/messages_cache.ts +3 -3
- package/src/utils/cache/optimistically_create_message.ts +4 -4
- package/src/utils/cache/optimistically_update_message.ts +1 -1
- package/src/utils/client/client.ts +0 -1
- package/src/utils/client/transform_request_data.ts +1 -1
- package/src/utils/gender_display_label.ts +10 -0
- package/src/utils/native_adapters/configuration.ts +5 -5
- package/src/utils/performance_tracking.ts +1 -1
- package/src/utils/theme.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { useSuspensePaginator } from './use_suspense_api';
|
|
3
2
|
import { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages';
|
|
3
|
+
import { useSuspensePaginator } from './use_suspense_api';
|
|
4
4
|
export const useConversationMessages = ({ conversation_id, reply_root_id }, opts) => {
|
|
5
5
|
const { data, refetch, isRefetching, fetchNextPage } = useSuspensePaginator(getMessagesRequestArgs({ conversation_id, reply_root_id }), opts);
|
|
6
6
|
const queryKey = getMessagesQueryKey({ conversation_id, reply_root_id });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_conversation_messages.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,
|
|
1
|
+
{"version":3,"file":"use_conversation_messages.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAA4B,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAEnF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,EAAE,eAAe,EAAE,aAAa,EAA8D,EAC9F,IAA+B,EAC/B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,oBAAoB,CACzE,sBAAsB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,EAC1D,IAAI,CACL,CAAA;IACD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,CAAA;IACxE,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CACH,IAAI;SACD,MAAM,CACL,OAAO,CAAC,EAAE,CACR,CAAC,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC;QAC3C,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CACxD;SACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC9C,CAAC,IAAI,CAAC,CACP,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AACrE,CAAC,CAAA","sourcesContent":["import { useMemo } from 'react'\nimport { MessageResource } from '../types'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\nimport { SuspensePaginatorOptions, useSuspensePaginator } from './use_suspense_api'\n\nexport const useConversationMessages = (\n { conversation_id, reply_root_id }: { conversation_id: number; reply_root_id?: string | null },\n opts?: SuspensePaginatorOptions\n) => {\n const { data, refetch, isRefetching, fetchNextPage } = useSuspensePaginator<MessageResource>(\n getMessagesRequestArgs({ conversation_id, reply_root_id }),\n opts\n )\n const queryKey = getMessagesQueryKey({ conversation_id, reply_root_id })\n const messages = useMemo(\n () =>\n data\n .filter(\n message =>\n (!message.deletedAt || message.replyRootId) &&\n (message.attachments?.length || message.text?.length)\n )\n .sort((a, b) => -a.id.localeCompare(b.id)),\n [data]\n )\n\n return { messages, refetch, isRefetching, fetchNextPage, queryKey }\n}\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useJoltChannel, useJoltEvent } from './use_jolt';
|
|
2
|
-
import { deleteRecordInPagesData } from '../utils';
|
|
3
1
|
import { useQueryClient } from '@tanstack/react-query';
|
|
4
|
-
import {
|
|
2
|
+
import { deleteRecordInPagesData } from '../utils';
|
|
3
|
+
import { updateCacheWithMessage, updateCacheWithIndividualMessage, updateCacheWithReaction, getThreadedMessagesQueryKey, } from '../utils/cache/messages_cache';
|
|
5
4
|
import { transformMessageEventDataToMessageResource } from '../utils/jolt/transform_message_event_data_to_message_resource';
|
|
6
|
-
import { getRequestQueryKey } from './use_suspense_api';
|
|
7
|
-
import { getMessagesRequestArgs } from '../utils/request/get_messages';
|
|
8
|
-
import { getMessageQueryKey } from '../utils/request/get_message';
|
|
9
|
-
import { TYPING_TIMEOUT_INTERVAL, useTypingStatusCache } from './use_typing_status_cache';
|
|
10
5
|
import { completeMessageCreationTracking } from '../utils/performance_tracking';
|
|
6
|
+
import { getMessageQueryKey } from '../utils/request/get_message';
|
|
7
|
+
import { getMessagesRequestArgs } from '../utils/request/get_messages';
|
|
11
8
|
import { useApiClient } from './use_api_client';
|
|
12
|
-
import {
|
|
9
|
+
import { useCurrentPerson } from './use_current_person';
|
|
10
|
+
import { useJoltChannel, useJoltEvent } from './use_jolt';
|
|
11
|
+
import { getRequestQueryKey } from './use_suspense_api';
|
|
12
|
+
import { TYPING_TIMEOUT_INTERVAL, useTypingStatusCache } from './use_typing_status_cache';
|
|
13
13
|
export function useConversationMessagesJoltEvents({ conversationId }) {
|
|
14
14
|
const queryClient = useQueryClient();
|
|
15
15
|
const currentPerson = useCurrentPerson();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_conversation_messages_jolt_events.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages_jolt_events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use_conversation_messages_jolt_events.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages_jolt_events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAQpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EACL,sBAAsB,EACtB,gCAAgC,EAChC,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,0CAA0C,EAAE,MAAM,gEAAgE,CAAA;AAC3H,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAA;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,sB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AuB,CAAC,CAAA;IAChE,YAAY,CAAC,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,CAAA;AAClE,CAAC","sourcesContent":["import { InfiniteData, useQueryClient } from '@tanstack/react-query'\nimport { ApiCollection, MessageResource } from '../types'\nimport { JoltReactionEvent, JoltTypingEvent } from '../types/jolt_events'\nimport {\n MessageCreatedEvent,\n MessageUpdatedEvent,\n MessageDeletedEvent,\n} from '../types/jolt_events/message_events'\nimport { deleteRecordInPagesData } from '../utils'\nimport {\n updateCacheWithMessage,\n updateCacheWithIndividualMessage,\n updateCacheWithReaction,\n getThreadedMessagesQueryKey,\n} from '../utils/cache/messages_cache'\nimport { transformMessageEventDataToMessageResource } from '../utils/jolt/transform_message_event_data_to_message_resource'\nimport { completeMessageCreationTracking } from '../utils/performance_tracking'\nimport { getMessageQueryKey } from '../utils/request/get_message'\nimport { getMessagesRequestArgs } from '../utils/request/get_messages'\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 { TYPING_TIMEOUT_INTERVAL, useTypingStatusCache } from './use_typing_status_cache'\n\ninterface Props {\n conversationId: number\n}\n\nexport function useConversationMessagesJoltEvents({ conversationId }: Props) {\n const queryClient = useQueryClient()\n const currentPerson = useCurrentPerson()\n const joltChannel = useJoltChannel(`chat.conversations.${conversationId}`)\n const messagesRequestArgs = getMessagesRequestArgs({ conversation_id: conversationId })\n const messagesQueryKey = getRequestQueryKey(messagesRequestArgs)\n const apiClient = useApiClient()\n\n const { addTypingEvent, removeTypingEventById, removeAllTypingEventsByAuthorId } =\n useTypingStatusCache(conversationId)\n\n const handleMessageUpdateOrCreate = async (e: MessageCreatedEvent | MessageUpdatedEvent) => {\n const { data } = e.data\n const message = transformMessageEventDataToMessageResource({\n data,\n currentPersonId: currentPerson.id,\n })\n\n if (e.event === 'message.created' && data.author_id) {\n removeAllTypingEventsByAuthorId(data.author_id)\n if (data.idempotent_key && data.author_id === currentPerson.id) {\n completeMessageCreationTracking({ apiClient, idempotentKey: data.idempotent_key })\n }\n }\n\n // Update the main conversation cache\n updateCacheWithMessage(queryClient, messagesQueryKey, message, e.event)\n\n // If message has a reply_root_id, also update the threaded cache\n if (data.reply_root_id) {\n const threadedMessagesQueryKey = getThreadedMessagesQueryKey(\n conversationId,\n data.reply_root_id\n )\n updateCacheWithMessage(queryClient, threadedMessagesQueryKey, message, e.event)\n }\n\n // Update individual message query cache so reply shadow messages update immediately\n if (e.event === 'message.updated') {\n const individualMessageQueryKey = getMessageQueryKey({\n conversation_id: conversationId,\n messageId: data.sort_key,\n })\n updateCacheWithIndividualMessage(queryClient, individualMessageQueryKey, message)\n }\n }\n\n const handleMessageDeleted = async (e: MessageDeletedEvent) => {\n const { data } = e.data\n const message = transformMessageEventDataToMessageResource({\n data,\n currentPersonId: currentPerson.id,\n })\n\n // Update the main conversation cache\n queryClient.setQueryData<QueryData>(messagesQueryKey, prev =>\n deleteRecordInPagesData({ data: prev, record: message })\n )\n\n // If message has a reply_root_id, also update the threaded cache\n if (data.reply_root_id) {\n const threadedMessagesQueryKey = getThreadedMessagesQueryKey(\n conversationId,\n data.reply_root_id\n )\n queryClient.setQueryData<QueryData>(threadedMessagesQueryKey, prev =>\n deleteRecordInPagesData({ data: prev, record: message })\n )\n }\n }\n\n const handleReactionJoltEvent = async (e: JoltReactionEvent) => {\n // Update the main conversation cache and capture the reply_root_id if present\n updateCacheWithReaction(queryClient, messagesQueryKey, e, currentPerson.id)\n\n const replyRootId = e.data.data.reply_root_id\n\n // If the message has a reply_root_id, also update the threaded cache\n if (replyRootId) {\n const threadedMessagesQueryKey = getThreadedMessagesQueryKey(conversationId, replyRootId)\n updateCacheWithReaction(queryClient, threadedMessagesQueryKey, e, currentPerson.id)\n }\n }\n\n const handleTypingEvent = async (e: JoltTypingEvent) => {\n const { data } = e.data\n addTypingEvent(data)\n setTimeout(() => removeTypingEventById(data.id), TYPING_TIMEOUT_INTERVAL)\n }\n\n useJoltEvent(joltChannel, 'message.created', handleMessageUpdateOrCreate)\n useJoltEvent(joltChannel, 'message.updated', handleMessageUpdateOrCreate)\n useJoltEvent(joltChannel, 'message.destroyed', handleMessageDeleted)\n useJoltEvent(joltChannel, 'reaction.*', handleReactionJoltEvent)\n useJoltEvent(joltChannel, 'typing.broadcast', handleTypingEvent)\n}\n\ntype QueryData = InfiniteData<ApiCollection<MessageResource>>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_create_android_ripple_color.js","sourceRoot":"","sources":["../../src/hooks/use_create_android_ripple_color.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"use_create_android_ripple_color.js","sourceRoot":"","sources":["../../src/hooks/use_create_android_ripple_color.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAAE,KAAK,EAAqB,EAAE,EAAE;IAC1E,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;IAErD,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,EAAE;QACtC,OAAO,aAAa,CAAC,KAAK,CAAC;aACxB,GAAG,EAAE,CACL,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC;aACzD,KAAK,CAAC,SAAS,CAAC;aAChB,MAAM,EAAE,CAAA;IACb,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAA;IAEnC,OAAO,kBAAkB,CAAA;AAC3B,CAAC,CAAA","sourcesContent":["import colorFunction from 'color'\nimport { useMemo } from 'react'\nimport { useTheme } from './use_theme'\n\nexport const useCreateAndroidRippleColor = ({ color }: { color: string }) => {\n const { colors } = useTheme()\n const intensity = colors.name === 'dark' ? 0.4 : 0.35\n\n const androidRippleColor = useMemo(() => {\n return colorFunction(color)\n .hsl()\n [colors.name === 'dark' ? 'lighten' : 'darken'](intensity)\n .alpha(intensity)\n .string()\n }, [color, colors.name, intensity])\n\n return androidRippleColor\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_current_person.js","sourceRoot":"","sources":["../../src/hooks/use_current_person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"use_current_person.js","sourceRoot":"","sources":["../../src/hooks/use_current_person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAGtD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEvE,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,GAAG,EAAE,KAAK;IACV,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,IAAI;gBACJ,MAAM;gBACN,QAAQ;gBACR,UAAU;gBACV,cAAc;gBACd,kBAAkB;gBAClB,0BAA0B;aAC3B;SACF;KACF;CACF,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,CAAA;AAEjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,cAAc,CAAwB,wBAAwB,EAAE;QACvF,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,6CAA6C;QACvE,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,kEAAkE;KAC3F,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAID,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,MAAM,YAAY,GAAG,CACnB,MAAsC,EACtC,gBAAsD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,EAChF,EAAE;QACF,WAAW,CAAC,YAAY,CAAqC,qBAAqB,EAAE,IAAI,CAAC,EAAE;YACzF,IAAI,CAAC,IAAI;gBAAE,OAAO,IAAI,CAAA;YAEtB,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAA;QAC5D,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,MAAM,gBAAgB,GAAG,GAAG,EAAE;QAC5B,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,qBAAqB,EAAE,CAAC,CAAA;IACpE,CAAC,CAAA;IAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAA;AAC/D,CAAC,CAAA","sourcesContent":["import { useQueryClient } from '@tanstack/react-query'\nimport { CurrentPersonResource } from '../types'\nimport { ApiResource } from '../types/api_primitives'\nimport { getRequestQueryKey, useSuspenseGet } from './use_suspense_api'\n\nexport const currentPersonRequestArgs = {\n url: '/me',\n data: {\n fields: {\n Person: [\n 'id',\n 'name',\n 'avatar',\n 'can_chat',\n 'unread_count',\n 'pco_chat_enabled',\n 'age_qualification_status',\n ],\n },\n },\n}\n\nexport const currentPersonQueryKey = getRequestQueryKey(currentPersonRequestArgs)\n\nexport const useCurrentPerson = () => {\n const { data: person } = useSuspenseGet<CurrentPersonResource>(currentPersonRequestArgs, {\n staleTime: 5 * 60 * 1000, // 5 minutes - data stays fresh for 5 minutes\n gcTime: 30 * 60 * 1000, // 30 minutes - data stays in cache for 30 minutes when not in use\n })\n\n return person\n}\n\ntype ProcessRecord<T> = (record: T, update: Partial<T>) => T\n\nexport const useCurrentPersonCache = () => {\n const queryClient = useQueryClient()\n const handleUpdate = (\n update: Partial<CurrentPersonResource>,\n processRecord: ProcessRecord<CurrentPersonResource> = (r, u) => ({ ...r, ...u })\n ) => {\n queryClient.setQueryData<ApiResource<CurrentPersonResource>>(currentPersonQueryKey, data => {\n if (!data) return data\n\n return { ...data, data: processRecord(data.data, update) }\n })\n }\n\n const handleInvalidate = () => {\n queryClient.invalidateQueries({ queryKey: currentPersonQueryKey })\n }\n\n return { update: handleUpdate, invalidate: handleInvalidate }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_features.d.ts","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use_features.d.ts","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAI1E,wBAAgB,WAAW;;kCAiBT,MAAM;EASvB;AAED,eAAO,MAAM,iBAAiB;;;;CAI7B,CAAA"}
|
|
@@ -24,6 +24,7 @@ export function useFeatures() {
|
|
|
24
24
|
export const availableFeatures = {
|
|
25
25
|
message_reporting: 'ROLLOUT_MOBILE_message_reporting',
|
|
26
26
|
granular_notifications_ui: 'ROLLOUT_granular_notification_preferences_ui',
|
|
27
|
+
gender_specific_conversations: 'ROLLOUT_gender_specific_conversations',
|
|
27
28
|
};
|
|
28
29
|
const stableEmptyFeatures = {
|
|
29
30
|
data: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_features.js","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"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C;IACrD,yBAAyB,EAAE,8CAA8C;IACzE,6BAA6B,EAAE,uCAAuC;CACvE,CAAA;AAED,MAAM,mBAAmB,GAAmC;IAC1D,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,IAAI,EAAE;QACJ,KAAK,EAAE,CAAC;QACR,UAAU,EAAE,CAAC;KACd;CACF,CAAA","sourcesContent":["import { useSuspenseQuery } from '@tanstack/react-query'\nimport { useCallback } from 'react'\nimport { ApiCollection } from '../types'\nimport type { FeatureResource } from '../types/resources/feature_resource'\nimport { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'\nimport { useApiClient } from './use_api_client'\n\nexport function useFeatures() {\n const apiClient = useApiClient()\n const requestArgs = getFeaturesRequestArgs()\n\n const { data } = useSuspenseQuery({\n queryKey: getFeaturesQueryKey(),\n queryFn: () => {\n return apiClient.chat\n .get<ApiCollection<FeatureResource>>(requestArgs)\n .catch(() => stableEmptyFeatures)\n },\n staleTime: 1000 * 60 * 5, // 5 minutes\n })\n\n const features = data.data\n\n const featureEnabled = useCallback(\n (featureName: string) =>\n features.some(feature => feature.name === featureName && feature.enabled),\n [features]\n )\n\n return {\n features,\n featureEnabled,\n }\n}\n\nexport const availableFeatures = {\n message_reporting: 'ROLLOUT_MOBILE_message_reporting',\n granular_notifications_ui: 'ROLLOUT_granular_notification_preferences_ui',\n gender_specific_conversations: 'ROLLOUT_gender_specific_conversations',\n}\n\nconst stableEmptyFeatures: ApiCollection<FeatureResource> = {\n data: [],\n links: {},\n meta: {\n count: 0,\n totalCount: 0,\n },\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useWindowDimensions } from 'react-native';
|
|
2
1
|
import { clamp } from 'lodash';
|
|
2
|
+
import { useWindowDimensions } from 'react-native';
|
|
3
3
|
export const useFontScale = ({ maxFontSizeMultiplier, minFontSizeMultiplier, } = {}) => {
|
|
4
4
|
const { fontScale: nativeFontScale } = useWindowDimensions();
|
|
5
5
|
// Infinity values are used to negate the scale if only one constraint is provided. This ensures that the scale is clamped to the provided constraint.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_font_scale.js","sourceRoot":"","sources":["../../src/hooks/use_font_scale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use_font_scale.js","sourceRoot":"","sources":["../../src/hooks/use_font_scale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,qBAAqB,EACrB,qBAAqB,MAInB,EAAE,EAAE,EAAE;IACR,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,mBAAmB,EAAE,CAAA;IAE5D,sJAAsJ;IACtJ,MAAM,YAAY,GAAG,qBAAqB,IAAI,MAAM,CAAC,iBAAiB,CAAA;IACtE,MAAM,YAAY,GAAG,qBAAqB,IAAI,MAAM,CAAC,iBAAiB,CAAA;IAEtE,MAAM,YAAY,GAAG,KAAK,CAAC,eAAe,EAAE,YAAY,EAAE,YAAY,CAAC,CAAA;IAEvE,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA","sourcesContent":["import { clamp } from 'lodash'\nimport { useWindowDimensions } from 'react-native'\n\nexport const useFontScale = ({\n maxFontSizeMultiplier,\n minFontSizeMultiplier,\n}: {\n maxFontSizeMultiplier?: number\n minFontSizeMultiplier?: number\n} = {}) => {\n const { fontScale: nativeFontScale } = useWindowDimensions()\n\n // Infinity values are used to negate the scale if only one constraint is provided. This ensures that the scale is clamped to the provided constraint.\n const maxFontScale = maxFontSizeMultiplier ?? Number.POSITIVE_INFINITY\n const minFontScale = minFontSizeMultiplier ?? Number.NEGATIVE_INFINITY\n\n const clampedScale = clamp(nativeFontScale, minFontScale, maxFontScale)\n\n return clampedScale\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_giphy.d.ts","sourceRoot":"","sources":["../../src/hooks/use_giphy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use_giphy.d.ts","sourceRoot":"","sources":["../../src/hooks/use_giphy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4CAA4C,EAAE,MAAM,gEAAgE,CAAA;AAyB7H,wBAAgB,QAAQ,CAAC,IAAI,GAAE,MAAW;;;;;;EAgDzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_giphy.js","sourceRoot":"","sources":["../../src/hooks/use_giphy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"use_giphy.js","sourceRoot":"","sources":["../../src/hooks/use_giphy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AA0BtD,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE;IACxC,MAAM,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IAC/C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACrD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAiD,EAAE,CAAC,CAAA;IAC1F,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IACjD,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAEnC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1B,UAAU,CAAC,EAAE,CAAC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O,CAAC,MAAM,CAAC,CAAC,CAAA;IAEpB,OAAO;QACL,WAAW;QACX,MAAM;QACN,WAAW;QACX,UAAU;QACV,UAAU;KACX,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CACxB,IAAY,EACZ,MAAkB;IAElB,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC1B,IAAI,EAAE,OAAO;QACb,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK,EAAE,IAAI;QACX,oBAAoB,EAAE,KAAK,CAAC,KAAK;QACjC,UAAU,EAAE,KAAK,CAAC,GAAG;QACrB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG;QACvC,KAAK,EAAE;YACL,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ;YAC/B,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,YAAY;YACvC,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,kBAAkB;YACnD,wBAAwB,EAAE,KAAK,CAAC,MAAM,CAAC,wBAAwB;YAC/D,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW;YACrC,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,iBAAiB;YACjD,uBAAuB,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;SAC9D;KACF,CAAC,CAAC,CAAA;AACL,CAAC","sourcesContent":["import { useCallback, useContext, useEffect, useState } from 'react'\nimport { ChatContext } from '../contexts/chat_context'\nimport { DenormalizedGiphyAttachmentResourceForCreate } from '../types/resources/denormalized_attachment_resource_for_create'\n\ninterface GiphyGif {\n id: string\n url: string\n title: string\n images: {\n original: GiphyVariant\n fixed_height: GiphyVariant\n fixed_height_still: GiphyVariant\n fixed_height_downsampled: GiphyVariant\n fixed_width: GiphyVariant\n fixed_width_still: GiphyVariant\n fixed_width_downsampled: GiphyVariant\n }\n}\n\ninterface GiphyVariant {\n url: string\n width: string\n height: string\n size: string\n frames: string\n}\n\nexport function useGiphy(term: string = '') {\n const { giphyApiKey } = useContext(ChatContext)\n const [isSearching, setIsSearching] = useState(false)\n const [results, setResults] = useState<DenormalizedGiphyAttachmentResourceForCreate[]>([])\n const [resultIndex, setResultIndex] = useState(0)\n const result = results[resultIndex]\n\n useEffect(() => {\n if (!giphyApiKey || !term) {\n setResults([])\n return\n }\n\n setIsSearching(true)\n fetch(\n `https://api.giphy.com/v1/gifs/search?api_key=${giphyApiKey}&q=${term}&limit=20&rating=pg`\n )\n .then(response => response.json())\n .then(data => {\n const originalGiphys: GiphyGif[] = data.data\n const denormalizedGiphys = denormalizeGiphys(term, originalGiphys)\n\n setResults(denormalizedGiphys)\n setResultIndex(0)\n })\n .catch(error => {\n console.error('Error fetching gifs:', error)\n })\n .finally(() => {\n setIsSearching(false)\n })\n }, [giphyApiKey, term])\n\n const nextResult = useCallback(() => {\n setResultIndex(oldResultIndex => (oldResultIndex < results.length - 1 ? oldResultIndex + 1 : 0))\n }, [results.length])\n\n const prevResult = useCallback(() => {\n setResultIndex(oldResultIndex => (oldResultIndex > 0 ? oldResultIndex - 1 : results.length - 1))\n }, [results.length])\n\n return {\n isSearching,\n result,\n resultIndex,\n nextResult,\n prevResult,\n }\n}\n\nfunction denormalizeGiphys(\n term: string,\n giphys: GiphyGif[]\n): DenormalizedGiphyAttachmentResourceForCreate[] {\n return giphys.map(giphy => ({\n type: 'giphy',\n id: giphy.id,\n title: term,\n original_giphy_title: giphy.title,\n title_link: giphy.url,\n thumb_url: giphy.images.fixed_width.url,\n giphy: {\n original: giphy.images.original,\n fixed_height: giphy.images.fixed_height,\n fixed_height_still: giphy.images.fixed_height_still,\n fixed_height_downsampled: giphy.images.fixed_height_downsampled,\n fixed_width: giphy.images.fixed_width,\n fixed_width_still: giphy.images.fixed_width_still,\n fixed_width_downsampled: giphy.images.fixed_width_downsampled,\n },\n }))\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import colorFunction from 'color';
|
|
1
2
|
import { useMemo } from 'react';
|
|
2
3
|
import { useTheme } from './use_theme';
|
|
3
|
-
import colorFunction from 'color';
|
|
4
4
|
export function useInteractionGhostBackgroundColor() {
|
|
5
5
|
const { colors } = useTheme();
|
|
6
6
|
const interactionGhostColor = useMemo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_interaction_ghost_color.js","sourceRoot":"","sources":["../../src/hooks/use_interaction_ghost_color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"use_interaction_ghost_color.js","sourceRoot":"","sources":["../../src/hooks/use_interaction_ghost_color.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,MAAM,UAAU,kCAAkC;IAChD,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,MAAM,qBAAqB,GAAG,OAAO,CAAC,GAAG,EAAE;QACzC,OAAO,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;aACrC,GAAG,EAAE;aACL,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3C,MAAM,EAAE,CAAA;IACb,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAErC,OAAO,qBAAqB,CAAA;AAC9B,CAAC","sourcesContent":["import colorFunction from 'color'\nimport { useMemo } from 'react'\nimport { useTheme } from './use_theme'\n\nexport function useInteractionGhostBackgroundColor() {\n const { colors } = useTheme()\n const interactionGhostColor = useMemo(() => {\n return colorFunction(colors.interaction)\n .hsl()\n .lightness(colors.name === 'dark' ? 12 : 92)\n .string()\n }, [colors.interaction, colors.name])\n\n return interactionGhostColor\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_live_relative_time.d.ts","sourceRoot":"","sources":["../../src/hooks/use_live_relative_time.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use_live_relative_time.d.ts","sourceRoot":"","sources":["../../src/hooks/use_live_relative_time.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,eAAe,CAAA;AAO5D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,UA6BlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_live_relative_time.js","sourceRoot":"","sources":["../../src/hooks/use_live_relative_time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"use_live_relative_time.js","sourceRoot":"","sources":["../../src/hooks/use_live_relative_time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAkB,MAAM,eAAe,CAAA;AAC5D,OAAO,KAAK,MAAM,gBAAgB,CAAA;AAElC,MAAM,MAAM,GAAG,EAAE,CAAA;AACjB,MAAM,IAAI,GAAG,MAAM,GAAG,EAAE,CAAA;AACxB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAA;AAErB,MAAM,UAAU,mBAAmB,CAAC,IAAe;IACjD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IAElD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,GAAG,EAAE;YAChB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;YAClC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;YAE3D,MAAM,eAAe,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;YAEnE,IAAI,eAAe,EAAE,CAAC;gBACpB,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,eAAe,GAAG,KAAK,CAAC,CAAA;YAC1E,CAAC;YAED,OAAO,CAAC,CAAA;QACV,CAAC,CAAA;QACD,MAAM,SAAS,GAAG,IAAI,EAAE,CAAA;QACxB,OAAO,GAAG,EAAE;YACV,IAAI,SAAS,EAAE,CAAC;gBACd,YAAY,CAAC,SAAS,CAAC,CAAA;YACzB,CAAC;QACH,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;IAEnB,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IACxB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEV,OAAO,YAAY,CAAC,IAAI,CAAC,CAAA;AAC3B,CAAC","sourcesContent":["import { useEffect, useState } from 'react'\nimport { relativeTime, type DateProps } from '../utils/date'\nimport dayjs from '../utils/dayjs'\n\nconst MINUTE = 60\nconst HOUR = MINUTE * 60\nconst DAY = HOUR * 24\n\nexport function useLiveRelativeTime(date: DateProps) {\n const [timeNow, setTimeNow] = useState(Date.now())\n\n useEffect(() => {\n const tick = () => {\n const then = dayjs(date).valueOf()\n const seconds = Math.round(Math.abs(timeNow - then) / 1000)\n\n const periodInMinutes = seconds < HOUR ? 1 : seconds < DAY ? 60 : 0\n\n if (periodInMinutes) {\n return setTimeout(() => setTimeNow(Date.now()), periodInMinutes * 60000)\n }\n\n return 0\n }\n const timeoutId = tick()\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId)\n }\n }\n }, [date, timeNow])\n\n useEffect(() => {\n setTimeNow(Date.now())\n }, [date])\n\n return relativeTime(date)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_message_create_or_update.d.ts","sourceRoot":"","sources":["../../src/hooks/use_message_create_or_update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use_message_create_or_update.d.ts","sourceRoot":"","sources":["../../src/hooks/use_message_create_or_update.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAAE,uCAAuC,EAAE,MAAM,gEAAgE,CAAA;AAexH,UAAU,KAAK;IACb,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,eAAe,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,wBAAgB,wBAAwB,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,KAAK;UAqD5E,MAAM;kBACE,uCAAuC,EAAE;;;GAgF5D"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
|
-
import { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages';
|
|
3
|
-
import { useApiClient } from './use_api_client';
|
|
4
2
|
import { chatQueryClient } from '../contexts/api_provider';
|
|
5
3
|
import { deleteRecordInPagesData, Haptic, updateOrCreateRecordInPagesData, updateRecordInPagesData, } from '../utils';
|
|
6
|
-
import {
|
|
7
|
-
import { optimisticallyUpdateMessage } from '../utils/cache/optimistically_update_message';
|
|
4
|
+
import { isNewMessage, mergeMessageUpdate } from '../utils/cache/messages_cache';
|
|
8
5
|
import { optimisticallyCreateMessage } from '../utils/cache/optimistically_create_message';
|
|
6
|
+
import { optimisticallyUpdateMessage } from '../utils/cache/optimistically_update_message';
|
|
9
7
|
import { startMessageCreationTracking } from '../utils/performance_tracking';
|
|
10
|
-
import {
|
|
8
|
+
import { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages';
|
|
9
|
+
import { useApiClient } from './use_api_client';
|
|
10
|
+
import { useCurrentPerson } from './use_current_person';
|
|
11
11
|
export function useMessageCreateOrUpdate({ conversationId, message, replyRootId }) {
|
|
12
12
|
const messageId = message?.id || null;
|
|
13
13
|
const isEditing = !isNewMessage(message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_message_create_or_update.js","sourceRoot":"","sources":["../../src/hooks/use_message_create_or_update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAQhF,MAAM,UAAU,wBAAwB,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAS;IACtF,MAAM,SAAS,GAAG,OAAO,EAAE,EAAE,IAAI,IA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AAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;SAChE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;AAC1E,CAAC","sourcesContent":["import { InfiniteData, useMutation } from '@tanstack/react-query'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\nimport { useApiClient } from './use_api_client'\nimport { ApiCollection, ApiResource, MessageResource } from '../types'\nimport { chatQueryClient } from '../contexts/api_provider'\nimport {\n deleteRecordInPagesData,\n Haptic,\n updateOrCreateRecordInPagesData,\n updateRecordInPagesData,\n} from '../utils'\nimport { DenormalizedAttachmentResourceForCreate } from '../types/resources/denormalized_attachment_resource_for_create'\nimport { useCurrentPerson } from './use_current_person'\nimport { optimisticallyUpdateMessage } from '../utils/cache/optimistically_update_message'\nimport { optimisticallyCreateMessage } from '../utils/cache/optimistically_create_message'\nimport { startMessageCreationTracking } from '../utils/performance_tracking'\nimport { isNewMessage, mergeMessageUpdate } from '../utils/cache/messages_cache'\n\ninterface Props {\n conversationId: number\n message?: MessageResource\n replyRootId?: string | null\n}\n\nexport function useMessageCreateOrUpdate({ conversationId, message, replyRootId }: Props) {\n const messageId = message?.id || null\n const isEditing = !isNewMessage(message)\n const apiClient = useApiClient()\n const currentPerson = useCurrentPerson()\n\n const mutation = useMutation({\n mutationFn: ({\n text,\n attachments,\n }: {\n text: string\n attachments?: DenormalizedAttachmentResourceForCreate[]\n }) => {\n const requestParams = getMessagesRequestArgs({ conversation_id: conversationId })\n const fieldsWithValueJoined = Object.fromEntries(\n Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')])\n )\n let attributes: any = {\n text,\n ...(attachments ? { attachments } : {}),\n ...(!isEditing && replyRootId ? { reply_root: { id: replyRootId } } : {}),\n }\n if (!isEditing) {\n const idempotentKey = insecureUUID()\n attributes.idempotent_key = idempotentKey\n startMessageCreationTracking(idempotentKey)\n }\n const data = {\n ...requestParams.data,\n data: {\n type: 'Message',\n attributes,\n },\n fields: fieldsWithValueJoined,\n }\n\n if (isEditing) {\n return apiClient.chat.patch<ApiResource<MessageResource>>({\n url: `/me/conversations/${conversationId}/messages/${messageId}`,\n data,\n })\n } else {\n return apiClient.chat.post<ApiResource<MessageResource>>({\n url: `/me/conversations/${conversationId}/messages`,\n data,\n })\n }\n },\n onMutate: async ({\n text,\n attachments,\n }: {\n text: string\n attachments?: DenormalizedAttachmentResourceForCreate[]\n }) => {\n if (message && isEditing) {\n const optimisticMessage = optimisticallyUpdateMessage({\n conversationId,\n message,\n text,\n replyRootId,\n })\n\n return { message: optimisticMessage }\n }\n\n const optimisticMessage = optimisticallyCreateMessage({\n conversationId,\n message,\n text,\n attachments,\n currentPerson,\n replyRootId,\n })\n\n return { message: optimisticMessage }\n },\n onError: (error, variables, context) => {\n const { message: optimisticMessage } = context || {}\n Haptic.notificationError()\n\n // Add error to the optimistic message from the cache on error\n if (optimisticMessage) {\n const queryKey = getMessagesQueryKey({\n conversation_id: conversationId,\n reply_root_id: replyRootId,\n })\n chatQueryClient.setQueryData(\n queryKey,\n (data: InfiniteData<ApiCollection<MessageResource>> | undefined) =>\n updateRecordInPagesData({\n data,\n record: optimisticMessage,\n processRecord: (_next, prev) => ({\n ...prev,\n error: error.message || 'Failed to send message',\n pending: false, // Mark as no longer pending\n }),\n })\n )\n }\n },\n onSuccess: (result: ApiResource<MessageResource>, variables, context) => {\n const { message: optimisticMessage } = context || {}\n const updatedMessage = result.data\n type QueryData = InfiniteData<ApiCollection<MessageResource>>\n const queryKey = getMessagesQueryKey({\n conversation_id: conversationId,\n reply_root_id: replyRootId,\n })\n\n // First remove the optimistic message if it exists\n if (optimisticMessage) {\n chatQueryClient.setQueryData<QueryData>(queryKey, data =>\n deleteRecordInPagesData({\n data,\n record: optimisticMessage,\n })\n )\n }\n\n // Then add the real message\n chatQueryClient.setQueryData<QueryData>(queryKey, data =>\n updateOrCreateRecordInPagesData({\n data,\n record: updatedMessage,\n processRecord: (record, current) => mergeMessageUpdate(record, current),\n })\n )\n },\n })\n\n return mutation\n}\n\n/**\n * Generate a random UUID (v4) for idempotent keys.\n * Uses Math.random, which is not cryptographically secure.\n * An actual crypto library requires native dependencies.\n * This is OK for now since idempotent keys are not security-sensitive\n * or need to be guaranteed unique.\n * They are short lived and we use it in combination with the message's creator_id so\n * their impact is scoped only the current user.\n */\nfunction insecureUUID(): string {\n return 'xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx'\n .replace(/x/g, () => Math.floor(Math.random() * 16).toString(16))\n .replace(/N/g, () => (Math.floor(Math.random() * 4) + 8).toString(16))\n}\n"]}
|
|
1
|
+
{"version":3,"file":"use_message_create_or_update.js","sourceRoot":"","sources":["../../src/hooks/use_message_create_or_update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAG1D,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAA;AAC5E,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAQ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ED;;;;;;;;GAQG;AACH,SAAS,YAAY;IACnB,OAAO,sCAAsC;SAC1C,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;SAChE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;AAC1E,CAAC","sourcesContent":["import { InfiniteData, useMutation } from '@tanstack/react-query'\nimport { chatQueryClient } from '../contexts/api_provider'\nimport { ApiCollection, ApiResource, MessageResource } from '../types'\nimport { DenormalizedAttachmentResourceForCreate } from '../types/resources/denormalized_attachment_resource_for_create'\nimport {\n deleteRecordInPagesData,\n Haptic,\n updateOrCreateRecordInPagesData,\n updateRecordInPagesData,\n} from '../utils'\nimport { isNewMessage, mergeMessageUpdate } from '../utils/cache/messages_cache'\nimport { optimisticallyCreateMessage } from '../utils/cache/optimistically_create_message'\nimport { optimisticallyUpdateMessage } from '../utils/cache/optimistically_update_message'\nimport { startMessageCreationTracking } from '../utils/performance_tracking'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\nimport { useApiClient } from './use_api_client'\nimport { useCurrentPerson } from './use_current_person'\n\ninterface Props {\n conversationId: number\n message?: MessageResource\n replyRootId?: string | null\n}\n\nexport function useMessageCreateOrUpdate({ conversationId, message, replyRootId }: Props) {\n const messageId = message?.id || null\n const isEditing = !isNewMessage(message)\n const apiClient = useApiClient()\n const currentPerson = useCurrentPerson()\n\n const mutation = useMutation({\n mutationFn: ({\n text,\n attachments,\n }: {\n text: string\n attachments?: DenormalizedAttachmentResourceForCreate[]\n }) => {\n const requestParams = getMessagesRequestArgs({ conversation_id: conversationId })\n const fieldsWithValueJoined = Object.fromEntries(\n Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')])\n )\n let attributes: any = {\n text,\n ...(attachments ? { attachments } : {}),\n ...(!isEditing && replyRootId ? { reply_root: { id: replyRootId } } : {}),\n }\n if (!isEditing) {\n const idempotentKey = insecureUUID()\n attributes.idempotent_key = idempotentKey\n startMessageCreationTracking(idempotentKey)\n }\n const data = {\n ...requestParams.data,\n data: {\n type: 'Message',\n attributes,\n },\n fields: fieldsWithValueJoined,\n }\n\n if (isEditing) {\n return apiClient.chat.patch<ApiResource<MessageResource>>({\n url: `/me/conversations/${conversationId}/messages/${messageId}`,\n data,\n })\n } else {\n return apiClient.chat.post<ApiResource<MessageResource>>({\n url: `/me/conversations/${conversationId}/messages`,\n data,\n })\n }\n },\n onMutate: async ({\n text,\n attachments,\n }: {\n text: string\n attachments?: DenormalizedAttachmentResourceForCreate[]\n }) => {\n if (message && isEditing) {\n const optimisticMessage = optimisticallyUpdateMessage({\n conversationId,\n message,\n text,\n replyRootId,\n })\n\n return { message: optimisticMessage }\n }\n\n const optimisticMessage = optimisticallyCreateMessage({\n conversationId,\n message,\n text,\n attachments,\n currentPerson,\n replyRootId,\n })\n\n return { message: optimisticMessage }\n },\n onError: (error, variables, context) => {\n const { message: optimisticMessage } = context || {}\n Haptic.notificationError()\n\n // Add error to the optimistic message from the cache on error\n if (optimisticMessage) {\n const queryKey = getMessagesQueryKey({\n conversation_id: conversationId,\n reply_root_id: replyRootId,\n })\n chatQueryClient.setQueryData(\n queryKey,\n (data: InfiniteData<ApiCollection<MessageResource>> | undefined) =>\n updateRecordInPagesData({\n data,\n record: optimisticMessage,\n processRecord: (_next, prev) => ({\n ...prev,\n error: error.message || 'Failed to send message',\n pending: false, // Mark as no longer pending\n }),\n })\n )\n }\n },\n onSuccess: (result: ApiResource<MessageResource>, variables, context) => {\n const { message: optimisticMessage } = context || {}\n const updatedMessage = result.data\n type QueryData = InfiniteData<ApiCollection<MessageResource>>\n const queryKey = getMessagesQueryKey({\n conversation_id: conversationId,\n reply_root_id: replyRootId,\n })\n\n // First remove the optimistic message if it exists\n if (optimisticMessage) {\n chatQueryClient.setQueryData<QueryData>(queryKey, data =>\n deleteRecordInPagesData({\n data,\n record: optimisticMessage,\n })\n )\n }\n\n // Then add the real message\n chatQueryClient.setQueryData<QueryData>(queryKey, data =>\n updateOrCreateRecordInPagesData({\n data,\n record: updatedMessage,\n processRecord: (record, current) => mergeMessageUpdate(record, current),\n })\n )\n },\n })\n\n return mutation\n}\n\n/**\n * Generate a random UUID (v4) for idempotent keys.\n * Uses Math.random, which is not cryptographically secure.\n * An actual crypto library requires native dependencies.\n * This is OK for now since idempotent keys are not security-sensitive\n * or need to be guaranteed unique.\n * They are short lived and we use it in combination with the message's creator_id so\n * their impact is scoped only the current user.\n */\nfunction insecureUUID(): string {\n return 'xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx'\n .replace(/x/g, () => Math.floor(Math.random() * 16).toString(16))\n .replace(/N/g, () => (Math.floor(Math.random() * 4) + 8).toString(16))\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { useAsyncStorage } from './use_async_storage';
|
|
3
2
|
import { useConversationContext } from '../contexts/conversation_context';
|
|
3
|
+
import { useAsyncStorage } from './use_async_storage';
|
|
4
4
|
const DRAFT_STORAGE_KEY = 'chat_message_drafts';
|
|
5
5
|
const DRAFT_EXPIRY_HOURS = 720; // 30 days
|
|
6
6
|
const DRAFT_EXPIRY_MS = DRAFT_EXPIRY_HOURS * 60 * 60 * 1000;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_message_draft.js","sourceRoot":"","sources":["../../src/hooks/use_message_draft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,
|
|
1
|
+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AAO,aAAa,CAAC,eAAe,CAAC,CAAA;QACrC,YAAY,CAAC,aAAa,CAAC,CAAA;QAC3B,QAAQ,CAAC,IAAI,CAAC,CAAA;IAChB,CAAC,EAAE,CAAC,eAAe,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAA;IAE9C,OAAO;QACL,KAAK;QACL,SAAS;QACT,UAAU;KACX,CAAA;AACH,CAAC","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\nimport { useConversationContext } from '../contexts/conversation_context'\nimport type { FileAttachment } from '../types/resources/denormalized_attachment_resource_for_create'\nimport { useAsyncStorage } from './use_async_storage'\n\ninterface MessageDraft {\n text: string\n attachments: FileAttachment[]\n lastUpdated: number\n}\n\nconst DRAFT_STORAGE_KEY = 'chat_message_drafts'\nconst DRAFT_EXPIRY_HOURS = 720 // 30 days\nconst DRAFT_EXPIRY_MS = DRAFT_EXPIRY_HOURS * 60 * 60 * 1000\nconst ATTACHMENT_EXPIRY_HOURS = 48 // 2 days\nconst ATTACHMENT_EXPIRY_MS = ATTACHMENT_EXPIRY_HOURS * 60 * 60 * 1000\n\nexport function useMessageDraft() {\n const { conversationId, currentPageReplyRootId } = useConversationContext()\n const conversationKey = currentPageReplyRootId\n ? `${conversationId}/threads/${currentPageReplyRootId}`\n : String(conversationId)\n const [allDrafts, setAllDrafts] = useAsyncStorage<Record<string, MessageDraft>>(\n DRAFT_STORAGE_KEY,\n {}\n )\n\n const [draft, setDraft] = useState<MessageDraft | null>(() => {\n const storedDraft = allDrafts[conversationKey] || null\n\n // Filter expired attachments\n if (storedDraft?.attachments) {\n const now = Date.now()\n const validAttachments = storedDraft.attachments.filter(attachment => {\n if (!attachment.uploadedAt) return false\n return now - attachment.uploadedAt < ATTACHMENT_EXPIRY_MS\n })\n\n return {\n ...storedDraft,\n attachments: validAttachments,\n }\n }\n\n return storedDraft\n })\n\n // Clean up expired drafts only once on mount - React 18 recommended pattern\n const hasCleanedUp = useRef(false)\n\n useEffect(() => {\n if (hasCleanedUp.current) return\n\n const now = Date.now()\n const validDrafts: Record<string, MessageDraft> = {}\n\n Object.entries(allDrafts).forEach(([id, draftData]) => {\n if (draftData?.lastUpdated && now - draftData.lastUpdated < DRAFT_EXPIRY_MS) {\n validDrafts[id] = draftData\n }\n })\n\n // If we filtered out any drafts, update storage\n if (Object.keys(validDrafts).length !== Object.keys(allDrafts).length) {\n setAllDrafts(validDrafts)\n }\n\n hasCleanedUp.current = true\n }, [allDrafts, setAllDrafts])\n\n const saveDraft = useCallback(\n (text: string, attachments: FileAttachment[]) => {\n const hasContent = text.trim().length > 0 || attachments.length > 0\n const updatedDrafts = { ...allDrafts }\n\n if (hasContent) {\n // Convert attachments to serializable format (similar to web implementation)\n const normalizedAttachments = attachments\n .filter(att => att.id && att.status === 'success')\n .map(att => ({\n ...att,\n file: {\n uri: att.file.uri,\n name: att.file.name,\n type: att.file.type,\n size: att.file.size,\n width: att.file.width,\n height: att.file.height,\n },\n }))\n\n const newDraft: MessageDraft = {\n text,\n attachments: normalizedAttachments,\n lastUpdated: Date.now(),\n }\n\n updatedDrafts[conversationKey] = newDraft\n setDraft(newDraft)\n } else {\n delete updatedDrafts[conversationKey]\n setDraft(null)\n }\n\n setAllDrafts(updatedDrafts)\n },\n [conversationKey, allDrafts, setAllDrafts]\n )\n\n const clearDraft = useCallback(() => {\n const updatedDrafts = { ...allDrafts }\n delete updatedDrafts[conversationKey]\n setAllDrafts(updatedDrafts)\n setDraft(null)\n }, [conversationKey, allDrafts, setAllDrafts])\n\n return {\n draft,\n saveDraft,\n clearDraft,\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_message_reaction_toggle.d.ts","sourceRoot":"","sources":["../../src/hooks/use_message_reaction_toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+B,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"use_message_reaction_toggle.d.ts","sourceRoot":"","sources":["../../src/hooks/use_message_reaction_toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+B,MAAM,uBAAuB,CAAA;AAGjF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAQnE,KAAK,6BAA6B,GAAG;IACnC,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAA;IACrC,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAED,KAAK,SAAS,GAAG,YAAY,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAA;AAE7D,wBAAgB,wBAAwB,CAAC,EACvC,eAAe,EACf,OAAO,EACP,SAAS,GACV,EAAE,6BAA6B;;;;;EA0E/B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { Alert } from 'react-native';
|
|
4
|
-
import { useApiClient } from './use_api_client';
|
|
5
|
-
import { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages';
|
|
6
4
|
import { updateRecordInPagesData, REACTION_EMOJIS } from '../utils';
|
|
5
|
+
import { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages';
|
|
6
|
+
import { useApiClient } from './use_api_client';
|
|
7
7
|
const REACT = 1;
|
|
8
8
|
const UNREACT = -1;
|
|
9
9
|
export function useMessageReactionToggle({ conversation_id, message, onSuccess, }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_message_reaction_toggle.js","sourceRoot":"","sources":["../../src/hooks/use_message_reaction_toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EA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AC,CAAC,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;AAClG,CAAC,CAAA","sourcesContent":["import { InfiniteData, useMutation, useQueryClient } from '@tanstack/react-query'\nimport { useCallback } from 'react'\nimport { Alert } from 'react-native'\nimport { ApiCollection, ApiResource, MessageResource } from '../types'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { updateRecordInPagesData, REACTION_EMOJIS } from '../utils'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\nimport { useApiClient } from './use_api_client'\n\nconst REACT = 1\nconst UNREACT = -1\n\ntype UseMessageReactionToggleProps = {\n conversation_id: number\n message: MessageResource\n onSuccess?: () => void\n}\n\ntype ToggleReactionParams = {\n value: ReactionCountResource['value']\n mine: boolean\n}\n\ntype QueryData = InfiniteData<ApiCollection<MessageResource>>\n\nexport function useMessageReactionToggle({\n conversation_id,\n message,\n onSuccess,\n}: UseMessageReactionToggleProps) {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const queryKey = getMessagesQueryKey({ conversation_id })\n const message_id = message.id\n\n const toggleReaction = useCallback(\n ({ value, mine }: ToggleReactionParams) => {\n const requestParams = getMessagesRequestArgs({ conversation_id })\n\n // If already reacted, unreact; otherwise react\n const endpoint = mine ? 'unreact' : 'react'\n const url = `/me/conversations/${conversation_id}/messages/${message_id}/${endpoint}`\n const fieldsWithValueJoined = Object.fromEntries(\n Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')])\n )\n\n return apiClient.chat.post<ApiResource<MessageResource>>({\n url,\n data: {\n ...requestParams.data,\n data: {\n type: 'Message',\n attributes: { value: value },\n },\n fields: fieldsWithValueJoined,\n },\n })\n },\n [apiClient, conversation_id, message_id]\n )\n\n const { mutate: handleReactionToggle, isPending } = useMutation({\n mutationFn: toggleReaction,\n onMutate: variables => {\n const previousData = queryClient.getQueryData<QueryData>(queryKey)\n if (previousData) {\n queryClient.setQueryData<QueryData>(queryKey, data =>\n optimisticUpdate({\n message,\n data,\n value: variables.value,\n mine: variables.mine,\n })\n )\n }\n return { previousData }\n },\n onSuccess: result => {\n const updatedMessage = result.data\n\n queryClient.setQueryData<QueryData>(queryKey, data =>\n updateRecordInPagesData({\n data,\n record: updatedMessage,\n })\n )\n\n if (onSuccess) {\n onSuccess()\n }\n },\n onError: (_data, _variables, context) => {\n if (context?.previousData) {\n queryClient.setQueryData<QueryData>(queryKey, context.previousData)\n }\n Alert.alert('Oops', 'We were unable to react to this message. Please try again.')\n },\n })\n\n return {\n handleReactionToggle,\n isPending,\n }\n}\n\nconst optimisticUpdate = ({\n message,\n data,\n value,\n mine,\n}: {\n message: MessageResource\n data: QueryData | undefined\n value: ReactionCountResource['value']\n mine: boolean\n}) => {\n if (!data) return data\n\n const hasExistingReaction = message.reactionCounts.some(r => r.value === value)\n\n let updatedReactionCounts: ReactionCountResource[]\n\n if (hasExistingReaction) {\n const delta = mine ? UNREACT : REACT\n updatedReactionCounts = updateCount(message.reactionCounts, value, delta)\n } else {\n updatedReactionCounts = createCount(message.reactionCounts, value, message.id)\n }\n\n const updatedMessage: MessageResource = {\n ...message,\n reactionCounts: updatedReactionCounts,\n }\n\n return updateRecordInPagesData({\n data,\n record: updatedMessage,\n })\n}\n\nconst updateCount = (\n reactionCounts: ReactionCountResource[],\n value: ReactionCountResource['value'],\n delta: typeof REACT | typeof UNREACT\n): ReactionCountResource[] => {\n return reactionCounts.map(reaction => {\n if (reaction.value === value) {\n return {\n ...reaction,\n mine: delta > 0 ? 1 : 0,\n count: reaction.count + delta,\n } as ReactionCountResource\n }\n return reaction\n })\n}\n\nconst createCount = (\n reactionCounts: ReactionCountResource[],\n value: ReactionCountResource['value'],\n messageId: string\n): ReactionCountResource[] => {\n const reactionOrder = Object.keys(REACTION_EMOJIS) as ReactionCountResource['value'][]\n const newReactionIndex = reactionOrder.indexOf(value)\n const insertIndex = reactionCounts.findIndex(\n r => reactionOrder.indexOf(r.value) > newReactionIndex\n )\n\n const newReaction: ReactionCountResource = {\n type: 'ReactionCount',\n id: `${messageId}/${value}`,\n value,\n count: 1,\n mine: 1,\n messageId,\n authorIds: [],\n }\n\n return insertIndex === -1\n ? [...reactionCounts, newReaction]\n : [...reactionCounts.slice(0, insertIndex), newReaction, ...reactionCounts.slice(insertIndex)]\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_my_gender.d.ts","sourceRoot":"","sources":["../../src/hooks/use_my_gender.ts"],"names":[],"mappings":"AAcA,wBAAgB,WAAW;;;;;EA2B1B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useApiGet } from './use_api';
|
|
2
|
+
import { availableFeatures, useFeatures } from './use_features';
|
|
3
|
+
export function useMyGender() {
|
|
4
|
+
const { featureEnabled } = useFeatures();
|
|
5
|
+
const isFeatureEnabled = featureEnabled(availableFeatures.gender_specific_conversations);
|
|
6
|
+
const { data, isFetching } = useApiGet({
|
|
7
|
+
url: '/me',
|
|
8
|
+
enabled: isFeatureEnabled,
|
|
9
|
+
data: {
|
|
10
|
+
include: ['gender'],
|
|
11
|
+
fields: {
|
|
12
|
+
Person: ['gender'],
|
|
13
|
+
Gender: ['value'],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
app: 'people',
|
|
17
|
+
});
|
|
18
|
+
const gender = data?.gender;
|
|
19
|
+
const genderValue = gender?.value ?? null;
|
|
20
|
+
const genderId = gender?.id ? String(gender.id) : null;
|
|
21
|
+
return {
|
|
22
|
+
isFeatureEnabled,
|
|
23
|
+
genderValue,
|
|
24
|
+
genderId,
|
|
25
|
+
isFetching,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=use_my_gender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_my_gender.js","sourceRoot":"","sources":["../../src/hooks/use_my_gender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAY/D,MAAM,UAAU,WAAW;IACzB,MAAM,EAAE,cAAc,EAAE,GAAG,WAAW,EAAE,CAAA;IACxC,MAAM,gBAAgB,GAAG,cAAc,CAAC,iBAAiB,CAAC,6BAA6B,CAAC,CAAA;IAExF,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,SAAS,CAAmB;QACvD,GAAG,EAAE,KAAK;QACV,OAAO,EAAE,gBAAgB;QACzB,IAAI,EAAE;YACJ,OAAO,EAAE,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE;gBACN,MAAM,EAAE,CAAC,QAAQ,CAAC;gBAClB,MAAM,EAAE,CAAC,OAAO,CAAC;aAClB;SACF;QACD,GAAG,EAAE,QAAQ;KACd,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,CAAA;IAC3B,MAAM,WAAW,GAAG,MAAM,EAAE,KAAK,IAAI,IAAI,CAAA;IACzC,MAAM,QAAQ,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAEtD,OAAO;QACL,gBAAgB;QAChB,WAAW;QACX,QAAQ;QACR,UAAU;KACX,CAAA;AACH,CAAC","sourcesContent":["import { ResourceObject } from '../types/api_primitives'\nimport { useApiGet } from './use_api'\nimport { availableFeatures, useFeatures } from './use_features'\n\ninterface GenderResource extends ResourceObject {\n type: 'Gender'\n value: string\n}\n\ninterface PersonWithGender extends ResourceObject {\n type: 'Person'\n gender: GenderResource | undefined\n}\n\nexport function useMyGender() {\n const { featureEnabled } = useFeatures()\n const isFeatureEnabled = featureEnabled(availableFeatures.gender_specific_conversations)\n\n const { data, isFetching } = useApiGet<PersonWithGender>({\n url: '/me',\n enabled: isFeatureEnabled,\n data: {\n include: ['gender'],\n fields: {\n Person: ['gender'],\n Gender: ['value'],\n },\n },\n app: 'people',\n })\n\n const gender = data?.gender\n const genderValue = gender?.value ?? null\n const genderId = gender?.id ? String(gender.id) : null\n\n return {\n isFeatureEnabled,\n genderValue,\n genderId,\n isFetching,\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_organization.d.ts","sourceRoot":"","sources":["../../src/hooks/use_organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"use_organization.d.ts","sourceRoot":"","sources":["../../src/hooks/use_organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAGtC,eAAO,MAAM,uBAAuB;;;;;;;SAOnB,GAAG;CACnB,CAAA;AAED,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;EAE9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_organization.js","sourceRoot":"","sources":["../../src/hooks/use_organization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use_organization.js","sourceRoot":"","sources":["../../src/hooks/use_organization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,GAAG,EAAE,GAAG;IACR,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,YAAY,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,sBAAsB,CAAC;SAChE;KACF;IACD,GAAG,EAAE,MAAa;CACnB,CAAA;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,cAAc,CAAuB,uBAAuB,CAAC,CAAA;AACtE,CAAC","sourcesContent":["import { OrganizationResource } from '../types'\nimport { App } from './use_api_client'\nimport { useSuspenseGet } from './use_suspense_api'\n\nexport const organizationRequestArgs = {\n url: '/',\n data: {\n fields: {\n Organization: ['contact_email', 'name', 'contact_phone_number'],\n },\n },\n app: 'chat' as App,\n}\n\nexport function useOrganization() {\n return useSuspenseGet<OrganizationResource>(organizationRequestArgs)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_product_analytics.d.ts","sourceRoot":"","sources":["../../src/hooks/use_product_analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use_product_analytics.d.ts","sourceRoot":"","sources":["../../src/hooks/use_product_analytics.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AAIjF,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;CAC5D;AAgFD,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,aAAkB,QAW1F;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE;IACnD,iBAAiB,CAAC,EAAE,yBAAyB,CAAA;CAC9C,GACwE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC/F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
|
-
import { SHA256, enc } from '../utils/sha_256';
|
|
3
2
|
import { useChatContext } from '../contexts/chat_context';
|
|
4
3
|
import { keysToSnakeCase } from '../utils/client/utils';
|
|
4
|
+
import { SHA256, enc } from '../utils/sha_256';
|
|
5
5
|
function contentSha256(payload) {
|
|
6
6
|
return SHA256(payload).toString(enc.Hex);
|
|
7
7
|
}
|