diff --git a/.eslintrc.js b/.eslintrc.js index 1a8861de7087..a5d36dec42c3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -244,6 +244,19 @@ module.exports = { 'react/prop-types': 'off', 'react/jsx-key': 'error', 'react/jsx-no-constructed-context-values': 'error', + 'react/forbid-component-props': [ + 'error', + { + forbid: [ + { + propName: 'fsClass', + allowedFor: ['View', 'Animated.View', 'Text', 'Pressable'], + message: + "The 'fsClass' prop doesn't work for custom components, only RN's View, Text and Pressable.\nPlease use the 'ForwardedFSClassProps' or 'MultipleFSClassProps' types to pass down the desired 'fsClass' value to the allowed components.", + }, + ], + }, + ], 'react-native-a11y/has-valid-accessibility-descriptors': [ 'error', { diff --git a/src/components/AddPaymentCard/PaymentCardForm.tsx b/src/components/AddPaymentCard/PaymentCardForm.tsx index 83a4bbef6a9e..fddbcd2f0838 100644 --- a/src/components/AddPaymentCard/PaymentCardForm.tsx +++ b/src/components/AddPaymentCard/PaymentCardForm.tsx @@ -269,6 +269,7 @@ function PaymentCardForm({ submitButtonText={submitButtonText} scrollContextEnabled style={[styles.mh5, styles.flexGrow1]} + forwardedFSClass={CONST.FULLSTORY.CLASS.MASK} > getTooltipShiftX(index), [getTooltipShiftX, index]); @@ -58,8 +60,6 @@ function DisplayNamesTooltipItem({ > {/* We need to get the refs to all the names which will be used to correct the horizontal position of the tooltip */} { if (!childRefs.current?.at(index) || !el) { return; @@ -68,6 +68,7 @@ function DisplayNamesTooltipItem({ childRefs.current[index] = el; }} style={[textStyles, styles.pre]} + fsClass={forwardedFSClass} > {displayName} diff --git a/src/components/DisplayNames/DisplayNamesWithTooltip.tsx b/src/components/DisplayNames/DisplayNamesWithTooltip.tsx index 000141987b58..cd72d02a46c1 100644 --- a/src/components/DisplayNames/DisplayNamesWithTooltip.tsx +++ b/src/components/DisplayNames/DisplayNamesWithTooltip.tsx @@ -19,6 +19,7 @@ function DisplayNamesWithToolTip({ textStyles = [], numberOfLines = 1, renderAdditionalText, + forwardedFSClass, }: DisplayNamesProps) { const styles = useThemeStyles(); const containerRef = useRef(null); @@ -63,6 +64,7 @@ function DisplayNamesWithToolTip({ numberOfLines={numberOfLines || undefined} ref={containerRef} testID={DisplayNamesWithToolTip.displayName} + fsClass={forwardedFSClass} > {shouldUseFullTitle ? formatReportLastMessageText(fullTitle) @@ -78,6 +80,7 @@ function DisplayNamesWithToolTip({ avatar={avatar} textStyles={textStyles} childRefs={childRefs} + forwardedFSClass={forwardedFSClass} /> {index < displayNamesWithTooltips.length - 1 && , } {shouldAddEllipsis && index === displayNamesWithTooltips.length - 1 && ...} diff --git a/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx b/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx index c66d1698bbd6..1ec60f3af5ac 100644 --- a/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx +++ b/src/components/DisplayNames/DisplayNamesWithoutTooltip.tsx @@ -2,8 +2,9 @@ import React from 'react'; import type {StyleProp, TextStyle} from 'react-native'; import Text from '@components/Text'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; -type DisplayNamesWithoutTooltipProps = { +type DisplayNamesWithoutTooltipProps = ForwardedFSClassProps & { /** The full title of the DisplayNames component (not split up) */ fullTitle?: string; @@ -17,12 +18,13 @@ type DisplayNamesWithoutTooltipProps = { renderAdditionalText?: () => React.ReactNode; }; -function DisplayNamesWithoutTooltip({textStyles = [], numberOfLines = 1, fullTitle = '', renderAdditionalText}: DisplayNamesWithoutTooltipProps) { +function DisplayNamesWithoutTooltip({textStyles = [], numberOfLines = 1, fullTitle = '', renderAdditionalText, forwardedFSClass}: DisplayNamesWithoutTooltipProps) { const styles = useThemeStyles(); return ( {fullTitle} {renderAdditionalText?.()} diff --git a/src/components/DisplayNames/index.native.tsx b/src/components/DisplayNames/index.native.tsx index 199c8749011a..f6f35f9689fd 100644 --- a/src/components/DisplayNames/index.native.tsx +++ b/src/components/DisplayNames/index.native.tsx @@ -8,7 +8,7 @@ import TextWithEmojiFragment from '@pages/home/report/comment/TextWithEmojiFragm import type DisplayNamesProps from './types'; // As we don't have to show tooltips of the Native platform so we simply render the full display names list. -function DisplayNames({accessibilityLabel, fullTitle, textStyles = [], numberOfLines = 1, renderAdditionalText}: DisplayNamesProps) { +function DisplayNames({accessibilityLabel, fullTitle, textStyles = [], numberOfLines = 1, renderAdditionalText, forwardedFSClass}: DisplayNamesProps) { const {translate} = useLocalize(); const titleContainsTextAndCustomEmoji = useMemo(() => containsCustomEmoji(fullTitle) && !containsOnlyCustomEmoji(fullTitle), [fullTitle]); return ( @@ -17,6 +17,7 @@ function DisplayNames({accessibilityLabel, fullTitle, textStyles = [], numberOfL style={textStyles} numberOfLines={numberOfLines} testID={DisplayNames.displayName} + fsClass={forwardedFSClass} > {titleContainsTextAndCustomEmoji ? ( ); } @@ -29,6 +40,7 @@ function DisplayNames({fullTitle, tooltipEnabled, textStyles, numberOfLines, sho textStyles={textStyles} numberOfLines={numberOfLines} renderAdditionalText={renderAdditionalText} + forwardedFSClass={forwardedFSClass} /> ); } @@ -41,6 +53,7 @@ function DisplayNames({fullTitle, tooltipEnabled, textStyles, numberOfLines, sho shouldAddEllipsis={shouldAddEllipsis} numberOfLines={numberOfLines} renderAdditionalText={renderAdditionalText} + forwardedFSClass={forwardedFSClass} /> ); } diff --git a/src/components/DisplayNames/types.ts b/src/components/DisplayNames/types.ts index ab9c0e5bbba2..1909bf774d84 100644 --- a/src/components/DisplayNames/types.ts +++ b/src/components/DisplayNames/types.ts @@ -1,4 +1,5 @@ import type {StyleProp, TextStyle} from 'react-native'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; import type {AvatarSource} from '@libs/UserUtils'; type DisplayNameWithTooltip = { @@ -15,7 +16,7 @@ type DisplayNameWithTooltip = { avatar?: AvatarSource; }; -type DisplayNamesProps = { +type DisplayNamesProps = ForwardedFSClassProps & { /** The full title of the DisplayNames component (not split up) */ fullTitle: string; diff --git a/src/components/FeatureTrainingModal.tsx b/src/components/FeatureTrainingModal.tsx index 630eca5cdcf5..d95d553d9492 100644 --- a/src/components/FeatureTrainingModal.tsx +++ b/src/components/FeatureTrainingModal.tsx @@ -431,6 +431,8 @@ function FeatureTrainingModal({ ref={shouldUseScrollView ? scrollViewRef : undefined} onLayout={shouldUseScrollView ? (e: LayoutChangeEvent) => setContainerHeight(e.nativeEvent.layout.height) : undefined} onContentSizeChange={shouldUseScrollView ? (_w: number, h: number) => setContentHeight(h) : undefined} + // Wrapper is either a View or ScrollView, which is also a View. + // eslint-disable-next-line react/forbid-component-props fsClass={CONST.FULLSTORY.CLASS.UNMASK} > diff --git a/src/components/Form/FormWrapper.tsx b/src/components/Form/FormWrapper.tsx index 67b11ce63f49..d342d865f5a8 100644 --- a/src/components/Form/FormWrapper.tsx +++ b/src/components/Form/FormWrapper.tsx @@ -95,6 +95,7 @@ function FormWrapper({ shouldSubmitButtonBlendOpacity = false, shouldPreventDefaultFocusOnPressSubmit = false, onScroll = () => {}, + forwardedFSClass, }: FormWrapperProps) { const styles = useThemeStyles(); const formRef = useRef(null); @@ -255,7 +256,10 @@ function FormWrapper({ } return ( - + {scrollContextEnabled ? ( = ComponentPropsWithoutRef & - InputComponentValueProps & { + InputComponentValueProps & + ForwardedFSClassProps & { InputComponent: TInput; inputID: string; isFocused?: boolean; diff --git a/src/components/Form/types.ts b/src/components/Form/types.ts index 5bfc590adac8..d406454649a7 100644 --- a/src/components/Form/types.ts +++ b/src/components/Form/types.ts @@ -26,6 +26,7 @@ import type TextPicker from '@components/TextPicker'; import type TimeModalPicker from '@components/TimeModalPicker'; import type UploadFile from '@components/UploadFile'; import type ValuePicker from '@components/ValuePicker'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; import type ConstantSelector from '@pages/Debug/ConstantSelector'; import type {FileObject} from '@pages/media/AttachmentModalScreen/types'; import type OnboardingCurrencyPicker from '@pages/OnboardingWorkspaceConfirmation/OnboardingCurrencyPicker'; @@ -128,7 +129,7 @@ type InputComponentBaseProps = Input type FormOnyxValues = Omit; type FormOnyxKeys = keyof FormOnyxValues; -type FormProps = { +type FormProps = ForwardedFSClassProps & { /** A unique Onyx key identifying the form */ formID: TFormID; @@ -173,6 +174,7 @@ type FormProps = { /** Render extra button above submit button */ shouldRenderFooterAboveSubmit?: boolean; + /** * Determines whether the form should automatically scroll to the end upon rendering or when the value changes. * If `true`, the form will smoothly scroll to the bottom after interactions have completed. diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index 8123c494f079..85ca068648e9 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -310,6 +310,7 @@ function OptionRowLHN({ style={alternateTextStyle} numberOfLines={1} accessibilityLabel={translate('accessibilityHints.lastChatMessagePreview')} + fsClass={CONST.FULLSTORY.CLASS.MASK} > {alternateTextContainsCustomEmojiWithText ? ( {optionItem?.descriptiveText ? ( - + {optionItem.descriptiveText} ) : null} diff --git a/src/components/MagicCodeInput.tsx b/src/components/MagicCodeInput.tsx index 00599a0b6476..12946ee83693 100644 --- a/src/components/MagicCodeInput.tsx +++ b/src/components/MagicCodeInput.tsx @@ -449,7 +449,10 @@ function MagicCodeInput( return ( <> - + {/* Android does not handle touch on invisible Views so I created a wrapper around invisible TextInput just to handle taps */} , ) { @@ -475,6 +476,7 @@ function BaseModal( onLayout={onViewLayout} style={[styles.defaultModalContainer, modalContainerStyle, modalPaddingStyles, !isVisible && styles.pointerEventsNone, sidePanelAnimatedStyle]} ref={ref} + fsClass={forwardedFSClass} > {children} diff --git a/src/components/Modal/types.ts b/src/components/Modal/types.ts index 2879b6afde87..3fe95e073b78 100644 --- a/src/components/Modal/types.ts +++ b/src/components/Modal/types.ts @@ -2,6 +2,7 @@ import type {FocusTrapProps} from 'focus-trap-react'; import type {GestureResponderEvent, PanResponderGestureState, ViewStyle} from 'react-native'; import type {Direction, ModalProps as ReactNativeModalProps} from 'react-native-modal'; import type {ValueOf} from 'type-fest'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; import type CONST from '@src/CONST'; import type ReanimatedModalProps from './ReanimatedModal/types'; @@ -19,7 +20,8 @@ type WindowState = { }; type BaseModalProps = Partial & - Partial & { + Partial & + ForwardedFSClassProps & { /** Decides whether the modal should cover fullscreen. FullScreen modal has backdrop */ fullscreen?: boolean; diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx index 210029493443..cf2322172cb4 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx @@ -13,13 +13,14 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import ControlSelection from '@libs/ControlSelection'; import canUseTouchScreen from '@libs/DeviceCapabilities/canUseTouchScreen'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; import {getTransactionPendingAction, isTransactionPendingDelete} from '@libs/TransactionUtils'; import variables from '@styles/variables'; import CONST from '@src/CONST'; import type {Report, TransactionViolation} from '@src/types/onyx'; import type {TransactionWithOptionalHighlight} from './MoneyRequestReportTransactionList'; -type MoneyRequestReportTransactionItemProps = { +type MoneyRequestReportTransactionItemProps = ForwardedFSClassProps & { /** The transaction that is being displayed */ transaction: TransactionWithOptionalHighlight; @@ -76,6 +77,7 @@ function MoneyRequestReportTransactionItem({ amountColumnSize, taxAmountColumnSize, scrollToNewTransaction, + forwardedFSClass, }: MoneyRequestReportTransactionItemProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -131,6 +133,7 @@ function MoneyRequestReportTransactionItem({ disabled={isTransactionPendingDelete(transaction)} ref={viewRef} wrapperStyle={[animatedHighlightStyle, styles.userSelectNone]} + forwardedFSClass={forwardedFSClass} > { @@ -265,6 +267,8 @@ function MoneyRequestReportTransactionList({ const listHorizontalPadding = styles.ph5; + const transactionItemFSClass = FS.getChatFSClass(personalDetailsList, report); + if (isEmptyTransactions) { return ( <> @@ -339,6 +343,7 @@ function MoneyRequestReportTransactionList({ taxAmountColumnSize={taxAmountColumnSize} // if we add few new transactions, then we need to scroll to the first one scrollToNewTransaction={transaction.transactionID === newTransactions?.at(0)?.transactionID ? scrollToNewTransaction : undefined} + forwardedFSClass={transactionItemFSClass} /> ); })} diff --git a/src/components/Pressable/GenericPressable/implementation/BaseGenericPressable.tsx b/src/components/Pressable/GenericPressable/implementation/BaseGenericPressable.tsx index 64111cf111ac..9ab28f1583b2 100644 --- a/src/components/Pressable/GenericPressable/implementation/BaseGenericPressable.tsx +++ b/src/components/Pressable/GenericPressable/implementation/BaseGenericPressable.tsx @@ -38,6 +38,7 @@ function GenericPressable({ isNested = false, ref, dataSet, + forwardedFSClass, ...rest }: PressableProps) { const styles = useThemeStyles(); @@ -176,6 +177,7 @@ function GenericPressable({ onMagicTap={!isDisabled ? voidOnPressHandler : undefined} onAccessibilityTap={!isDisabled ? voidOnPressHandler : undefined} accessible={accessible} + fsClass={forwardedFSClass} // eslint-disable-next-line react/jsx-props-no-spreading {...rest} onHoverOut={(event) => { diff --git a/src/components/Pressable/GenericPressable/types.ts b/src/components/Pressable/GenericPressable/types.ts index 4fdde78329be..ebaa4686d1c8 100644 --- a/src/components/Pressable/GenericPressable/types.ts +++ b/src/components/Pressable/GenericPressable/types.ts @@ -2,6 +2,7 @@ import type {ComponentRef, ForwardedRef, RefObject} from 'react'; // eslint-disable-next-line no-restricted-imports import type {GestureResponderEvent, HostComponent, PressableStateCallbackType, PressableProps as RNPressableProps, Text as RNText, StyleProp, View, ViewStyle} from 'react-native'; import type {ValueOf} from 'type-fest'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; import type {Shortcut} from '@libs/KeyboardShortcut'; import type CONST from '@src/CONST'; @@ -37,7 +38,8 @@ type RequiredAccessibilityLabel = }; type PressableProps = RNPressableProps & - RequiredAccessibilityLabel & { + RequiredAccessibilityLabel & + ForwardedFSClassProps & { /** * onPress callback */ diff --git a/src/components/RNMarkdownTextInput.tsx b/src/components/RNMarkdownTextInput.tsx index 69ab57e4ed30..a8cd02c11fd6 100644 --- a/src/components/RNMarkdownTextInput.tsx +++ b/src/components/RNMarkdownTextInput.tsx @@ -6,6 +6,7 @@ import Animated, {useSharedValue} from 'react-native-reanimated'; import useShortMentionsList from '@hooks/useShortMentionsList'; import useTheme from '@hooks/useTheme'; import toggleSelectionFormat from '@libs/FormatSelectionUtils'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; import {parseExpensiMarkWithShortMentions} from '@libs/ParsingUtils'; import runOnLiveMarkdownRuntime from '@libs/runOnLiveMarkdownRuntime'; import CONST from '@src/CONST'; @@ -16,12 +17,13 @@ const AnimatedMarkdownTextInput = Animated.createAnimatedComponent(MarkdownTextI type AnimatedMarkdownTextInputRef = typeof AnimatedMarkdownTextInput & MarkdownTextInput & HTMLInputElement; // Make the parser prop optional for this component because we are always defaulting to `parseExpensiMark` -type RNMarkdownTextInputWithRefProps = Omit & { - parser?: MarkdownTextInputProps['parser']; - ref?: ForwardedRef; -}; +type RNMarkdownTextInputWithRefProps = Omit & + ForwardedFSClassProps & { + parser?: MarkdownTextInputProps['parser']; + ref?: ForwardedRef; + }; -function RNMarkdownTextInputWithRef({maxLength, parser, ref, ...props}: RNMarkdownTextInputWithRefProps) { +function RNMarkdownTextInputWithRef({maxLength, parser, ref, forwardedFSClass = CONST.FULLSTORY.CLASS.MASK, ...props}: RNMarkdownTextInputWithRefProps) { const theme = useTheme(); const {availableLoginsList, currentUserMentions} = useShortMentionsList(); @@ -76,6 +78,8 @@ function RNMarkdownTextInputWithRef({maxLength, parser, ref, ...props}: RNMarkdo parser={parserWorklet} ref={inputRef} formatSelection={toggleSelectionFormat} + // eslint-disable-next-line react/forbid-component-props + fsClass={forwardedFSClass} // eslint-disable-next-line {...props} /** diff --git a/src/components/RNMaskedTextInput.tsx b/src/components/RNMaskedTextInput.tsx index 10dd4c17f462..9891b3fa4830 100644 --- a/src/components/RNMaskedTextInput.tsx +++ b/src/components/RNMaskedTextInput.tsx @@ -5,17 +5,20 @@ import type {MaskedTextInputProps} from 'react-native-advanced-input-mask'; import {MaskedTextInput} from 'react-native-advanced-input-mask'; import Animated from 'react-native-reanimated'; import useTheme from '@hooks/useTheme'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; +import CONST from '@src/CONST'; // Convert the underlying TextInput into an Animated component so that we can take an animated ref and pass it to a worklet const AnimatedTextInput = Animated.createAnimatedComponent(TextInput); type AnimatedTextInputRef = typeof AnimatedTextInput & TextInput & HTMLInputElement; -type RNMaskedTextInputWithRefProps = MaskedTextInputProps & { - ref?: ForwardedRef; -}; +type RNMaskedTextInputWithRefProps = MaskedTextInputProps & + ForwardedFSClassProps & { + ref?: ForwardedRef; + }; -function RNMaskedTextInputWithRef({ref, ...props}: RNMaskedTextInputWithRefProps) { +function RNMaskedTextInputWithRef({ref, forwardedFSClass = CONST.FULLSTORY.CLASS.MASK, ...props}: RNMaskedTextInputWithRefProps) { const theme = useTheme(); return ( @@ -32,6 +35,8 @@ function RNMaskedTextInputWithRef({ref, ...props}: RNMaskedTextInputWithRefProps } ref(refHandle as AnimatedTextInputRef | null); }} + // eslint-disable-next-line react/forbid-component-props + fsClass={forwardedFSClass} // eslint-disable-next-line {...props} /> diff --git a/src/components/RNTextInput.tsx b/src/components/RNTextInput.tsx index 8b63c9a1e528..bffdce8aa466 100644 --- a/src/components/RNTextInput.tsx +++ b/src/components/RNTextInput.tsx @@ -4,17 +4,20 @@ import type {TextInputProps} from 'react-native'; import {TextInput} from 'react-native'; import Animated from 'react-native-reanimated'; import useTheme from '@hooks/useTheme'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; +import CONST from '@src/CONST'; // Convert the underlying TextInput into an Animated component so that we can take an animated ref and pass it to a worklet const AnimatedTextInput = Animated.createAnimatedComponent(TextInput); type AnimatedTextInputRef = typeof AnimatedTextInput & TextInput & HTMLInputElement; -type RNTextInputWithRefProps = TextInputProps & { - ref?: ForwardedRef; -}; +type RNTextInputWithRefProps = TextInputProps & + ForwardedFSClassProps & { + ref?: ForwardedRef; + }; -function RNTextInputWithRef({ref, ...props}: RNTextInputWithRefProps) { +function RNTextInputWithRef({ref, forwardedFSClass = CONST.FULLSTORY.CLASS.MASK, ...props}: RNTextInputWithRefProps) { const theme = useTheme(); return ( @@ -28,6 +31,8 @@ function RNTextInputWithRef({ref, ...props}: RNTextInputWithRefProps) { } ref(refHandle as AnimatedTextInputRef); }} + // eslint-disable-next-line react/forbid-component-props + fsClass={forwardedFSClass} // eslint-disable-next-line {...props} /> diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 387fd41ef98d..be793ca940c6 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -108,6 +108,7 @@ function MoneyRequestReportPreviewContent({ isInvoice, shouldShowBorder = false, onPress, + forwardedFSClass, }: MoneyRequestReportPreviewContentProps) { const [chatReportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${chatReportID}`, {canBeMissing: true, allowStaleData: true}); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: true}); @@ -602,6 +603,7 @@ function MoneyRequestReportPreviewContent({ ); + const fsClass = FS.getChatFSClass(personalDetailsList, iouReport); + return ( ); } diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts index c73555b187d9..c6eaf67e7c77 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts @@ -1,6 +1,7 @@ import type {LayoutChangeEvent, ListRenderItem, StyleProp, ViewStyle} from 'react-native'; import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; import type {TransactionPreviewStyleType} from '@components/ReportActionItem/TransactionPreview/types'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; import type {ContextMenuAnchor} from '@pages/home/report/ContextMenu/ReportActionContextMenu'; import type {PersonalDetails, Policy, Report, ReportAction, Transaction, TransactionViolation, TransactionViolations} from '@src/types/onyx'; @@ -81,7 +82,8 @@ type MoneyRequestReportPreviewContentOnyxProps = { }; type MoneyRequestReportPreviewContentProps = MoneyRequestReportPreviewContentOnyxProps & - Omit & { + Omit & + ForwardedFSClassProps & { /** Extra styles passed used by MoneyRequestReportPreviewContent */ reportPreviewStyles: MoneyRequestReportPreviewStyleType; diff --git a/src/components/ScreenWrapper/ScreenWrapperContainer.tsx b/src/components/ScreenWrapper/ScreenWrapperContainer.tsx index 3c63b4b9ae2f..e64165ff5172 100644 --- a/src/components/ScreenWrapper/ScreenWrapperContainer.tsx +++ b/src/components/ScreenWrapper/ScreenWrapperContainer.tsx @@ -13,78 +13,80 @@ import useTackInputFocus from '@hooks/useTackInputFocus'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import {isMobile, isMobileWebKit, isSafari} from '@libs/Browser'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; import addViewportResizeListener from '@libs/VisualViewport'; import toggleTestToolsModal from '@userActions/TestTool'; import CONST from '@src/CONST'; -type ScreenWrapperContainerProps = React.PropsWithChildren<{ - /** A unique ID to find the screen wrapper in tests */ - testID: string; +type ScreenWrapperContainerProps = ForwardedFSClassProps & + React.PropsWithChildren<{ + /** A unique ID to find the screen wrapper in tests */ + testID: string; - /** Additional styles to add */ - style?: StyleProp; + /** Additional styles to add */ + style?: StyleProp; - /** Content to display under the offline indicator */ - bottomContent?: ReactNode; + /** Content to display under the offline indicator */ + bottomContent?: ReactNode; - /** Additional styles for bottom content */ - bottomContentStyle?: StyleProp; + /** Additional styles for bottom content */ + bottomContentStyle?: StyleProp; - /** Whether the screen wrapper has finished the transition */ - didScreenTransitionEnd?: boolean; + /** Whether the screen wrapper has finished the transition */ + didScreenTransitionEnd?: boolean; - /** The behavior to pass to the KeyboardAvoidingView, requires some trial and error depending on the layout/devices used. - * Search 'switch(behavior)' in ./node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js for more context */ - keyboardAvoidingViewBehavior?: 'padding' | 'height' | 'position'; + /** The behavior to pass to the KeyboardAvoidingView, requires some trial and error depending on the layout/devices used. + * Search 'switch(behavior)' in ./node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js for more context */ + keyboardAvoidingViewBehavior?: 'padding' | 'height' | 'position'; - /** The vertical offset to pass to the KeyboardAvoidingView */ - keyboardVerticalOffset?: number; + /** The vertical offset to pass to the KeyboardAvoidingView */ + keyboardVerticalOffset?: number; - /** Whether KeyboardAvoidingView should be enabled. Use false for screens where this functionality is not necessary */ - shouldEnableKeyboardAvoidingView?: boolean; + /** Whether KeyboardAvoidingView should be enabled. Use false for screens where this functionality is not necessary */ + shouldEnableKeyboardAvoidingView?: boolean; - /** Whether picker modal avoiding should be enabled. Should be enabled when there's a picker at the bottom of a - * scrollable form, gives a subtly better UX if disabled on non-scrollable screens with a submit button */ - shouldEnablePickerAvoiding?: boolean; + /** Whether picker modal avoiding should be enabled. Should be enabled when there's a picker at the bottom of a + * scrollable form, gives a subtly better UX if disabled on non-scrollable screens with a submit button */ + shouldEnablePickerAvoiding?: boolean; - /** - * Whether the KeyboardAvoidingView should compensate for the bottom safe area padding. - * The KeyboardAvoidingView will use a negative keyboardVerticalOffset. - */ - shouldKeyboardOffsetBottomSafeAreaPadding?: boolean; + /** + * Whether the KeyboardAvoidingView should compensate for the bottom safe area padding. + * The KeyboardAvoidingView will use a negative keyboardVerticalOffset. + */ + shouldKeyboardOffsetBottomSafeAreaPadding?: boolean; - /** Whether to dismiss keyboard before leaving a screen */ - shouldDismissKeyboardBeforeClose?: boolean; + /** Whether to dismiss keyboard before leaving a screen */ + shouldDismissKeyboardBeforeClose?: boolean; - /** Whether to use the maxHeight (true) or use the 100% of the height (false) */ - shouldEnableMaxHeight?: boolean; + /** Whether to use the maxHeight (true) or use the 100% of the height (false) */ + shouldEnableMaxHeight?: boolean; - /** Whether to use the minHeight. Use true for screens where the window height are changing because of Virtual Keyboard */ - shouldEnableMinHeight?: boolean; + /** Whether to use the minHeight. Use true for screens where the window height are changing because of Virtual Keyboard */ + shouldEnableMinHeight?: boolean; - /** Whether to avoid scroll on virtual viewport */ - shouldAvoidScrollOnVirtualViewport?: boolean; + /** Whether to avoid scroll on virtual viewport */ + shouldAvoidScrollOnVirtualViewport?: boolean; - /** Whether to use cached virtual viewport height */ - shouldUseCachedViewportHeight?: boolean; + /** Whether to use cached virtual viewport height */ + shouldUseCachedViewportHeight?: boolean; - /** Whether to include padding bottom */ - includeSafeAreaPaddingBottom?: boolean; + /** Whether to include padding bottom */ + includeSafeAreaPaddingBottom?: boolean; - /** Whether to include padding top */ - includePaddingTop?: boolean; + /** Whether to include padding top */ + includePaddingTop?: boolean; - /** Whether to enable edge to edge bottom safe area padding */ - enableEdgeToEdgeBottomSafeAreaPadding?: boolean; + /** Whether to enable edge to edge bottom safe area padding */ + enableEdgeToEdgeBottomSafeAreaPadding?: boolean; - /** - * Whether the screen is focused. (Only passed if wrapped in ScreenWrapper) - */ - isFocused?: boolean; + /** + * Whether the screen is focused. (Only passed if wrapped in ScreenWrapper) + */ + isFocused?: boolean; - /** Reference to the outer element */ - ref?: ForwardedRef; -}>; + /** Reference to the outer element */ + ref?: ForwardedRef; + }>; function ScreenWrapperContainer({ children, @@ -107,6 +109,7 @@ function ScreenWrapperContainer({ includeSafeAreaPaddingBottom = false, isFocused = true, ref, + forwardedFSClass, }: ScreenWrapperContainerProps) { const {windowHeight} = useWindowDimensions(shouldUseCachedViewportHeight); const {initialHeight} = useInitialDimensions(); @@ -205,10 +208,10 @@ function ScreenWrapperContainer({ // eslint-disable-next-line react/jsx-props-no-spreading, react-compiler/react-compiler {...panResponder.panHandlers} testID={testID} + fsClass={forwardedFSClass} > & - Omit & { + Omit & + ForwardedFSClassProps & { /** * The navigation prop is passed by the navigator. It is used to trigger the onEntryTransitionEnd callback * when the screen transition ends. diff --git a/src/components/Search/SearchAutocompleteInput.tsx b/src/components/Search/SearchAutocompleteInput.tsx index 2ca0201d75a6..0735a7a45ede 100644 --- a/src/components/Search/SearchAutocompleteInput.tsx +++ b/src/components/Search/SearchAutocompleteInput.tsx @@ -197,10 +197,7 @@ function SearchAutocompleteInput( return ( - + diff --git a/src/components/Search/SearchAutocompleteList.tsx b/src/components/Search/SearchAutocompleteList.tsx index 40e34d414d16..4bfd72b5849f 100644 --- a/src/components/Search/SearchAutocompleteList.tsx +++ b/src/components/Search/SearchAutocompleteList.tsx @@ -145,6 +145,7 @@ function SearchRouterItem(props: UserListItemProps | SearchQueryList return ( diff --git a/src/components/SelectionList/BaseListItem.tsx b/src/components/SelectionList/BaseListItem.tsx index 256d9d701e40..8a3bfc193e76 100644 --- a/src/components/SelectionList/BaseListItem.tsx +++ b/src/components/SelectionList/BaseListItem.tsx @@ -41,6 +41,7 @@ function BaseListItem({ onLongPressRow, testID, shouldUseDefaultRightHandSideCheckmark = true, + forwardedFSClass, }: BaseListItemProps) { const theme = useTheme(); const styles = useThemeStyles(); @@ -123,6 +124,7 @@ function BaseListItem({ wrapperStyle, isFocused && StyleUtils.getItemBackgroundColorStyle(!!item.isSelected, !!isFocused, !!item.isDisabled, theme.activeComponentBG, theme.hoverComponentBG), ]} + fsClass={forwardedFSClass} > {typeof children === 'function' ? children(hovered) : children} diff --git a/src/components/SelectionList/ChatListItem.tsx b/src/components/SelectionList/ChatListItem.tsx index 33dff5d23500..a337558d57af 100644 --- a/src/components/SelectionList/ChatListItem.tsx +++ b/src/components/SelectionList/ChatListItem.tsx @@ -2,9 +2,9 @@ import React from 'react'; import useAnimatedHighlightStyle from '@hooks/useAnimatedHighlightStyle'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import FS from '@libs/Fullstory'; import ReportActionItem from '@pages/home/report/ReportActionItem'; import variables from '@styles/variables'; -import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import BaseListItem from './BaseListItem'; import type {ChatListItemProps, ListItem, ReportActionListItemType} from './types'; @@ -28,8 +28,7 @@ function ChatListItem({ userBillingFundID, }: ChatListItemProps) { const reportActionItem = item as unknown as ReportActionListItemType; - const reportID = Number(reportActionItem?.reportID ?? CONST.DEFAULT_NUMBER_ID); - const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; + const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportActionItem?.reportID}`]; const styles = useThemeStyles(); const theme = useTheme(); const animatedHighlightStyle = useAnimatedHighlightStyle({ @@ -50,6 +49,8 @@ function ChatListItem({ item.cursorStyle, ]; + const fsClass = FS.getChatFSClass(personalDetails, report); + return ( ({ shouldSyncFocus={shouldSyncFocus} pressableWrapperStyle={[styles.mh5, animatedHighlightStyle]} hoverStyle={item.isSelected && styles.activeComponentBG} + forwardedFSClass={fsClass} > ({ @@ -18,8 +20,11 @@ function TaskListItem({ onFocus, onLongPressRow, shouldSyncFocus, + allReports, + personalDetails, }: TaskListItemProps) { const taskItem = item as unknown as TaskListItemType; + const parentReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${taskItem?.parentReportID}`]; const styles = useThemeStyles(); const theme = useTheme(); @@ -48,6 +53,8 @@ function TaskListItem({ backgroundColor: theme.highlightBG, }); + const fsClass = FS.getChatFSClass(personalDetails, parentReport); + return ( ({ shouldSyncFocus={shouldSyncFocus} hoverStyle={item.isSelected && styles.activeComponentBG} pressableWrapperStyle={[styles.mh5, animatedHighlightStyle]} + forwardedFSClass={fsClass} > ({ wrapperStyle, pressableStyle, shouldUseDefaultRightHandSideCheckmark, + forwardedFSClass, }: UserListItemProps) { const styles = useThemeStyles(); const theme = useTheme(); @@ -149,6 +150,7 @@ function UserListItem({ shouldShowTooltip={showTooltip} text={Str.removeSMSDomain(item.alternateText ?? '')} style={[styles.textLabelSupporting, styles.lh16, styles.pre]} + forwardedFSClass={forwardedFSClass} /> )} diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 072186485206..50da65e299f9 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -18,6 +18,7 @@ import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; import type {AnimatedStyle} from 'react-native-reanimated'; import type {SearchRouterItem} from '@components/Search/SearchAutocompleteList'; import type {SearchColumnType, SearchGroupBy, SearchQueryJSON} from '@components/Search/types'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; import type {BrickRoad} from '@libs/WorkspacesSettingsUtils'; import type UnreportedExpenseListItem from '@pages/UnreportedExpenseListItem'; import type SpendCategorySelectorListItem from '@pages/workspace/categories/SpendCategorySelectorListItem'; @@ -411,36 +412,38 @@ type ListItemProps = CommonListItemProps & { onInputBlur?: (e: NativeSyntheticEvent) => void; }; -type BaseListItemProps = CommonListItemProps & { - item: TItem; - shouldPreventDefaultFocusOnSelectRow?: boolean; - shouldPreventEnterKeySubmit?: boolean; - shouldShowBlueBorderOnFocus?: boolean; - keyForList?: string | null; - errors?: Errors | ReceiptErrors | null; - pendingAction?: PendingAction | null; - FooterComponent?: ReactElement; - children?: ReactElement> | ((hovered: boolean) => ReactElement>); - shouldSyncFocus?: boolean; - hoverStyle?: StyleProp; - /** Errors that this user may contain */ - shouldDisplayRBR?: boolean; - /** Test ID of the component. Used to locate this view in end-to-end tests. */ - testID?: string; - /** Whether to show the default right hand side checkmark */ - shouldUseDefaultRightHandSideCheckmark?: boolean; -}; +type BaseListItemProps = CommonListItemProps & + ForwardedFSClassProps & { + item: TItem; + shouldPreventDefaultFocusOnSelectRow?: boolean; + shouldPreventEnterKeySubmit?: boolean; + shouldShowBlueBorderOnFocus?: boolean; + keyForList?: string | null; + errors?: Errors | ReceiptErrors | null; + pendingAction?: PendingAction | null; + FooterComponent?: ReactElement; + children?: ReactElement> | ((hovered: boolean) => ReactElement>); + shouldSyncFocus?: boolean; + hoverStyle?: StyleProp; + /** Errors that this user may contain */ + shouldDisplayRBR?: boolean; + /** Test ID of the component. Used to locate this view in end-to-end tests. */ + testID?: string; + /** Whether to show the default right hand side checkmark */ + shouldUseDefaultRightHandSideCheckmark?: boolean; + }; -type UserListItemProps = ListItemProps & { - /** Errors that this user may contain */ - errors?: Errors | ReceiptErrors | null; +type UserListItemProps = ListItemProps & + ForwardedFSClassProps & { + /** Errors that this user may contain */ + errors?: Errors | ReceiptErrors | null; - /** The type of action that's pending */ - pendingAction?: PendingAction | null; + /** The type of action that's pending */ + pendingAction?: PendingAction | null; - /** The React element that will be shown as a footer */ - FooterComponent?: ReactElement; -}; + /** The React element that will be shown as a footer */ + FooterComponent?: ReactElement; + }; type SplitListItemType = ListItem & SplitExpense & { @@ -499,6 +502,12 @@ type TransactionListItemProps = ListItemProps & { type TaskListItemProps = ListItemProps & { /** Whether the item's action is loading */ isLoading?: boolean; + + /** All the data of the report collection */ + allReports?: OnyxCollection; + + /** Personal details list */ + personalDetails: OnyxEntry; }; type TransactionGroupListItemProps = ListItemProps & { diff --git a/src/components/TextInput/BaseTextInput/types.ts b/src/components/TextInput/BaseTextInput/types.ts index 26c4a2176729..2ba74a24ce47 100644 --- a/src/components/TextInput/BaseTextInput/types.ts +++ b/src/components/TextInput/BaseTextInput/types.ts @@ -3,10 +3,11 @@ import type {ForwardedRef} from 'react'; import type {GestureResponderEvent, StyleProp, TextInputProps, TextStyle, ViewStyle} from 'react-native'; import type {MaskedTextInputOwnProps} from 'react-native-advanced-input-mask/lib/typescript/src/types'; import type {AnimatedTextInputRef} from '@components/RNTextInput'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; import type IconAsset from '@src/types/utils/IconAsset'; type InputType = 'markdown' | 'mask' | 'default'; -type CustomBaseTextInputProps = { +type CustomBaseTextInputProps = ForwardedFSClassProps & { /** Input label */ label?: string; diff --git a/src/components/TextWithTooltip/index.native.tsx b/src/components/TextWithTooltip/index.native.tsx index 9f5f246ff9d3..dad41ac02030 100644 --- a/src/components/TextWithTooltip/index.native.tsx +++ b/src/components/TextWithTooltip/index.native.tsx @@ -1,19 +1,20 @@ import React from 'react'; import Text from '@components/Text'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as EmojiUtils from '@libs/EmojiUtils'; +import {getProcessedText, splitTextWithEmojis} from '@libs/EmojiUtils'; import type TextWithTooltipProps from './types'; -function TextWithTooltip({text, style, numberOfLines = 1}: TextWithTooltipProps) { +function TextWithTooltip({text, style, numberOfLines = 1, forwardedFSClass}: TextWithTooltipProps) { const styles = useThemeStyles(); - const processedTextArray = EmojiUtils.splitTextWithEmojis(text); + const processedTextArray = splitTextWithEmojis(text); return ( - {processedTextArray.length !== 0 ? EmojiUtils.getProcessedText(processedTextArray, [style, styles.emojisFontFamily]) : text} + {processedTextArray.length !== 0 ? getProcessedText(processedTextArray, [style, styles.emojisFontFamily]) : text} ); } diff --git a/src/components/TextWithTooltip/index.tsx b/src/components/TextWithTooltip/index.tsx index 704ffdb8bb1c..2ded192e8808 100644 --- a/src/components/TextWithTooltip/index.tsx +++ b/src/components/TextWithTooltip/index.tsx @@ -7,7 +7,7 @@ type LayoutChangeEvent = { target: HTMLElement; }; -function TextWithTooltip({text, shouldShowTooltip, style, numberOfLines = 1}: TextWithTooltipProps) { +function TextWithTooltip({text, shouldShowTooltip, style, numberOfLines = 1, forwardedFSClass}: TextWithTooltipProps) { const [showTooltip, setShowTooltip] = useState(false); return ( @@ -29,6 +29,7 @@ function TextWithTooltip({text, shouldShowTooltip, style, numberOfLines = 1}: Te } setShowTooltip(false); }} + fsClass={forwardedFSClass} > {text} diff --git a/src/components/TextWithTooltip/types.ts b/src/components/TextWithTooltip/types.ts index e0211adcdba2..c69a64f6967b 100644 --- a/src/components/TextWithTooltip/types.ts +++ b/src/components/TextWithTooltip/types.ts @@ -1,6 +1,7 @@ import type {StyleProp, TextStyle} from 'react-native'; +import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; -type TextWithTooltipProps = { +type TextWithTooltipProps = ForwardedFSClassProps & { /** The text to display */ text: string; diff --git a/src/libs/Fullstory/types.ts b/src/libs/Fullstory/types.ts index 508e0b814273..70e0079e0d09 100644 --- a/src/libs/Fullstory/types.ts +++ b/src/libs/Fullstory/types.ts @@ -1,6 +1,10 @@ import type {OnyxEntry} from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; import type {OnyxInputOrEntry, PersonalDetailsList, Report, UserMetadata} from '@src/types/onyx'; +type FSClass = ValueOf; + type PropertiesWithoutPageName = Record & {pageName?: never}; /** @@ -20,7 +24,7 @@ interface FSPageLikeConstructor { new (name: string, properties: PropertiesWithoutPageName): FSPageLike; } -type GetChatFSClass = (context: OnyxEntry, report: OnyxInputOrEntry) => string; +type GetChatFSClass = (context: OnyxEntry, report: OnyxInputOrEntry) => FSClass; type Fullstory = { /** @@ -64,4 +68,96 @@ type Fullstory = { anonymize: () => void; }; -export type {FSPageLike, FSPageLikeConstructor, Fullstory, GetChatFSClass, PropertiesWithoutPageName}; +/** + * Use this type when you want your component to be able to be supplied a `fsClass`-like prop that it's going + * to be used in its inner components. + * + * TS allows the `fsClass` prop to be used in any components, but the prop is only effective when passed directly to + * core React Native components like `View`, `Text`, `Pressable`, etc. + * + * To solve this we have an ESLint rule that forbids the use of `fsClass` prop in all components expect those listed here, + * and instructs the developer to use this type instead. + * + * @example + * ```tsx + * type CustomComponentProps = ForwardedFSClassProps & { + * title: string; + * }; + * + * function CustomComponent({title, forwardedFSClass}: CustomComponentProps) { + * return ( + * + * {title} + * + * ); + * } + * + * // ... + * + * function Page() { + * return ( + * + * ); + * } + * ``` + */ +type ForwardedFSClassProps = { + /** + * Used to pass down `fsClass` prop to inner components that will need it for Fullstory masking. + */ + forwardedFSClass?: FSClass; +}; + +/** + * Use this type when you want your component to be able to be supplied multiple `fsClass`-like props that are going + * to be used in its inner components. + * + * TS allows the `fsClass` prop to be used in any components, but the prop is only effective when passed directly to + * core React Native components like `View`, `Text`, `Pressable`, etc. + * + * To solve this we have an ESLint rule that forbids the use of `fsClass` prop in all components expect those listed here, + * and instructs the developer to use this type instead. + * + * @example + * ```tsx + * type CustomComponentProps = MultipleFSClassProps<'headerFSClass' | 'contentFSClass'> & { + * title: string; + * }; + * + * function CustomComponent({title, headerFSClass, contentFSClass}: CustomComponentProps) { + * return ( + * + * + * Header + * + * + * {title} + * + * + * ); + * } + * + * // ... + * + * function Page() { + * return ( + * + * ); + * } + * ``` + */ +type MultipleFSClassProps = { + /** + * Used to pass down multiple `fsClass` props to inner components that will need them for Fullstory masking. + */ + [key in T]?: FSClass; +}; + +export type {FSPageLike, FSPageLikeConstructor, Fullstory, GetChatFSClass, PropertiesWithoutPageName, ForwardedFSClassProps, MultipleFSClassProps}; diff --git a/src/pages/EnablePayments/EnablePayments.tsx b/src/pages/EnablePayments/EnablePayments.tsx index 1b19fdbdcb17..da6b96501f54 100644 --- a/src/pages/EnablePayments/EnablePayments.tsx +++ b/src/pages/EnablePayments/EnablePayments.tsx @@ -1,4 +1,5 @@ import React, {useEffect} from 'react'; +import {View} from 'react-native'; import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -6,8 +7,9 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useOnyx from '@hooks/useOnyx'; +import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; -import * as Wallet from '@userActions/Wallet'; +import {openEnablePaymentsPage} from '@userActions/Wallet'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; @@ -19,11 +21,12 @@ import PersonalInfo from './PersonalInfo/PersonalInfo'; import VerifyIdentity from './VerifyIdentity/VerifyIdentity'; function EnablePaymentsPage() { + const styles = useThemeStyles(); const {translate} = useLocalize(); const {isOffline} = useNetwork(); - const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET); - const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); - const [isActingAsDelegate] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => !!account?.delegatedAccess?.delegate}); + const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET, {canBeMissing: true}); + const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST, {canBeMissing: true}); + const [isActingAsDelegate] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => !!account?.delegatedAccess?.delegate, canBeMissing: true}); useEffect(() => { if (isOffline) { @@ -31,7 +34,7 @@ function EnablePaymentsPage() { } if (isEmptyObject(userWallet)) { - Wallet.openEnablePaymentsPage(); + openEnablePaymentsPage(); } }, [isOffline, userWallet]); @@ -67,20 +70,40 @@ function EnablePaymentsPage() { ); } - const currentStep = isEmptyObject(bankAccountList) ? CONST.WALLET.STEP.ADD_BANK_ACCOUNT : userWallet?.currentStep || CONST.WALLET.STEP.ADDITIONAL_DETAILS; - switch (currentStep) { + const enablePaymentsStep = isEmptyObject(bankAccountList) ? CONST.WALLET.STEP.ADD_BANK_ACCOUNT : userWallet?.currentStep || CONST.WALLET.STEP.ADDITIONAL_DETAILS; + + let CurrentStep: React.JSX.Element | null; + switch (enablePaymentsStep) { case CONST.WALLET.STEP.ADD_BANK_ACCOUNT: - return ; + CurrentStep = ; + break; case CONST.WALLET.STEP.ADDITIONAL_DETAILS: case CONST.WALLET.STEP.ADDITIONAL_DETAILS_KBA: - return ; + CurrentStep = ; + break; case CONST.WALLET.STEP.ONFIDO: - return ; + CurrentStep = ; + break; case CONST.WALLET.STEP.TERMS: - return ; + CurrentStep = ; + break; default: - return null; + CurrentStep = null; + break; } + + if (CurrentStep) { + return ( + + {CurrentStep} + + ); + } + + return null; } EnablePaymentsPage.displayName = 'EnablePaymentsPage'; diff --git a/src/pages/EnablePayments/EnablePaymentsPage.tsx b/src/pages/EnablePayments/EnablePaymentsPage.tsx index adc7fdcdab84..249524e58e4e 100644 --- a/src/pages/EnablePayments/EnablePaymentsPage.tsx +++ b/src/pages/EnablePayments/EnablePaymentsPage.tsx @@ -53,6 +53,7 @@ function EnablePaymentsPage() { shouldShowOfflineIndicator={userWallet?.currentStep !== CONST.WALLET.STEP.ONFIDO} includeSafeAreaPaddingBottom testID={EnablePaymentsPage.displayName} + forwardedFSClass={CONST.FULLSTORY.CLASS.MASK} > {() => { if (userWallet?.errorCode === CONST.WALLET.ERROR.KYC) { diff --git a/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx b/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx index d011ad04e5f0..2283603d8f46 100644 --- a/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx +++ b/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx @@ -15,6 +15,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import WorkspaceResetBankAccountModal from '@pages/workspace/WorkspaceResetBankAccountModal'; import {requestResetBankAccount, resetReimbursementAccount} from '@userActions/ReimbursementAccount'; +import CONST from '@src/CONST'; import type {ReimbursementAccount} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; @@ -67,6 +68,7 @@ function ConnectedVerifiedBankAccount({ shouldEnablePickerAvoiding={false} shouldEnableMaxHeight style={[styles.flex1, styles.justifyContentBetween, styles.mh2]} + forwardedFSClass={CONST.FULLSTORY.CLASS.MASK} > ); + break; case CONST.NON_USD_BANK_ACCOUNT.STEP.BANK_INFO: - return ( + CurrentStep = ( ); + break; case CONST.NON_USD_BANK_ACCOUNT.STEP.BUSINESS_INFO: - return ( + CurrentStep = ( ); + break; case CONST.NON_USD_BANK_ACCOUNT.STEP.BENEFICIAL_OWNER_INFO: - return ( + CurrentStep = ( ); + break; case CONST.NON_USD_BANK_ACCOUNT.STEP.SIGNER_INFO: - return ( + CurrentStep = ( ); + break; case CONST.NON_USD_BANK_ACCOUNT.STEP.AGREEMENTS: - return ( + CurrentStep = ( ); + break; case CONST.NON_USD_BANK_ACCOUNT.STEP.DOCUSIGN: - return ( + CurrentStep = ( ); + break; case CONST.NON_USD_BANK_ACCOUNT.STEP.FINISH: - return ; + CurrentStep = ; + break; default: - return null; + CurrentStep = null; + break; } + + if (CurrentStep) { + return ( + + {CurrentStep} + + ); + } + + return null; } NonUSDVerifiedBankAccountFlow.displayName = 'NonUSDVerifiedBankAccountFlow'; diff --git a/src/pages/ReimbursementAccount/USD/USDVerifiedBankAccountFlow.tsx b/src/pages/ReimbursementAccount/USD/USDVerifiedBankAccountFlow.tsx index 5508c4e01b91..f3ca3b9c65d9 100644 --- a/src/pages/ReimbursementAccount/USD/USDVerifiedBankAccountFlow.tsx +++ b/src/pages/ReimbursementAccount/USD/USDVerifiedBankAccountFlow.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import type {View} from 'react-native'; +import {View} from 'react-native'; import useOnyx from '@hooks/useOnyx'; +import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import BankInfo from './BankInfo/BankInfo'; @@ -30,11 +31,13 @@ function USDVerifiedBankAccountFlow({ setUSDBankAccountStep, setShouldShowConnectedVerifiedBankAccount, }: USDVerifiedBankAccountFlowProps) { + const styles = useThemeStyles(); const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {canBeMissing: false}); + let CurrentStep: React.JSX.Element | null; switch (USDBankAccountStep) { case CONST.BANK_ACCOUNT.STEP.COUNTRY: - return ( + CurrentStep = ( ); + break; case CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT: - return ( + CurrentStep = ( ); + break; case CONST.BANK_ACCOUNT.STEP.REQUESTOR: - return ( + CurrentStep = ( ); + break; case CONST.BANK_ACCOUNT.STEP.COMPANY: - return ; + CurrentStep = ; + break; case CONST.BANK_ACCOUNT.STEP.BENEFICIAL_OWNERS: - return ; + CurrentStep = ; + break; case CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT: - return ; + CurrentStep = ; + break; case CONST.BANK_ACCOUNT.STEP.VALIDATION: - return ( + CurrentStep = ( ); + break; default: - return null; + CurrentStep = null; + break; } + + if (CurrentStep) { + return ( + + {CurrentStep} + + ); + } + + return null; } USDVerifiedBankAccountFlow.displayName = 'USDVerifiedBankAccountFlow'; diff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx index e346924e9a05..597737e16e34 100644 --- a/src/pages/home/HeaderView.tsx +++ b/src/pages/home/HeaderView.tsx @@ -31,6 +31,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useSubscriptionPlan from '@hooks/useSubscriptionPlan'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import FS from '@libs/Fullstory'; import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID'; import Navigation from '@libs/Navigation/Navigation'; import {getPersonalDetailsForAccountIDs} from '@libs/OptionsListUtils'; @@ -143,6 +144,7 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked, const isPersonalExpenseChat = isPolicyExpenseChat && isCurrentUserSubmitter(report); const hasTeam2025Pricing = useHasTeam2025Pricing(); const subscriptionPlan = useSubscriptionPlan(); + const displayNamesFSClass = FS.getChatFSClass(personalDetails, report); const shouldShowSubtitle = () => { if (!subtitle) { @@ -293,6 +295,7 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked, shouldUseFullTitle={isChatRoom || isPolicyExpenseChat || isChatThread || isTaskReport || shouldUseGroupTitle || isReportArchived} renderAdditionalText={renderAdditionalText} shouldAddEllipsis={shouldAddEllipsis} + forwardedFSClass={displayNamesFSClass} /> {!isEmptyObject(parentNavigationSubtitleData) && ( diff --git a/src/pages/settings/Security/CloseAccountPage.tsx b/src/pages/settings/Security/CloseAccountPage.tsx index 4b2f8da8d99c..871aae59550c 100644 --- a/src/pages/settings/Security/CloseAccountPage.tsx +++ b/src/pages/settings/Security/CloseAccountPage.tsx @@ -123,7 +123,7 @@ function CloseAccountPage() { aria-label={translate('closeAccountPage.enterMessageHere')} role={CONST.ROLE.PRESENTATION} containerStyles={[styles.mt5]} - fsClass={CONST.FULLSTORY.CLASS.UNMASK} + forwardedFSClass={CONST.FULLSTORY.CLASS.UNMASK} /> {translate('closeAccountPage.enterDefaultContactToConfirm')} {userEmailOrPhone} @@ -138,8 +138,7 @@ function CloseAccountPage() { containerStyles={[styles.mt5]} autoCorrect={false} inputMode={userEmailOrPhone && Str.isValidEmail(userEmailOrPhone) ? CONST.INPUT_MODE.EMAIL : CONST.INPUT_MODE.TEXT} - fsClass={CONST.FULLSTORY.CLASS.UNMASK} - testID={CONST.FULLSTORY.CLASS.UNMASK} + forwardedFSClass={CONST.FULLSTORY.CLASS.UNMASK} /> + {pan?.length > 0 && ( )} - + ); } diff --git a/src/pages/workspace/companyCards/addNew/AddNewCardPage.tsx b/src/pages/workspace/companyCards/addNew/AddNewCardPage.tsx index 4781bcb9d674..577f2c1a89c7 100644 --- a/src/pages/workspace/companyCards/addNew/AddNewCardPage.tsx +++ b/src/pages/workspace/companyCards/addNew/AddNewCardPage.tsx @@ -1,9 +1,11 @@ import React, {useEffect} from 'react'; +import {View} from 'react-native'; import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import ScreenWrapper from '@components/ScreenWrapper'; import useOnyx from '@hooks/useOnyx'; import usePermissions from '@hooks/usePermissions'; +import useThemeStyles from '@hooks/useThemeStyles'; import useWorkspaceAccountID from '@hooks/useWorkspaceAccountID'; import BankConnection from '@pages/workspace/companyCards/BankConnection'; import withPolicyAndFullscreenLoading from '@pages/workspace/withPolicyAndFullscreenLoading'; @@ -25,6 +27,7 @@ import StatementCloseDateStep from './StatementCloseDateStep'; function AddNewCardPage({policy}: WithPolicyAndFullscreenLoadingProps) { const policyID = policy?.id; + const styles = useThemeStyles(); const workspaceAccountID = useWorkspaceAccountID(policyID); const [addNewCardFeed, addNewCardFeedMetadata] = useOnyx(ONYXKEYS.ADD_NEW_COMPANY_CARD, {canBeMissing: false}); const {currentStep} = addNewCardFeed ?? {}; @@ -65,30 +68,52 @@ function AddNewCardPage({policy}: WithPolicyAndFullscreenLoadingProps) { ); } + + let CurrentStep: React.JSX.Element; switch (currentStep) { case CONST.COMPANY_CARDS.STEP.SELECT_BANK: - return ; + CurrentStep = ; + break; case CONST.COMPANY_CARDS.STEP.SELECT_FEED_TYPE: - return ; + CurrentStep = ; + break; case CONST.COMPANY_CARDS.STEP.CARD_TYPE: - return ; + CurrentStep = ; + break; case CONST.COMPANY_CARDS.STEP.BANK_CONNECTION: - return ; + CurrentStep = ; + break; case CONST.COMPANY_CARDS.STEP.CARD_INSTRUCTIONS: - return ; + CurrentStep = ; + break; case CONST.COMPANY_CARDS.STEP.CARD_NAME: - return ; + CurrentStep = ; + break; case CONST.COMPANY_CARDS.STEP.CARD_DETAILS: - return ; + CurrentStep = ; + break; case CONST.COMPANY_CARDS.STEP.AMEX_CUSTOM_FEED: - return ; + CurrentStep = ; + break; case CONST.COMPANY_CARDS.STEP.PLAID_CONNECTION: - return ; + CurrentStep = ; + break; case CONST.COMPANY_CARDS.STEP.SELECT_STATEMENT_CLOSE_DATE: - return ; + CurrentStep = ; + break; default: - return isBetaEnabled(CONST.BETAS.PLAID_COMPANY_CARDS) ? : ; + CurrentStep = isBetaEnabled(CONST.BETAS.PLAID_COMPANY_CARDS) ? : ; + break; } + + return ( + + {CurrentStep} + + ); } AddNewCardPage.displayName = 'AddNewCardPage';