@planningcenter/chat-react-native 3.42.3-qa-staging.6 → 3.42.3-qa-staging.7

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.
Files changed (76) hide show
  1. package/build/components/display/platform_modal_header_buttons.d.ts +7 -47
  2. package/build/components/display/platform_modal_header_buttons.d.ts.map +1 -1
  3. package/build/components/display/platform_modal_header_buttons.js +9 -119
  4. package/build/components/display/platform_modal_header_buttons.js.map +1 -1
  5. package/build/hooks/index.d.ts +1 -1
  6. package/build/hooks/index.d.ts.map +1 -1
  7. package/build/hooks/index.js +1 -1
  8. package/build/hooks/index.js.map +1 -1
  9. package/build/hooks/use_current_person.d.ts.map +1 -1
  10. package/build/hooks/use_current_person.js +0 -1
  11. package/build/hooks/use_current_person.js.map +1 -1
  12. package/build/hooks/use_direct_messages_enabled.d.ts +2 -0
  13. package/build/hooks/use_direct_messages_enabled.d.ts.map +1 -0
  14. package/build/hooks/use_direct_messages_enabled.js +16 -0
  15. package/build/hooks/use_direct_messages_enabled.js.map +1 -0
  16. package/build/hooks/use_features.d.ts +1 -0
  17. package/build/hooks/use_features.d.ts.map +1 -1
  18. package/build/hooks/use_features.js +1 -0
  19. package/build/hooks/use_features.js.map +1 -1
  20. package/build/navigation/index.d.ts +173 -69
  21. package/build/navigation/index.d.ts.map +1 -1
  22. package/build/navigation/index.js +72 -61
  23. package/build/navigation/index.js.map +1 -1
  24. package/build/screens/bug_report_screen.d.ts.map +1 -1
  25. package/build/screens/bug_report_screen.js +13 -10
  26. package/build/screens/bug_report_screen.js.map +1 -1
  27. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  28. package/build/screens/conversation_details_screen.js +12 -11
  29. package/build/screens/conversation_details_screen.js.map +1 -1
  30. package/build/screens/conversation_filters/components/conversation_filters.js +3 -3
  31. package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
  32. package/build/screens/conversation_filters_screen.js +2 -2
  33. package/build/screens/conversation_filters_screen.js.map +1 -1
  34. package/build/screens/conversation_screen.d.ts.map +1 -1
  35. package/build/screens/conversation_screen.js +2 -9
  36. package/build/screens/conversation_screen.js.map +1 -1
  37. package/build/screens/conversation_select_type_screen.d.ts.map +1 -1
  38. package/build/screens/conversation_select_type_screen.js +7 -4
  39. package/build/screens/conversation_select_type_screen.js.map +1 -1
  40. package/build/screens/conversations/components/list_header_component.js +3 -3
  41. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  42. package/build/screens/message_report_screen.d.ts.map +1 -1
  43. package/build/screens/message_report_screen.js +18 -14
  44. package/build/screens/message_report_screen.js.map +1 -1
  45. package/build/screens/notification_settings_screen.d.ts.map +1 -1
  46. package/build/screens/notification_settings_screen.js +14 -0
  47. package/build/screens/notification_settings_screen.js.map +1 -1
  48. package/build/screens/settings_screen.js +3 -3
  49. package/build/screens/settings_screen.js.map +1 -1
  50. package/build/types/resources/person.d.ts +0 -1
  51. package/build/types/resources/person.d.ts.map +1 -1
  52. package/build/types/resources/person.js.map +1 -1
  53. package/package.json +4 -4
  54. package/src/components/display/platform_modal_header_buttons.tsx +13 -254
  55. package/src/hooks/index.ts +1 -1
  56. package/src/hooks/use_current_person.ts +0 -1
  57. package/src/hooks/use_direct_messages_enabled.ts +23 -0
  58. package/src/hooks/use_features.ts +1 -0
  59. package/src/navigation/index.tsx +166 -149
  60. package/src/screens/bug_report_screen.tsx +15 -16
  61. package/src/screens/conversation_details_screen.tsx +17 -11
  62. package/src/screens/conversation_filters/components/conversation_filters.tsx +3 -3
  63. package/src/screens/conversation_filters_screen.tsx +2 -2
  64. package/src/screens/conversation_screen.tsx +2 -10
  65. package/src/screens/conversation_select_type_screen.tsx +7 -4
  66. package/src/screens/conversations/components/list_header_component.tsx +3 -3
  67. package/src/screens/message_report_screen.tsx +21 -20
  68. package/src/screens/notification_settings_screen.tsx +21 -1
  69. package/src/screens/settings_screen.tsx +3 -3
  70. package/src/types/resources/person.ts +0 -1
  71. package/build/hooks/use_direct_messages_eligible.d.ts +0 -2
  72. package/build/hooks/use_direct_messages_eligible.d.ts.map +0 -1
  73. package/build/hooks/use_direct_messages_eligible.js +0 -9
  74. package/build/hooks/use_direct_messages_eligible.js.map +0 -1
  75. package/src/__tests__/hooks/use_direct_messages_eligible.test.tsx +0 -77
  76. package/src/hooks/use_direct_messages_eligible.ts +0 -11
@@ -1,6 +1,5 @@
1
- import type { NativeStackHeaderItemProps, NativeStackNavigationOptions } from '@react-navigation/native-stack';
1
+ import type { NativeStackHeaderRightProps } from '@react-navigation/native-stack';
2
2
  import { ColorValue } from 'react-native';
3
- import { type IconString } from './icon';
4
3
  interface HeaderTextButtonProps {
5
4
  onPress: () => void;
6
5
  title?: string;
@@ -13,51 +12,12 @@ interface HeaderDismissButtonProps {
13
12
  tintColor?: ColorValue;
14
13
  }
15
14
  export declare const HeaderDismissButton: ({ onPress, title, tintColor, ...props }: HeaderDismissButtonProps) => import("react/jsx-runtime").JSX.Element;
16
- export type OptionsDecorator = (options: NativeStackNavigationOptions) => NativeStackNavigationOptions;
17
- export declare const composeOptions: (base: NativeStackNavigationOptions, ...decorators: OptionsDecorator[]) => NativeStackNavigationOptions;
18
- interface TextButtonDecoratorProps {
19
- text: string;
20
- onPress: () => void;
21
- disabled?: boolean;
22
- }
23
- export declare const withRightText: ({ text, onPress, disabled }: TextButtonDecoratorProps) => OptionsDecorator;
24
- export declare const useHeaderSlotReserve: () => number;
25
- export interface HeaderIconProps {
26
- icon: IconString;
27
- accessibilityLabel: string;
28
- onPress: () => void;
29
- disabled?: boolean;
30
- variant?: 'plain' | 'fill';
15
+ interface HeaderDoneButtonProps extends NativeStackHeaderRightProps {
16
+ navigation: {
17
+ goBack: () => void;
18
+ getState: () => any;
19
+ };
31
20
  }
32
- export declare const withRightIcon: (props: HeaderIconProps) => OptionsDecorator;
33
- export declare const withLeftIcon: (props: HeaderIconProps) => OptionsDecorator;
34
- export declare const withRightClose: ({ onPress }: {
35
- onPress: () => void;
36
- }) => OptionsDecorator;
37
- export declare const withLeftClose: ({ onPress }: {
38
- onPress: () => void;
39
- }) => OptionsDecorator;
40
- export declare const withRightDone: ({ onPress }: {
41
- onPress: () => void;
42
- }) => OptionsDecorator;
43
- export declare const createMinimalHeaderBackButton: ({ onPress }: {
44
- onPress: () => void;
45
- }) => (props: NativeStackHeaderItemProps) => import("react/jsx-runtime").JSX.Element;
46
- export declare const withMinimalBack: ({ onPress }: {
47
- onPress: () => void;
48
- }) => OptionsDecorator;
49
- type UseHeaderRightOptions = {
50
- onPress: () => void;
51
- disabled?: boolean;
52
- enabled?: boolean;
53
- } & ((HeaderIconProps & {
54
- title?: never;
55
- }) | {
56
- title: string;
57
- icon?: never;
58
- accessibilityLabel?: never;
59
- variant?: never;
60
- });
61
- export declare const useHeaderRight: (options: UseHeaderRightOptions) => void;
21
+ export declare const HeaderDoneButton: ({ navigation, ...props }: HeaderDoneButtonProps) => import("react/jsx-runtime").JSX.Element | null;
62
22
  export {};
63
23
  //# sourceMappingURL=platform_modal_header_buttons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform_modal_header_buttons.d.ts","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAA;AAM/D,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAA;AAI9C,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,gBAAgB,GAAI,8BAI9B,qBAAqB,4CAavB,CAAA;AAED,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,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AejC,CAAA;AAIH,eAAO,MAAM,eAAe,GACzB,aAAa;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,KAAG,gBAItC,CAAA;AAIJ,KAAK,qBAAqB,GAAG;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,CACA,CAAC,eAAe,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,GACrC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,kBAAkB,CAAC,EAAE,KAAK,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAC/E,CAAA;AAID,eAAO,MAAM,cAAc,GAAI,SAAS,qBAAqB,SAmB5D,CAAA"}
1
+ {"version":3,"file":"platform_modal_header_buttons.d.ts","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AACjF,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAA;AAK/D,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,gBAAgB,GAAI,8BAI9B,qBAAqB,4CAavB,CAAA;AAED,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAED,eAAO,MAAM,mBAAmB,GAAI,yCAKjC,wBAAwB,4CAoB1B,CAAA;AAED,UAAU,qBAAsB,SAAQ,2BAA2B;IACjE,UAAU,EAAE;QAAE,MAAM,EAAE,MAAM,IAAI,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,CAAA;KAAE,CAAA;CACxD;AAED,eAAO,MAAM,gBAAgB,GAAI,0BAA0B,qBAAqB,mDAS/E,CAAA"}
@@ -1,16 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { HeaderBackButton, HeaderButton, PlatformPressable } from '@react-navigation/elements';
3
- import { useNavigation } from '@react-navigation/native';
4
- import { useLayoutEffect } from 'react';
2
+ import { HeaderButton } from '@react-navigation/elements';
5
3
  import { Platform, StyleSheet } from 'react-native';
6
- import LinearGradient from 'react-native-linear-gradient';
7
- import { useFontScale, useTheme } from '../../hooks';
8
- import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils';
9
- import { isLiquidGlassEnabled } from '../../utils/liquid_glass';
10
- import { tokens } from '../../vendor/tapestry/tokens';
4
+ import { useTheme } from '../../hooks';
11
5
  import { Icon } from './icon';
12
6
  import { TextButton } from './text_button';
13
- import { getColorKey, useGradientColorMap } from './utils/button_colors';
14
7
  export const HeaderTextButton = ({ onPress, title = 'Submit', ...props }) => {
15
8
  const styles = useStyles();
16
9
  return (_jsx(TextButton, { maxFontSizeMultiplier: 1, onPress: onPress, textStyle: [styles.interactionColor, props.disabled && styles.disabledColor], ...props, children: title }));
@@ -22,116 +15,13 @@ export const HeaderDismissButton = ({ onPress, title = 'Cancel', tintColor, ...p
22
15
  default: (_jsx(HeaderButton, { onPress: onPress, style: [styles.androidCancelButton], ...props, children: _jsx(Icon, { name: "general.x", size: 16, color: tintColor }) })),
23
16
  });
24
17
  };
25
- const createTextHeaderRight = ({ onPress, title, disabled }) => (props) => (_jsx(HeaderTextButton, { ...props, onPress: onPress, title: title, disabled: disabled }));
26
- export const composeOptions = (base, ...decorators) => decorators.reduce((options, decorate) => decorate(options), base);
27
- // Native bar items pick up liquid glass on iOS 26; hosts on an older
28
- // react-navigation ignore the unstable option and keep using the
29
- // headerRight/headerLeft fallbacks, as does Android.
30
- export const withRightText = ({ text, onPress, disabled }) => options => ({
31
- ...options,
32
- headerRight: createTextHeaderRight({ onPress, title: text, disabled }),
33
- unstable_headerRightItems: () => [{ type: 'button', label: text, onPress, disabled }],
34
- });
35
- const HEADER_ICON_SIZE = 17;
36
- const HEADER_FILL_ICON_SIZE = 16;
37
- const HEADER_FILL_PADDING = 14;
38
- const HEADER_BAR_INSET = 16;
39
- const HEADER_SLOT_GAP = 12;
40
- const headerFillSize = (fontScale) => {
41
- const icon = HEADER_FILL_ICON_SIZE * fontScale;
42
- return { icon, circle: icon + HEADER_FILL_PADDING * 2 };
43
- };
44
- // Liquid glass icons don't communicate
45
- export const useHeaderSlotReserve = () => {
46
- const fontScale = useFontScale({ maxFontSizeMultiplier: MAX_FONT_SIZE_MULTIPLIER_LANDMARK });
47
- return HEADER_BAR_INSET + headerFillSize(fontScale).circle + HEADER_SLOT_GAP;
48
- };
49
- const HEADER_FALLBACK_HIT_SLOP = 14;
50
- const iconStyles = StyleSheet.create({
51
- disabled: {
52
- opacity: 0.4,
53
- },
54
- fallbackButton: {
55
- alignItems: 'center',
56
- justifyContent: 'center',
57
- paddingHorizontal: 8,
58
- },
59
- fillCircle: {
60
- alignItems: 'center',
61
- justifyContent: 'center',
62
- },
63
- });
64
- const HeaderIcon = ({ icon, disabled, variant, }) => {
65
- const { colors } = useTheme();
66
- const gradients = useGradientColorMap();
67
- const fontScale = useFontScale({ maxFontSizeMultiplier: MAX_FONT_SIZE_MULTIPLIER_LANDMARK });
68
- if (variant !== 'fill')
69
- return _jsx(Icon, { name: icon, size: HEADER_ICON_SIZE });
70
- const { icon: iconSize, circle: circleSize } = headerFillSize(fontScale);
71
- return (_jsx(LinearGradient, { start: { x: 0.1, y: 0.1 }, end: { x: 0.9, y: 0.9 }, colors: gradients[getColorKey({ disabled: Boolean(disabled), appearance: 'interaction' })], style: [
72
- iconStyles.fillCircle,
73
- { borderRadius: circleSize, height: circleSize, width: circleSize },
74
- ], children: _jsx(Icon, { name: icon, size: iconSize, color: disabled ? colors.iconColorDefaultDisabled : tokens.colorNeutral100White }) }));
75
- };
76
- // Native bar items take SF Symbols, images, or any element, so both paths
77
- // render the same icon: iOS 26 puts this one in the glass circle, and the
78
- // element below covers Android and older iOS.
79
- const createHeaderIconItem = ({ icon, accessibilityLabel, onPress, disabled, variant, }) => ({
80
- type: 'custom',
81
- // The gradient circle replaces the glass one rather than sitting on it.
82
- hidesSharedBackground: variant === 'fill',
83
- element: (_jsx(PlatformPressable, { onPress: onPress, disabled: disabled, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: accessibilityLabel, style: disabled && variant !== 'fill' && iconStyles.disabled, children: _jsx(HeaderIcon, { icon: icon, disabled: disabled, variant: variant }) })),
84
- });
85
- const createHeaderIconElement = ({ icon, accessibilityLabel, onPress, disabled, variant }) => () => (_jsx(PlatformPressable, { onPress: onPress, disabled: disabled, hitSlop: HEADER_FALLBACK_HIT_SLOP, accessibilityRole: "button", accessibilityLabel: accessibilityLabel, style: [iconStyles.fallbackButton, disabled && variant !== 'fill' && iconStyles.disabled], children: _jsx(HeaderIcon, { icon: icon, disabled: disabled, variant: variant }) }));
86
- export const withRightIcon = (props) => options => ({
87
- ...options,
88
- headerRight: createHeaderIconElement(props),
89
- unstable_headerRightItems: () => [createHeaderIconItem(props)],
90
- });
91
- export const withLeftIcon = (props) => options => ({
92
- ...options,
93
- headerLeft: createHeaderIconElement(props),
94
- unstable_headerLeftItems: () => [createHeaderIconItem(props)],
95
- });
96
- export const withRightClose = ({ onPress }) => withRightIcon({ icon: 'general.x', accessibilityLabel: 'Close', onPress });
97
- export const withLeftClose = ({ onPress }) => withLeftIcon({ icon: 'general.x', accessibilityLabel: 'Close', onPress });
98
- export const withRightDone = ({ onPress }) => withRightIcon({ icon: 'general.check', accessibilityLabel: 'Done', onPress });
99
- // The default back icon reserves trailing space for a label that
100
- // displayMode="minimal" never shows; a custom image skips it so the glass
101
- // capsule hugs the glyph.
102
- const renderGlassBackImage = ({ tintColor }) => (_jsx(Icon, { name: "general.leftChevron", size: 18, color: tintColor }));
103
- // The iOS 26 glass capsule manages its own insets — negative margins clip
104
- // the button against the capsule edge.
105
- export const createMinimalHeaderBackButton = ({ onPress }) => (props) => (_jsx(HeaderBackButton, { style: isLiquidGlassEnabled()
106
- ? undefined
107
- : {
108
- marginLeft: Platform.select({ ios: -8, default: -3 }),
109
- marginRight: Platform.select({ ios: 0, default: 30 }),
110
- }, backImage: isLiquidGlassEnabled() ? renderGlassBackImage : undefined, displayMode: "minimal", onPress: onPress, ...props }));
111
- // Under glass the native minimal back button suffices; pre-26 needs the
112
- // custom button and its layout nudges.
113
- export const withMinimalBack = ({ onPress }) => options => ({
114
- ...options,
115
- ...(isLiquidGlassEnabled() ? {} : { headerLeft: createMinimalHeaderBackButton({ onPress }) }),
116
- });
117
- // For screens whose header button depends on live state (form validity,
118
- // mutation callbacks). Static buttons belong in the navigator options.
119
- export const useHeaderRight = (options) => {
120
- const navigation = useNavigation();
121
- const { onPress, disabled, enabled = true } = options;
122
- const icon = options.icon;
123
- const label = options.icon !== undefined ? options.accessibilityLabel : options.title;
124
- const variant = options.variant;
125
- useLayoutEffect(() => {
126
- if (!enabled) {
127
- navigation.setOptions({ headerRight: () => null, unstable_headerRightItems: undefined });
128
- return;
129
- }
130
- const decorate = icon
131
- ? withRightIcon({ icon, accessibilityLabel: label, onPress, disabled, variant })
132
- : withRightText({ text: label, onPress, disabled });
133
- navigation.setOptions(decorate({}));
134
- }, [disabled, enabled, icon, label, navigation, onPress, variant]);
18
+ export const HeaderDoneButton = ({ navigation, ...props }) => {
19
+ const state = navigation.getState();
20
+ const isFirstScreen = state.index === 0;
21
+ if (!isFirstScreen) {
22
+ return null;
23
+ }
24
+ return _jsx(HeaderTextButton, { ...props, onPress: navigation.goBack, title: "Done" });
135
25
  };
136
26
  const useStyles = () => {
137
27
  const { colors } = useTheme();
@@ -1 +1 @@
1
- {"version":3,"file":"platform_modal_header_buttons.js","sourceRoot":"","sources":["../../../src/components/display/platform_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b,UAAU,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,yBAAyB,EAAE,SAAS,EAAE,CAAC,CAAA;YACxF,OAAM;QACR,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI;YACnB,CAAC,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;YAChF,CAAC,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAA;QAErD,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;IACrC,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;AACpE,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACrB,GAAG,EAAE,MAAM,CAAC,6BAA6B;gBACzC,OAAO,EAAE,MAAM,CAAC,iCAAiC;aAClD,CAAC;SACH;QACD,mBAAmB,EAAE;YACnB,WAAW,EAAE,EAAE;SAChB;QACD,eAAe,EAAE;YACf,UAAU,EAAE,QAAQ;SACrB;QACD,aAAa,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { HeaderBackButton, HeaderButton, PlatformPressable } from '@react-navigation/elements'\nimport { useNavigation } from '@react-navigation/native'\nimport type {\n NativeStackHeaderItemProps,\n NativeStackNavigationOptions,\n} from '@react-navigation/native-stack'\nimport { useLayoutEffect } from 'react'\nimport { ColorValue, Platform, StyleSheet } from 'react-native'\nimport LinearGradient from 'react-native-linear-gradient'\nimport { useFontScale, useTheme } from '../../hooks'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\nimport { isLiquidGlassEnabled } from '../../utils/liquid_glass'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { Icon, type IconString } from './icon'\nimport { TextButton } from './text_button'\nimport { getColorKey, useGradientColorMap } from './utils/button_colors'\n\ninterface HeaderTextButtonProps {\n onPress: () => void\n title?: string\n disabled?: boolean\n}\n\nexport const HeaderTextButton = ({\n onPress,\n title = 'Submit',\n ...props\n}: HeaderTextButtonProps) => {\n const styles = useStyles()\n\n return (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, props.disabled && styles.disabledColor]}\n {...props}\n >\n {title}\n </TextButton>\n )\n}\n\ninterface HeaderDismissButtonProps {\n onPress: () => void\n title?: string\n tintColor?: ColorValue\n}\n\nexport const HeaderDismissButton = ({\n onPress,\n title = 'Cancel',\n tintColor,\n ...props\n}: HeaderDismissButtonProps) => {\n const styles = useStyles()\n\n return Platform.select({\n ios: (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, styles.iosCancelButton]}\n {...props}\n >\n {title}\n </TextButton>\n ),\n default: (\n <HeaderButton onPress={onPress} style={[styles.androidCancelButton]} {...props}>\n <Icon name=\"general.x\" size={16} color={tintColor} />\n </HeaderButton>\n ),\n })\n}\n\nconst createTextHeaderRight =\n ({ onPress, title, disabled }: HeaderTextButtonProps) =>\n (props: NativeStackHeaderItemProps) => (\n <HeaderTextButton {...props} onPress={onPress} title={title} disabled={disabled} />\n )\n\nexport type OptionsDecorator = (\n options: NativeStackNavigationOptions\n) => NativeStackNavigationOptions\n\nexport const composeOptions = (\n base: NativeStackNavigationOptions,\n ...decorators: OptionsDecorator[]\n): NativeStackNavigationOptions => decorators.reduce((options, decorate) => decorate(options), base)\n\ninterface TextButtonDecoratorProps {\n text: string\n onPress: () => void\n disabled?: boolean\n}\n\n// Native bar items pick up liquid glass on iOS 26; hosts on an older\n// react-navigation ignore the unstable option and keep using the\n// headerRight/headerLeft fallbacks, as does Android.\nexport const withRightText =\n ({ text, onPress, disabled }: TextButtonDecoratorProps): OptionsDecorator =>\n options => ({\n ...options,\n headerRight: createTextHeaderRight({ onPress, title: text, disabled }),\n unstable_headerRightItems: () => [{ type: 'button' as const, label: text, onPress, disabled }],\n })\n\nconst HEADER_ICON_SIZE = 17\nconst HEADER_FILL_ICON_SIZE = 16\nconst HEADER_FILL_PADDING = 14\nconst HEADER_BAR_INSET = 16\nconst HEADER_SLOT_GAP = 12\n\nconst headerFillSize = (fontScale: number) => {\n const icon = HEADER_FILL_ICON_SIZE * fontScale\n\n return { icon, circle: icon + HEADER_FILL_PADDING * 2 }\n}\n\n// Liquid glass icons don't communicate\nexport const useHeaderSlotReserve = (): number => {\n const fontScale = useFontScale({ maxFontSizeMultiplier: MAX_FONT_SIZE_MULTIPLIER_LANDMARK })\n\n return HEADER_BAR_INSET + headerFillSize(fontScale).circle + HEADER_SLOT_GAP\n}\n\nconst HEADER_FALLBACK_HIT_SLOP = 14\n\nconst iconStyles = StyleSheet.create({\n disabled: {\n opacity: 0.4,\n },\n fallbackButton: {\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: 8,\n },\n fillCircle: {\n alignItems: 'center',\n justifyContent: 'center',\n },\n})\n\nexport interface HeaderIconProps {\n icon: IconString\n accessibilityLabel: string\n onPress: () => void\n disabled?: boolean\n variant?: 'plain' | 'fill'\n}\n\nconst HeaderIcon = ({\n icon,\n disabled,\n variant,\n}: Pick<HeaderIconProps, 'icon' | 'disabled' | 'variant'>) => {\n const { colors } = useTheme()\n const gradients = useGradientColorMap()\n const fontScale = useFontScale({ maxFontSizeMultiplier: MAX_FONT_SIZE_MULTIPLIER_LANDMARK })\n\n if (variant !== 'fill') return <Icon name={icon} size={HEADER_ICON_SIZE} />\n\n const { icon: iconSize, circle: circleSize } = headerFillSize(fontScale)\n\n return (\n <LinearGradient\n start={{ x: 0.1, y: 0.1 }}\n end={{ x: 0.9, y: 0.9 }}\n colors={gradients[getColorKey({ disabled: Boolean(disabled), appearance: 'interaction' })]}\n style={[\n iconStyles.fillCircle,\n { borderRadius: circleSize, height: circleSize, width: circleSize },\n ]}\n >\n <Icon\n name={icon}\n size={iconSize}\n color={disabled ? colors.iconColorDefaultDisabled : tokens.colorNeutral100White}\n />\n </LinearGradient>\n )\n}\n\n// Native bar items take SF Symbols, images, or any element, so both paths\n// render the same icon: iOS 26 puts this one in the glass circle, and the\n// element below covers Android and older iOS.\nconst createHeaderIconItem = ({\n icon,\n accessibilityLabel,\n onPress,\n disabled,\n variant,\n}: HeaderIconProps) => ({\n type: 'custom' as const,\n // The gradient circle replaces the glass one rather than sitting on it.\n hidesSharedBackground: variant === 'fill',\n element: (\n <PlatformPressable\n onPress={onPress}\n disabled={disabled}\n hitSlop={12}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n style={disabled && variant !== 'fill' && iconStyles.disabled}\n >\n <HeaderIcon icon={icon} disabled={disabled} variant={variant} />\n </PlatformPressable>\n ),\n})\n\nconst createHeaderIconElement =\n ({ icon, accessibilityLabel, onPress, disabled, variant }: HeaderIconProps) =>\n () => (\n <PlatformPressable\n onPress={onPress}\n disabled={disabled}\n hitSlop={HEADER_FALLBACK_HIT_SLOP}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n style={[iconStyles.fallbackButton, disabled && variant !== 'fill' && iconStyles.disabled]}\n >\n <HeaderIcon icon={icon} disabled={disabled} variant={variant} />\n </PlatformPressable>\n )\n\nexport const withRightIcon =\n (props: HeaderIconProps): OptionsDecorator =>\n options => ({\n ...options,\n headerRight: createHeaderIconElement(props),\n unstable_headerRightItems: () => [createHeaderIconItem(props)],\n })\n\nexport const withLeftIcon =\n (props: HeaderIconProps): OptionsDecorator =>\n options => ({\n ...options,\n headerLeft: createHeaderIconElement(props),\n unstable_headerLeftItems: () => [createHeaderIconItem(props)],\n })\n\nexport const withRightClose = ({ onPress }: { onPress: () => void }) =>\n withRightIcon({ icon: 'general.x', accessibilityLabel: 'Close', onPress })\n\nexport const withLeftClose = ({ onPress }: { onPress: () => void }) =>\n withLeftIcon({ icon: 'general.x', accessibilityLabel: 'Close', onPress })\n\nexport const withRightDone = ({ onPress }: { onPress: () => void }) =>\n withRightIcon({ icon: 'general.check', accessibilityLabel: 'Done', onPress })\n\n// The default back icon reserves trailing space for a label that\n// displayMode=\"minimal\" never shows; a custom image skips it so the glass\n// capsule hugs the glyph.\nconst renderGlassBackImage = ({ tintColor }: { tintColor: string }) => (\n <Icon name=\"general.leftChevron\" size={18} color={tintColor} />\n)\n\n// The iOS 26 glass capsule manages its own insets — negative margins clip\n// the button against the capsule edge.\nexport const createMinimalHeaderBackButton =\n ({ onPress }: { onPress: () => void }) =>\n (props: NativeStackHeaderItemProps) => (\n <HeaderBackButton\n style={\n isLiquidGlassEnabled()\n ? undefined\n : {\n marginLeft: Platform.select({ ios: -8, default: -3 }),\n marginRight: Platform.select({ ios: 0, default: 30 }),\n }\n }\n backImage={isLiquidGlassEnabled() ? renderGlassBackImage : undefined}\n displayMode=\"minimal\"\n onPress={onPress}\n {...props}\n />\n )\n\n// Under glass the native minimal back button suffices; pre-26 needs the\n// custom button and its layout nudges.\nexport const withMinimalBack =\n ({ onPress }: { onPress: () => void }): OptionsDecorator =>\n options => ({\n ...options,\n ...(isLiquidGlassEnabled() ? {} : { headerLeft: createMinimalHeaderBackButton({ onPress }) }),\n })\n\n// An icon or a title, never both — passing both is a compile error rather\n// than a question of which one wins.\ntype UseHeaderRightOptions = {\n onPress: () => void\n disabled?: boolean\n enabled?: boolean\n} & (\n | (HeaderIconProps & { title?: never })\n | { title: string; icon?: never; accessibilityLabel?: never; variant?: never }\n)\n\n// For screens whose header button depends on live state (form validity,\n// mutation callbacks). Static buttons belong in the navigator options.\nexport const useHeaderRight = (options: UseHeaderRightOptions) => {\n const navigation = useNavigation()\n const { onPress, disabled, enabled = true } = options\n const icon = options.icon\n const label = options.icon !== undefined ? options.accessibilityLabel : options.title\n const variant = options.variant\n\n useLayoutEffect(() => {\n if (!enabled) {\n navigation.setOptions({ headerRight: () => null, unstable_headerRightItems: undefined })\n return\n }\n\n const decorate = icon\n ? withRightIcon({ icon, accessibilityLabel: label, onPress, disabled, variant })\n : withRightText({ text: label, onPress, disabled })\n\n navigation.setOptions(decorate({}))\n }, [disabled, enabled, icon, label, navigation, onPress, variant])\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n interactionColor: {\n color: Platform.select({\n ios: colors.iOSModalHeaderButtonTextColor,\n android: colors.androidModalHeaderButtonTextColor,\n }),\n },\n androidCancelButton: {\n marginRight: 16,\n },\n iosCancelButton: {\n fontWeight: 'normal',\n },\n disabledColor: {\n color: colors.textColorDefaultDisabled,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"platform_modal_header_buttons.js","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,EAAc,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAQ1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,OAAO,EACP,KAAK,GAAG,QAAQ,EAChB,GAAG,KAAK,EACc,EAAE,EAAE;IAC1B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,KAAC,UAAU,IACT,qBAAqB,EAAE,CAAC,EACxB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CA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GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACrB,GAAG,EAAE,MAAM,CAAC,6BAA6B;gBACzC,OAAO,EAAE,MAAM,CAAC,iCAAiC;aAClD,CAAC;SACH;QACD,mBAAmB,EAAE;YACnB,WAAW,EAAE,EAAE;SAChB;QACD,eAAe,EAAE;YACf,UAAU,EAAE,QAAQ;SACrB;QACD,aAAa,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { HeaderButton } from '@react-navigation/elements'\nimport type { NativeStackHeaderRightProps } from '@react-navigation/native-stack'\nimport { ColorValue, Platform, StyleSheet } from 'react-native'\nimport { useTheme } from '../../hooks'\nimport { Icon } from './icon'\nimport { TextButton } from './text_button'\n\ninterface HeaderTextButtonProps {\n onPress: () => void\n title?: string\n disabled?: boolean\n}\n\nexport const HeaderTextButton = ({\n onPress,\n title = 'Submit',\n ...props\n}: HeaderTextButtonProps) => {\n const styles = useStyles()\n\n return (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, props.disabled && styles.disabledColor]}\n {...props}\n >\n {title}\n </TextButton>\n )\n}\n\ninterface HeaderDismissButtonProps {\n onPress: () => void\n title?: string\n tintColor?: ColorValue\n}\n\nexport const HeaderDismissButton = ({\n onPress,\n title = 'Cancel',\n tintColor,\n ...props\n}: HeaderDismissButtonProps) => {\n const styles = useStyles()\n\n return Platform.select({\n ios: (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, styles.iosCancelButton]}\n {...props}\n >\n {title}\n </TextButton>\n ),\n default: (\n <HeaderButton onPress={onPress} style={[styles.androidCancelButton]} {...props}>\n <Icon name=\"general.x\" size={16} color={tintColor} />\n </HeaderButton>\n ),\n })\n}\n\ninterface HeaderDoneButtonProps extends NativeStackHeaderRightProps {\n navigation: { goBack: () => void; getState: () => any }\n}\n\nexport const HeaderDoneButton = ({ navigation, ...props }: HeaderDoneButtonProps) => {\n const state = navigation.getState()\n const isFirstScreen = state.index === 0\n\n if (!isFirstScreen) {\n return null\n }\n\n return <HeaderTextButton {...props} onPress={navigation.goBack} title=\"Done\" />\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n interactionColor: {\n color: Platform.select({\n ios: colors.iOSModalHeaderButtonTextColor,\n android: colors.androidModalHeaderButtonTextColor,\n }),\n },\n androidCancelButton: {\n marginRight: 16,\n },\n iosCancelButton: {\n fontWeight: 'normal',\n },\n disabledColor: {\n color: colors.textColorDefaultDisabled,\n },\n })\n}\n"]}
@@ -8,7 +8,7 @@ export * from './use_chat_permissions';
8
8
  export * from './use_create_android_ripple_color';
9
9
  export * from './use_current_person';
10
10
  export * from './use_deleting_ids';
11
- export * from './use_direct_messages_eligible';
11
+ export * from './use_direct_messages_enabled';
12
12
  export * from './use_font_scale';
13
13
  export * from './use_has_direct_messages';
14
14
  export * from './use_groups_groups';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,mCAAmC,CAAA;AACjD,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,mCAAmC,CAAA;AACjD,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA"}
@@ -8,7 +8,7 @@ export * from './use_chat_permissions';
8
8
  export * from './use_create_android_ripple_color';
9
9
  export * from './use_current_person';
10
10
  export * from './use_deleting_ids';
11
- export * from './use_direct_messages_eligible';
11
+ export * from './use_direct_messages_enabled';
12
12
  export * from './use_font_scale';
13
13
  export * from './use_has_direct_messages';
14
14
  export * from './use_groups_groups';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,mCAAmC,CAAA;AACjD,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA","sourcesContent":["export * from './use_animated_message_background_color'\nexport { useApiClient } from './use_api_client'\nexport * from './use_api'\nexport * from './use_app_state'\nexport * from './use_async_storage'\nexport * from './use_at_font_scale_breakpoint'\nexport * from './use_chat_permissions'\nexport * from './use_create_android_ripple_color'\nexport * from './use_current_person'\nexport * from './use_deleting_ids'\nexport * from './use_direct_messages_eligible'\nexport * from './use_font_scale'\nexport * from './use_has_direct_messages'\nexport * from './use_groups_groups'\nexport * from './use_groups'\nexport * from './use_interaction_ghost_color'\nexport * from './use_message_reaction_toggle'\nexport * from './use_new_conversation_entry'\nexport * from './use_organization'\nexport * from './use_people_person'\nexport * from './use_preview_avatar_diameter'\nexport * from './use_product_analytics'\nexport * from './use_qualified_by_age'\nexport * from './use_scalable_number_of_lines'\nexport * from './use_submit_age_check'\nexport * from './use_suspense_api'\nexport * from './use_theme'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,mCAAmC,CAAA;AACjD,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA","sourcesContent":["export * from './use_animated_message_background_color'\nexport { useApiClient } from './use_api_client'\nexport * from './use_api'\nexport * from './use_app_state'\nexport * from './use_async_storage'\nexport * from './use_at_font_scale_breakpoint'\nexport * from './use_chat_permissions'\nexport * from './use_create_android_ripple_color'\nexport * from './use_current_person'\nexport * from './use_deleting_ids'\nexport * from './use_direct_messages_enabled'\nexport * from './use_font_scale'\nexport * from './use_has_direct_messages'\nexport * from './use_groups_groups'\nexport * from './use_groups'\nexport * from './use_interaction_ghost_color'\nexport * from './use_message_reaction_toggle'\nexport * from './use_new_conversation_entry'\nexport * from './use_organization'\nexport * from './use_people_person'\nexport * from './use_preview_avatar_diameter'\nexport * from './use_product_analytics'\nexport * from './use_qualified_by_age'\nexport * from './use_scalable_number_of_lines'\nexport * from './use_submit_age_check'\nexport * from './use_suspense_api'\nexport * from './use_theme'\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use_current_person.d.ts","sourceRoot":"","sources":["../../src/hooks/use_current_person.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAKhD,eAAO,MAAM,wBAAwB;;;;;;;CAkBpC,CAAA;AAED,eAAO,MAAM,qBAAqB,8CAA+C,CAAA;AAEjF,eAAO,MAAM,gBAAgB,6BAO5B,CAAA;AAED,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AAE5D,eAAO,MAAM,qBAAqB;qBAGtB,OAAO,CAAC,qBAAqB,CAAC,kBACvB,aAAa,CAAC,qBAAqB,CAAC;;CActD,CAAA"}
1
+ {"version":3,"file":"use_current_person.d.ts","sourceRoot":"","sources":["../../src/hooks/use_current_person.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAKhD,eAAO,MAAM,wBAAwB;;;;;;;CAiBpC,CAAA;AAED,eAAO,MAAM,qBAAqB,8CAA+C,CAAA;AAEjF,eAAO,MAAM,gBAAgB,6BAO5B,CAAA;AAED,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AAE5D,eAAO,MAAM,qBAAqB;qBAGtB,OAAO,CAAC,qBAAqB,CAAC,kBACvB,aAAa,CAAC,qBAAqB,CAAC;;CActD,CAAA"}
@@ -14,7 +14,6 @@ export const currentPersonRequestArgs = {
14
14
  'pco_chat_enabled',
15
15
  'age_qualification_status',
16
16
  'direct_messages_disabled',
17
- 'direct_messages_eligible',
18
17
  'under_18',
19
18
  ],
20
19
  },
@@ -1 +1 @@
1
- {"version":3,"file":"use_current_person.js","sourceRoot":"","sources":["../../src/hooks/use_current_person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAGtD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEvE,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,GAAG,EAAE,KAAK;IACV,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,IAAI;gBACJ,MAAM;gBACN,QAAQ;gBACR,UAAU;gBACV,cAAc;gBACd,kBAAkB;gBAClB,0BAA0B;gBAC1B,0BAA0B;gBAC1B,0BAA0B;gBAC1B,UAAU;aACX;SACF;KACF;CACF,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,CAAA;AAEjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,cAAc,CAAwB,wBAAwB,EAAE;QACvF,SAAS,EAAE,YAAY;QACvB,MAAM,EAAE,cAAc;KACvB,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAID,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,MAAM,YAAY,GAAG,CACnB,MAAsC,EACtC,gBAAsD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,EAChF,EAAE;QACF,WAAW,CAAC,YAAY,CAAqC,qBAAqB,EAAE,IAAI,CAAC,EAAE;YACzF,IAAI,CAAC,IAAI;gBAAE,OAAO,IAAI,CAAA;YAEtB,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAA;QAC5D,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,MAAM,gBAAgB,GAAG,GAAG,EAAE;QAC5B,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,qBAAqB,EAAE,CAAC,CAAA;IACpE,CAAC,CAAA;IAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAA;AAC/D,CAAC,CAAA","sourcesContent":["import { useQueryClient } from '@tanstack/react-query'\nimport { CurrentPersonResource } from '../types'\nimport { ApiResource } from '../types/api_primitives'\nimport { FIVE_MINUTES, THIRTY_MINUTES } from '../utils/time'\nimport { getRequestQueryKey, useSuspenseGet } from './use_suspense_api'\n\nexport const currentPersonRequestArgs = {\n url: '/me',\n data: {\n fields: {\n Person: [\n 'id',\n 'name',\n 'avatar',\n 'can_chat',\n 'unread_count',\n 'pco_chat_enabled',\n 'age_qualification_status',\n 'direct_messages_disabled',\n 'direct_messages_eligible',\n 'under_18',\n ],\n },\n },\n}\n\nexport const currentPersonQueryKey = getRequestQueryKey(currentPersonRequestArgs)\n\nexport const useCurrentPerson = () => {\n const { data: person } = useSuspenseGet<CurrentPersonResource>(currentPersonRequestArgs, {\n staleTime: FIVE_MINUTES,\n gcTime: THIRTY_MINUTES,\n })\n\n return person\n}\n\ntype ProcessRecord<T> = (record: T, update: Partial<T>) => T\n\nexport const useCurrentPersonCache = () => {\n const queryClient = useQueryClient()\n const handleUpdate = (\n update: Partial<CurrentPersonResource>,\n processRecord: ProcessRecord<CurrentPersonResource> = (r, u) => ({ ...r, ...u })\n ) => {\n queryClient.setQueryData<ApiResource<CurrentPersonResource>>(currentPersonQueryKey, data => {\n if (!data) return data\n\n return { ...data, data: processRecord(data.data, update) }\n })\n }\n\n const handleInvalidate = () => {\n queryClient.invalidateQueries({ queryKey: currentPersonQueryKey })\n }\n\n return { update: handleUpdate, invalidate: handleInvalidate }\n}\n"]}
1
+ {"version":3,"file":"use_current_person.js","sourceRoot":"","sources":["../../src/hooks/use_current_person.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAGtD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEvE,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,GAAG,EAAE,KAAK;IACV,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,IAAI;gBACJ,MAAM;gBACN,QAAQ;gBACR,UAAU;gBACV,cAAc;gBACd,kBAAkB;gBAClB,0BAA0B;gBAC1B,0BAA0B;gBAC1B,UAAU;aACX;SACF;KACF;CACF,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,CAAA;AAEjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,cAAc,CAAwB,wBAAwB,EAAE;QACvF,SAAS,EAAE,YAAY;QACvB,MAAM,EAAE,cAAc;KACvB,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAID,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,MAAM,YAAY,GAAG,CACnB,MAAsC,EACtC,gBAAsD,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,EAChF,EAAE;QACF,WAAW,CAAC,YAAY,CAAqC,qBAAqB,EAAE,IAAI,CAAC,EAAE;YACzF,IAAI,CAAC,IAAI;gBAAE,OAAO,IAAI,CAAA;YAEtB,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAA;QAC5D,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,MAAM,gBAAgB,GAAG,GAAG,EAAE;QAC5B,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,qBAAqB,EAAE,CAAC,CAAA;IACpE,CAAC,CAAA;IAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAA;AAC/D,CAAC,CAAA","sourcesContent":["import { useQueryClient } from '@tanstack/react-query'\nimport { CurrentPersonResource } from '../types'\nimport { ApiResource } from '../types/api_primitives'\nimport { FIVE_MINUTES, THIRTY_MINUTES } from '../utils/time'\nimport { getRequestQueryKey, useSuspenseGet } from './use_suspense_api'\n\nexport const currentPersonRequestArgs = {\n url: '/me',\n data: {\n fields: {\n Person: [\n 'id',\n 'name',\n 'avatar',\n 'can_chat',\n 'unread_count',\n 'pco_chat_enabled',\n 'age_qualification_status',\n 'direct_messages_disabled',\n 'under_18',\n ],\n },\n },\n}\n\nexport const currentPersonQueryKey = getRequestQueryKey(currentPersonRequestArgs)\n\nexport const useCurrentPerson = () => {\n const { data: person } = useSuspenseGet<CurrentPersonResource>(currentPersonRequestArgs, {\n staleTime: FIVE_MINUTES,\n gcTime: THIRTY_MINUTES,\n })\n\n return person\n}\n\ntype ProcessRecord<T> = (record: T, update: Partial<T>) => T\n\nexport const useCurrentPersonCache = () => {\n const queryClient = useQueryClient()\n const handleUpdate = (\n update: Partial<CurrentPersonResource>,\n processRecord: ProcessRecord<CurrentPersonResource> = (r, u) => ({ ...r, ...u })\n ) => {\n queryClient.setQueryData<ApiResource<CurrentPersonResource>>(currentPersonQueryKey, data => {\n if (!data) return data\n\n return { ...data, data: processRecord(data.data, update) }\n })\n }\n\n const handleInvalidate = () => {\n queryClient.invalidateQueries({ queryKey: currentPersonQueryKey })\n }\n\n return { update: handleUpdate, invalidate: handleInvalidate }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function useDirectMessagesEnabled(): boolean;
2
+ //# sourceMappingURL=use_direct_messages_enabled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_direct_messages_enabled.d.ts","sourceRoot":"","sources":["../../src/hooks/use_direct_messages_enabled.ts"],"names":[],"mappings":"AAOA,wBAAgB,wBAAwB,IAAI,OAAO,CAelD"}
@@ -0,0 +1,16 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features';
3
+ import { useApiClient } from './use_api_client';
4
+ import { availableFeatures } from './use_features';
5
+ export function useDirectMessagesEnabled() {
6
+ const apiClient = useApiClient();
7
+ const { data, isFetched } = useQuery({
8
+ queryKey: getFeaturesQueryKey(),
9
+ queryFn: () => apiClient.chat.get(getFeaturesRequestArgs()),
10
+ staleTime: 1000 * 60 * 5,
11
+ });
12
+ if (!isFetched)
13
+ return false;
14
+ return (data?.data.some(feature => feature.name === availableFeatures.direct_messages_eap && feature.enabled) ?? false);
15
+ }
16
+ //# sourceMappingURL=use_direct_messages_enabled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_direct_messages_enabled.js","sourceRoot":"","sources":["../../src/hooks/use_direct_messages_enabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGhD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,UAAU,wBAAwB;IACtC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAiC;QACnE,QAAQ,EAAE,mBAAmB,EAAE;QAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAiC,sBAAsB,EAAE,CAAC;QAC3F,SAAS,EAAE,IAAI,GAAG,EAAE,GAAG,CAAC;KACzB,CAAC,CAAA;IAEF,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAA;IAE5B,OAAO,CACL,IAAI,EAAE,IAAI,CAAC,IAAI,CACb,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,iBAAiB,CAAC,mBAAmB,IAAI,OAAO,CAAC,OAAO,CACrF,IAAI,KAAK,CACX,CAAA;AACH,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { ApiCollection } from '../types'\nimport type { FeatureResource } from '../types/resources/feature_resource'\nimport { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'\nimport { useApiClient } from './use_api_client'\nimport { availableFeatures } from './use_features'\n\nexport function useDirectMessagesEnabled(): boolean {\n const apiClient = useApiClient()\n const { data, isFetched } = useQuery<ApiCollection<FeatureResource>>({\n queryKey: getFeaturesQueryKey(),\n queryFn: () => apiClient.chat.get<ApiCollection<FeatureResource>>(getFeaturesRequestArgs()),\n staleTime: 1000 * 60 * 5,\n })\n\n if (!isFetched) return false\n\n return (\n data?.data.some(\n feature => feature.name === availableFeatures.direct_messages_eap && feature.enabled\n ) ?? false\n )\n}\n"]}
@@ -11,6 +11,7 @@ export declare const availableFeatures: {
11
11
  readonly custom_conversation_avatars: "ROLLOUT_custom_conversation_avatars";
12
12
  readonly conversation_safety_lock: "ROLLOUT_conversation_safety_lock";
13
13
  readonly video_moderation: "ROLLOUT_MOBILE_video_moderation";
14
+ readonly direct_messages_eap: "ROLLOUT_direct_messages_eap";
14
15
  readonly dm_search_clear_fix: "ROLLOUT_MOBILE_dm_search_clear_fix";
15
16
  };
16
17
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"use_features.d.ts","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAK1E,KAAK,WAAW,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;AAE7E,wBAAgB,WAAW;;kCAiBT,WAAW;EAS5B;AAED,eAAO,MAAM,iBAAiB;;;;;;;;CAQ0B,CAAA"}
1
+ {"version":3,"file":"use_features.d.ts","sourceRoot":"","sources":["../../src/hooks/use_features.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAK1E,KAAK,WAAW,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;AAE7E,wBAAgB,WAAW;;kCAiBT,WAAW;EAS5B;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;CAS0B,CAAA"}
@@ -29,6 +29,7 @@ export const availableFeatures = {
29
29
  custom_conversation_avatars: 'ROLLOUT_custom_conversation_avatars',
30
30
  conversation_safety_lock: 'ROLLOUT_conversation_safety_lock',
31
31
  video_moderation: 'ROLLOUT_MOBILE_video_moderation',
32
+ direct_messages_eap: 'ROLLOUT_direct_messages_eap',
32
33
  dm_search_clear_fix: 'ROLLOUT_MOBILE_dm_search_clear_fix',
33
34
  };
34
35
  const stableEmptyFeatures = {
@@ -1 +1 @@
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,EAAE,kCAAkC;IAC5D,gBAAgB,EAAE,iCAAiC;IACnD,mBAAmB,EAAE,oCAAoC;CACH,CAAA;AAExD,MAAM,mBAAmB,GAAmC;IAC1D,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,IAAI,EAAE;QACJ,KAAK,EAAE,CAAC;QACR,UAAU,EAAE,CAAC;KACd;CACF,CAAA","sourcesContent":["import { useSuspenseQuery } from '@tanstack/react-query'\nimport { useCallback } from 'react'\nimport { ApiCollection } from '../types'\nimport type { FeatureResource } from '../types/resources/feature_resource'\nimport { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'\nimport { FIVE_MINUTES } from '../utils/time'\nimport { useApiClient } from './use_api_client'\n\ntype FeatureName = (typeof availableFeatures)[keyof typeof availableFeatures]\n\nexport function useFeatures() {\n const apiClient = useApiClient()\n const requestArgs = getFeaturesRequestArgs()\n\n const { data } = useSuspenseQuery({\n queryKey: getFeaturesQueryKey(),\n queryFn: () => {\n return apiClient.chat\n .get<ApiCollection<FeatureResource>>(requestArgs)\n .catch(() => stableEmptyFeatures)\n },\n staleTime: FIVE_MINUTES,\n })\n\n const features = data.data\n\n const featureEnabled = useCallback(\n (featureName: FeatureName) =>\n features.some(feature => feature.name === featureName && feature.enabled),\n [features]\n )\n\n return {\n features,\n featureEnabled,\n }\n}\n\nexport const availableFeatures = {\n gender_specific_conversations: 'ROLLOUT_gender_specific_conversations',\n message_reporting: 'ROLLOUT_MOBILE_message_reporting',\n granular_notifications_ui: 'ROLLOUT_granular_notification_preferences_ui',\n custom_conversation_avatars: 'ROLLOUT_custom_conversation_avatars',\n conversation_safety_lock: 'ROLLOUT_conversation_safety_lock',\n video_moderation: 'ROLLOUT_MOBILE_video_moderation',\n dm_search_clear_fix: 'ROLLOUT_MOBILE_dm_search_clear_fix',\n} as const satisfies Record<string, `ROLLOUT_${string}`>\n\nconst stableEmptyFeatures: ApiCollection<FeatureResource> = {\n data: [],\n links: {},\n meta: {\n count: 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B,EAAE,qCAAqC;IAClE,wBAAwB,EAAE,kCAAkC;IAC5D,gBAAgB,EAAE,iCAAiC;IACnD,mBAAmB,EAAE,6BAA6B;IAClD,mBAAmB,EAAE,oCAAoC;CACH,CAAA;AAExD,MAAM,mBAAmB,GAAmC;IAC1D,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,IAAI,EAAE;QACJ,KAAK,EAAE,CAAC;QACR,UAAU,EAAE,CAAC;KACd;CACF,CAAA","sourcesContent":["import { useSuspenseQuery } from '@tanstack/react-query'\nimport { useCallback } from 'react'\nimport { ApiCollection } from '../types'\nimport type { FeatureResource } from '../types/resources/feature_resource'\nimport { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'\nimport { FIVE_MINUTES } from '../utils/time'\nimport { useApiClient } from './use_api_client'\n\ntype FeatureName = (typeof availableFeatures)[keyof typeof availableFeatures]\n\nexport function useFeatures() {\n const apiClient = useApiClient()\n const requestArgs = getFeaturesRequestArgs()\n\n const { data } = useSuspenseQuery({\n queryKey: getFeaturesQueryKey(),\n queryFn: () => {\n return apiClient.chat\n .get<ApiCollection<FeatureResource>>(requestArgs)\n .catch(() => stableEmptyFeatures)\n },\n staleTime: FIVE_MINUTES,\n })\n\n const features = data.data\n\n const featureEnabled = useCallback(\n (featureName: FeatureName) =>\n features.some(feature => feature.name === featureName && feature.enabled),\n [features]\n )\n\n return {\n features,\n featureEnabled,\n }\n}\n\nexport const availableFeatures = {\n gender_specific_conversations: 'ROLLOUT_gender_specific_conversations',\n message_reporting: 'ROLLOUT_MOBILE_message_reporting',\n granular_notifications_ui: 'ROLLOUT_granular_notification_preferences_ui',\n custom_conversation_avatars: 'ROLLOUT_custom_conversation_avatars',\n conversation_safety_lock: 'ROLLOUT_conversation_safety_lock',\n video_moderation: 'ROLLOUT_MOBILE_video_moderation',\n direct_messages_eap: 'ROLLOUT_direct_messages_eap',\n dm_search_clear_fix: 'ROLLOUT_MOBILE_dm_search_clear_fix',\n} as const satisfies Record<string, `ROLLOUT_${string}`>\n\nconst stableEmptyFeatures: ApiCollection<FeatureResource> = {\n data: [],\n links: {},\n meta: {\n count: 0,\n totalCount: 0,\n },\n}\n"]}