@planningcenter/chat-react-native 3.38.1-rc.2 → 3.38.2-qa-778.0
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/messages_disabled_banners.d.ts +6 -1
- package/build/components/conversation/messages_disabled_banners.d.ts.map +1 -1
- package/build/components/conversation/messages_disabled_banners.js +8 -2
- package/build/components/conversation/messages_disabled_banners.js.map +1 -1
- package/build/components/primitive/form_sheet.d.ts +1 -0
- package/build/components/primitive/form_sheet.d.ts.map +1 -1
- package/build/components/primitive/form_sheet.js +17 -7
- package/build/components/primitive/form_sheet.js.map +1 -1
- package/build/contexts/api_provider.js +2 -1
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/conversations_context.d.ts.map +1 -1
- package/build/contexts/conversations_context.js +6 -2
- package/build/contexts/conversations_context.js.map +1 -1
- package/build/hooks/direct_messages/use_direct_message_affiliations.d.ts +5 -0
- package/build/hooks/direct_messages/use_direct_message_affiliations.d.ts.map +1 -0
- package/build/hooks/direct_messages/use_direct_message_affiliations.js +20 -0
- package/build/hooks/direct_messages/use_direct_message_affiliations.js.map +1 -0
- package/build/hooks/direct_messages/use_direct_message_candidates.d.ts +4 -0
- package/build/hooks/direct_messages/use_direct_message_candidates.d.ts.map +1 -0
- package/build/hooks/direct_messages/use_direct_message_candidates.js +28 -0
- package/build/hooks/direct_messages/use_direct_message_candidates.js.map +1 -0
- package/build/hooks/direct_messages/use_direct_message_conversation_validate.d.ts +11 -0
- package/build/hooks/direct_messages/use_direct_message_conversation_validate.d.ts.map +1 -0
- package/build/hooks/direct_messages/use_direct_message_conversation_validate.js +25 -0
- package/build/hooks/direct_messages/use_direct_message_conversation_validate.js.map +1 -0
- package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.d.ts +13 -0
- package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.d.ts.map +1 -0
- package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.js +51 -0
- package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.js.map +1 -0
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts.map +1 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.js +2 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.js.map +1 -1
- package/build/hooks/index.d.ts +2 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/services/use_services_chat_conversation_payload.d.ts.map +1 -1
- package/build/hooks/services/use_services_chat_conversation_payload.js +2 -1
- package/build/hooks/services/use_services_chat_conversation_payload.js.map +1 -1
- package/build/hooks/use_api.d.ts +5 -1
- package/build/hooks/use_api.d.ts.map +1 -1
- package/build/hooks/use_api.js +2 -1
- package/build/hooks/use_api.js.map +1 -1
- package/build/hooks/use_chat_configuration.d.ts.map +1 -1
- package/build/hooks/use_chat_configuration.js +2 -1
- package/build/hooks/use_chat_configuration.js.map +1 -1
- package/build/hooks/use_chat_permissions.d.ts.map +1 -1
- package/build/hooks/use_chat_permissions.js +4 -1
- package/build/hooks/use_chat_permissions.js.map +1 -1
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +1 -0
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_conversation_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversation_jolt_events.js +2 -2
- package/build/hooks/use_conversation_jolt_events.js.map +1 -1
- package/build/hooks/use_current_person.d.ts.map +1 -1
- package/build/hooks/use_current_person.js +5 -2
- package/build/hooks/use_current_person.js.map +1 -1
- package/build/hooks/use_direct_messages_enabled.d.ts +2 -0
- package/build/hooks/use_direct_messages_enabled.d.ts.map +1 -0
- package/build/hooks/use_direct_messages_enabled.js +16 -0
- package/build/hooks/use_direct_messages_enabled.js.map +1 -0
- 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 +3 -1
- package/build/hooks/use_features.js.map +1 -1
- package/build/hooks/use_groups.d.ts.map +1 -1
- package/build/hooks/use_groups.js +2 -1
- package/build/hooks/use_groups.js.map +1 -1
- package/build/hooks/use_groups_groups.d.ts.map +1 -1
- package/build/hooks/use_groups_groups.js +2 -1
- package/build/hooks/use_groups_groups.js.map +1 -1
- package/build/hooks/use_has_direct_messages.d.ts +2 -0
- package/build/hooks/use_has_direct_messages.d.ts.map +1 -0
- package/build/hooks/use_has_direct_messages.js +17 -0
- package/build/hooks/use_has_direct_messages.js.map +1 -0
- package/build/hooks/use_jolt.d.ts.map +1 -1
- package/build/hooks/use_jolt.js +2 -1
- package/build/hooks/use_jolt.js.map +1 -1
- package/build/hooks/use_organization.d.ts.map +1 -1
- package/build/hooks/use_organization.js +4 -1
- package/build/hooks/use_organization.js.map +1 -1
- package/build/hooks/use_person_settings.d.ts +6 -0
- package/build/hooks/use_person_settings.d.ts.map +1 -0
- package/build/hooks/use_person_settings.js +26 -0
- package/build/hooks/use_person_settings.js.map +1 -0
- package/build/navigation/index.d.ts +39 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +19 -1
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +2 -1
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.js +20 -5
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
- package/build/screens/conversation_filters/components/rows.d.ts +2 -1
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/rows.js +2 -2
- 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 +4 -0
- package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -1
- package/build/screens/conversation_filters/filter_types.d.ts +1 -0
- package/build/screens/conversation_filters/filter_types.d.ts.map +1 -1
- package/build/screens/conversation_filters/filter_types.js +1 -0
- package/build/screens/conversation_filters/filter_types.js.map +1 -1
- package/build/screens/conversation_filters/screen_props.d.ts +1 -0
- package/build/screens/conversation_filters/screen_props.d.ts.map +1 -1
- package/build/screens/conversation_filters/screen_props.js.map +1 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +1 -1
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts +3 -0
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js +334 -0
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js.map +1 -0
- package/build/screens/conversation_select_type_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_type_screen.js +11 -17
- package/build/screens/conversation_select_type_screen.js.map +1 -1
- package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +35 -17
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts +1 -0
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/screens/get_help_screen.d.ts.map +1 -1
- package/build/screens/get_help_screen.js +2 -18
- package/build/screens/get_help_screen.js.map +1 -1
- package/build/screens/index.d.ts +1 -0
- package/build/screens/index.d.ts.map +1 -1
- package/build/screens/index.js +1 -0
- package/build/screens/index.js.map +1 -1
- package/build/screens/settings_screen.d.ts +5 -0
- package/build/screens/settings_screen.d.ts.map +1 -0
- package/build/screens/settings_screen.js +56 -0
- package/build/screens/settings_screen.js.map +1 -0
- package/build/types/jolt_events/conversation_events.d.ts +2 -0
- package/build/types/jolt_events/conversation_events.d.ts.map +1 -1
- package/build/types/jolt_events/conversation_events.js.map +1 -1
- package/build/types/resources/conversation.d.ts +2 -0
- package/build/types/resources/conversation.d.ts.map +1 -1
- package/build/types/resources/conversation.js.map +1 -1
- package/build/types/resources/direct_message_affiliations.d.ts +8 -0
- package/build/types/resources/direct_message_affiliations.d.ts.map +1 -0
- package/build/types/resources/direct_message_affiliations.js +2 -0
- package/build/types/resources/direct_message_affiliations.js.map +1 -0
- package/build/types/resources/direct_message_candidate.d.ts +12 -0
- package/build/types/resources/direct_message_candidate.d.ts.map +1 -0
- package/build/types/resources/direct_message_candidate.js +2 -0
- package/build/types/resources/direct_message_candidate.js.map +1 -0
- package/build/types/resources/index.d.ts +2 -0
- package/build/types/resources/index.d.ts.map +1 -1
- package/build/types/resources/index.js +2 -0
- package/build/types/resources/index.js.map +1 -1
- package/build/types/resources/organization.d.ts +1 -0
- package/build/types/resources/organization.d.ts.map +1 -1
- package/build/types/resources/organization.js.map +1 -1
- package/build/types/resources/person.d.ts +2 -0
- package/build/types/resources/person.d.ts.map +1 -1
- package/build/types/resources/person.js.map +1 -1
- package/build/utils/request/conversation.d.ts +2 -1
- package/build/utils/request/conversation.d.ts.map +1 -1
- package/build/utils/request/conversation.js +15 -6
- package/build/utils/request/conversation.js.map +1 -1
- package/build/utils/time.d.ts +8 -0
- package/build/utils/time.d.ts.map +1 -0
- package/build/utils/time.js +15 -0
- package/build/utils/time.js.map +1 -0
- package/package.json +3 -3
- package/src/components/conversation/messages_disabled_banners.tsx +16 -2
- package/src/components/primitive/form_sheet.tsx +23 -6
- package/src/contexts/api_provider.tsx +4 -1
- package/src/contexts/conversations_context.tsx +6 -2
- package/src/hooks/direct_messages/use_direct_message_affiliations.ts +39 -0
- package/src/hooks/direct_messages/use_direct_message_candidates.ts +31 -0
- package/src/hooks/direct_messages/use_direct_message_conversation_validate.ts +35 -0
- package/src/hooks/direct_messages/use_find_or_create_direct_message_conversation.ts +66 -0
- package/src/hooks/groups/use_group_chat_conversation_payload.ts +2 -1
- package/src/hooks/index.ts +2 -0
- package/src/hooks/services/use_services_chat_conversation_payload.ts +2 -1
- package/src/hooks/use_api.ts +10 -1
- package/src/hooks/use_chat_configuration.ts +2 -1
- package/src/hooks/use_chat_permissions.ts +4 -1
- package/src/hooks/use_conversation.ts +1 -0
- package/src/hooks/use_conversation_jolt_events.ts +3 -2
- package/src/hooks/use_current_person.ts +5 -2
- package/src/hooks/use_direct_messages_enabled.ts +23 -0
- package/src/hooks/use_features.ts +3 -1
- package/src/hooks/use_groups.ts +16 -12
- package/src/hooks/use_groups_groups.ts +19 -15
- package/src/hooks/use_has_direct_messages.ts +21 -0
- package/src/hooks/use_jolt.ts +2 -1
- package/src/hooks/use_organization.ts +4 -1
- package/src/hooks/use_person_settings.ts +29 -0
- package/src/navigation/index.tsx +27 -1
- package/src/screens/conversation_details_screen.tsx +2 -1
- package/src/screens/conversation_filters/components/conversation_filters.tsx +25 -5
- package/src/screens/conversation_filters/components/rows.tsx +16 -3
- package/src/screens/conversation_filters/context/conversation_filter_context.tsx +4 -0
- package/src/screens/conversation_filters/filter_types.ts +1 -0
- package/src/screens/conversation_filters/screen_props.ts +1 -0
- package/src/screens/conversation_screen.tsx +2 -1
- package/src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx +536 -0
- package/src/screens/conversation_select_type_screen.tsx +26 -17
- package/src/screens/conversations/components/list_header_component.tsx +84 -34
- package/src/screens/conversations/conversations_screen.tsx +1 -0
- package/src/screens/get_help_screen.tsx +2 -29
- package/src/screens/index.ts +1 -0
- package/src/screens/settings_screen.tsx +67 -0
- package/src/types/jolt_events/conversation_events.ts +2 -0
- package/src/types/resources/conversation.ts +3 -0
- package/src/types/resources/direct_message_affiliations.ts +8 -0
- package/src/types/resources/direct_message_candidate.ts +12 -0
- package/src/types/resources/index.ts +2 -0
- package/src/types/resources/organization.ts +1 -0
- package/src/types/resources/person.ts +2 -0
- package/src/utils/__tests__/conversation.test.ts +14 -0
- package/src/utils/request/conversation.ts +13 -5
- package/src/utils/time.ts +17 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ResourceObject } from '../api_primitives';
|
|
2
|
+
export interface DirectMessageCandidateResource extends ResourceObject {
|
|
3
|
+
type: 'DirectMessageCandidate';
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
avatar: string;
|
|
7
|
+
groups: number[];
|
|
8
|
+
teams: number[];
|
|
9
|
+
under_18: boolean;
|
|
10
|
+
directMessagesDisabled: boolean;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=direct_message_candidate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct_message_candidate.d.ts","sourceRoot":"","sources":["../../../src/types/resources/direct_message_candidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,8BAA+B,SAAQ,cAAc;IACpE,IAAI,EAAE,wBAAwB,CAAA;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,sBAAsB,EAAE,OAAO,CAAA;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct_message_candidate.js","sourceRoot":"","sources":["../../../src/types/resources/direct_message_candidate.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport interface DirectMessageCandidateResource extends ResourceObject {\n type: 'DirectMessageCandidate'\n id: string\n name: string\n avatar: string\n groups: number[]\n teams: number[]\n under_18: boolean\n directMessagesDisabled: boolean\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './analytics_metadata'\nexport * from './conversation'\nexport * from './conversation_membership'\nexport * from './conversation_validate'\nexport * from './member'\nexport * from './message'\nexport * from './oauth_token'\nexport * from './person'\nexport * from './groups'\nexport * from './app_grant'\nexport * from './services'\nexport * from './organization'\nexport * from './group_membership'\nexport * from './group_resource'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './analytics_metadata'\nexport * from './direct_message_affiliations'\nexport * from './direct_message_candidate'\nexport * from './conversation'\nexport * from './conversation_membership'\nexport * from './conversation_validate'\nexport * from './member'\nexport * from './message'\nexport * from './oauth_token'\nexport * from './person'\nexport * from './groups'\nexport * from './app_grant'\nexport * from './services'\nexport * from './organization'\nexport * from './group_membership'\nexport * from './group_resource'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../src/types/resources/organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,IAAI,EAAE,cAAc,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd"}
|
|
1
|
+
{"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../src/types/resources/organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,IAAI,EAAE,cAAc,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;CACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../../../src/types/resources/organization.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport interface OrganizationResource extends ResourceObject {\n type: 'Organization'\n contactEmail?: string\n name?: string\n}\n"]}
|
|
1
|
+
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../../../src/types/resources/organization.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport interface OrganizationResource extends ResourceObject {\n type: 'Organization'\n contactEmail?: string\n contactPhoneNumber?: string\n name?: string\n}\n"]}
|
|
@@ -16,5 +16,7 @@ export interface CurrentPersonResource extends PersonResource {
|
|
|
16
16
|
unreadCount: number;
|
|
17
17
|
pcoChatEnabled: boolean;
|
|
18
18
|
ageQualificationStatus?: AgeQualificationStatus;
|
|
19
|
+
directMessagesDisabled: boolean;
|
|
20
|
+
under_18: boolean;
|
|
19
21
|
}
|
|
20
22
|
//# sourceMappingURL=person.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.d.ts","sourceRoot":"","sources":["../../../src/types/resources/person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAA;AAEV,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAA;AAEtE,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,OAAO,CAAA;IACvB,sBAAsB,CAAC,EAAE,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"person.d.ts","sourceRoot":"","sources":["../../../src/types/resources/person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAA;AAEV,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAA;AAEtE,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,OAAO,CAAA;IACvB,sBAAsB,CAAC,EAAE,sBAAsB,CAAA;IAC/C,sBAAsB,EAAE,OAAO,CAAA;IAC/B,QAAQ,EAAE,OAAO,CAAA;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.js","sourceRoot":"","sources":["../../../src/types/resources/person.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,OAAO,EAAE,SAAS;CACV,CAAA","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport const AgeQualificationStatus = {\n QUALIFIED: 'qualified',\n DISQUALIFIED: 'disqualified',\n UNKNOWN: 'unknown',\n} as const\n\nexport type AgeQualificationStatus =\n (typeof AgeQualificationStatus)[keyof typeof AgeQualificationStatus]\n\nexport interface PersonResource extends ResourceObject {\n id: number\n type: 'Person'\n name: string\n avatar: string\n}\n\nexport interface CurrentPersonResource extends PersonResource {\n canChat: boolean\n unreadCount: number\n pcoChatEnabled: boolean\n ageQualificationStatus?: AgeQualificationStatus\n}\n"]}
|
|
1
|
+
{"version":3,"file":"person.js","sourceRoot":"","sources":["../../../src/types/resources/person.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,OAAO,EAAE,SAAS;CACV,CAAA","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport const AgeQualificationStatus = {\n QUALIFIED: 'qualified',\n DISQUALIFIED: 'disqualified',\n UNKNOWN: 'unknown',\n} as const\n\nexport type AgeQualificationStatus =\n (typeof AgeQualificationStatus)[keyof typeof AgeQualificationStatus]\n\nexport interface PersonResource extends ResourceObject {\n id: number\n type: 'Person'\n name: string\n avatar: string\n}\n\nexport interface CurrentPersonResource extends PersonResource {\n canChat: boolean\n unreadCount: number\n pcoChatEnabled: boolean\n ageQualificationStatus?: AgeQualificationStatus\n directMessagesDisabled: boolean\n under_18: boolean\n}\n"]}
|
|
@@ -4,6 +4,7 @@ export interface ConversationRequestArgs {
|
|
|
4
4
|
gids: string;
|
|
5
5
|
chat_group_graph_id?: GraphId;
|
|
6
6
|
group_source_app_name?: string;
|
|
7
|
+
show_direct_messages?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare const getConversationsRequestArgs: ({ gids, chat_group_graph_id, group_source_app_name, }?: Partial<ConversationRequestArgs>) => GetRequest;
|
|
9
|
+
export declare const getConversationsRequestArgs: ({ gids, chat_group_graph_id, group_source_app_name, show_direct_messages, }?: Partial<ConversationRequestArgs>) => GetRequest;
|
|
9
10
|
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B;AAED,eAAO,MAAM,2BAA2B,GAAI,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,eAAO,MAAM,2BAA2B,GAAI,8EAKzC,OAAO,CAAC,uBAAuB,CAAM,KAAG,UAkD1C,CAAA"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
export const getConversationsRequestArgs = ({ gids, chat_group_graph_id, group_source_app_name, } = {}) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export const getConversationsRequestArgs = ({ gids, chat_group_graph_id, group_source_app_name, show_direct_messages, } = {}) => {
|
|
2
|
+
let filter;
|
|
3
|
+
if (chat_group_graph_id) {
|
|
4
|
+
filter = 'group';
|
|
5
|
+
}
|
|
6
|
+
else if (show_direct_messages) {
|
|
7
|
+
filter = 'mine_or_not_empty,direct_message';
|
|
8
|
+
}
|
|
9
|
+
else if (group_source_app_name) {
|
|
10
|
+
filter = 'group_source_app_name';
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
filter = 'mine_or_not_empty';
|
|
14
|
+
}
|
|
7
15
|
return {
|
|
8
16
|
url: '/me/conversations',
|
|
9
17
|
data: {
|
|
@@ -18,6 +26,7 @@ export const getConversationsRequestArgs = ({ gids, chat_group_graph_id, group_s
|
|
|
18
26
|
'created_at',
|
|
19
27
|
'badges',
|
|
20
28
|
'disabled',
|
|
29
|
+
'disabled_reason',
|
|
21
30
|
'groups',
|
|
22
31
|
'last_message_author_id',
|
|
23
32
|
'last_message_author_name',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,IAAI,EACJ,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,MACgB,EAAE,EAAc,EAAE;IACtD,IAAI,MAAc,CAAA;IAClB,IAAI,mBAAmB,EAAE,CAAC;QACxB,MAAM,GAAG,OAAO,CAAA;IAClB,CAAC;SAAM,IAAI,oBAAoB,EAAE,CAAC;QAChC,MAAM,GAAG,kCAAkC,CAAA;IAC7C,CAAC;SAAM,IAAI,qBAAqB,EAAE,CAAC;QACjC,MAAM,GAAG,uBAAuB,CAAA;IAClC,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,mBAAmB,CAAA;IAC9B,CAAC;IAED,OAAO;QACL,GAAG,EAAE,mBAAmB;QACxB,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,eAAe;YACtB,MAAM;YACN,IAAI;YACJ,KAAK,EAAE,mBAAmB;YAC1B,qBAAqB;YACrB,MAAM,EAAE;gBACN,YAAY,EAAE;oBACZ,YAAY;oBACZ,QAAQ;oBACR,UAAU;oBACV,iBAAiB;oBACjB,QAAQ;oBACR,wBAAwB;oBACxB,0BAA0B;oBAC1B,yBAAyB;oBACzB,2BAA2B;oBAC3B,qBAAqB;oBACrB,oBAAoB;oBACpB,mBAAmB;oBACnB,qBAAqB;oBACrB,yBAAyB;oBACzB,gBAAgB;oBAChB,OAAO;oBACP,kBAAkB;oBAClB,OAAO;oBACP,cAAc;oBACd,YAAY;iBACb;gBACD,iBAAiB,EAAE,CAAC,UAAU,CAAC;gBAC/B,iBAAiB,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,MAAM,CAAC;aAC7D;YACD,OAAO,EAAE,CAAC,QAAQ,EAAE,oBAAoB,CAAC;SAC1C;KACF,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { GraphId } from '../../types/resources/group_resource'\nimport { GetRequest } from '../client/types'\n\nexport interface ConversationRequestArgs {\n gids: string\n chat_group_graph_id?: GraphId\n group_source_app_name?: string\n show_direct_messages?: boolean\n}\n\nexport const getConversationsRequestArgs = ({\n gids,\n chat_group_graph_id,\n group_source_app_name,\n show_direct_messages,\n}: Partial<ConversationRequestArgs> = {}): GetRequest => {\n let filter: string\n if (chat_group_graph_id) {\n filter = 'group'\n } else if (show_direct_messages) {\n filter = 'mine_or_not_empty,direct_message'\n } else if (group_source_app_name) {\n filter = 'group_source_app_name'\n } else {\n filter = 'mine_or_not_empty'\n }\n\n return {\n url: '/me/conversations',\n data: {\n perPage: 20,\n order: '-last_message',\n filter,\n gids,\n group: chat_group_graph_id,\n group_source_app_name,\n fields: {\n Conversation: [\n 'created_at',\n 'badges',\n 'disabled',\n 'disabled_reason',\n 'groups',\n 'last_message_author_id',\n 'last_message_author_name',\n 'last_message_created_at',\n 'last_message_text_preview',\n 'preview_avatar_urls',\n 'custom_avatar_type',\n 'custom_avatar_key',\n 'custom_avatar_color',\n 'custom_avatar_image_url',\n 'member_ability',\n 'muted',\n 'replies_disabled',\n 'title',\n 'unread_count',\n 'updated_at',\n ],\n AnalyticsMetadata: ['metadata'],\n ConversationBadge: ['app_name', 'pco_resource_type', 'text'],\n },\n include: ['badges', 'analytics_metadata'],\n },\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type TimeUnit = 'hours' | 'minutes' | 'seconds';
|
|
2
|
+
export declare function toMs(value: number, unit: TimeUnit): number;
|
|
3
|
+
export declare const FIVE_SECONDS: number;
|
|
4
|
+
export declare const FIVE_MINUTES: number;
|
|
5
|
+
export declare const THIRTY_MINUTES: number;
|
|
6
|
+
export declare const ONE_HOUR: number;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AAE/C,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAS1D;AAED,eAAO,MAAM,YAAY,QAAqB,CAAA;AAC9C,eAAO,MAAM,YAAY,QAAqB,CAAA;AAC9C,eAAO,MAAM,cAAc,QAAsB,CAAA;AACjD,eAAO,MAAM,QAAQ,QAAmB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function toMs(value, unit) {
|
|
2
|
+
switch (unit) {
|
|
3
|
+
case 'hours':
|
|
4
|
+
return value * 60 * 60 * 1000;
|
|
5
|
+
case 'minutes':
|
|
6
|
+
return value * 60 * 1000;
|
|
7
|
+
case 'seconds':
|
|
8
|
+
return value * 1000;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export const FIVE_SECONDS = toMs(5, 'seconds');
|
|
12
|
+
export const FIVE_MINUTES = toMs(5, 'minutes');
|
|
13
|
+
export const THIRTY_MINUTES = toMs(30, 'minutes');
|
|
14
|
+
export const ONE_HOUR = toMs(1, 'hours');
|
|
15
|
+
//# sourceMappingURL=time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,IAAI,CAAC,KAAa,EAAE,IAAc;IAChD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,OAAO;YACV,OAAO,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;QAC/B,KAAK,SAAS;YACZ,OAAO,KAAK,GAAG,EAAE,GAAG,IAAI,CAAA;QAC1B,KAAK,SAAS;YACZ,OAAO,KAAK,GAAG,IAAI,CAAA;IACvB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;AAC9C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAA;AACjD,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA","sourcesContent":["type TimeUnit = 'hours' | 'minutes' | 'seconds'\n\nexport function toMs(value: number, unit: TimeUnit): number {\n switch (unit) {\n case 'hours':\n return value * 60 * 60 * 1000\n case 'minutes':\n return value * 60 * 1000\n case 'seconds':\n return value * 1000\n }\n}\n\nexport const FIVE_SECONDS = toMs(5, 'seconds')\nexport const FIVE_MINUTES = toMs(5, 'minutes')\nexport const THIRTY_MINUTES = toMs(30, 'minutes')\nexport const ONE_HOUR = toMs(1, 'hours')\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.38.
|
|
3
|
+
"version": "3.38.2-qa-778.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"react-native": "./src/index.tsx",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
28
28
|
"@fortawesome/react-native-fontawesome": "^0.3.2",
|
|
29
|
-
"@planningcenter/emoji-keyboard": "3.38.0",
|
|
29
|
+
"@planningcenter/emoji-keyboard": "3.38.2-qa-778.0",
|
|
30
30
|
"lodash-inflection": "^1.5.0",
|
|
31
31
|
"react-compiler-runtime": "^1.0.0"
|
|
32
32
|
},
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"react-native-url-polyfill": "^2.0.0",
|
|
73
73
|
"typescript": "~5.9.2"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "67db204fc2b066439bc894fc560279a05a9def76"
|
|
76
76
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StyleSheet, View, type ViewStyle } from 'react-native'
|
|
2
2
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
3
3
|
import { useTheme } from '../../hooks'
|
|
4
|
+
import type { ConversationDisabledReason } from '../../types'
|
|
4
5
|
import { ADULT_REQUIREMENT_BODY } from '../../utils'
|
|
5
6
|
import { Text } from '../display'
|
|
6
7
|
|
|
@@ -21,10 +22,23 @@ export const MemberMessagesDisabledBanner = () => {
|
|
|
21
22
|
)
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
const DISABLED_REASON_TEXT: Record<ConversationDisabledReason, string> = {
|
|
26
|
+
safety_check: ADULT_REQUIREMENT_BODY,
|
|
27
|
+
direct_messages_disabled: 'Direct messages have been turned off by someone in this conversation.',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const DEFAULT_DISABLED_TEXT = 'This conversation has been disabled.'
|
|
31
|
+
|
|
32
|
+
interface ConversationDisabledBannerProps {
|
|
33
|
+
disabledReason?: ConversationDisabledReason
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const ConversationDisabledBanner = ({ disabledReason }: ConversationDisabledBannerProps) => {
|
|
25
37
|
const styles = useStyles()
|
|
38
|
+
const description =
|
|
39
|
+
(disabledReason && DISABLED_REASON_TEXT[disabledReason]) ?? DEFAULT_DISABLED_TEXT
|
|
26
40
|
|
|
27
|
-
return <MessagesDisabledBanner description={
|
|
41
|
+
return <MessagesDisabledBanner description={description} style={styles.memberBanner} />
|
|
28
42
|
}
|
|
29
43
|
|
|
30
44
|
interface MessagesDisabledBannerProps {
|
|
@@ -242,6 +242,7 @@ interface FormSheetActionProps {
|
|
|
242
242
|
accessibilityRole?: AccessibilityRole
|
|
243
243
|
appearance?: FormSheetActionAppearanceUnion
|
|
244
244
|
disabled?: boolean
|
|
245
|
+
disabledReason?: string
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
function FormSheetAction({
|
|
@@ -253,14 +254,17 @@ function FormSheetAction({
|
|
|
253
254
|
accessibilityRole = 'button',
|
|
254
255
|
appearance = 'neutral',
|
|
255
256
|
disabled = false,
|
|
257
|
+
disabledReason,
|
|
256
258
|
}: FormSheetActionProps) {
|
|
257
|
-
const styles = useStyles({ appearance })
|
|
259
|
+
const styles = useStyles({ appearance, disabled })
|
|
258
260
|
|
|
259
261
|
return (
|
|
260
262
|
<PlatformPressable
|
|
261
263
|
onPress={onPress}
|
|
262
264
|
accessibilityLabel={accessibilityLabel}
|
|
263
|
-
accessibilityHint={
|
|
265
|
+
accessibilityHint={
|
|
266
|
+
accessibilityHint ?? (disabled && disabledReason ? disabledReason : undefined)
|
|
267
|
+
}
|
|
264
268
|
accessibilityRole={accessibilityRole}
|
|
265
269
|
style={styles.actionPressable}
|
|
266
270
|
disabled={disabled}
|
|
@@ -268,7 +272,12 @@ function FormSheetAction({
|
|
|
268
272
|
{iconName && (
|
|
269
273
|
<Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />
|
|
270
274
|
)}
|
|
271
|
-
<
|
|
275
|
+
<View style={styles.actionTextBlock}>
|
|
276
|
+
<Text style={styles.actionTitle}>{title}</Text>
|
|
277
|
+
{disabled && disabledReason && (
|
|
278
|
+
<Text style={styles.actionDisabledReason}>{disabledReason}</Text>
|
|
279
|
+
)}
|
|
280
|
+
</View>
|
|
272
281
|
</PlatformPressable>
|
|
273
282
|
)
|
|
274
283
|
}
|
|
@@ -281,9 +290,10 @@ FormSheetAction.displayName = 'FormSheet.Action'
|
|
|
281
290
|
|
|
282
291
|
interface Styles {
|
|
283
292
|
appearance?: FormSheetActionAppearanceUnion
|
|
293
|
+
disabled?: boolean
|
|
284
294
|
}
|
|
285
295
|
|
|
286
|
-
const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
|
|
296
|
+
const useStyles = ({ appearance = 'neutral', disabled = false }: Styles = {}) => {
|
|
287
297
|
const { colors } = useTheme()
|
|
288
298
|
const { height } = useWindowDimensions()
|
|
289
299
|
const { bottom, top } = useSafeAreaInsets()
|
|
@@ -368,10 +378,17 @@ const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
|
|
|
368
378
|
gap: 8,
|
|
369
379
|
},
|
|
370
380
|
actionIcon: {
|
|
371
|
-
color: appearanceColorsMap[appearance].iconColor,
|
|
381
|
+
color: disabled ? colors.textColorDefaultDisabled : appearanceColorsMap[appearance].iconColor,
|
|
382
|
+
},
|
|
383
|
+
actionTextBlock: {
|
|
384
|
+
flex: 1,
|
|
372
385
|
},
|
|
373
386
|
actionTitle: {
|
|
374
|
-
color: appearanceColorsMap[appearance].textColor,
|
|
387
|
+
color: disabled ? colors.textColorDefaultDisabled : appearanceColorsMap[appearance].textColor,
|
|
388
|
+
},
|
|
389
|
+
actionDisabledReason: {
|
|
390
|
+
color: colors.textColorDefaultDisabled,
|
|
391
|
+
fontSize: 12,
|
|
375
392
|
},
|
|
376
393
|
})
|
|
377
394
|
}
|
|
@@ -95,7 +95,10 @@ function useSessionChanged(value: Pick<ChatContextValue, 'token' | 'env'>): bool
|
|
|
95
95
|
const isInitialLogin = !prevToken && !!newToken
|
|
96
96
|
if (isInitialLogin) return false
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
const tokenChanged = Boolean(
|
|
99
|
+
prevToken?.access_token && newToken?.access_token !== prevToken?.access_token
|
|
100
|
+
)
|
|
101
|
+
return tokenChanged || Boolean(prevEnv && newEnv !== prevEnv)
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
function usePrevious<T>(value: T): T {
|
|
@@ -39,9 +39,13 @@ export const ConversationsContextProvider = ({
|
|
|
39
39
|
args = {},
|
|
40
40
|
}: PropsWithChildren<{ args: ConversationFiltersParams }>) => {
|
|
41
41
|
const [activeConversationId, setActiveConversationId] = useState<number | undefined>()
|
|
42
|
-
const { chat_group_graph_id, group_source_app_name } = args
|
|
42
|
+
const { chat_group_graph_id, group_source_app_name, show_direct_messages } = args
|
|
43
43
|
|
|
44
|
-
const query = useConversations({
|
|
44
|
+
const query = useConversations({
|
|
45
|
+
chat_group_graph_id,
|
|
46
|
+
group_source_app_name,
|
|
47
|
+
show_direct_messages,
|
|
48
|
+
})
|
|
45
49
|
|
|
46
50
|
const value = useMemo(
|
|
47
51
|
() => ({
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
import { useMemo } from 'react'
|
|
3
|
+
import { ApiResource } from '../../types'
|
|
4
|
+
import { DirectMessageAffiliationsResource } from '../../types/resources/direct_message_affiliations'
|
|
5
|
+
import { useApiClient } from '../use_api_client'
|
|
6
|
+
|
|
7
|
+
export function useDirectMessageAffiliations() {
|
|
8
|
+
const apiClient = useApiClient()
|
|
9
|
+
|
|
10
|
+
const { data } = useQuery({
|
|
11
|
+
queryKey: ['chat', '/me/direct_message_affiliations'],
|
|
12
|
+
queryFn: () =>
|
|
13
|
+
apiClient.chat.get({
|
|
14
|
+
url: '/me/direct_message_affiliations',
|
|
15
|
+
data: {
|
|
16
|
+
fields: { DirectMessageAffiliations: ['groups', 'teams'] },
|
|
17
|
+
},
|
|
18
|
+
}) as Promise<ApiResource<DirectMessageAffiliationsResource>>,
|
|
19
|
+
staleTime: 5 * 60 * 1000,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const groups = useMemo(
|
|
23
|
+
() =>
|
|
24
|
+
new Map<number, string>(
|
|
25
|
+
Object.entries(data?.data?.groups ?? {}).map(([id, name]) => [+id, name])
|
|
26
|
+
),
|
|
27
|
+
[data]
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const teams = useMemo(
|
|
31
|
+
() =>
|
|
32
|
+
new Map<number, string>(
|
|
33
|
+
Object.entries(data?.data?.teams ?? {}).map(([id, name]) => [+id, name])
|
|
34
|
+
),
|
|
35
|
+
[data]
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
return { groups, teams }
|
|
39
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
import { ApiCollection } from '../../types'
|
|
3
|
+
import { DirectMessageCandidateResource } from '../../types/resources/direct_message_candidate'
|
|
4
|
+
import { useApiClient } from '../use_api_client'
|
|
5
|
+
|
|
6
|
+
export function useDirectMessageCandidates(term: string) {
|
|
7
|
+
const apiClient = useApiClient()
|
|
8
|
+
return useQuery({
|
|
9
|
+
queryKey: ['chat', '/me/direct_message_candidates', term],
|
|
10
|
+
queryFn: () =>
|
|
11
|
+
apiClient.chat.get({
|
|
12
|
+
url: '/me/direct_message_candidates',
|
|
13
|
+
data: {
|
|
14
|
+
q: term,
|
|
15
|
+
fields: {
|
|
16
|
+
DirectMessageCandidate: [
|
|
17
|
+
'name',
|
|
18
|
+
'avatar',
|
|
19
|
+
'groups',
|
|
20
|
+
'teams',
|
|
21
|
+
'under_18',
|
|
22
|
+
'direct_messages_disabled',
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}) as Promise<ApiCollection<DirectMessageCandidateResource>>,
|
|
27
|
+
enabled: term.length >= 1,
|
|
28
|
+
staleTime: 1000 * 60,
|
|
29
|
+
throwOnError: true,
|
|
30
|
+
})
|
|
31
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
import { ApiResource, ConversationValidateResource, ConversationWarning } from '../../types'
|
|
3
|
+
import { useApiClient } from '../use_api_client'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
recipientIds: string[]
|
|
7
|
+
enabled?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function useDirectMessageConversationValidate({ recipientIds, enabled = true }: Props) {
|
|
11
|
+
const apiClient = useApiClient()
|
|
12
|
+
|
|
13
|
+
const { data, isLoading } = useQuery({
|
|
14
|
+
queryKey: ['chat', '/me/conversation_validate', { recipient_ids: recipientIds }],
|
|
15
|
+
queryFn: () =>
|
|
16
|
+
apiClient.chat.post<ApiResource<ConversationValidateResource>>({
|
|
17
|
+
url: '/me/conversation_validate',
|
|
18
|
+
data: {
|
|
19
|
+
data: {
|
|
20
|
+
type: 'ConversationValidate',
|
|
21
|
+
attributes: { recipient_ids: recipientIds },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
enabled: enabled && recipientIds.length > 0,
|
|
26
|
+
retry: false,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const warnings: ConversationWarning[] = data?.data.warnings ?? []
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
warnings,
|
|
33
|
+
validationPending: enabled && recipientIds.length > 0 && isLoading,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
import { useState, useCallback } from 'react'
|
|
3
|
+
import { ApiCollection, ApiResource, ConversationResource } from '../../types'
|
|
4
|
+
import { ApiClient, useApiClient } from '../use_api_client'
|
|
5
|
+
|
|
6
|
+
const findDirectMessageConversation = (apiClient: ApiClient, participantIds: string[]) =>
|
|
7
|
+
apiClient.chat.get({
|
|
8
|
+
url: '/me/conversations',
|
|
9
|
+
data: {
|
|
10
|
+
fields: { Conversation: ['title'] },
|
|
11
|
+
filter: 'with_exact_direct_message_participants',
|
|
12
|
+
participant_ids: participantIds.join(','),
|
|
13
|
+
},
|
|
14
|
+
}) as Promise<ApiCollection<ConversationResource>>
|
|
15
|
+
|
|
16
|
+
const createDirectMessageConversation = (apiClient: ApiClient, ids: string[]) =>
|
|
17
|
+
apiClient.chat.post({
|
|
18
|
+
url: '/me/direct_messages',
|
|
19
|
+
data: {
|
|
20
|
+
data: {
|
|
21
|
+
type: 'DirectMessage',
|
|
22
|
+
attributes: { recipients: ids },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
}) as Promise<ApiResource<ConversationResource>>
|
|
26
|
+
|
|
27
|
+
interface Props {
|
|
28
|
+
recipientIds: string[]
|
|
29
|
+
onSuccess: (conversationId: ConversationResource['id']) => void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function useFindOrCreateDirectMessageConversation({ recipientIds, onSuccess }: Props) {
|
|
33
|
+
const apiClient = useApiClient()
|
|
34
|
+
const [isFinding, setIsFinding] = useState(false)
|
|
35
|
+
const [isError, setIsError] = useState(false)
|
|
36
|
+
|
|
37
|
+
const { data } = useQuery({
|
|
38
|
+
queryKey: ['chat', '/me/conversations', 'with_exact_direct_message_participants', recipientIds],
|
|
39
|
+
queryFn: () => findDirectMessageConversation(apiClient, recipientIds),
|
|
40
|
+
enabled: recipientIds.length > 0,
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const directMessageExists = (data?.data.length ?? 0) > 0
|
|
44
|
+
|
|
45
|
+
const findOrCreateConversation = useCallback(
|
|
46
|
+
async (participantIds: string[]) => {
|
|
47
|
+
setIsFinding(true)
|
|
48
|
+
setIsError(false)
|
|
49
|
+
try {
|
|
50
|
+
const findResponse = await findDirectMessageConversation(apiClient, participantIds)
|
|
51
|
+
if (findResponse.data.length > 0) {
|
|
52
|
+
onSuccess(findResponse.data[0].id)
|
|
53
|
+
} else {
|
|
54
|
+
const createResponse = await createDirectMessageConversation(apiClient, participantIds)
|
|
55
|
+
onSuccess(createResponse.data.id)
|
|
56
|
+
}
|
|
57
|
+
} catch {
|
|
58
|
+
setIsError(true)
|
|
59
|
+
setIsFinding(false)
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
[apiClient, onSuccess]
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
return { findOrCreateConversation, directMessageExists, isFinding, isError }
|
|
66
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query'
|
|
2
2
|
import { ApiResource, ResourceObject } from '../../types'
|
|
3
|
+
import { toMs } from '../../utils/time'
|
|
3
4
|
import { useApiClient } from '../use_api_client'
|
|
4
5
|
|
|
5
|
-
const STALE_TIME_MS = 25
|
|
6
|
+
const STALE_TIME_MS = toMs(25, 'minutes') // under Groups' 30-min server-side expiry
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
8
9
|
groupId: number
|
package/src/hooks/index.ts
CHANGED
|
@@ -8,7 +8,9 @@ export * from './use_chat_permissions'
|
|
|
8
8
|
export * from './use_create_android_ripple_color'
|
|
9
9
|
export * from './use_current_person'
|
|
10
10
|
export * from './use_deleting_ids'
|
|
11
|
+
export * from './use_direct_messages_enabled'
|
|
11
12
|
export * from './use_font_scale'
|
|
13
|
+
export * from './use_has_direct_messages'
|
|
12
14
|
export * from './use_groups_groups'
|
|
13
15
|
export * from './use_groups'
|
|
14
16
|
export * from './use_interaction_ghost_color'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
import { toMs } from '../../utils/time'
|
|
2
3
|
import { useApiClient } from '../use_api_client'
|
|
3
4
|
import { getServicesChatConversationPayload } from './use_find_or_create_services_conversation'
|
|
4
5
|
|
|
5
|
-
const STALE_TIME_MS = 55
|
|
6
|
+
const STALE_TIME_MS = toMs(55, 'minutes') // under Services' 1-hour server-side expiry
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
8
9
|
teamIds: number[]
|
package/src/hooks/use_api.ts
CHANGED
|
@@ -17,7 +17,15 @@ interface ApiGetOptions extends GetRequest {
|
|
|
17
17
|
enabled?: boolean
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
type UseApiGetOptions = {
|
|
21
|
+
staleTime?: number
|
|
22
|
+
gcTime?: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const useApiGet = <T extends ResourceObject | ResourceObject[]>(
|
|
26
|
+
args: ApiGetOptions,
|
|
27
|
+
opts?: UseApiGetOptions
|
|
28
|
+
) => {
|
|
21
29
|
type Resource = ApiResource<T>
|
|
22
30
|
const { session } = useContext(ChatContext)
|
|
23
31
|
const apiClient = useApiClient()
|
|
@@ -32,6 +40,7 @@ export const useApiGet = <T extends ResourceObject | ResourceObject[]>(args: Api
|
|
|
32
40
|
return apiClient[app].get({ url, data: d, headers }) as Promise<Resource>
|
|
33
41
|
},
|
|
34
42
|
enabled,
|
|
43
|
+
...opts,
|
|
35
44
|
})
|
|
36
45
|
|
|
37
46
|
return { ...data, ...query }
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
getChatConfigurationRequestArgs,
|
|
6
6
|
getChatConfigurationQueryKey,
|
|
7
7
|
} from '../utils/request/get_chat_configuration'
|
|
8
|
+
import { ONE_HOUR } from '../utils/time'
|
|
8
9
|
import {
|
|
9
10
|
FALLBACK_ALLOWED_FILE_EXTENSIONS,
|
|
10
11
|
FALLBACK_ALLOWED_MIME_TYPES,
|
|
@@ -28,7 +29,7 @@ export function useChatConfiguration() {
|
|
|
28
29
|
.get<ApiResource<ChatConfigurationResource>>(requestArgs)
|
|
29
30
|
.catch(() => stableFallbackConfiguration)
|
|
30
31
|
},
|
|
31
|
-
staleTime:
|
|
32
|
+
staleTime: ONE_HOUR,
|
|
32
33
|
})
|
|
33
34
|
|
|
34
35
|
const attrs = data.data
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AppGrantsResource } from '../types'
|
|
2
|
+
import { FIVE_MINUTES } from '../utils/time'
|
|
2
3
|
import { useApiGet } from './use_api'
|
|
3
4
|
import { App } from './use_api_client'
|
|
4
5
|
|
|
@@ -13,7 +14,9 @@ export const appGrantsRequestArgs = {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export function useAppGrants() {
|
|
16
|
-
return useApiGet<AppGrantsResource[]>(appGrantsRequestArgs
|
|
17
|
+
return useApiGet<AppGrantsResource[]>(appGrantsRequestArgs, {
|
|
18
|
+
staleTime: FIVE_MINUTES,
|
|
19
|
+
})
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
export function useCanCreateConversations(): boolean {
|