Skip to content

Commit

Permalink
Merge pull request #54260 from Expensify/revert-54064-and-53396
Browse files Browse the repository at this point in the history
Revert 54064 and 53396

(cherry picked from commit fdd9136)

(CP triggered by luacmartins)
  • Loading branch information
luacmartins authored and OSBotify committed Dec 17, 2024
1 parent 61a90f4 commit 81a99af
Show file tree
Hide file tree
Showing 20 changed files with 287 additions and 93 deletions.
2 changes: 0 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import KeyboardProvider from './components/KeyboardProvider';
import {LocaleContextProvider} from './components/LocaleContextProvider';
import OnyxProvider from './components/OnyxProvider';
import PopoverContextProvider from './components/PopoverProvider';
import {ProductTrainingContextProvider} from './components/ProductTrainingContext';
import SafeArea from './components/SafeArea';
import ScrollOffsetContextProvider from './components/ScrollOffsetContextProvider';
import {SearchRouterContextProvider} from './components/Search/SearchRouter/SearchRouterContext';
Expand Down Expand Up @@ -96,7 +95,6 @@ function App({url}: AppProps) {
VideoPopoverMenuContextProvider,
KeyboardProvider,
SearchRouterContextProvider,
ProductTrainingContextProvider,
]}
>
<CustomStatusBarAndBackground />
Expand Down
3 changes: 3 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6408,13 +6408,16 @@ const CONST = {
},

MIGRATED_USER_WELCOME_MODAL: 'migratedUserWelcomeModal',
<<<<<<< HEAD

PRODUCT_TRAINING_TOOLTIP_NAMES: {
CONCEIRGE_LHN_GBR: 'conciergeLHNGBR',
RENAME_SAVED_SEARCH: 'renameSavedSearch',
QUICK_ACTION_BUTTON: 'quickActionButton',
WORKSAPCE_CHAT_CREATE: 'workspaceChatCreate',
},
=======
>>>>>>> fdd9136 (Merge pull request #54260 from Expensify/revert-54064-and-53396)
} as const;

type Country = keyof typeof CONST.ALL_COUNTRIES;
Expand Down
16 changes: 16 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ const ONYXKEYS = {

/** NVP keys */

/** Boolean flag only true when first set */
NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER: 'nvp_isFirstTimeNewExpensifyUser',

/** This NVP contains list of at most 5 recent attendees */
NVP_RECENT_ATTENDEES: 'nvp_expensify_recentAttendees',

Expand Down Expand Up @@ -213,9 +216,18 @@ const ONYXKEYS = {
/** The end date (epoch timestamp) of the workspace owner’s grace period after the free trial ends. */
NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END: 'nvp_private_billingGracePeriodEnd',

/** The NVP containing all information related to educational tooltip in workspace chat */
NVP_WORKSPACE_TOOLTIP: 'workspaceTooltip',

/** The NVP containing the target url to navigate to when deleting a transaction */
NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL: 'nvp_deleteTransactionNavigateBackURL',

/** Whether to show save search rename tooltip */
SHOULD_SHOW_SAVED_SEARCH_RENAME_TOOLTIP: 'shouldShowSavedSearchRenameTooltip',

/** Whether to hide gbr tooltip */
NVP_SHOULD_HIDE_GBR_TOOLTIP: 'nvp_should_hide_gbr_tooltip',

/** Does this user have push notifications enabled for this device? */
PUSH_NOTIFICATIONS_ENABLED: 'pushNotificationsEnabled',

Expand Down Expand Up @@ -864,6 +876,7 @@ type OnyxCollectionValuesMapping = {
type OnyxValuesMapping = {
[ONYXKEYS.ACCOUNT]: OnyxTypes.Account;
[ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID]: string;
[ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER]: boolean;

// NVP_ONBOARDING is an array for old users.
[ONYXKEYS.NVP_ONBOARDING]: Onboarding | [];
Expand Down Expand Up @@ -1004,14 +1017,17 @@ type OnyxValuesMapping = {
[ONYXKEYS.NVP_BILLING_FUND_ID]: number;
[ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED]: number;
[ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END]: number;
[ONYXKEYS.NVP_WORKSPACE_TOOLTIP]: OnyxTypes.WorkspaceTooltip;
[ONYXKEYS.NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL]: string | undefined;
[ONYXKEYS.NVP_SHOULD_HIDE_GBR_TOOLTIP]: boolean;
[ONYXKEYS.NVP_PRIVATE_CANCELLATION_DETAILS]: OnyxTypes.CancellationDetails[];
[ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE]: string;
[ONYXKEYS.APPROVAL_WORKFLOW]: OnyxTypes.ApprovalWorkflowOnyx;
[ONYXKEYS.IMPORTED_SPREADSHEET]: OnyxTypes.ImportedSpreadsheet;
[ONYXKEYS.LAST_ROUTE]: string;
[ONYXKEYS.IS_SINGLE_NEW_DOT_ENTRY]: boolean | undefined;
[ONYXKEYS.IS_USING_IMPORTED_STATE]: boolean;
[ONYXKEYS.SHOULD_SHOW_SAVED_SEARCH_RENAME_TOOLTIP]: boolean;
[ONYXKEYS.NVP_EXPENSIFY_COMPANY_CARDS_CUSTOM_NAMES]: Record<string, string>;
[ONYXKEYS.CONCIERGE_REPORT_ID]: string;
[ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING]: OnyxTypes.DismissedProductTraining;
Expand Down
50 changes: 49 additions & 1 deletion src/components/LHNOptionsList/OptionRowLHN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import MultipleAvatars from '@components/MultipleAvatars';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import {useSession} from '@components/OnyxProvider';
import PressableWithSecondaryInteraction from '@components/PressableWithSecondaryInteraction';
import {useProductTrainingContext} from '@components/ProductTrainingContext';
import SubscriptAvatar from '@components/SubscriptAvatar';
import Text from '@components/Text';
import Tooltip from '@components/Tooltip';
Expand All @@ -23,6 +22,7 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import DateUtils from '@libs/DateUtils';
import DomUtils from '@libs/DomUtils';
import {hasCompletedGuidedSetupFlowSelector} from '@libs/onboardingSelectors';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import Parser from '@libs/Parser';
import Performance from '@libs/Performance';
Expand All @@ -32,6 +32,7 @@ import * as ReportActionContextMenu from '@pages/home/report/ContextMenu/ReportA
import FreeTrial from '@pages/settings/Subscription/FreeTrial';
import variables from '@styles/variables';
import Timing from '@userActions/Timing';
import * as User from '@userActions/User';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
Expand All @@ -47,19 +48,31 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti

// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${optionItem?.reportID || -1}`);
<<<<<<< HEAD

=======
const [isFirstTimeNewExpensifyUser] = useOnyx(ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER);
const [isOnboardingCompleted = true] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {
selector: hasCompletedGuidedSetupFlowSelector,
});
>>>>>>> fdd9136 (Merge pull request #54260 from Expensify/revert-54064-and-53396)
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const session = useSession();

// Guides are assigned for the MANAGE_TEAM onboarding action, except for emails that have a '+'.
const isOnboardingGuideAssigned = introSelected?.choice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM && !session?.email?.includes('+');
const shouldShowToooltipOnThisReport = isOnboardingGuideAssigned ? ReportUtils.isAdminRoom(report) : ReportUtils.isConciergeChatReport(report);
<<<<<<< HEAD

const shouldShowGetStartedTooltip = shouldShowToooltipOnThisReport && isScreenFocused;
const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip, hideProductTrainingTooltip} = useProductTrainingContext(
CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCEIRGE_LHN_GBR,
shouldShowGetStartedTooltip,
);
=======
const [shouldHideGBRTooltip] = useOnyx(ONYXKEYS.NVP_SHOULD_HIDE_GBR_TOOLTIP, {initialValue: true});

>>>>>>> fdd9136 (Merge pull request #54260 from Expensify/revert-54064-and-53396)
const {translate} = useLocalize();
const [isContextMenuActive, setIsContextMenuActive] = useState(false);

Expand All @@ -72,6 +85,30 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti
}, []),
);

const renderGBRTooltip = useCallback(
() => (
<View style={[styles.alignItemsCenter, styles.flexRow, styles.justifyContentCenter, styles.flexWrap, styles.textAlignCenter, styles.gap1]}>
<Icon
src={Expensicons.Lightbulb}
fill={theme.tooltipHighlightText}
medium
/>
<Text style={styles.quickActionTooltipSubtitle}>{translate('sidebarScreen.tooltip')}</Text>
</View>
),
[
styles.alignItemsCenter,
styles.flexRow,
styles.justifyContentCenter,
styles.flexWrap,
styles.textAlignCenter,
styles.gap1,
styles.quickActionTooltipSubtitle,
theme.tooltipHighlightText,
translate,
],
);

const isInFocusMode = viewMode === CONST.OPTION_MODE.COMPACT;
const sidebarInnerRowStyle = StyleSheet.flatten<ViewStyle>(
isInFocusMode
Expand Down Expand Up @@ -156,17 +193,28 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti
needsOffscreenAlphaCompositing
>
<EducationalTooltip
<<<<<<< HEAD
shouldRender={shouldShowProductTrainingTooltip}
renderTooltipContent={renderProductTrainingTooltip}
=======
shouldRender={isFirstTimeNewExpensifyUser && !shouldHideGBRTooltip && isOnboardingCompleted && isScreenFocused && shouldUseNarrowLayout && shouldShowToooltipOnThisReport}
renderTooltipContent={renderGBRTooltip}
>>>>>>> fdd9136 (Merge pull request #54260 from Expensify/revert-54064-and-53396)
anchorAlignment={{
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
}}
shouldUseOverlay
shiftHorizontal={variables.gbrTooltipShiftHorizontal}
<<<<<<< HEAD
onHideTooltip={hideProductTrainingTooltip}
shiftVertical={variables.composerTooltipShiftVertical}
wrapperStyle={styles.quickActionTooltipWrapper}
=======
shiftVertical={variables.composerTooltipShiftVertical}
wrapperStyle={styles.quickActionTooltipWrapper}
onHideTooltip={User.dismissGBRTooltip}
>>>>>>> fdd9136 (Merge pull request #54260 from Expensify/revert-54064-and-53396)
>
<View>
<Hoverable>
Expand Down
6 changes: 6 additions & 0 deletions src/hooks/useOnboardingFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,14 @@ function useOnboardingFlowRouter() {
dismissedProductTrainingMetadata,
dismissedProductTraining?.migratedUserWelcomeModal,
dismissedProductTraining,
<<<<<<< HEAD
allBetasMetadata,
allBetas,
=======
isPrivateDomain,
allBetas,
allBetasMetadata,
>>>>>>> fdd9136 (Merge pull request #54260 from Expensify/revert-54064-and-53396)
]);

return {isOnboardingCompleted, isHybridAppOnboardingCompleted};
Expand Down
12 changes: 12 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,10 @@ const translations = {
emoji: 'Emoji',
collapse: 'Collapse',
expand: 'Expand',
tooltip: {
title: 'Get started!',
subtitle: ' Submit your first expense',
},
},
reportActionContextMenu: {
copyToClipboard: 'Copy to clipboard',
Expand Down Expand Up @@ -833,6 +837,10 @@ const translations = {
trackDistance: 'Track distance',
noLongerHaveReportAccess: 'You no longer have access to your previous quick action destination. Pick a new one below.',
updateDestination: 'Update destination',
tooltip: {
title: 'Quick action! ',
subtitle: 'Just a tap away.',
},
},
iou: {
amount: 'Amount',
Expand Down Expand Up @@ -4546,6 +4554,7 @@ const translations = {
},
},
saveSearch: 'Save search',
saveSearchTooltipText: 'You can rename your saved search',
deleteSavedSearch: 'Delete saved search',
deleteSavedSearchConfirm: 'Are you sure you want to delete this search?',
searchName: 'Search name',
Expand Down Expand Up @@ -5447,6 +5456,7 @@ const translations = {
crossPlatform: 'Do <strong>everything</strong> from your phone or browser',
},
},
<<<<<<< HEAD
productTrainingTooltip: {
conciergeLHNGBR: {
part1: 'Get started',
Expand All @@ -5466,6 +5476,8 @@ const translations = {
part3: ' here!',
},
},
=======
>>>>>>> fdd9136 (Merge pull request #54260 from Expensify/revert-54064-and-53396)
};

export default translations satisfies TranslationDeepObject<typeof translations>;
12 changes: 12 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,10 @@ const translations = {
emoji: 'Emoji',
collapse: 'Colapsar',
expand: 'Expandir',
tooltip: {
title: '¡Empecemos!',
subtitle: ' Presenta tu primer gasto',
},
},
reportActionContextMenu: {
copyToClipboard: 'Copiar al portapapeles',
Expand Down Expand Up @@ -828,6 +832,10 @@ const translations = {
trackDistance: 'Crear gasto por desplazamiento',
noLongerHaveReportAccess: 'Ya no tienes acceso al destino previo de esta acción rápida. Escoge uno nuevo a continuación.',
updateDestination: 'Actualiza el destino',
tooltip: {
title: '¡Acción rápida! ',
subtitle: 'A un click.',
},
},
iou: {
amount: 'Importe',
Expand Down Expand Up @@ -4595,6 +4603,7 @@ const translations = {
},
},
saveSearch: 'Guardar búsqueda',
saveSearchTooltipText: 'Puedes cambiar el nombre de tu búsqueda guardada',
savedSearchesMenuItemTitle: 'Guardadas',
searchName: 'Nombre de la búsqueda',
deleteSavedSearch: 'Eliminar búsqueda guardada',
Expand Down Expand Up @@ -5967,6 +5976,7 @@ const translations = {
crossPlatform: 'Haz <strong>todo</strong> desde tu teléfono o navegador',
},
},
<<<<<<< HEAD
productTrainingTooltip: {
conciergeLHNGBR: {
part1: '¡Comienza',
Expand All @@ -5986,6 +5996,8 @@ const translations = {
part3: ' aquí',
},
},
=======
>>>>>>> fdd9136 (Merge pull request #54260 from Expensify/revert-54064-and-53396)
};

export default translations satisfies TranslationDeepObject<typeof en>;
10 changes: 10 additions & 0 deletions src/libs/actions/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,14 @@ function clearAdvancedFilters() {
Onyx.merge(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, values);
}

function showSavedSearchRenameTooltip() {
Onyx.set(ONYXKEYS.SHOULD_SHOW_SAVED_SEARCH_RENAME_TOOLTIP, true);
}

function dismissSavedSearchRenameTooltip() {
Onyx.set(ONYXKEYS.SHOULD_SHOW_SAVED_SEARCH_RENAME_TOOLTIP, false);
}

export {
saveSearch,
search,
Expand All @@ -392,6 +400,8 @@ export {
clearAllFilters,
clearAdvancedFilters,
deleteSavedSearch,
dismissSavedSearchRenameTooltip,
showSavedSearchRenameTooltip,
payMoneyRequestOnSearch,
approveMoneyRequestOnSearch,
handleActionButtonPress,
Expand Down
10 changes: 10 additions & 0 deletions src/libs/actions/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,14 @@ function dismissTrackTrainingModal() {
});
}

function dismissWorkspaceTooltip() {
Onyx.merge(ONYXKEYS.NVP_WORKSPACE_TOOLTIP, {shouldShow: false});
}

function dismissGBRTooltip() {
Onyx.merge(ONYXKEYS.NVP_SHOULD_HIDE_GBR_TOOLTIP, true);
}

function requestRefund() {
API.write(WRITE_COMMANDS.REQUEST_REFUND, null);
}
Expand All @@ -1382,6 +1390,7 @@ export {
closeAccount,
dismissReferralBanner,
dismissTrackTrainingModal,
dismissWorkspaceTooltip,
resendValidateCode,
requestContactMethodValidateCode,
updateNewsletterSubscription,
Expand Down Expand Up @@ -1415,5 +1424,6 @@ export {
addPendingContactMethod,
clearValidateCodeActionError,
subscribeToActiveGuides,
dismissGBRTooltip,
setIsDebugModeEnabled,
};
24 changes: 14 additions & 10 deletions src/libs/actions/Welcome/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,20 @@ function setSelfTourViewed(shouldUpdateOnyxDataOnlyLocally = false) {

function dismissProductTraining(elementName: string) {
const date = new Date();
const optimisticData = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING,
value: {
[elementName]: DateUtils.getDBTime(date.valueOf()),
},
},
];
API.write(WRITE_COMMANDS.DISMISS_PRODUCT_TRAINING, {name: elementName}, {optimisticData});
// const optimisticData = [
// {
// onyxMethod: Onyx.METHOD.MERGE,
// key: ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING,
// value: {
// [elementName]: DateUtils.getDBTime(date.valueOf()),
// },
// },
// ];
// API.write(WRITE_COMMANDS.DISMISS_PRODUCT_TRAINING, {name: elementName}, {optimisticData});

Onyx.merge(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, {
[elementName]: DateUtils.getDBTime(date.valueOf()),
});
}

export {
Expand Down
Loading

0 comments on commit 81a99af

Please sign in to comment.