Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/components/FeatureTrainingModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {VideoReadyForDisplayEvent} from 'expo-av';
import type {ImageContentFit} from 'expo-image';
import React, {useCallback, useEffect, useState} from 'react';
import React, {useCallback, useEffect, useLayoutEffect, useState} from 'react';
import {InteractionManager, View} from 'react-native';
import type {StyleProp, ViewStyle} from 'react-native';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
Expand All @@ -10,6 +10,7 @@ import useNetwork from '@hooks/useNetwork';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import {parseFSAttributes} from '@libs/Fullstory';
import Navigation from '@libs/Navigation/Navigation';
import variables from '@styles/variables';
import {dismissTrackTrainingModal} from '@userActions/User';
Expand Down Expand Up @@ -264,6 +265,14 @@ function FeatureTrainingModal({
onConfirm?.();
}, [onConfirm, closeModal]);

/**
* Extracts values from the non-scraped attribute WEB_PROP_ATTR at build time
* to ensure necessary properties are available for further processing.
* Reevaluates "fs-class" to dynamically apply styles or behavior based on
* updated attribute values.
*/
useLayoutEffect(parseFSAttributes, []);

return (
<SafeAreaConsumer>
{({safeAreaPaddingBottomStyle}) => (
Expand All @@ -286,7 +295,11 @@ function FeatureTrainingModal({
...modalInnerContainerStyle,
}}
>
<View style={[styles.mh100, onboardingIsMediumOrLargerScreenWidth && StyleUtils.getWidthStyle(width), safeAreaPaddingBottomStyle]}>
<View
style={[styles.mh100, onboardingIsMediumOrLargerScreenWidth && StyleUtils.getWidthStyle(width), safeAreaPaddingBottomStyle]}
fsClass={CONST.FULL_STORY.UNMASK}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we also need to set the testID, see here, and this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes thanks, will update

testID={CONST.FULL_STORY.UNMASK}
>
<View style={[onboardingIsMediumOrLargerScreenWidth ? {padding: MODAL_PADDING} : {paddingHorizontal: MODAL_PADDING}, illustrationOuterContainerStyle]}>
{renderIllustration()}
</View>
Expand Down
17 changes: 15 additions & 2 deletions src/components/MigratedUserWelcomeModal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import React, {useLayoutEffect} from 'react';
import {View} from 'react-native';
import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import {dismissProductTraining} from '@libs/actions/Welcome';
import convertToLTR from '@libs/convertToLTR';
import {parseFSAttributes} from '@libs/Fullstory';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import type {FeatureListItem} from './FeatureList';
Expand Down Expand Up @@ -36,6 +37,14 @@ function OnboardingWelcomeVideo() {
const StyleUtils = useStyleUtils();
const {shouldUseNarrowLayout} = useResponsiveLayout();

/**
* Extracts values from the non-scraped attribute WEB_PROP_ATTR at build time
* to ensure necessary properties are available for further processing.
* Reevaluates "fs-class" to dynamically apply styles or behavior based on
* updated attribute values.
*/
useLayoutEffect(parseFSAttributes, []);

return (
<FeatureTrainingModal
// We would like to show the Lottie animation instead of a video
Expand All @@ -54,7 +63,11 @@ function OnboardingWelcomeVideo() {
contentOuterContainerStyles={!shouldUseNarrowLayout && [styles.mt8, styles.mh8]}
modalInnerContainerStyle={{...styles.pt0, ...(shouldUseNarrowLayout ? {} : styles.pb8)}}
>
<View style={[styles.gap3, styles.pt1, styles.pl1]}>
<View
style={[styles.gap3, styles.pt1, styles.pl1]}
fsClass={CONST.FULL_STORY.UNMASK}
testID={CONST.FULL_STORY.UNMASK}
>
{ExpensifyFeatures.map(({translationKey, icon}) => (
<View
key={translationKey}
Expand Down
16 changes: 14 additions & 2 deletions src/components/ProductTrainingContext/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {createContext, useCallback, useContext, useEffect, useMemo, useState} from 'react';
import React, {createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useState} from 'react';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import Button from '@components/Button';
Expand All @@ -9,6 +9,7 @@ import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {parseFSAttributes} from '@libs/Fullstory';
import {hasCompletedGuidedSetupFlowSelector} from '@libs/onboardingSelectors';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -174,10 +175,21 @@ const useProductTrainingContext = (tooltipName: ProductTrainingTooltipName, shou
};
}, [tooltipName, registerTooltip, unregisterTooltip, shouldShow]);

/**
* Extracts values from the non-scraped attribute WEB_PROP_ATTR at build time
* to ensure necessary properties are available for further processing.
* Reevaluates "fs-class" to dynamically apply styles or behavior based on
* updated attribute values.
*/
useLayoutEffect(parseFSAttributes, []);

const renderProductTrainingTooltip = useCallback(() => {
const tooltip = TOOLTIPS[tooltipName];
return (
<View>
<View
fsClass={CONST.FULL_STORY.UNMASK}
testID={CONST.FULL_STORY.UNMASK}
>
<View style={[styles.alignItemsCenter, styles.flexRow, styles.justifyContentCenter, styles.flexWrap, styles.textAlignCenter, styles.gap3, styles.p2]}>
<Icon
src={Expensicons.Lightbulb}
Expand Down
22 changes: 20 additions & 2 deletions src/components/Tooltip/BaseGenericTooltip/index.native.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Portal} from '@gorhom/portal';
import React, {useMemo, useRef, useState} from 'react';
import React, {useLayoutEffect, useMemo, useRef, useState} from 'react';
import {View} from 'react-native';
// eslint-disable-next-line no-restricted-imports
import type {View as RNView} from 'react-native';
Expand All @@ -8,6 +8,7 @@ import AnimatedPressableWithoutFeedback from '@components/AnimatedPressableWitho
import TransparentOverlay from '@components/AutoCompleteSuggestions/AutoCompleteSuggestionsPortal/TransparentOverlay/TransparentOverlay';
import Text from '@components/Text';
import useStyleUtils from '@hooks/useStyleUtils';
import {parseFSAttributes} from '@libs/Fullstory';
import CONST from '@src/CONST';
import type {BaseGenericTooltipProps} from './types';

Expand Down Expand Up @@ -101,14 +102,31 @@ function BaseGenericTooltip({
});
});

/**
* Extracts values from the non-scraped attribute WEB_PROP_ATTR at build time
* to ensure necessary properties are available for further processing.
* Reevaluates "fs-class" to dynamically apply styles or behavior based on
* updated attribute values.
*/
useLayoutEffect(parseFSAttributes, []);

let content;
if (renderTooltipContent) {
content = <View>{renderTooltipContent()}</View>;
content = (
<View
fsClass={CONST.FULL_STORY.UNMASK}
testID={CONST.FULL_STORY.UNMASK}
>
{renderTooltipContent()}
</View>
);
} else {
content = (
<Text
numberOfLines={numberOfLines}
style={textStyle}
fsClass={CONST.FULL_STORY.UNMASK}
testID={CONST.FULL_STORY.UNMASK}
>
<Text style={textStyle}>{text}</Text>
</Text>
Expand Down
21 changes: 20 additions & 1 deletion src/components/Tooltip/BaseGenericTooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import TransparentOverlay from '@components/AutoCompleteSuggestions/AutoComplete
import {PopoverContext} from '@components/PopoverProvider';
import Text from '@components/Text';
import useStyleUtils from '@hooks/useStyleUtils';
import {parseFSAttributes} from '@libs/Fullstory';
import CONST from '@src/CONST';
import textRef from '@src/types/utils/textRef';
import viewRef from '@src/types/utils/viewRef';
Expand Down Expand Up @@ -120,14 +121,32 @@ function BaseGenericTooltip({
return StyleUtils.getTooltipAnimatedStyles({tooltipContentWidth: contentMeasuredWidth, tooltipWrapperHeight: wrapperMeasuredHeight, currentSize: animation});
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjcoffee do you have any idea if we have FS sessions for Native devices as well, if so then i need to update index.native.tsx as well, let me know

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this, maybe @puneetlath knows?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we do.

/**
* Extracts values from the non-scraped attribute WEB_PROP_ATTR at build time
* to ensure necessary properties are available for further processing.
* Reevaluates "fs-class" to dynamically apply styles or behavior based on
* updated attribute values.
*/
useLayoutEffect(parseFSAttributes, []);

let content;
if (renderTooltipContent) {
content = <View ref={viewRef(contentRef)}>{renderTooltipContent()}</View>;
content = (
<View
ref={viewRef(contentRef)}
fsClass={CONST.FULL_STORY.UNMASK}
testID={CONST.FULL_STORY.UNMASK}
>
{renderTooltipContent()}
</View>
);
} else {
content = (
<Text
numberOfLines={numberOfLines}
style={textStyle}
fsClass={CONST.FULL_STORY.UNMASK}
testID={CONST.FULL_STORY.UNMASK}
>
<Text
style={textStyle}
Expand Down
7 changes: 7 additions & 0 deletions tests/navigation/ResizeScreenTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ jest.mock('@libs/getIsNarrowLayout', () => jest.fn());

jest.mock('@pages/settings/InitialSettingsPage');
jest.mock('@pages/settings/Profile/ProfilePage');
// Mock Fullstory library dependency
jest.mock('@libs/Fullstory', () => ({
default: {
consentAndIdentify: jest.fn(),
},
parseFSAttributes: jest.fn(),
}));

const INITIAL_STATE = {
index: 0,
Expand Down
8 changes: 8 additions & 0 deletions tests/ui/components/ProductTrainingContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ jest.mock('@hooks/useResponsiveLayout', () => ({
default: jest.fn(),
}));

// Mock Fullstory library dependency
jest.mock('@libs/Fullstory', () => ({
default: {
consentAndIdentify: jest.fn(),
},
parseFSAttributes: jest.fn(),
}));

const DEFAULT_USE_RESPONSIVE_LAYOUT_VALUE = {
shouldUseNarrowLayout: true,
isSmallScreenWidth: true,
Expand Down