@planningcenter/chat-react-native 4.3.0-rc.9 → 4.3.1-qa-989.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/attachments/giphy_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/giphy_attachment.js +2 -2
- 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 +5 -3
- package/build/components/conversation/attachments/image_attachment.js.map +1 -1
- package/build/components/conversation/message.d.ts +3 -1
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +183 -158
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +3 -3
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversation/message_list.d.ts.map +1 -1
- package/build/components/conversation/message_list.js +143 -88
- package/build/components/conversation/message_list.js.map +1 -1
- package/build/components/conversation/system_message.js +3 -3
- package/build/components/conversation/system_message.js.map +1 -1
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +0 -6
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +28 -25
- package/build/contexts/api_provider.js.map +1 -1
- package/build/hooks/use_animated_message_background_color.d.ts +1 -0
- package/build/hooks/use_animated_message_background_color.d.ts.map +1 -1
- package/build/hooks/use_animated_message_background_color.js +26 -9
- package/build/hooks/use_animated_message_background_color.js.map +1 -1
- package/build/hooks/use_chat_permissions.d.ts +10 -2
- package/build/hooks/use_chat_permissions.d.ts.map +1 -1
- package/build/hooks/use_chat_permissions.js +8 -0
- package/build/hooks/use_chat_permissions.js.map +1 -1
- package/build/hooks/use_debounced_search_term.d.ts +2 -0
- package/build/hooks/use_debounced_search_term.d.ts.map +1 -0
- package/build/hooks/use_debounced_search_term.js +40 -0
- package/build/hooks/use_debounced_search_term.js.map +1 -0
- package/build/hooks/use_features.d.ts +2 -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_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_product_analytics.d.ts +9 -0
- package/build/hooks/use_product_analytics.d.ts.map +1 -1
- package/build/hooks/use_product_analytics.js +4 -2
- package/build/hooks/use_product_analytics.js.map +1 -1
- package/build/hooks/use_search_enabled.d.ts +2 -0
- package/build/hooks/use_search_enabled.d.ts.map +1 -0
- package/build/hooks/use_search_enabled.js +18 -0
- package/build/hooks/use_search_enabled.js.map +1 -0
- package/build/hooks/use_search_results.d.ts +19 -0
- package/build/hooks/use_search_results.d.ts.map +1 -0
- package/build/hooks/use_search_results.js +153 -0
- package/build/hooks/use_search_results.js.map +1 -0
- package/build/screens/age_check/age_check_underage_screen.d.ts.map +1 -1
- package/build/screens/age_check/age_check_underage_screen.js +2 -1
- package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
- package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -1
- package/build/screens/attachment_actions/attachment_actions_screen.js +5 -2
- package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
- package/build/screens/bug_report_screen.d.ts.map +1 -1
- package/build/screens/bug_report_screen.js +2 -2
- package/build/screens/bug_report_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts +2 -1
- package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/components/view_more_link_row.js +39 -24
- package/build/screens/conversation_select_recipients/components/view_more_link_row.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js +142 -158
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js.map +1 -1
- package/build/screens/conversations/components/search_list_header_component.js +3 -3
- package/build/screens/conversations/components/search_list_header_component.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js +2 -5
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/screens/get_help_screen.js +2 -2
- package/build/screens/get_help_screen.js.map +1 -1
- package/build/screens/message_actions_screen.js +6 -2
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/screens/search/components/conversation_result_row.d.ts +8 -0
- package/build/screens/search/components/conversation_result_row.d.ts.map +1 -0
- package/build/screens/search/components/conversation_result_row.js +80 -0
- package/build/screens/search/components/conversation_result_row.js.map +1 -0
- package/build/screens/search/components/conversation_results.d.ts +8 -0
- package/build/screens/search/components/conversation_results.d.ts.map +1 -0
- package/build/screens/search/components/conversation_results.js +77 -0
- package/build/screens/search/components/conversation_results.js.map +1 -0
- package/build/screens/search/components/message_result_row.d.ts +8 -0
- package/build/screens/search/components/message_result_row.d.ts.map +1 -0
- package/build/screens/search/components/message_result_row.js +152 -0
- package/build/screens/search/components/message_result_row.js.map +1 -0
- package/build/screens/search/components/result_row.d.ts +10 -0
- package/build/screens/search/components/result_row.d.ts.map +1 -0
- package/build/screens/search/components/result_row.js +102 -0
- package/build/screens/search/components/result_row.js.map +1 -0
- package/build/screens/search/components/results_section.d.ts +9 -0
- package/build/screens/search/components/results_section.d.ts.map +1 -0
- package/build/screens/search/components/results_section.js +51 -0
- package/build/screens/search/components/results_section.js.map +1 -0
- package/build/screens/search/components/search_results_list.d.ts +13 -0
- package/build/screens/search/components/search_results_list.d.ts.map +1 -0
- package/build/screens/search/components/search_results_list.js +344 -0
- package/build/screens/search/components/search_results_list.js.map +1 -0
- package/build/screens/search/components/snippet.d.ts +8 -0
- package/build/screens/search/components/snippet.d.ts.map +1 -0
- package/build/screens/search/components/snippet.js +68 -0
- package/build/screens/search/components/snippet.js.map +1 -0
- package/build/screens/search/search_screen.d.ts.map +1 -1
- package/build/screens/search/search_screen.js +92 -20
- package/build/screens/search/search_screen.js.map +1 -1
- package/build/utils/client/request_helpers.js +1 -1
- package/build/utils/client/request_helpers.js.map +1 -1
- package/build/utils/native_adapters/linking.d.ts +11 -3
- package/build/utils/native_adapters/linking.d.ts.map +1 -1
- package/build/utils/native_adapters/linking.js.map +1 -1
- package/build/utils/response_error.d.ts +1 -1
- package/build/utils/response_error.d.ts.map +1 -1
- package/build/utils/response_error.js +1 -1
- package/build/utils/response_error.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/components/conversation/attachments/giphy_attachment.test.tsx +76 -0
- package/src/__tests__/contexts/api_provider.test.tsx +50 -0
- package/src/__tests__/screens/attachment_actions_screen.test.tsx +81 -0
- package/src/__tests__/screens/get_help_screen.test.ts +36 -0
- package/src/__tests__/screens/message_actions_screen.test.tsx +136 -0
- package/src/__tests__/utils/client.ts +3 -4
- package/src/components/conversation/__tests__/message_form.test.tsx +83 -0
- package/src/components/conversation/__tests__/message_list.test.tsx +71 -3
- package/src/components/conversation/attachments/giphy_attachment.tsx +2 -3
- package/src/components/conversation/attachments/image_attachment.tsx +2 -3
- package/src/components/conversation/message.tsx +12 -1
- package/src/components/conversation/message_form.tsx +2 -2
- package/src/components/conversation/message_list.tsx +26 -1
- package/src/components/conversation/system_message.tsx +3 -3
- package/src/components/conversations/conversations.tsx +0 -7
- package/src/contexts/__tests__/api_provider.test.tsx +106 -0
- package/src/contexts/api_provider.tsx +6 -9
- package/src/hooks/__tests__/use_debounced_search_term.test.tsx +38 -0
- package/src/hooks/__tests__/use_jolt.test.tsx +70 -0
- package/src/hooks/__tests__/use_search_results.test.tsx +88 -0
- package/src/hooks/use_animated_message_background_color.ts +37 -12
- package/src/hooks/use_chat_permissions.ts +15 -2
- package/src/hooks/use_debounced_search_term.ts +20 -0
- package/src/hooks/use_features.ts +2 -0
- package/src/hooks/use_jolt.ts +10 -7
- package/src/hooks/use_product_analytics.ts +3 -1
- package/src/hooks/use_search_enabled.ts +9 -0
- package/src/hooks/use_search_results.ts +78 -0
- package/src/screens/age_check/age_check_underage_screen.tsx +2 -1
- package/src/screens/attachment_actions/attachment_actions_screen.tsx +3 -2
- package/src/screens/bug_report_screen.tsx +2 -10
- package/src/screens/conversation_select_recipients/components/view_more_link_row.tsx +12 -3
- package/src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx +3 -8
- package/src/screens/conversations/__tests__/conversations_screen.test.tsx +71 -0
- package/src/screens/conversations/components/search_list_header_component.tsx +1 -1
- package/src/screens/conversations/conversations_screen.tsx +2 -3
- package/src/screens/get_help_screen.tsx +2 -2
- package/src/screens/message_actions_screen.tsx +6 -2
- package/src/screens/search/__tests__/search_screen.test.tsx +194 -0
- package/src/screens/search/components/__tests__/conversation_results.test.tsx +55 -0
- package/src/screens/search/components/__tests__/message_result_row.test.tsx +65 -0
- package/src/screens/search/components/__tests__/result_row.test.tsx +33 -0
- package/src/screens/search/components/__tests__/search_results_list.test.tsx +180 -0
- package/src/screens/search/components/conversation_result_row.tsx +36 -0
- package/src/screens/search/components/conversation_results.tsx +43 -0
- package/src/screens/search/components/message_result_row.tsx +48 -0
- package/src/screens/search/components/result_row.tsx +58 -0
- package/src/screens/search/components/results_section.tsx +34 -0
- package/src/screens/search/components/search_results_list.tsx +168 -0
- package/src/screens/search/components/snippet.tsx +37 -0
- package/src/screens/search/search_screen.tsx +50 -4
- package/src/utils/__tests__/response_error.test.ts +7 -2
- package/src/utils/client/__tests__/request_helpers.test.ts +40 -0
- package/src/utils/client/request_helpers.ts +1 -1
- package/src/utils/native_adapters/__tests__/linking.test.ts +12 -0
- package/src/utils/native_adapters/linking.ts +12 -3
- package/src/utils/response_error.ts +2 -2
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { useNavigation } from '@react-navigation/native';
|
|
3
|
+
import React, { useRef, useState } from 'react';
|
|
4
|
+
import { Keyboard, StyleSheet, View } from 'react-native';
|
|
4
5
|
import { KeyboardView } from '../../components';
|
|
5
6
|
import { composeOptions, withMinimalBack } from '../../components/display/platform_modal_header_buttons';
|
|
7
|
+
import { useDebouncedSearchTerm } from '../../hooks/use_debounced_search_term';
|
|
8
|
+
import { analyticsEvents, useProductAnalytics } from '../../hooks/use_product_analytics';
|
|
6
9
|
import { SearchPromptBlankState } from './components/search_blank_states';
|
|
7
10
|
import { SearchField } from './components/search_field';
|
|
11
|
+
import { SearchResultsList } from './components/search_results_list';
|
|
8
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
13
|
export const SearchScreenOptions = ({
|
|
10
14
|
navigation
|
|
@@ -15,41 +19,109 @@ export const SearchScreenOptions = ({
|
|
|
15
19
|
onPress: () => navigation.goBack()
|
|
16
20
|
}));
|
|
17
21
|
export function SearchScreen() {
|
|
18
|
-
const $ = _c(
|
|
22
|
+
const $ = _c(15);
|
|
23
|
+
const navigation = useNavigation();
|
|
19
24
|
const [term, setTerm] = useState("");
|
|
25
|
+
const debouncedTerm = useDebouncedSearchTerm(term);
|
|
26
|
+
const {
|
|
27
|
+
publishEvent
|
|
28
|
+
} = useProductAnalytics();
|
|
20
29
|
let t0;
|
|
21
|
-
if ($[0]
|
|
22
|
-
t0 =
|
|
23
|
-
|
|
24
|
-
onChange: setTerm
|
|
25
|
-
});
|
|
26
|
-
$[0] = term;
|
|
27
|
-
$[1] = t0;
|
|
30
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
31
|
+
t0 = new Set();
|
|
32
|
+
$[0] = t0;
|
|
28
33
|
} else {
|
|
29
|
-
t0 = $[
|
|
34
|
+
t0 = $[0];
|
|
30
35
|
}
|
|
36
|
+
const publishedTerms = useRef(t0);
|
|
31
37
|
let t1;
|
|
32
|
-
if ($[
|
|
33
|
-
t1 =
|
|
38
|
+
if ($[1] !== publishEvent) {
|
|
39
|
+
t1 = (settledTerm, counts) => {
|
|
40
|
+
if (publishedTerms.current.has(settledTerm)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
publishedTerms.current.add(settledTerm);
|
|
44
|
+
publishEvent(analyticsEvents.search_performed, {
|
|
45
|
+
term_length: settledTerm.length,
|
|
46
|
+
conversation_result_count: counts.conversationResultCount,
|
|
47
|
+
message_result_count: counts.messageResultCount
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
$[1] = publishEvent;
|
|
34
51
|
$[2] = t1;
|
|
35
52
|
} else {
|
|
36
53
|
t1 = $[2];
|
|
37
54
|
}
|
|
55
|
+
const publishSearch = t1;
|
|
38
56
|
let t2;
|
|
39
|
-
if ($[3] !==
|
|
40
|
-
t2 =
|
|
57
|
+
if ($[3] !== navigation || $[4] !== publishEvent) {
|
|
58
|
+
t2 = (result, position) => {
|
|
59
|
+
Keyboard.dismiss();
|
|
60
|
+
publishEvent(analyticsEvents.search_result_opened, {
|
|
61
|
+
result_type: result.type,
|
|
62
|
+
position
|
|
63
|
+
});
|
|
64
|
+
if (result.type === "conversation") {
|
|
65
|
+
navigation.navigate("Conversation", {
|
|
66
|
+
conversation_id: Number(result.id),
|
|
67
|
+
title: result.title
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
navigation.navigate("Conversation", {
|
|
71
|
+
conversation_id: result.extra.conversationId,
|
|
72
|
+
initial_message_id: result.id,
|
|
73
|
+
title: result.title
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
$[3] = navigation;
|
|
78
|
+
$[4] = publishEvent;
|
|
79
|
+
$[5] = t2;
|
|
80
|
+
} else {
|
|
81
|
+
t2 = $[5];
|
|
82
|
+
}
|
|
83
|
+
const openResult = t2;
|
|
84
|
+
let t3;
|
|
85
|
+
if ($[6] !== term) {
|
|
86
|
+
t3 = /*#__PURE__*/_jsx(SearchField, {
|
|
87
|
+
term: term,
|
|
88
|
+
onChange: setTerm
|
|
89
|
+
});
|
|
90
|
+
$[6] = term;
|
|
91
|
+
$[7] = t3;
|
|
92
|
+
} else {
|
|
93
|
+
t3 = $[7];
|
|
94
|
+
}
|
|
95
|
+
let t4;
|
|
96
|
+
if ($[8] !== debouncedTerm || $[9] !== openResult || $[10] !== publishSearch) {
|
|
97
|
+
t4 = debouncedTerm.length > 0 ? /*#__PURE__*/_jsx(SearchResultsList, {
|
|
98
|
+
term: debouncedTerm,
|
|
99
|
+
onSelect: openResult,
|
|
100
|
+
onSettled: publishSearch
|
|
101
|
+
}, debouncedTerm) : /*#__PURE__*/_jsx(SearchPromptBlankState, {});
|
|
102
|
+
$[8] = debouncedTerm;
|
|
103
|
+
$[9] = openResult;
|
|
104
|
+
$[10] = publishSearch;
|
|
105
|
+
$[11] = t4;
|
|
106
|
+
} else {
|
|
107
|
+
t4 = $[11];
|
|
108
|
+
}
|
|
109
|
+
let t5;
|
|
110
|
+
if ($[12] !== t3 || $[13] !== t4) {
|
|
111
|
+
t5 = /*#__PURE__*/_jsx(KeyboardView, {
|
|
41
112
|
children: /*#__PURE__*/_jsxs(View, {
|
|
42
113
|
style: styles.container,
|
|
43
114
|
testID: "search-screen",
|
|
44
|
-
children: [
|
|
115
|
+
children: [t3, t4]
|
|
45
116
|
})
|
|
46
117
|
});
|
|
47
|
-
$[
|
|
48
|
-
$[
|
|
118
|
+
$[12] = t3;
|
|
119
|
+
$[13] = t4;
|
|
120
|
+
$[14] = t5;
|
|
49
121
|
} else {
|
|
50
|
-
|
|
122
|
+
t5 = $[14];
|
|
51
123
|
}
|
|
52
|
-
return
|
|
124
|
+
return t5;
|
|
53
125
|
}
|
|
54
126
|
const styles = StyleSheet.create({
|
|
55
127
|
container: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_screen.js","names":["React","useState","StyleSheet","View","KeyboardView","composeOptions","withMinimalBack","SearchPromptBlankState","SearchField","jsx","_jsx","jsxs","_jsxs","SearchScreenOptions","navigation","title","animation","onPress","goBack","SearchScreen","$","_c","term","setTerm","
|
|
1
|
+
{"version":3,"file":"search_screen.js","names":["useNavigation","React","useRef","useState","Keyboard","StyleSheet","View","KeyboardView","composeOptions","withMinimalBack","useDebouncedSearchTerm","analyticsEvents","useProductAnalytics","SearchPromptBlankState","SearchField","SearchResultsList","jsx","_jsx","jsxs","_jsxs","SearchScreenOptions","navigation","title","animation","onPress","goBack","SearchScreen","$","_c","term","setTerm","debouncedTerm","publishEvent","t0","Symbol","for","Set","publishedTerms","t1","settledTerm","counts","current","has","add","search_performed","term_length","length","conversation_result_count","conversationResultCount","message_result_count","messageResultCount","publishSearch","t2","result","position","dismiss","search_result_opened","result_type","type","navigate","conversation_id","Number","id","extra","conversationId","initial_message_id","openResult","t3","t4","t5","children","style","styles","container","testID","create","flex"],"sources":["../../../src/screens/search/search_screen.tsx"],"sourcesContent":["import { ParamListBase, useNavigation } from '@react-navigation/native'\nimport {\n NativeStackNavigationOptions,\n NativeStackScreenProps,\n} from '@react-navigation/native-stack'\nimport React, { useRef, useState } from 'react'\nimport { Keyboard, StyleSheet, View } from 'react-native'\nimport { KeyboardView } from '../../components'\nimport {\n composeOptions,\n withMinimalBack,\n} from '../../components/display/platform_modal_header_buttons'\nimport { useDebouncedSearchTerm } from '../../hooks/use_debounced_search_term'\nimport { analyticsEvents, useProductAnalytics } from '../../hooks/use_product_analytics'\nimport type { SearchResultResource } from '../../types/resources/search_result'\nimport { SearchPromptBlankState } from './components/search_blank_states'\nimport { SearchField } from './components/search_field'\nimport { SearchResultsList, type SearchResultCounts } from './components/search_results_list'\n\nexport const SearchScreenOptions = ({\n navigation,\n}: NativeStackScreenProps<ParamListBase>): NativeStackNavigationOptions =>\n composeOptions(\n { title: 'Search', animation: 'fade' },\n withMinimalBack({ onPress: () => navigation.goBack() })\n )\n\nexport function SearchScreen() {\n const navigation = useNavigation()\n const [term, setTerm] = useState('')\n const debouncedTerm = useDebouncedSearchTerm(term)\n const { publishEvent } = useProductAnalytics()\n const publishedTerms = useRef(new Set<string>())\n\n const publishSearch = (settledTerm: string, counts: SearchResultCounts) => {\n if (publishedTerms.current.has(settledTerm)) return\n\n publishedTerms.current.add(settledTerm)\n publishEvent(analyticsEvents.search_performed, {\n term_length: settledTerm.length,\n conversation_result_count: counts.conversationResultCount,\n message_result_count: counts.messageResultCount,\n })\n }\n\n const openResult = (result: SearchResultResource, position: number) => {\n Keyboard.dismiss()\n publishEvent(analyticsEvents.search_result_opened, { result_type: result.type, position })\n\n if (result.type === 'conversation') {\n navigation.navigate('Conversation', {\n conversation_id: Number(result.id),\n title: result.title,\n })\n } else {\n navigation.navigate('Conversation', {\n conversation_id: result.extra.conversationId,\n initial_message_id: result.id,\n title: result.title,\n })\n }\n }\n\n return (\n <KeyboardView>\n <View style={styles.container} testID=\"search-screen\">\n <SearchField term={term} onChange={setTerm} />\n {debouncedTerm.length > 0 ? (\n <SearchResultsList\n key={debouncedTerm}\n term={debouncedTerm}\n onSelect={openResult}\n onSettled={publishSearch}\n />\n ) : (\n <SearchPromptBlankState />\n )}\n </View>\n </KeyboardView>\n )\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n})\n"],"mappings":";AAAA,SAAwBA,aAAa,QAAQ,0BAA0B;AAKvE,OAAOC,KAAK,IAAIC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/C,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACzD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACEC,cAAc,EACdC,eAAe,QACV,wDAAwD;AAC/D,SAASC,sBAAsB,QAAQ,uCAAuC;AAC9E,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,mCAAmC;AAExF,SAASC,sBAAsB,QAAQ,kCAAkC;AACzE,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,iBAAiB,QAAiC,kCAAkC;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA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zC,CAAA,QAAAI,aAAA,IAAAJ,CAAA,QAAAuC,UAAA,IAAAvC,CAAA,SAAAwB,aAAA;IAC7CiB,EAAA,GAAArC,aAAa,CAAAe,MAAO,GAAG,CASvB,gBATA7B,IAAA,CACEF,iBAAiB;MAEVgB,IAAa,EAAbA,aAAa;MACTmC,QAAU,EAAVA,UAAU;MACTf,SAAa,EAAbA;IAAa,GAHnBpB,aAOT,CAAC,gBATAd,IAAA,CAQEJ,sBAAsB,IACzB,CAAC;IAAAc,CAAA,MAAAI,aAAA;IAAAJ,CAAA,MAAAuC,UAAA;IAAAvC,CAAA,OAAAwB,aAAA;IAAAxB,CAAA,OAAAyC,EAAA;EAAA;IAAAA,EAAA,GAAAzC,CAAA;EAAA;EAAA,IAAA0C,EAAA;EAAA,IAAA1C,CAAA,SAAAwC,EAAA,IAAAxC,CAAA,SAAAyC,EAAA;IAZLC,EAAA,gBAAApD,IAAA,CAACV,YAAY;MAAA+D,QAAA,eACXnD,KAAA,CAACb,IAAI;QAAQiE,KAAgB,EAAhBC,MAAM,CAAAC,SAAU;QAASC,MAAe,EAAf,eAAe;QAAAJ,QAAA,GACnDH,EAA8C,EAC7CC,EASA;MAAA,CACG;IAAC,CACK,CAAC;IAAAzC,CAAA,OAAAwC,EAAA;IAAAxC,CAAA,OAAAyC,EAAA;IAAAzC,CAAA,OAAA0C,EAAA;EAAA;IAAAA,EAAA,GAAA1C,CAAA;EAAA;EAAA,OAdf0C,EAce;AAAA;AAInB,MAAMG,MAAM,GAAGnE,UAAU,CAACsE,MAAM,CAAC;EAC/BF,SAAS,EAAE;IACTG,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -27,7 +27,7 @@ export const makeRequest = ({
|
|
|
27
27
|
uri = uri.query(combinedQuery);
|
|
28
28
|
}
|
|
29
29
|
const body = ['POST', 'PATCH'].includes(action) ? JSON.stringify(data) : undefined;
|
|
30
|
-
return instrumentedFetch(
|
|
30
|
+
return instrumentedFetch(uri.toString(), {
|
|
31
31
|
method: action,
|
|
32
32
|
headers,
|
|
33
33
|
body
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request_helpers.js","names":["_","URI","instrumentedFetch","transformRequestData","transformResponse","makeRequest","action","url","data","headers","uri","query","urlQuery","combinedQuery","Object","entries","sort","reduce","obj","key","value","body","includes","JSON","stringify","undefined","
|
|
1
|
+
{"version":3,"file":"request_helpers.js","names":["_","URI","instrumentedFetch","transformRequestData","transformResponse","makeRequest","action","url","data","headers","uri","query","urlQuery","combinedQuery","Object","entries","sort","reduce","obj","key","value","body","includes","JSON","stringify","undefined","toString","method","then","response","ok","text","t","parse","Promise","reject","STANDARD_META_ATTRIBUTES","concatRecords","records","moreRecords","included","meta","pick","throwErrorIfFieldsMissing","walk","args","fields","Error","fieldTypes","keys","dataTypes","castArray","map","includedTypes","responseTypes","uniq","concat","missingFields","difference","filter","length","friendlyErrors","throwErrorIfQueryParams","noQueryParamsFriendlyErrors","request","passthrough","resolve","ensureFieldsInDev","__DEV__","ensureNoQueryParamsInDev","search","transformGetToPost","rest","include","fieldsArray","Array","isArray","join","fromEntries"],"sources":["../../../src/utils/client/request_helpers.ts"],"sourcesContent":["import _ from 'lodash'\nimport URI from 'urijs'\nimport { instrumentedFetch } from './instrumented_fetch'\nimport { transformRequestData } from './transform_request_data'\nimport transformResponse from './transform_response'\nimport { Accumulator, GetRequest, PostRequest, RequestData, WalkRequest } from './types'\n\nexport type MakeRequestArgs = {\n action: 'GET' | 'POST' | 'PATCH' | 'DELETE'\n url: string\n data?: Partial<RequestData>\n headers: Record<string, string>\n}\n\nexport const makeRequest = ({ action = 'GET', url, data = {}, headers = {} }: MakeRequestArgs) => {\n // break apart url so we can reconstruct the url with the query params\n let uri = new URI(url)\n const query = transformRequestData(data)\n const urlQuery = uri.query(true)\n\n // This likely doesn't matter but will enforce consistent ordering of query params\n const combinedQuery = Object.entries({ ...query, ...urlQuery })\n .sort()\n .reduce((obj, [key, value]) => {\n // @ts-ignore\n obj[key] = value\n return obj\n }, {})\n\n if (action === 'GET') {\n uri = uri.query(combinedQuery)\n }\n\n const body = ['POST', 'PATCH'].includes(action) ? JSON.stringify(data) : undefined\n\n return instrumentedFetch(uri.toString(), {\n method: action,\n headers,\n body,\n }).then(response => {\n if (response.ok) {\n return response.text().then(t => (t === '' ? '' : JSON.parse(t)))\n } else {\n return Promise.reject(response)\n }\n })\n}\n\nconst STANDARD_META_ATTRIBUTES = [\n 'total_count',\n 'count',\n 'prev',\n 'next',\n 'can_order_by',\n 'can_query_by',\n 'can_include',\n 'can_filter',\n 'parent',\n]\n\nexport const concatRecords = (records: Accumulator, moreRecords: Accumulator) => ({\n data: [...records.data, ...moreRecords.data],\n included: [...records.included, ...moreRecords.included],\n // Because custom meta can be computed on a per-page bases,\n // it is safer to remove all custom meta when concatenating multiple pages of data\n meta: _.pick(moreRecords.meta, STANDARD_META_ATTRIBUTES),\n})\n\ntype Walk = (args: MakeRequestArgs | WalkRequest) => Promise<any>\ntype WalkArgs = MakeRequestArgs & {\n data?: {\n fields?: Record<string, any>\n }\n}\n\nexport const throwErrorIfFieldsMissing = async (walk: Walk, args: WalkArgs) => {\n const fields = args?.data?.fields\n\n if (!fields) {\n throw new Error(`Must pass fields for request: ${args.url}`)\n }\n\n const fieldTypes = Object.keys(fields)\n\n const response = await walk(args)\n\n const dataTypes = _(response.data).castArray().map('type').value()\n const includedTypes = _.map(response.included, 'type')\n const responseTypes = _.uniq(dataTypes.concat(includedTypes))\n const missingFields = _.difference(responseTypes, fieldTypes).filter(t => t)\n\n if (missingFields.length > 0) {\n throw new Error(\n `Must include fields for types: ${JSON.stringify(missingFields)} for request ${args.url}`\n )\n }\n\n return transformResponse(response)\n}\n\nexport const friendlyErrors = (walk: Walk, args: WalkArgs) =>\n throwErrorIfQueryParams(args.url)\n .then(() => throwErrorIfFieldsMissing(walk, args))\n .then(transformResponse)\n\nexport const noQueryParamsFriendlyErrors = (request: typeof makeRequest, args: WalkArgs) =>\n throwErrorIfQueryParams(args.url)\n .then(() => request(args))\n .then(transformResponse)\n\nconst passthrough = async <T, R>(walk: (args: T) => Promise<R>, args: T) =>\n Promise.resolve(transformResponse(await walk(args)))\n\nexport const ensureFieldsInDev = __DEV__ ? friendlyErrors : passthrough\n\nexport const ensureNoQueryParamsInDev = __DEV__ ? noQueryParamsFriendlyErrors : passthrough\n\nexport const throwErrorIfQueryParams = (url: string) => {\n if (new URI(url).search().length) {\n throw new Error('Must pass query params as data arg')\n }\n\n return Promise.resolve()\n}\n\nexport const transformGetToPost = (args: GetRequest): PostRequest => {\n const { data, ...rest } = args\n const { fields, include } = data\n const fieldsArray = Object.entries(fields).map(([key, value]) => {\n if (Array.isArray(value)) {\n return [key, value.join(',')]\n }\n\n return [key, value]\n })\n\n return {\n ...rest,\n data: {\n fields: Object.fromEntries(fieldsArray),\n include,\n },\n }\n}\n"],"mappings":"AAAA,OAAOA,CAAC,MAAM,QAAQ;AACtB,OAAOC,GAAG,MAAM,OAAO;AACvB,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,oBAAoB,QAAQ,0BAA0B;AAC/D,OAAOC,iBAAiB,MAAM,sBAAsB;AAUpD,OAAO,MAAMC,WAAW,GAAGA,CAAC;EAAEC,MAAM,GAAG,KAAK;EAAEC,GAAG;EAAEC,IAAI,GAAG,CAAC,CAAC;EAAEC,OAAO,GAAG,CAAC;AAAmB,CAAC,KAAK;EAChG;EACA,IAAIC,GAAG,GAAG,IAAIT,GAAG,CAACM,GAAG,CAAC;EACtB,MAAMI,KAAK,GAAGR,oBAAoB,CAACK,IAAI,CAAC;EACxC,MAAMI,QAAQ,GAAGF,GAAG,CAACC,KAAK,CAAC,IAAI,CAAC;;EAEhC;EACA,MAAME,aAAa,GAAGC,MAAM,CAACC,OAAO,CAAC;IAAE,GAAGJ,KAAK;IAAE,GAAGC;EAAS,CAAC,CAAC,CAC5DI,IAAI,CAAC,CAAC,CACNC,MAAM,CAAC,CAACC,GAAG,EAAE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AK;IAC/D,IAAIuD,KAAK,CAACC,OAAO,CAACxD,KAAK,CAAC,EAAE;MACxB,OAAO,CAACD,GAAG,EAAEC,KAAK,CAACyD,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B;IAEA,OAAO,CAAC1D,GAAG,EAAEC,KAAK,CAAC;EACrB,CAAC,CAAC;EAEF,OAAO;IACL,GAAGoD,IAAI;IACPhE,IAAI,EAAE;MACJsC,MAAM,EAAEhC,MAAM,CAACgE,WAAW,CAACJ,WAAW,CAAC;MACvCD;IACF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { Linking } from 'react-native';
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export type LinkingOpenURLOptions = {
|
|
3
|
+
forceOpenInBrowser?: boolean;
|
|
4
|
+
};
|
|
5
|
+
type LinkingMethods = {
|
|
6
|
+
openURL: (url: string, options?: LinkingOpenURLOptions) => Promise<unknown>;
|
|
4
7
|
canOpenURL: Linking['canOpenURL'];
|
|
5
|
-
|
|
8
|
+
};
|
|
9
|
+
export declare class LinkingAdapter {
|
|
10
|
+
openURL: LinkingMethods['openURL'];
|
|
11
|
+
canOpenURL: LinkingMethods['canOpenURL'];
|
|
12
|
+
constructor(methods: LinkingMethods);
|
|
6
13
|
}
|
|
14
|
+
export {};
|
|
7
15
|
//# sourceMappingURL=linking.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/linking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,
|
|
1
|
+
{"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/linking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,MAAM,qBAAqB,GAAG;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC3E,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAClC,CAAA;AAED,qBAAa,cAAc;IACzB,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;IAClC,UAAU,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;gBAE5B,OAAO,EAAE,cAAc;CAIpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linking.js","names":["Linking","LinkingAdapter","constructor","methods","openURL","bind","canOpenURL"],"sources":["../../../src/utils/native_adapters/linking.ts"],"sourcesContent":["import { Linking } from 'react-native'\n\nexport class LinkingAdapter {\n openURL:
|
|
1
|
+
{"version":3,"file":"linking.js","names":["Linking","LinkingAdapter","constructor","methods","openURL","bind","canOpenURL"],"sources":["../../../src/utils/native_adapters/linking.ts"],"sourcesContent":["import { Linking } from 'react-native'\n\nexport type LinkingOpenURLOptions = {\n forceOpenInBrowser?: boolean\n}\n\ntype LinkingMethods = {\n openURL: (url: string, options?: LinkingOpenURLOptions) => Promise<unknown>\n canOpenURL: Linking['canOpenURL']\n}\n\nexport class LinkingAdapter {\n openURL: LinkingMethods['openURL']\n canOpenURL: LinkingMethods['canOpenURL']\n\n constructor(methods: LinkingMethods) {\n this.openURL = methods.openURL.bind(Linking)\n this.canOpenURL = methods.canOpenURL.bind(Linking)\n }\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,cAAc;AAWtC,OAAO,MAAMC,cAAc,CAAC;EAI1BC,WAAWA,CAACC,OAAuB,EAAE;IACnC,IAAI,CAACC,OAAO,GAAGD,OAAO,CAACC,OAAO,CAACC,IAAI,CAACL,OAAO,CAAC;IAC5C,IAAI,CAACM,UAAU,GAAGH,OAAO,CAACG,UAAU,CAACD,IAAI,CAACL,OAAO,CAAC;EACpD;AACF","ignoreList":[]}
|
|
@@ -7,5 +7,5 @@ export declare class ResponseError extends Error {
|
|
|
7
7
|
constructor(response: FailedResponse);
|
|
8
8
|
}
|
|
9
9
|
export declare const isResponseLike: (value: unknown) => value is Response;
|
|
10
|
-
export declare const throwResponseError: (error: unknown) =>
|
|
10
|
+
export declare const throwResponseError: (error: unknown) => never;
|
|
11
11
|
//# sourceMappingURL=response_error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response_error.d.ts","sourceRoot":"","sources":["../../src/utils/response_error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,qBAAa,aAAc,SAAQ,KAAK;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IAChC,QAAQ,EAAE,cAAc,CAAA;gBAEZ,QAAQ,EAAE,cAAc;CAQrC;AAOD,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,QAgBxD,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,
|
|
1
|
+
{"version":3,"file":"response_error.d.ts","sourceRoot":"","sources":["../../src/utils/response_error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,qBAAa,aAAc,SAAQ,KAAK;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IAChC,QAAQ,EAAE,cAAc,CAAA;gBAEZ,QAAQ,EAAE,cAAc;CAQrC;AAOD,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,QAgBxD,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,KAMnD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response_error.js","names":["ResponseError","Error","constructor","response","status","statusText","name","errors","isResponseLike","value","candidate","ok","url","headers","clone","json","text","arrayBuffer","throwResponseError","error"
|
|
1
|
+
{"version":3,"file":"response_error.js","names":["ResponseError","Error","constructor","response","status","statusText","name","errors","isResponseLike","value","candidate","ok","url","headers","clone","json","text","arrayBuffer","throwResponseError","error"],"sources":["../../src/utils/response_error.ts"],"sourcesContent":["import { FailedResponse } from '../types/api_primitives'\n\nexport class ResponseError extends Error {\n status: number\n statusText: string\n errors: FailedResponse['errors']\n response: FailedResponse\n\n constructor(response: FailedResponse) {\n super(`ResponseError: ${response?.status} ${response?.statusText}`)\n this.name = 'ResponseError'\n this.status = response?.status\n this.statusText = response?.statusText\n this.errors = response?.errors || []\n this.response = response\n }\n}\n\n// Detect a fetch Response by shape, not `instanceof`: Expo's winter runtime\n// swaps in a `fetch` whose `FetchResponse` isn't an instance of the global\n// `Response`, so `instanceof` silently misses it under Expo. We avoid checking\n// `redirected` because React Native's whatwg-fetch polyfill never assigns it,\n// which would reject every real response under RN's fetch.\nexport const isResponseLike = (value: unknown): value is Response => {\n if (typeof value !== 'object' || value === null) return false\n\n const candidate = value as Record<string, unknown>\n return (\n typeof candidate.status === 'number' &&\n typeof candidate.statusText === 'string' &&\n typeof candidate.ok === 'boolean' &&\n typeof candidate.url === 'string' &&\n typeof candidate.headers === 'object' &&\n candidate.headers !== null &&\n typeof candidate.clone === 'function' &&\n typeof candidate.json === 'function' &&\n typeof candidate.text === 'function' &&\n typeof candidate.arrayBuffer === 'function'\n )\n}\n\nexport const throwResponseError = (error: unknown): never => {\n if (isResponseLike(error)) {\n throw new ResponseError(error as FailedResponse)\n }\n\n throw error\n}\n"],"mappings":"AAEA,OAAO,MAAMA,aAAa,SAASC,KAAK,CAAC;EAMvCC,WAAWA,CAACC,QAAwB,EAAE;IACpC,KAAK,CAAC,kBAAkBA,Q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
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.1-qa-989.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
35
35
|
"@fortawesome/react-native-fontawesome": "^0.3.2",
|
|
36
|
-
"@planningcenter/emoji-keyboard": "4.
|
|
36
|
+
"@planningcenter/emoji-keyboard": "4.3.1-qa-989.0",
|
|
37
37
|
"lodash-inflection": "^1.5.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"sf-symbols-typescript": "^2.2.0",
|
|
85
85
|
"typescript": "~6.0.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "bd271384ad50f354963f1a563d59bbd616caa42e"
|
|
88
88
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { DefaultTheme, ThemeProvider } from '@react-navigation/native'
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react-native'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { Linking as RNLinking } from 'react-native'
|
|
5
|
+
import { GiphyAttachment } from '../../../../components/conversation/attachments/giphy_attachment'
|
|
6
|
+
import {
|
|
7
|
+
DenormalizedGiphyAttachmentResource,
|
|
8
|
+
GiphyAttachmentVariant,
|
|
9
|
+
} from '../../../../types/resources/denormalized_attachment_resource'
|
|
10
|
+
import {
|
|
11
|
+
AudioAdapter,
|
|
12
|
+
ChatAdapters,
|
|
13
|
+
ClipboardAdapter,
|
|
14
|
+
ImagePickerAdapter,
|
|
15
|
+
LinkingAdapter,
|
|
16
|
+
VideoAdapter,
|
|
17
|
+
} from '../../../../utils/native_adapters'
|
|
18
|
+
|
|
19
|
+
const variant: GiphyAttachmentVariant = {
|
|
20
|
+
url: 'https://media.giphy.com/cat.gif',
|
|
21
|
+
width: '200',
|
|
22
|
+
height: '100',
|
|
23
|
+
size: '1',
|
|
24
|
+
frames: '1',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const attachment: DenormalizedGiphyAttachmentResource = {
|
|
28
|
+
type: 'giphy',
|
|
29
|
+
id: '1',
|
|
30
|
+
title: 'cat',
|
|
31
|
+
titleLink: 'https://giphy.com/gifs/cat',
|
|
32
|
+
thumbUrl: variant.url,
|
|
33
|
+
giphy: {
|
|
34
|
+
original: variant,
|
|
35
|
+
fixedHeight: variant,
|
|
36
|
+
fixedHeightStill: variant,
|
|
37
|
+
fixedHeightDownsampled: variant,
|
|
38
|
+
fixedWidth: variant,
|
|
39
|
+
fixedWidthStill: variant,
|
|
40
|
+
fixedWidthDownsampled: variant,
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const hostOpenURL = jest.fn(async (_: string) => {})
|
|
45
|
+
|
|
46
|
+
describe('GiphyAttachment', () => {
|
|
47
|
+
beforeAll(() => {
|
|
48
|
+
ChatAdapters.configure({
|
|
49
|
+
clipboard: new ClipboardAdapter({
|
|
50
|
+
getStringAsync: async () => '',
|
|
51
|
+
setStringAsync: async () => {},
|
|
52
|
+
}),
|
|
53
|
+
audio: new AudioAdapter({ useAudio: () => ({}) as any }),
|
|
54
|
+
video: new VideoAdapter({ Player: React.forwardRef(() => null) }),
|
|
55
|
+
imagePicker: new ImagePickerAdapter({
|
|
56
|
+
openCameraAsync: async () => ({ canceled: true, assets: null }),
|
|
57
|
+
openImageLibraryAsync: async () => ({ canceled: true, assets: null }),
|
|
58
|
+
}),
|
|
59
|
+
linking: new LinkingAdapter({ openURL: hostOpenURL, canOpenURL: async () => true }),
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it("opens the Giphy link through the host app's linking adapter", () => {
|
|
64
|
+
const rnOpenURL = jest.spyOn(RNLinking, 'openURL')
|
|
65
|
+
const { getByText } = render(
|
|
66
|
+
<ThemeProvider value={DefaultTheme}>
|
|
67
|
+
<GiphyAttachment attachment={attachment} onMessageLongPress={jest.fn()} />
|
|
68
|
+
</ThemeProvider>
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
fireEvent.press(getByText('/giphy'))
|
|
72
|
+
|
|
73
|
+
expect(hostOpenURL).toHaveBeenCalledWith('https://giphy.com/gifs/cat')
|
|
74
|
+
expect(rnOpenURL).not.toHaveBeenCalled()
|
|
75
|
+
})
|
|
76
|
+
})
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { render } from '@testing-library/react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { ApiProvider, chatQueryClient } from '../../contexts/api_provider'
|
|
4
|
+
import { ChatContext, ChatContextValue } from '../../contexts/chat_context'
|
|
5
|
+
import { ApiClient, useApiClient } from '../../hooks/use_api_client'
|
|
6
|
+
import { Session } from '../../utils'
|
|
7
|
+
|
|
8
|
+
jest.mock('../../hooks/use_api_client')
|
|
9
|
+
|
|
10
|
+
const mockedUseApiClient = useApiClient as jest.MockedFunction<typeof useApiClient>
|
|
11
|
+
|
|
12
|
+
let get: jest.Mock
|
|
13
|
+
|
|
14
|
+
const renderApiProvider = ({ token }: { token?: { access_token: string } } = {}) => {
|
|
15
|
+
const session = new Session({ token })
|
|
16
|
+
|
|
17
|
+
return render(
|
|
18
|
+
<ChatContext.Provider value={{ session, token } as unknown as ChatContextValue}>
|
|
19
|
+
<ApiProvider>{null}</ApiProvider>
|
|
20
|
+
</ChatContext.Provider>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
jest.useFakeTimers()
|
|
26
|
+
chatQueryClient.clear()
|
|
27
|
+
get = jest.fn().mockResolvedValue({ data: [] })
|
|
28
|
+
mockedUseApiClient.mockReturnValue({ chat: { get } } as unknown as ApiClient)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
afterEach(() => {
|
|
32
|
+
chatQueryClient.clear()
|
|
33
|
+
jest.clearAllMocks()
|
|
34
|
+
jest.useRealTimers()
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('ApiProvider', () => {
|
|
38
|
+
it('requests app grants on the first attempt without waiting for a retry', () => {
|
|
39
|
+
renderApiProvider({ token: { access_token: 'a-real-token' } })
|
|
40
|
+
|
|
41
|
+
expect(get).toHaveBeenCalledWith(expect.objectContaining({ url: '/me/app_grants' }))
|
|
42
|
+
expect(get.mock.calls.filter(([args]) => args.url === '/me/app_grants')).toHaveLength(1)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('does not prefetch anything without a token', () => {
|
|
46
|
+
renderApiProvider()
|
|
47
|
+
|
|
48
|
+
expect(get).not.toHaveBeenCalled()
|
|
49
|
+
})
|
|
50
|
+
})
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { HeaderHeightContext } from '@react-navigation/elements'
|
|
2
|
+
import { DefaultTheme, ThemeProvider } from '@react-navigation/native'
|
|
3
|
+
import { fireEvent, render } from '@testing-library/react-native'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context'
|
|
6
|
+
import {
|
|
7
|
+
AttachmentActionsScreen,
|
|
8
|
+
AttachmentActionsScreenProps,
|
|
9
|
+
} from '../../screens/attachment_actions/attachment_actions_screen'
|
|
10
|
+
import {
|
|
11
|
+
AudioAdapter,
|
|
12
|
+
ChatAdapters,
|
|
13
|
+
ClipboardAdapter,
|
|
14
|
+
ImagePickerAdapter,
|
|
15
|
+
LinkingAdapter,
|
|
16
|
+
VideoAdapter,
|
|
17
|
+
} from '../../utils/native_adapters'
|
|
18
|
+
|
|
19
|
+
jest.mock('@react-navigation/native', () => ({
|
|
20
|
+
...jest.requireActual('@react-navigation/native'),
|
|
21
|
+
useNavigation: () => ({ goBack: jest.fn() }),
|
|
22
|
+
}))
|
|
23
|
+
jest.mock('../../screens/attachment_actions/hooks/useDeleteAttachment', () => ({
|
|
24
|
+
useDeleteAttachment: () => ({ handleDeleteAttachment: jest.fn() }),
|
|
25
|
+
}))
|
|
26
|
+
|
|
27
|
+
const hostOpenURL = jest.fn(async (_url: string, _options?: object) => {})
|
|
28
|
+
|
|
29
|
+
const safeAreaMetrics = {
|
|
30
|
+
frame: { x: 0, y: 0, width: 390, height: 844 },
|
|
31
|
+
insets: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const route = {
|
|
35
|
+
key: 'AttachmentActions',
|
|
36
|
+
name: 'AttachmentActions',
|
|
37
|
+
params: {
|
|
38
|
+
attachmentId: '1',
|
|
39
|
+
attachmentContentType: 'application/pdf',
|
|
40
|
+
attachmentUrl: 'https://example.com/file.pdf',
|
|
41
|
+
conversation_id: 1,
|
|
42
|
+
canDeleteNonAuthoredMessages: false,
|
|
43
|
+
myMessage: false,
|
|
44
|
+
},
|
|
45
|
+
} as AttachmentActionsScreenProps['route']
|
|
46
|
+
|
|
47
|
+
describe('AttachmentActionsScreen', () => {
|
|
48
|
+
beforeAll(() => {
|
|
49
|
+
ChatAdapters.configure({
|
|
50
|
+
clipboard: new ClipboardAdapter({
|
|
51
|
+
getStringAsync: async () => '',
|
|
52
|
+
setStringAsync: async () => {},
|
|
53
|
+
}),
|
|
54
|
+
audio: new AudioAdapter({ useAudio: () => ({}) as any }),
|
|
55
|
+
video: new VideoAdapter({ Player: React.forwardRef(() => null) }),
|
|
56
|
+
imagePicker: new ImagePickerAdapter({
|
|
57
|
+
openCameraAsync: async () => ({ canceled: true, assets: null }),
|
|
58
|
+
openImageLibraryAsync: async () => ({ canceled: true, assets: null }),
|
|
59
|
+
}),
|
|
60
|
+
linking: new LinkingAdapter({ openURL: hostOpenURL, canOpenURL: async () => true }),
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('asks the host app to open the attachment in the browser', () => {
|
|
65
|
+
const { getByText } = render(
|
|
66
|
+
<SafeAreaProvider initialMetrics={safeAreaMetrics}>
|
|
67
|
+
<ThemeProvider value={DefaultTheme}>
|
|
68
|
+
<HeaderHeightContext.Provider value={0}>
|
|
69
|
+
<AttachmentActionsScreen route={route} />
|
|
70
|
+
</HeaderHeightContext.Provider>
|
|
71
|
+
</ThemeProvider>
|
|
72
|
+
</SafeAreaProvider>
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
fireEvent.press(getByText('Open in browser'))
|
|
76
|
+
|
|
77
|
+
expect(hostOpenURL).toHaveBeenCalledWith('https://example.com/file.pdf', {
|
|
78
|
+
forceOpenInBrowser: true,
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
})
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { sendEmail } from '../../screens/get_help_screen'
|
|
3
|
+
import {
|
|
4
|
+
AudioAdapter,
|
|
5
|
+
ChatAdapters,
|
|
6
|
+
ClipboardAdapter,
|
|
7
|
+
ImagePickerAdapter,
|
|
8
|
+
LinkingAdapter,
|
|
9
|
+
VideoAdapter,
|
|
10
|
+
} from '../../utils/native_adapters'
|
|
11
|
+
|
|
12
|
+
const hostOpenURL = jest.fn(async (_: string) => {})
|
|
13
|
+
|
|
14
|
+
describe('sendEmail', () => {
|
|
15
|
+
beforeAll(() => {
|
|
16
|
+
ChatAdapters.configure({
|
|
17
|
+
clipboard: new ClipboardAdapter({
|
|
18
|
+
getStringAsync: async () => '',
|
|
19
|
+
setStringAsync: async () => {},
|
|
20
|
+
}),
|
|
21
|
+
audio: new AudioAdapter({ useAudio: () => ({}) as any }),
|
|
22
|
+
video: new VideoAdapter({ Player: React.forwardRef(() => null) }),
|
|
23
|
+
imagePicker: new ImagePickerAdapter({
|
|
24
|
+
openCameraAsync: async () => ({ canceled: true, assets: null }),
|
|
25
|
+
openImageLibraryAsync: async () => ({ canceled: true, assets: null }),
|
|
26
|
+
}),
|
|
27
|
+
linking: new LinkingAdapter({ openURL: hostOpenURL, canOpenURL: async () => true }),
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it("opens mailto through the host app's linking adapter", () => {
|
|
32
|
+
sendEmail('help@example.com')
|
|
33
|
+
|
|
34
|
+
expect(hostOpenURL).toHaveBeenCalledWith('mailto:help@example.com')
|
|
35
|
+
})
|
|
36
|
+
})
|