@planningcenter/chat-react-native 4.7.1-rc.0 → 4.8.0-qa-staging.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/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js +333 -193
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/conversations/conversation_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +106 -91
- package/build/components/conversations/conversation_preview.js.map +1 -1
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +63 -56
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/components/conversations/conversations_blank_state.d.ts +2 -1
- package/build/components/conversations/conversations_blank_state.d.ts.map +1 -1
- package/build/components/conversations/conversations_blank_state.js +71 -39
- package/build/components/conversations/conversations_blank_state.js.map +1 -1
- package/build/components/conversations/hidden_indicator.d.ts +4 -0
- package/build/components/conversations/hidden_indicator.d.ts.map +1 -0
- package/build/components/conversations/hidden_indicator.js +52 -0
- package/build/components/conversations/hidden_indicator.js.map +1 -0
- package/build/components/conversations/hidden_results_footer.d.ts +2 -0
- package/build/components/conversations/hidden_results_footer.d.ts.map +1 -0
- package/build/components/conversations/hidden_results_footer.js +34 -0
- package/build/components/conversations/hidden_results_footer.js.map +1 -0
- package/build/components/display/toast.d.ts +3 -0
- package/build/components/display/toast.d.ts.map +1 -0
- package/build/components/display/toast.js +224 -0
- package/build/components/display/toast.js.map +1 -0
- package/build/components/group_conversation_list.d.ts.map +1 -1
- package/build/components/group_conversation_list.js +1 -0
- package/build/components/group_conversation_list.js.map +1 -1
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +2 -0
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/chat_context.d.ts +0 -2
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +16 -93
- package/build/contexts/chat_context.js.map +1 -1
- package/build/contexts/conversations_context.d.ts +3 -1
- package/build/contexts/conversations_context.d.ts.map +1 -1
- package/build/contexts/conversations_context.js +39 -31
- package/build/contexts/conversations_context.js.map +1 -1
- package/build/contexts/session_context.d.ts.map +1 -1
- package/build/contexts/session_context.js +3 -0
- package/build/contexts/session_context.js.map +1 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts +11 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts.map +1 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.js +92 -47
- package/build/hooks/groups/use_group_chat_conversation_payload.js.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +33 -25
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.js +125 -110
- package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.js +39 -31
- package/build/hooks/groups/use_groups_conversation_create.js.map +1 -1
- package/build/hooks/groups/use_groups_proxy.d.ts +2 -0
- package/build/hooks/groups/use_groups_proxy.d.ts.map +1 -0
- package/build/hooks/groups/use_groups_proxy.js +18 -0
- package/build/hooks/groups/use_groups_proxy.js.map +1 -0
- package/build/hooks/use_api.d.ts +6 -0
- package/build/hooks/use_api.d.ts.map +1 -1
- package/build/hooks/use_api.js +8 -5
- package/build/hooks/use_api.js.map +1 -1
- package/build/hooks/use_clear_conversation_filters.d.ts.map +1 -1
- package/build/hooks/use_clear_conversation_filters.js +1 -0
- package/build/hooks/use_clear_conversation_filters.js.map +1 -1
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +1 -1
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_conversation_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversation_jolt_events.js +3 -2
- package/build/hooks/use_conversation_jolt_events.js.map +1 -1
- package/build/hooks/use_conversations_actions.d.ts +9 -9
- package/build/hooks/use_conversations_actions.d.ts.map +1 -1
- package/build/hooks/use_conversations_actions.js +12 -7
- package/build/hooks/use_conversations_actions.js.map +1 -1
- package/build/hooks/use_conversations_cache.d.ts +1 -3
- package/build/hooks/use_conversations_cache.d.ts.map +1 -1
- package/build/hooks/use_conversations_cache.js +79 -124
- package/build/hooks/use_conversations_cache.js.map +1 -1
- package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversations_jolt_events.js +47 -20
- package/build/hooks/use_conversations_jolt_events.js.map +1 -1
- 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_groups.d.ts +6 -0
- package/build/hooks/use_groups.d.ts.map +1 -1
- package/build/hooks/use_groups_groups.d.ts +6 -0
- package/build/hooks/use_groups_groups.d.ts.map +1 -1
- package/build/hooks/use_groups_groups.js +25 -9
- package/build/hooks/use_groups_groups.js.map +1 -1
- package/build/hooks/use_hidden_conversations_count.d.ts +2 -0
- package/build/hooks/use_hidden_conversations_count.d.ts.map +1 -0
- package/build/hooks/use_hidden_conversations_count.js +32 -0
- package/build/hooks/use_hidden_conversations_count.js.map +1 -0
- package/build/hooks/use_hide_conversation.d.ts +108 -0
- package/build/hooks/use_hide_conversation.d.ts.map +1 -0
- package/build/hooks/use_hide_conversation.js +243 -0
- package/build/hooks/use_hide_conversation.js.map +1 -0
- package/build/hooks/use_hide_conversations_enabled.d.ts +2 -0
- package/build/hooks/use_hide_conversations_enabled.d.ts.map +1 -0
- package/build/hooks/use_hide_conversations_enabled.js +18 -0
- package/build/hooks/use_hide_conversations_enabled.js.map +1 -0
- package/build/hooks/use_mark_latest_message_read.d.ts.map +1 -1
- package/build/hooks/use_mark_latest_message_read.js +5 -4
- package/build/hooks/use_mark_latest_message_read.js.map +1 -1
- package/build/hooks/use_new_conversation_from_filter.d.ts.map +1 -1
- package/build/hooks/use_new_conversation_from_filter.js +11 -1
- package/build/hooks/use_new_conversation_from_filter.js.map +1 -1
- package/build/hooks/use_product_analytics.d.ts.map +1 -1
- package/build/hooks/use_product_analytics.js +93 -75
- package/build/hooks/use_product_analytics.js.map +1 -1
- package/build/hooks/use_teams.d.ts +6 -0
- package/build/hooks/use_teams.d.ts.map +1 -1
- package/build/navigation/index.d.ts +5 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +5 -0
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_actions_screen.d.ts +7 -0
- package/build/screens/conversation_actions_screen.d.ts.map +1 -0
- package/build/screens/conversation_actions_screen.js +89 -0
- package/build/screens/conversation_actions_screen.js.map +1 -0
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +460 -394
- 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 +53 -12
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
- package/build/screens/conversation_filters/components/rows.d.ts +6 -3
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/rows.js +99 -62
- 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/hooks/filters.d.ts +12 -0
- package/build/screens/conversation_filters/hooks/filters.d.ts.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_new/components/groups_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/groups_form.js +96 -93
- package/build/screens/conversation_new/components/groups_form.js.map +1 -1
- package/build/screens/conversations/components/filter_dropdown_list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/filter_dropdown_list_header_component.js +138 -126
- package/build/screens/conversations/components/filter_dropdown_list_header_component.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 +95 -90
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/conversations/components/search_list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/search_list_header_component.js +100 -95
- package/build/screens/conversations/components/search_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 +18 -10
- 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 +4 -20
- 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/types/jolt_events/index.d.ts +2 -0
- package/build/types/jolt_events/index.d.ts.map +1 -1
- package/build/types/jolt_events/index.js.map +1 -1
- package/build/types/jolt_events/person_events.d.ts +9 -0
- package/build/types/jolt_events/person_events.d.ts.map +1 -0
- package/build/types/jolt_events/person_events.js +2 -0
- package/build/types/jolt_events/person_events.js.map +1 -0
- package/build/types/resources/conversation_membership.d.ts +1 -0
- package/build/types/resources/conversation_membership.d.ts.map +1 -1
- package/build/types/resources/conversation_membership.js.map +1 -1
- package/build/types/resources/groups/groups_group_resource.d.ts +1 -1
- package/build/types/resources/groups/groups_group_resource.d.ts.map +1 -1
- package/build/types/resources/groups/groups_group_resource.js.map +1 -1
- package/build/types/resources/groups/groups_membership_resource.d.ts +11 -0
- package/build/types/resources/groups/groups_membership_resource.d.ts.map +1 -0
- package/build/types/resources/groups/groups_membership_resource.js +2 -0
- package/build/types/resources/groups/groups_membership_resource.js.map +1 -0
- package/build/types/resources/groups/index.d.ts +1 -0
- package/build/types/resources/groups/index.d.ts.map +1 -1
- package/build/types/resources/groups/index.js +1 -0
- package/build/types/resources/groups/index.js.map +1 -1
- package/build/utils/jolt/parse_stream_user_event_type.d.ts +3 -0
- package/build/utils/jolt/parse_stream_user_event_type.d.ts.map +1 -0
- package/build/utils/jolt/parse_stream_user_event_type.js +9 -0
- package/build/utils/jolt/parse_stream_user_event_type.js.map +1 -0
- package/build/utils/native_adapters/linking.d.ts.map +1 -1
- package/build/utils/native_adapters/linking.js +48 -2
- package/build/utils/native_adapters/linking.js.map +1 -1
- package/build/utils/product_analytics_token.d.ts +12 -0
- package/build/utils/product_analytics_token.d.ts.map +1 -0
- package/build/utils/product_analytics_token.js +84 -0
- package/build/utils/product_analytics_token.js.map +1 -0
- package/build/utils/request/conversation.d.ts +3 -1
- package/build/utils/request/conversation.d.ts.map +1 -1
- package/build/utils/request/conversation.js +4 -0
- package/build/utils/request/conversation.js.map +1 -1
- package/build/utils/throttled_refresh.d.ts +7 -0
- package/build/utils/throttled_refresh.d.ts.map +1 -0
- package/build/utils/throttled_refresh.js +42 -0
- package/build/utils/throttled_refresh.js.map +1 -0
- package/build/utils/toast_store.d.ts +21 -0
- package/build/utils/toast_store.d.ts.map +1 -0
- package/build/utils/toast_store.js +27 -0
- package/build/utils/toast_store.js.map +1 -0
- package/build/vendor/font_awesome_pro_solid_icons.d.ts +1 -0
- package/build/vendor/font_awesome_pro_solid_icons.d.ts.map +1 -1
- package/build/vendor/font_awesome_pro_solid_icons.js +5 -0
- package/build/vendor/font_awesome_pro_solid_icons.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/hooks/use_group_chat_conversation_payload.test.tsx +31 -0
- package/src/__tests__/screens/conversation_filters/components/conversation_filters.test.tsx +6 -0
- package/src/components/conversations/__tests__/conversation_actions.test.tsx +77 -2
- package/src/components/conversations/__tests__/conversation_preview.test.tsx +29 -0
- package/src/components/conversations/__tests__/conversations.test.tsx +26 -0
- package/src/components/conversations/__tests__/conversations_blank_state.test.tsx +17 -0
- package/src/components/conversations/conversation_actions.tsx +73 -4
- package/src/components/conversations/conversation_preview.tsx +12 -1
- package/src/components/conversations/conversations.tsx +9 -0
- package/src/components/conversations/conversations_blank_state.tsx +18 -0
- package/src/components/conversations/hidden_indicator.tsx +30 -0
- package/src/components/conversations/hidden_results_footer.tsx +25 -0
- package/src/components/display/__tests__/toast.test.tsx +55 -0
- package/src/components/display/toast.tsx +115 -0
- package/src/components/group_conversation_list.tsx +4 -1
- package/src/contexts/api_provider.tsx +2 -0
- package/src/contexts/chat_context.tsx +2 -58
- package/src/contexts/conversations_context.tsx +8 -1
- package/src/contexts/session_context.tsx +3 -0
- package/src/hooks/__tests__/jolt_refresh_throttling.test.tsx +229 -0
- package/src/hooks/__tests__/use_conversations_jolt_events.test.tsx +1 -0
- package/src/hooks/__tests__/use_conversations_mark_read.test.tsx +38 -12
- package/src/hooks/__tests__/use_hide_conversation.test.tsx +189 -0
- package/src/hooks/__tests__/use_mark_latest_message_read.test.tsx +23 -2
- package/src/hooks/__tests__/use_product_analytics.test.tsx +304 -0
- package/src/hooks/groups/use_group_chat_conversation_payload.ts +30 -12
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +49 -18
- package/src/hooks/groups/use_groups_conversation_create.ts +10 -14
- package/src/hooks/groups/use_groups_proxy.ts +6 -0
- package/src/hooks/use_api.ts +2 -1
- package/src/hooks/use_clear_conversation_filters.ts +1 -0
- package/src/hooks/use_conversation.ts +1 -0
- package/src/hooks/use_conversation_jolt_events.ts +2 -1
- package/src/hooks/use_conversations_actions.ts +7 -4
- package/src/hooks/use_conversations_cache.ts +1 -23
- package/src/hooks/use_conversations_jolt_events.ts +24 -10
- package/src/hooks/use_features.ts +2 -0
- package/src/hooks/use_groups_groups.ts +21 -16
- package/src/hooks/use_hidden_conversations_count.ts +14 -0
- package/src/hooks/use_hide_conversation.ts +128 -0
- package/src/hooks/use_hide_conversations_enabled.ts +7 -0
- package/src/hooks/use_mark_latest_message_read.ts +6 -5
- package/src/hooks/use_new_conversation_from_filter.ts +13 -5
- package/src/hooks/use_product_analytics.ts +74 -41
- package/src/navigation/index.tsx +8 -0
- package/src/screens/__tests__/conversation_actions_screen.test.tsx +79 -0
- package/src/screens/__tests__/conversation_details_screen.test.tsx +49 -1
- package/src/screens/conversation_actions_screen.tsx +53 -0
- package/src/screens/conversation_details_screen.tsx +19 -0
- package/src/screens/conversation_filters/__tests__/conversation_filters.test.tsx +42 -0
- package/src/screens/conversation_filters/components/conversation_filters.tsx +22 -3
- package/src/screens/conversation_filters/components/rows.tsx +44 -10
- 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_new/components/groups_form.tsx +11 -9
- package/src/screens/conversations/__tests__/conversations_screen.test.tsx +1 -0
- package/src/screens/conversations/components/__tests__/filter_dropdown_list_header_component.test.tsx +42 -0
- package/src/screens/conversations/components/__tests__/list_header_component.test.tsx +1 -0
- package/src/screens/conversations/components/filter_dropdown_list_header_component.tsx +21 -5
- package/src/screens/conversations/components/list_header_component.tsx +14 -4
- package/src/screens/conversations/components/search_list_header_component.tsx +14 -4
- package/src/screens/conversations/conversations_screen.tsx +3 -0
- package/src/screens/get_help_screen.tsx +4 -18
- package/src/screens/index.ts +1 -0
- package/src/types/jolt_events/index.ts +2 -0
- package/src/types/jolt_events/person_events.ts +16 -0
- package/src/types/resources/conversation_membership.ts +1 -0
- package/src/types/resources/groups/groups_group_resource.ts +1 -1
- package/src/types/resources/groups/groups_membership_resource.ts +10 -0
- package/src/types/resources/groups/index.ts +1 -0
- package/src/utils/__tests__/throttled_refresh.test.ts +101 -0
- package/src/utils/jolt/__tests__/parse_stream_user_event_type.test.ts +27 -0
- package/src/utils/jolt/parse_stream_user_event_type.ts +16 -0
- package/src/utils/native_adapters/__tests__/linking.test.ts +60 -4
- package/src/utils/native_adapters/linking.ts +50 -2
- package/src/utils/product_analytics_token.ts +120 -0
- package/src/utils/request/conversation.ts +6 -0
- package/src/utils/throttled_refresh.ts +62 -0
- package/src/utils/toast_store.ts +45 -0
- package/src/vendor/font_awesome_pro_solid_icons.ts +12 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/linking.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/linking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAE,MAAM,cAAc,CAAA;AAG7C,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;AAID,qBAAa,cAAc;IACzB,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;IAClC,UAAU,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;gBAE5B,OAAO,EAAE,cAAc;CAYpC"}
|
|
@@ -1,8 +1,54 @@
|
|
|
1
|
-
import { Linking } from 'react-native';
|
|
1
|
+
import { Alert, Linking } from 'react-native';
|
|
2
|
+
import { Clipboard, Log } from './configuration';
|
|
3
|
+
const CONTACT_SCHEME = /^(mailto|tel):/i;
|
|
2
4
|
export class LinkingAdapter {
|
|
3
5
|
constructor(methods) {
|
|
4
|
-
|
|
6
|
+
const openURL = methods.openURL.bind(Linking);
|
|
7
|
+
this.openURL = async (...args) => {
|
|
8
|
+
try {
|
|
9
|
+
await openURL(...args);
|
|
10
|
+
} catch (error) {
|
|
11
|
+
handleOpenFailure(args[0], error);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
5
14
|
this.canOpenURL = methods.canOpenURL.bind(Linking);
|
|
6
15
|
}
|
|
7
16
|
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* mailto: and tel: links fail for ordinary reasons (no mail app, no phone),
|
|
20
|
+
* so the user gets an alert offering to copy the address. Any other failure
|
|
21
|
+
* is reported through the Log adapter so it stays visible as a handled error.
|
|
22
|
+
*/
|
|
23
|
+
function handleOpenFailure(url, error) {
|
|
24
|
+
if (CONTACT_SCHEME.test(url)) {
|
|
25
|
+
alertUnableToOpen(url);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
Log.reportError(toError(error, url), {
|
|
29
|
+
extra: {
|
|
30
|
+
url
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function alertUnableToOpen(url) {
|
|
35
|
+
const address = readableAddress(url);
|
|
36
|
+
Alert.alert('Oops', `Unable to open: ${address}`, [{
|
|
37
|
+
text: 'Copy to clipboard',
|
|
38
|
+
onPress: () => Clipboard.setStringAsync(address)
|
|
39
|
+
}, {
|
|
40
|
+
text: 'OK'
|
|
41
|
+
}]);
|
|
42
|
+
}
|
|
43
|
+
function readableAddress(url) {
|
|
44
|
+
const address = url.replace(CONTACT_SCHEME, '');
|
|
45
|
+
try {
|
|
46
|
+
return decodeURIComponent(address);
|
|
47
|
+
} catch {
|
|
48
|
+
return address;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function toError(error, url) {
|
|
52
|
+
return error instanceof Error ? error : new Error(`Unable to open URL: ${url}`);
|
|
53
|
+
}
|
|
8
54
|
//# sourceMappingURL=linking.js.map
|
|
@@ -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 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
|
|
1
|
+
{"version":3,"file":"linking.js","names":["Alert","Linking","Clipboard","Log","CONTACT_SCHEME","LinkingAdapter","constructor","methods","openURL","bind","args","error","handleOpenFailure","canOpenURL","url","test","alertUnableToOpen","reportError","toError","extra","address","readableAddress","alert","text","onPress","setStringAsync","replace","decodeURIComponent","Error"],"sources":["../../../src/utils/native_adapters/linking.ts"],"sourcesContent":["import { Alert, Linking } from 'react-native'\nimport { Clipboard, Log } from './configuration'\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\nconst CONTACT_SCHEME = /^(mailto|tel):/i\n\nexport class LinkingAdapter {\n openURL: LinkingMethods['openURL']\n canOpenURL: LinkingMethods['canOpenURL']\n\n constructor(methods: LinkingMethods) {\n const openURL = methods.openURL.bind(Linking)\n\n this.openURL = async (...args) => {\n try {\n await openURL(...args)\n } catch (error) {\n handleOpenFailure(args[0], error)\n }\n }\n this.canOpenURL = methods.canOpenURL.bind(Linking)\n }\n}\n\n/**\n * mailto: and tel: links fail for ordinary reasons (no mail app, no phone),\n * so the user gets an alert offering to copy the address. Any other failure\n * is reported through the Log adapter so it stays visible as a handled error.\n */\nfunction handleOpenFailure(url: string, error: unknown) {\n if (CONTACT_SCHEME.test(url)) {\n alertUnableToOpen(url)\n return\n }\n\n Log.reportError(toError(error, url), { extra: { url } })\n}\n\nfunction alertUnableToOpen(url: string) {\n const address = readableAddress(url)\n\n Alert.alert('Oops', `Unable to open: ${address}`, [\n { text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(address) },\n { text: 'OK' },\n ])\n}\n\nfunction readableAddress(url: string) {\n const address = url.replace(CONTACT_SCHEME, '')\n\n try {\n return decodeURIComponent(address)\n } catch {\n return address\n }\n}\n\nfunction toError(error: unknown, url: string) {\n return error instanceof Error ? error : new Error(`Unable to open URL: ${url}`)\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,OAAO,QAAQ,cAAc;AAC7C,SAASC,SAAS,EAAEC,GAAG,QAAQ,iBAAiB;AAWhD,MAAMC,cAAc,GAAG,iBAAiB;AAExC,OAAO,MAAMC,cAAc,CAAC;EAI1BC,WAAWA,CAACC,OAAuB,EAAE;IACnC,MAAMC,OAAO,GAAGD,OAAO,CAACC,OAAO,CAACC,IAAI,CAACR,OAAO,CAAC;IAE7C,IAAI,CAACO,OAAO,GAAG,OAAO,GAAGE,IAAI,KAAK;MAChC,IAAI;QACF,MAAMF,OAAO,CAAC,GAAGE,IAAI,CAAC;MACxB,CAAC,CAAC,OAAOC,KAAK,EAAE;QACdC,iBAAiB,CAACF,IAAI,CAAC,CAAC,CAAC,EAAEC,KAAK,CAAC;MACnC;IACF,CAAC;IACD,IAAI,CAACE,UAAU,GAAGN,OAAO,CAACM,UAAU,CAACJ,IAAI,CAACR,OAAO,CAAC;EACpD;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASW,iBAAiBA,CAACE,GAAW,EAAEH,KAAc,EAAE;EACtD,IAAIP,cAAc,CAACW,IAAI,CAACD,GAAG,CAAC,EAAE;IAC5BE,iBAAiB,CAACF,GAAG,CAAC;IACtB;EACF;EAEAX,GAAG,CAACc,WAAW,CAACC,OAAO,CAACP,KAAK,EAAEG,GAAG,CAAC,EAAE;IAAEK,KAAK,EAAE;MAAEL;IAAI;EAAE,CAAC,CAAC;AAC1D;AAEA,SAASE,iBAAiBA,CAACF,GAAW,EAAE;EACtC,MAAMM,OAAO,GAAGC,eAAe,CAACP,GAAG,CAAC;EAEpCd,KAAK,CAACsB,KAAK,CAAC,MAAM,EAAE,mBAAmBF,OAAO,EAAE,EAAE,CAChD;IAAEG,IAAI,EAAE,mBAAmB;IAAEC,OAAO,EAAEA,CAAA,KAAMtB,SAAS,CAACuB,cAAc,CAACL,OAAO;EAAE,CAAC,EAC/E;IAAEG,IAAI,EAAE;EAAK,CAAC,CACf,CAAC;AACJ;AAEA,SAASF,eAAeA,CAACP,GAAW,EAAE;EACpC,MAAMM,OAAO,GAAGN,GAAG,CAACY,OAAO,CAACtB,cAAc,EAAE,EAAE,CAAC;EAE/C,IAAI;IACF,OAAOuB,kBAAkB,CAACP,OAAO,CAAC;EACpC,CAAC,CAAC,MAAM;IACN,OAAOA,OAAO;EAChB;AACF;AAEA,SAASF,OAAOA,CAACP,KAAc,EAAEG,GAAW,EAAE;EAC5C,OAAOH,KAAK,YAAYiB,KAAK,GAAGjB,KAAK,GAAG,IAAIiB,KAAK,CAAC,uBAAuBd,GAAG,EAAE,CAAC;AACjF","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { ProductAnalyticsConfig } from '../types/product_analytics';
|
|
3
|
+
import { Session } from './session';
|
|
4
|
+
export interface StoredProductAnalyticsConfig extends ProductAnalyticsConfig {
|
|
5
|
+
expiresAt: number;
|
|
6
|
+
personId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const TOKEN_EXPIRY_TIME: number;
|
|
9
|
+
export declare const productAnalyticsStorageKey: (session: Session) => string;
|
|
10
|
+
export declare const productAnalyticsQueryKey: (session: Session) => string[];
|
|
11
|
+
export declare function fetchProductAnalyticsConfig(queryClient: QueryClient, session: Session): Promise<StoredProductAnalyticsConfig>;
|
|
12
|
+
//# sourceMappingURL=product_analytics_token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product_analytics_token.d.ts","sourceRoot":"","sources":["../../src/utils/product_analytics_token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAGnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAWnC,MAAM,WAAW,4BAA6B,SAAQ,sBAAsB;IAC1E,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,iBAAiB,QAAwB,CAAA;AAKtD,eAAO,MAAM,0BAA0B,GAAI,SAAS,OAAO,WACjB,CAAA;AAE1C,eAAO,MAAM,wBAAwB,GAAI,SAAS,OAAO,aAIxD,CAAA;AAyED,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,4BAA4B,CAAC,CASvC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { currentPersonQueryKey } from '../hooks/use_current_person';
|
|
2
|
+
import { Client } from './client';
|
|
3
|
+
import { Storage } from './native_adapters';
|
|
4
|
+
import { ONE_HOUR, toMs } from './time';
|
|
5
|
+
import { Uri } from './uri';
|
|
6
|
+
export const TOKEN_EXPIRY_TIME = toMs(7 * 24, 'hours');
|
|
7
|
+
const EXPIRY_MARGIN = ONE_HOUR;
|
|
8
|
+
|
|
9
|
+
// One slot per environment, tagged with the person it belongs to. Keying on
|
|
10
|
+
// session.id would miss on every access-token refresh and leave orphaned entries.
|
|
11
|
+
export const productAnalyticsStorageKey = session => `product-analytics-token:${session.env}`;
|
|
12
|
+
export const productAnalyticsQueryKey = session => ['product-analytics-token', session.env, session.id];
|
|
13
|
+
const renewalTime = config => config.expiresAt - EXPIRY_MARGIN;
|
|
14
|
+
const isStoredConfig = value => typeof value === 'object' && value !== null && typeof value.token === 'string' && typeof value.endpoint === 'string' && typeof value.expiresAt === 'number' && typeof value.personId === 'string';
|
|
15
|
+
async function readStoredConfig(key) {
|
|
16
|
+
try {
|
|
17
|
+
const raw = await Storage.getItem(key);
|
|
18
|
+
if (!raw) return undefined;
|
|
19
|
+
const parsed = JSON.parse(raw);
|
|
20
|
+
return isStoredConfig(parsed) ? parsed : undefined;
|
|
21
|
+
} catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function writeStoredConfig(key, config) {
|
|
26
|
+
return Storage.setItem(key, JSON.stringify(config)).catch(() => {});
|
|
27
|
+
}
|
|
28
|
+
function requestConfig(session, personId) {
|
|
29
|
+
const uri = new Uri({
|
|
30
|
+
session
|
|
31
|
+
});
|
|
32
|
+
const client = new Client({
|
|
33
|
+
root: uri.api('/chat/v2'),
|
|
34
|
+
defaultHeaders: uri.headers,
|
|
35
|
+
version: '2018-11-01'
|
|
36
|
+
});
|
|
37
|
+
return client.post({
|
|
38
|
+
url: '/me/product_analytics_authorize',
|
|
39
|
+
data: {
|
|
40
|
+
data: {
|
|
41
|
+
type: 'ProductAnalyticsToken',
|
|
42
|
+
attributes: {}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}).then(res => ({
|
|
46
|
+
token: res.data.id,
|
|
47
|
+
endpoint: res.data.url,
|
|
48
|
+
metadata: res.data.metadata,
|
|
49
|
+
expiresAt: Date.now() + TOKEN_EXPIRY_TIME,
|
|
50
|
+
personId
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// The chat screens that publish events already load /me, and the package's query
|
|
55
|
+
// client is cleared whenever the access token changes, so this is normally a cache hit.
|
|
56
|
+
async function currentPersonId(queryClient) {
|
|
57
|
+
const {
|
|
58
|
+
data
|
|
59
|
+
} = await queryClient.ensureQueryData({
|
|
60
|
+
queryKey: currentPersonQueryKey
|
|
61
|
+
});
|
|
62
|
+
return String(data.id);
|
|
63
|
+
}
|
|
64
|
+
async function loadConfig(queryClient, session) {
|
|
65
|
+
const personId = await currentPersonId(queryClient);
|
|
66
|
+
const key = productAnalyticsStorageKey(session);
|
|
67
|
+
const stored = await readStoredConfig(key);
|
|
68
|
+
if (stored && stored.personId === personId && renewalTime(stored) > Date.now()) return stored;
|
|
69
|
+
const config = await requestConfig(session, personId);
|
|
70
|
+
await writeStoredConfig(key, config);
|
|
71
|
+
return config;
|
|
72
|
+
}
|
|
73
|
+
export function fetchProductAnalyticsConfig(queryClient, session) {
|
|
74
|
+
return queryClient.fetchQuery({
|
|
75
|
+
queryKey: productAnalyticsQueryKey(session),
|
|
76
|
+
queryFn: () => loadConfig(queryClient, session),
|
|
77
|
+
staleTime: ({
|
|
78
|
+
state
|
|
79
|
+
}) => state.data ? Math.max(0, renewalTime(state.data) - state.dataUpdatedAt) : 0,
|
|
80
|
+
gcTime: TOKEN_EXPIRY_TIME,
|
|
81
|
+
retry: false
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=product_analytics_token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product_analytics_token.js","names":["currentPersonQueryKey","Client","Storage","ONE_HOUR","toMs","Uri","TOKEN_EXPIRY_TIME","EXPIRY_MARGIN","productAnalyticsStorageKey","session","env","productAnalyticsQueryKey","id","renewalTime","config","expiresAt","isStoredConfig","value","token","endpoint","personId","readStoredConfig","key","raw","getItem","undefined","parsed","JSON","parse","writeStoredConfig","setItem","stringify","catch","requestConfig","uri","client","root","api","defaultHeaders","headers","version","post","url","data","type","attributes","then","res","metadata","Date","now","currentPersonId","queryClient","ensureQueryData","queryKey","String","loadConfig","stored","fetchProductAnalyticsConfig","fetchQuery","queryFn","staleTime","state","Math","max","dataUpdatedAt","gcTime","retry"],"sources":["../../src/utils/product_analytics_token.ts"],"sourcesContent":["import { QueryClient } from '@tanstack/react-query'\nimport { currentPersonQueryKey } from '../hooks/use_current_person'\nimport { ApiResource, CurrentPersonResource } from '../types'\nimport { ProductAnalyticsConfig } from '../types/product_analytics'\nimport { Client } from './client'\nimport { Storage } from './native_adapters'\nimport { Session } from './session'\nimport { ONE_HOUR, toMs } from './time'\nimport { Uri } from './uri'\n\ninterface ProductAnalyticsTokenResponse {\n type: 'ProductAnalyticsToken'\n id: string\n url: string\n metadata: Record<string, unknown>\n}\n\nexport interface StoredProductAnalyticsConfig extends ProductAnalyticsConfig {\n expiresAt: number\n personId: string\n}\n\nexport const TOKEN_EXPIRY_TIME = toMs(7 * 24, 'hours')\nconst EXPIRY_MARGIN = ONE_HOUR\n\n// One slot per environment, tagged with the person it belongs to. Keying on\n// session.id would miss on every access-token refresh and leave orphaned entries.\nexport const productAnalyticsStorageKey = (session: Session) =>\n `product-analytics-token:${session.env}`\n\nexport const productAnalyticsQueryKey = (session: Session) => [\n 'product-analytics-token',\n session.env,\n session.id,\n]\n\nconst renewalTime = (config: StoredProductAnalyticsConfig) => config.expiresAt - EXPIRY_MARGIN\n\nconst isStoredConfig = (value: unknown): value is StoredProductAnalyticsConfig =>\n typeof value === 'object' &&\n value !== null &&\n typeof (value as StoredProductAnalyticsConfig).token === 'string' &&\n typeof (value as StoredProductAnalyticsConfig).endpoint === 'string' &&\n typeof (value as StoredProductAnalyticsConfig).expiresAt === 'number' &&\n typeof (value as StoredProductAnalyticsConfig).personId === 'string'\n\nasync function readStoredConfig(key: string): Promise<StoredProductAnalyticsConfig | undefined> {\n try {\n const raw = await Storage.getItem(key)\n if (!raw) return undefined\n\n const parsed: unknown = JSON.parse(raw)\n return isStoredConfig(parsed) ? parsed : undefined\n } catch {\n return undefined\n }\n}\n\nfunction writeStoredConfig(key: string, config: StoredProductAnalyticsConfig): Promise<void> {\n return Storage.setItem(key, JSON.stringify(config)).catch(() => {})\n}\n\nfunction requestConfig(session: Session, personId: string): Promise<StoredProductAnalyticsConfig> {\n const uri = new Uri({ session })\n const client = new Client({\n root: uri.api('/chat/v2'),\n defaultHeaders: uri.headers,\n version: '2018-11-01',\n })\n\n return client\n .post<ApiResource<ProductAnalyticsTokenResponse>>({\n url: '/me/product_analytics_authorize',\n data: { data: { type: 'ProductAnalyticsToken', attributes: {} } },\n })\n .then(res => ({\n token: res.data.id,\n endpoint: res.data.url,\n metadata: res.data.metadata,\n expiresAt: Date.now() + TOKEN_EXPIRY_TIME,\n personId,\n }))\n}\n\n// The chat screens that publish events already load /me, and the package's query\n// client is cleared whenever the access token changes, so this is normally a cache hit.\nasync function currentPersonId(queryClient: QueryClient): Promise<string> {\n const { data } = await queryClient.ensureQueryData<ApiResource<CurrentPersonResource>>({\n queryKey: currentPersonQueryKey,\n })\n return String(data.id)\n}\n\nasync function loadConfig(\n queryClient: QueryClient,\n session: Session\n): Promise<StoredProductAnalyticsConfig> {\n const personId = await currentPersonId(queryClient)\n const key = productAnalyticsStorageKey(session)\n const stored = await readStoredConfig(key)\n if (stored && stored.personId === personId && renewalTime(stored) > Date.now()) return stored\n\n const config = await requestConfig(session, personId)\n await writeStoredConfig(key, config)\n return config\n}\n\nexport function fetchProductAnalyticsConfig(\n queryClient: QueryClient,\n session: Session\n): Promise<StoredProductAnalyticsConfig> {\n return queryClient.fetchQuery({\n queryKey: productAnalyticsQueryKey(session),\n queryFn: () => loadConfig(queryClient, session),\n staleTime: ({ state }) =>\n state.data ? Math.max(0, renewalTime(state.data) - state.dataUpdatedAt) : 0,\n gcTime: TOKEN_EXPIRY_TIME,\n retry: false,\n })\n}\n"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,6BAA6B;AAGnE,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,OAAO,QAAQ,mBAAmB;AAE3C,SAASC,QAAQ,EAAEC,IAAI,QAAQ,QAAQ;AACvC,SAASC,GAAG,QAAQ,OAAO;AAc3B,OAAO,MAAMC,iBAAiB,GAAGF,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC;AACtD,MAAMG,aAAa,GAAGJ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AAM,CAAC,GAAGR,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE,OAAOO,MAAM;EAE7F,MAAM3C,MAAM,GAAG,MAAMmB,aAAa,CAACxB,OAAO,EAAEW,QAAQ,CAAC;EACrD,MAAMS,iBAAiB,CAACP,GAAG,EAAER,MAAM,CAAC;EACpC,OAAOA,MAAM;AACf;AAEA,OAAO,SAAS4C,2BAA2BA,CACzCN,WAAwB,EACxB3C,OAAgB,EACuB;EACvC,OAAO2C,WAAW,CAACO,UAAU,CAAC;IAC5BL,QAAQ,EAAE3C,wBAAwB,CAACF,OAAO,CAAC;IAC3CmD,OAAO,EAAEA,CAAA,KAAMJ,UAAU,CAACJ,WAAW,EAAE3C,OAAO,CAAC;IAC/CoD,SAAS,EAAEA,CAAC;MAAEC;IAAM,CAAC,KACnBA,KAAK,CAACnB,IAAI,GAAGoB,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEnD,WAAW,CAACiD,KAAK,CAACnB,IAAI,CAAC,GAAGmB,KAAK,CAACG,aAAa,CAAC,GAAG,CAAC;IAC7EC,MAAM,EAAE5D,iBAAiB;IACzB6D,KAAK,EAAE;EACT,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -6,7 +6,9 @@ export interface ConversationRequestArgs {
|
|
|
6
6
|
group_source_app_name?: string;
|
|
7
7
|
show_direct_messages?: boolean;
|
|
8
8
|
show_archived?: boolean;
|
|
9
|
+
show_hidden?: boolean;
|
|
9
10
|
show_unread?: boolean;
|
|
10
11
|
}
|
|
11
|
-
export declare const
|
|
12
|
+
export declare const HIDDEN_CONVERSATIONS_FILTER = "mine_or_not_empty,hidden";
|
|
13
|
+
export declare const getConversationsRequestArgs: ({ gids, chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived, show_hidden, show_unread, }?: Partial<ConversationRequestArgs>) => GetRequest;
|
|
12
14
|
//# 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;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;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;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,eAAO,MAAM,2BAA2B,6BAA6B,CAAA;AAErE,eAAO,MAAM,2BAA2B,GAAI,uHAQzC,OAAO,CAAC,uBAAuB,CAAM,KAAG,UA2D1C,CAAA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
export const HIDDEN_CONVERSATIONS_FILTER = 'mine_or_not_empty,hidden';
|
|
1
2
|
export const getConversationsRequestArgs = ({
|
|
2
3
|
gids,
|
|
3
4
|
chat_group_graph_id,
|
|
4
5
|
group_source_app_name,
|
|
5
6
|
show_direct_messages,
|
|
6
7
|
show_archived,
|
|
8
|
+
show_hidden,
|
|
7
9
|
show_unread
|
|
8
10
|
} = {}) => {
|
|
9
11
|
let filter;
|
|
@@ -11,6 +13,8 @@ export const getConversationsRequestArgs = ({
|
|
|
11
13
|
filter = 'mine_or_not_empty,group';
|
|
12
14
|
} else if (show_archived) {
|
|
13
15
|
filter = 'mine_or_not_empty,archived';
|
|
16
|
+
} else if (show_hidden) {
|
|
17
|
+
filter = HIDDEN_CONVERSATIONS_FILTER;
|
|
14
18
|
} else if (show_unread) {
|
|
15
19
|
filter = 'mine_or_not_empty,unread';
|
|
16
20
|
} else if (show_direct_messages) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","names":["getConversationsRequestArgs","gids","chat_group_graph_id","group_source_app_name","show_direct_messages","show_archived","show_unread","filter","url","data","perPage","order","group","fields","Conversation","AnalyticsMetadata","ConversationBadge","include"],"sources":["../../../src/utils/request/conversation.ts"],"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 show_archived?: boolean\n show_unread?: boolean\n}\n\nexport const getConversationsRequestArgs = ({\n gids,\n chat_group_graph_id,\n group_source_app_name,\n show_direct_messages,\n show_archived,\n show_unread,\n}: Partial<ConversationRequestArgs> = {}): GetRequest => {\n let filter: string\n if (chat_group_graph_id) {\n filter = 'mine_or_not_empty,group'\n } else if (show_archived) {\n filter = 'mine_or_not_empty,archived'\n } else if (show_unread) {\n filter = 'mine_or_not_empty,unread'\n } else if (show_direct_messages) {\n filter = 'mine_or_not_empty,direct_message'\n } else if (group_source_app_name) {\n filter = 'mine_or_not_empty,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 'conversation_preview',\n 'disabled',\n 'disabled_reason',\n 'disabled_message',\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 'unread_reaction',\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"],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversation.js","names":["HIDDEN_CONVERSATIONS_FILTER","getConversationsRequestArgs","gids","chat_group_graph_id","group_source_app_name","show_direct_messages","show_archived","show_hidden","show_unread","filter","url","data","perPage","order","group","fields","Conversation","AnalyticsMetadata","ConversationBadge","include"],"sources":["../../../src/utils/request/conversation.ts"],"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 show_archived?: boolean\n show_hidden?: boolean\n show_unread?: boolean\n}\n\nexport const HIDDEN_CONVERSATIONS_FILTER = 'mine_or_not_empty,hidden'\n\nexport const getConversationsRequestArgs = ({\n gids,\n chat_group_graph_id,\n group_source_app_name,\n show_direct_messages,\n show_archived,\n show_hidden,\n show_unread,\n}: Partial<ConversationRequestArgs> = {}): GetRequest => {\n let filter: string\n if (chat_group_graph_id) {\n filter = 'mine_or_not_empty,group'\n } else if (show_archived) {\n filter = 'mine_or_not_empty,archived'\n } else if (show_hidden) {\n filter = HIDDEN_CONVERSATIONS_FILTER\n } else if (show_unread) {\n filter = 'mine_or_not_empty,unread'\n } else if (show_direct_messages) {\n filter = 'mine_or_not_empty,direct_message'\n } else if (group_source_app_name) {\n filter = 'mine_or_not_empty,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 'conversation_preview',\n 'disabled',\n 'disabled_reason',\n 'disabled_message',\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 'unread_reaction',\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"],"mappings":"AAaA,OAAO,MAAMA,2BAA2B,GAAG,0BAA0B;AAErE,OAAO,MAAMC,2BAA2B,GAAGA,CAAC;EAC1CC,IAAI;EACJC,mBAAmB;EACnBC,qBAAqB;EACrBC,oBAAoB;EACpBC,aAAa;EACbC,WAAW;EACXC;AACgC,CAAC,GAAG,CAAC,CAAC,KAAiB;EACvD,IAAIC,MAAc;EAClB,IAAIN,mBAAmB,EAAE;IACvBM,MAAM,GAAG,yBAAyB;EACpC,CAAC,MAAM,IAAIH,aAAa,EAAE;IACxBG,MAAM,GAAG,4BAA4B;EACvC,CAAC,MAAM,IAAIF,WAAW,EAAE;IACtBE,MAAM,GAAGT,2BAA2B;EACtC,CAAC,MAAM,IAAIQ,WAAW,EAAE;IACtBC,MAAM,GAAG,0BAA0B;EACrC,CAAC,MAAM,IAAIJ,oBAAoB,EAAE;IAC/BI,MAAM,GAAG,kCAAkC;EAC7C,CAAC,MAAM,IAAIL,qBAAqB,EAAE;IAChCK,MAAM,GAAG,yCAAyC;EACpD,CAAC,MAAM;IACLA,MAAM,GAAG,mBAAmB;EAC9B;EAEA,OAAO;IACLC,GAAG,EAAE,mBAAmB;IACxBC,IAAI,EAAE;MACJC,OAAO,EAAE,EAAE;MACXC,KAAK,EAAE,eAAe;MACtBJ,MAAM;MACNP,IAAI;MACJY,KAAK,EAAEX,mBAAmB;MAC1BC,qBAAqB;MACrBW,MAAM,EAAE;QACNC,YAAY,EAAE,CACZ,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EACR,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,YAAY,CACb;QACDC,iBAAiB,EAAE,CAAC,UAAU,CAAC;QAC/BC,iBAAiB,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,MAAM;MAC7D,CAAC;MACDC,OAAO,EAAE,CAAC,QAAQ,EAAE,oBAAoB;IAC1C;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { QueryClient, QueryKey } from '@tanstack/react-query';
|
|
2
|
+
export declare const REFRESH_THROTTLE_MS = 3000;
|
|
3
|
+
type Refresh = () => unknown;
|
|
4
|
+
export declare const throttledRefresh: (queryClient: QueryClient, key: QueryKey, event: object, refresh: Refresh) => void;
|
|
5
|
+
export declare const cancelThrottledRefreshes: (queryClient: QueryClient) => void;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=throttled_refresh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttled_refresh.d.ts","sourceRoot":"","sources":["../../src/utils/throttled_refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGtE,eAAO,MAAM,mBAAmB,OAAO,CAAA;AAEvC,KAAK,OAAO,GAAG,MAAM,OAAO,CAAA;AAqC5B,eAAO,MAAM,gBAAgB,GAC3B,aAAa,WAAW,EACxB,KAAK,QAAQ,EACb,OAAO,MAAM,EACb,SAAS,OAAO,SAOjB,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,aAAa,WAAW,SAMhE,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { hashKey } from '@tanstack/react-query';
|
|
2
|
+
import { throttle } from 'lodash';
|
|
3
|
+
export const REFRESH_THROTTLE_MS = 3000;
|
|
4
|
+
const refreshesByClient = new WeakMap();
|
|
5
|
+
const refreshesFor = queryClient => {
|
|
6
|
+
const existing = refreshesByClient.get(queryClient);
|
|
7
|
+
if (existing) return existing;
|
|
8
|
+
const refreshes = new Map();
|
|
9
|
+
refreshesByClient.set(queryClient, refreshes);
|
|
10
|
+
return refreshes;
|
|
11
|
+
};
|
|
12
|
+
const throttledRefreshFor = (queryClient, key) => {
|
|
13
|
+
const refreshes = refreshesFor(queryClient);
|
|
14
|
+
const hashedKey = hashKey(key);
|
|
15
|
+
const existing = refreshes.get(hashedKey);
|
|
16
|
+
if (existing) return existing;
|
|
17
|
+
const created = {
|
|
18
|
+
run: throttle(refresh => {
|
|
19
|
+
refresh();
|
|
20
|
+
}, REFRESH_THROTTLE_MS, {
|
|
21
|
+
leading: true,
|
|
22
|
+
trailing: true
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
refreshes.set(hashedKey, created);
|
|
26
|
+
return created;
|
|
27
|
+
};
|
|
28
|
+
export const throttledRefresh = (queryClient, key, event, refresh) => {
|
|
29
|
+
const throttled = throttledRefreshFor(queryClient, key);
|
|
30
|
+
if (throttled.lastEvent === event) return;
|
|
31
|
+
throttled.lastEvent = event;
|
|
32
|
+
throttled.run(refresh);
|
|
33
|
+
};
|
|
34
|
+
export const cancelThrottledRefreshes = queryClient => {
|
|
35
|
+
const refreshes = refreshesByClient.get(queryClient);
|
|
36
|
+
if (!refreshes) return;
|
|
37
|
+
refreshes.forEach(({
|
|
38
|
+
run
|
|
39
|
+
}) => run.cancel());
|
|
40
|
+
refreshesByClient.delete(queryClient);
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=throttled_refresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttled_refresh.js","names":["hashKey","throttle","REFRESH_THROTTLE_MS","refreshesByClient","WeakMap","refreshesFor","queryClient","existing","get","refreshes","Map","set","throttledRefreshFor","key","hashedKey","created","run","refresh","leading","trailing","throttledRefresh","event","throttled","lastEvent","cancelThrottledRefreshes","forEach","cancel","delete"],"sources":["../../src/utils/throttled_refresh.ts"],"sourcesContent":["import { hashKey, QueryClient, QueryKey } from '@tanstack/react-query'\nimport { DebouncedFuncLeading, throttle } from 'lodash'\n\nexport const REFRESH_THROTTLE_MS = 3000\n\ntype Refresh = () => unknown\n\ninterface ThrottledRefresh {\n run: DebouncedFuncLeading<(refresh: Refresh) => void>\n lastEvent?: object\n}\n\nconst refreshesByClient = new WeakMap<QueryClient, Map<string, ThrottledRefresh>>()\n\nconst refreshesFor = (queryClient: QueryClient) => {\n const existing = refreshesByClient.get(queryClient)\n if (existing) return existing\n\n const refreshes = new Map<string, ThrottledRefresh>()\n refreshesByClient.set(queryClient, refreshes)\n return refreshes\n}\n\nconst throttledRefreshFor = (queryClient: QueryClient, key: QueryKey) => {\n const refreshes = refreshesFor(queryClient)\n const hashedKey = hashKey(key)\n const existing = refreshes.get(hashedKey)\n if (existing) return existing\n\n const created: ThrottledRefresh = {\n run: throttle(\n (refresh: Refresh) => {\n refresh()\n },\n REFRESH_THROTTLE_MS,\n { leading: true, trailing: true }\n ),\n }\n refreshes.set(hashedKey, created)\n return created\n}\n\nexport const throttledRefresh = (\n queryClient: QueryClient,\n key: QueryKey,\n event: object,\n refresh: Refresh\n) => {\n const throttled = throttledRefreshFor(queryClient, key)\n if (throttled.lastEvent === event) return\n\n throttled.lastEvent = event\n throttled.run(refresh)\n}\n\nexport const cancelThrottledRefreshes = (queryClient: QueryClient) => {\n const refreshes = refreshesByClient.get(queryClient)\n if (!refreshes) return\n\n refreshes.forEach(({ run }) => run.cancel())\n refreshesByClient.delete(queryClient)\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAA+B,uBAAuB;AACtE,SAA+BC,QAAQ,QAAQ,QAAQ;AAEvD,OAAO,MAAMC,mBAAmB,GAAG,IAAI;AASvC,MAAMC,iBAAiB,GAAG,IAAIC,OAAO,CAA6C,CAAC;AAEnF,MAAMC,YAAY,GAAIC,WAAwB,IAAK;EACjD,MAAMC,QAAQ,GAAGJ,iBAAiB,CAACK,GAAG,CAACF,WAAW,CAAC;EACnD,IAAIC,QAAQ,EAAE,OAAOA,QAAQ;EAE7B,MAAME,SAAS,GAAG,IAAIC,GAAG,CAA2B,CAAC;EACrDP,iBAAiB,CAACQ,GAAG,CAACL,WAAW,EAAEG,SAAS,CAAC;EAC7C,OAAOA,SAAS;AAClB,CAAC;AAED,MAAMG,mBAAmB,GAAGA,CAACN,WAAwB,EAAEO,GAAa,KAAK;EACvE,MAAMJ,SAAS,GAAGJ,YAAY,CAACC,WAAW,CAAC;EAC3C,MAAMQ,SAAS,GAAGd,OAAO,CAACa,GAAG,CAAC;EAC9B,MAAMN,QAAQ,GAAGE,SAAS,CAACD,GAAG,CAACM,SAAS,CAAC;EACzC,IAAIP,QAAQ,EAAE,OAAOA,QAAQ;EAE7B,MAAMQ,OAAyB,GAAG;IAChCC,GAAG,EAAEf,QAAQ,CACVgB,OAAgB,IAAK;MACpBA,OAAO,CAAC,CAAC;IACX,CAAC,EACDf,mBAAmB,EACnB;MAAEgB,OAAO,EAAE,IAAI;MAAEC,QAAQ,EAAE;IAAK,CAClC;EACF,CAAC;EACDV,SAAS,CAACE,GAAG,CAACG,SAAS,EAAEC,OAAO,CAAC;EACjC,OAAOA,OAAO;AAChB,CAAC;AAED,OAAO,MAAMK,gBAAgB,GAAGA,CAC9Bd,WAAwB,EACxBO,GAAa,EACbQ,KAAa,EACbJ,OAAgB,KACb;EACH,MAAMK,SAAS,GAAGV,mBAAmB,CAACN,WAAW,EAAEO,GAAG,CAAC;EACvD,IAAIS,SAAS,CAACC,SAAS,KAAKF,KAAK,EAAE;EAEnCC,SAAS,CAACC,SAAS,GAAGF,KAAK;EAC3BC,SAAS,CAACN,GAAG,CAACC,OAAO,CAAC;AACxB,CAAC;AAED,OAAO,MAAMO,wBAAwB,GAAIlB,WAAwB,IAAK;EACpE,MAAMG,SAAS,GAAGN,iBAAiB,CAACK,GAAG,CAACF,WAAW,CAAC;EACpD,IAAI,CAACG,SAAS,EAAE;EAEhBA,SAAS,CAACgB,OAAO,CAAC,CAAC;IAAET;EAAI,CAAC,KAAKA,GAAG,CAACU,MAAM,CAAC,CAAC,CAAC;EAC5CvB,iBAAiB,CAACwB,MAAM,CAACrB,WAAW,CAAC;AACvC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ToastAction {
|
|
2
|
+
label: string;
|
|
3
|
+
onPress: () => void;
|
|
4
|
+
}
|
|
5
|
+
export interface ToastOptions {
|
|
6
|
+
title: string;
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
action?: ToastAction;
|
|
9
|
+
}
|
|
10
|
+
export interface ToastState extends ToastOptions {
|
|
11
|
+
id: number;
|
|
12
|
+
}
|
|
13
|
+
type Listener = () => void;
|
|
14
|
+
export declare const toastStore: {
|
|
15
|
+
getSnapshot: () => ToastState | null;
|
|
16
|
+
subscribe: (listener: Listener) => () => void;
|
|
17
|
+
};
|
|
18
|
+
export declare function showToast(options: ToastOptions): void;
|
|
19
|
+
export declare function dismissToast(id?: number): void;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=toast_store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast_store.d.ts","sourceRoot":"","sources":["../../src/utils/toast_store.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,EAAE,EAAE,MAAM,CAAA;CACX;AAED,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAA;AAQ1B,eAAO,MAAM,UAAU;;0BAEC,QAAQ;CAM/B,CAAA;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,YAAY,QAG9C;AAED,wBAAgB,YAAY,CAAC,EAAE,CAAC,EAAE,MAAM,QAMvC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
let currentToast = null;
|
|
2
|
+
let nextId = 1;
|
|
3
|
+
const listeners = new Set();
|
|
4
|
+
const emit = () => listeners.forEach(listener => listener());
|
|
5
|
+
export const toastStore = {
|
|
6
|
+
getSnapshot: () => currentToast,
|
|
7
|
+
subscribe: listener => {
|
|
8
|
+
listeners.add(listener);
|
|
9
|
+
return () => {
|
|
10
|
+
listeners.delete(listener);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export function showToast(options) {
|
|
15
|
+
currentToast = {
|
|
16
|
+
...options,
|
|
17
|
+
id: nextId++
|
|
18
|
+
};
|
|
19
|
+
emit();
|
|
20
|
+
}
|
|
21
|
+
export function dismissToast(id) {
|
|
22
|
+
if (!currentToast) return;
|
|
23
|
+
if (id !== undefined && currentToast.id !== id) return;
|
|
24
|
+
currentToast = null;
|
|
25
|
+
emit();
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=toast_store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast_store.js","names":["currentToast","nextId","listeners","Set","emit","forEach","listener","toastStore","getSnapshot","subscribe","add","delete","showToast","options","id","dismissToast","undefined"],"sources":["../../src/utils/toast_store.ts"],"sourcesContent":["export interface ToastAction {\n label: string\n onPress: () => void\n}\n\nexport interface ToastOptions {\n title: string\n subtitle?: string\n action?: ToastAction\n}\n\nexport interface ToastState extends ToastOptions {\n id: number\n}\n\ntype Listener = () => void\n\nlet currentToast: ToastState | null = null\nlet nextId = 1\nconst listeners = new Set<Listener>()\n\nconst emit = () => listeners.forEach(listener => listener())\n\nexport const toastStore = {\n getSnapshot: () => currentToast,\n subscribe: (listener: Listener) => {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n}\n\nexport function showToast(options: ToastOptions) {\n currentToast = { ...options, id: nextId++ }\n emit()\n}\n\nexport function dismissToast(id?: number) {\n if (!currentToast) return\n if (id !== undefined && currentToast.id !== id) return\n\n currentToast = null\n emit()\n}\n"],"mappings":"AAiBA,IAAIA,YAA+B,GAAG,IAAI;AAC1C,IAAIC,MAAM,GAAG,CAAC;AACd,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAAW,CAAC;AAErC,MAAMC,IAAI,GAAGA,CAAA,KAAMF,SAAS,CAACG,OAAO,CAACC,QAAQ,IAAIA,QAAQ,CAAC,CAAC,CAAC;AAE5D,OAAO,MAAMC,UAAU,GAAG;EACxBC,WAAW,EAAEA,CAAA,KAAMR,YAAY;EAC/BS,SAAS,EAAGH,QAAkB,IAAK;IACjCJ,SAAS,CAACQ,GAAG,CAACJ,QAAQ,CAAC;IACvB,OAAO,MAAM;MACXJ,SAAS,CAACS,MAAM,CAACL,QAAQ,CAAC;IAC5B,CAAC;EACH;AACF,CAAC;AAED,OAAO,SAASM,SAASA,CAACC,OAAqB,EAAE;EAC/Cb,YAAY,GAAG;IAAE,GAAGa,OAAO;IAAEC,EAAE,EAAEb,MAAM;EAAG,CAAC;EAC3CG,IAAI,CAAC,CAAC;AACR;AAEA,OAAO,SAASW,YAAYA,CAACD,EAAW,EAAE;EACxC,IAAI,CAACd,YAAY,EAAE;EACnB,IAAIc,EAAE,KAAKE,SAAS,IAAIhB,YAAY,CAACc,EAAE,KAAKA,EAAE,EAAE;EAEhDd,YAAY,GAAG,IAAI;EACnBI,IAAI,CAAC,CAAC;AACR","ignoreList":[]}
|
|
@@ -50,4 +50,5 @@ export declare const faBullhorn: IconDefinition;
|
|
|
50
50
|
export declare const faCar: IconDefinition;
|
|
51
51
|
export declare const faTag: IconDefinition;
|
|
52
52
|
export declare const faBoxArchive: IconDefinition;
|
|
53
|
+
export declare const faEyeSlash: IconDefinition;
|
|
53
54
|
//# sourceMappingURL=font_awesome_pro_solid_icons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font_awesome_pro_solid_icons.d.ts","sourceRoot":"","sources":["../../src/vendor/font_awesome_pro_solid_icons.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AASvE,eAAO,MAAM,WAAW,EAAE,cAUzB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,cAUtB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,cAUrB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,cAUpB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,cAUjC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,cAU1B,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,cAU5B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,cAUtB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,cAUvB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,cAU9B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,cAU1B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,cAUtB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,cAU9B,CAAA;AAED,eAAO,MAAM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ED,eAAO,MAAM,MAAM,EAAE,cAUpB,CAAA;AAID,eAAO,MAAM,eAAe,EAAE,cAU7B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,cAUxB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,cAUnB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,cAUnB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,cAU1B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,cAUxB,CAAA"}
|
|
@@ -263,4 +263,9 @@ export const faBoxArchive = {
|
|
|
263
263
|
iconName: 'box-archive',
|
|
264
264
|
icon: [512, 512, ['archive'], 'f187', 'M0 64C0 46.3 14.3 32 32 32l448 0c17.7 0 32 14.3 32 32l0 32c0 17.7-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96L0 64zM32 176l448 0 0 240c0 35.3-28.7 64-64 64L96 480c-35.3 0-64-28.7-64-64l0-240zm152 64c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0z']
|
|
265
265
|
};
|
|
266
|
+
export const faEyeSlash = {
|
|
267
|
+
prefix: 'fas',
|
|
268
|
+
iconName: 'eye-slash',
|
|
269
|
+
icon: [576, 512, [], 'f070', 'M41-24.9c-9.4-9.4-24.6-9.4-33.9 0S-2.3-.3 7 9.1l528 528c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-96.4-96.4c2.7-2.4 5.4-4.8 8-7.2 46.8-43.5 78.1-95.4 93-131.1 3.3-7.9 3.3-16.7 0-24.6-14.9-35.7-46.2-87.7-93-131.1-47.1-43.7-111.8-80.6-192.6-80.6-56.8 0-105.6 18.2-146 44.2L41-24.9zM204.5 138.7c23.5-16.8 52.4-26.7 83.5-26.7 79.5 0 144 64.5 144 144 0 31.1-9.9 59.9-26.7 83.5l-34.7-34.7c12.7-21.4 17-47.7 10.1-73.7-13.7-51.2-66.4-81.6-117.6-67.9-8.6 2.3-16.7 5.7-24 10l-34.7-34.7zM325.3 395.1c-11.9 3.2-24.4 4.9-37.3 4.9-79.5 0-144-64.5-144-144 0-12.9 1.7-25.4 4.9-37.3L69.4 139.2c-32.6 36.8-55 75.8-66.9 104.5-3.3 7.9-3.3 16.7 0 24.6 14.9 35.7 46.2 87.7 93 131.1 47.1 43.7 111.8 80.6 192.6 80.6 37.3 0 71.2-7.9 101.5-20.6l-64.2-64.2z']
|
|
270
|
+
};
|
|
266
271
|
//# sourceMappingURL=font_awesome_pro_solid_icons.js.map
|