Skip to content

Commit

Permalink
Merge pull request #42387 from software-mansion-labs/ts/expensify-com…
Browse files Browse the repository at this point in the history
…mon-bump

[TS migration] Update `expensify-common` usage in NewDot
  • Loading branch information
yuwenmemon authored Jun 5, 2024
2 parents a68d104 + 4200f12 commit 088939b
Show file tree
Hide file tree
Showing 107 changed files with 118 additions and 127 deletions.
13 changes: 7 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"date-fns-tz": "^2.0.0",
"dom-serializer": "^0.2.2",
"domhandler": "^4.3.0",
"expensify-common": "git+ssh://[email protected]/Expensify/expensify-common.git#1713f28214f0e7176c4fd13433fb0ea15491ebf9",
"expensify-common": "^2.0.10",
"expo": "^50.0.3",
"expo-av": "~13.10.4",
"expo-image": "1.11.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {useEffect, useRef} from 'react';
// eslint-disable-next-line no-restricted-imports
import type {Text as RNText} from 'react-native';
Expand Down
2 changes: 1 addition & 1 deletion src/components/AttachmentModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {memo, useCallback, useEffect, useMemo, useState} from 'react';
import {Animated, Keyboard, View} from 'react-native';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
Expand Down
2 changes: 1 addition & 1 deletion src/components/AttachmentPicker/index.native.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {useCallback, useMemo, useRef, useState} from 'react';
import {Alert, View} from 'react-native';
import RNFetchBlob from 'react-native-blob-util';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Attachments/AttachmentView/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {memo, useEffect, useState} from 'react';
import type {GestureResponderEvent, StyleProp, ViewStyle} from 'react-native';
import {View} from 'react-native';
Expand Down
6 changes: 3 additions & 3 deletions src/components/AutoEmailLink.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CONST} from 'expensify-common/lib/CONST';
import {CONST as COMMON_CONST} from 'expensify-common';
import React from 'react';
import type {StyleProp, TextStyle} from 'react-native';
import useThemeStyles from '@hooks/useThemeStyles';
Expand All @@ -20,8 +20,8 @@ function AutoEmailLink({text, style}: AutoEmailLinkProps) {
const styles = useThemeStyles();
return (
<Text style={style}>
{text.split(CONST.REG_EXP.EXTRACT_EMAIL).map((str, index) => {
if (CONST.REG_EXP.EMAIL.test(str)) {
{text.split(COMMON_CONST.REG_EXP.EXTRACT_EMAIL).map((str, index) => {
if (COMMON_CONST.REG_EXP.EMAIL.test(str)) {
return (
<TextLink
// eslint-disable-next-line react/no-array-index-key
Expand Down
2 changes: 1 addition & 1 deletion src/components/CurrencySelectionList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {useMemo, useState} from 'react';
import {withOnyx} from 'react-native-onyx';
import SelectionList from '@components/SelectionList';
Expand Down
2 changes: 1 addition & 1 deletion src/components/DatePicker/CalendarPicker/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {addMonths, endOfDay, endOfMonth, format, getYear, isSameDay, parseISO, setDate, setYear, startOfDay, startOfMonth, subMonths} from 'date-fns';
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {useState} from 'react';
import {View} from 'react-native';
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
Expand Down
2 changes: 1 addition & 1 deletion src/components/DeeplinkWrapper/index.website.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import {useEffect, useRef, useState} from 'react';
import * as Browser from '@libs/Browser';
import Navigation from '@libs/Navigation/Navigation';
Expand Down
2 changes: 1 addition & 1 deletion src/components/DragAndDrop/Provider/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {PortalHost} from '@gorhom/portal';
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {useCallback, useEffect, useMemo, useRef} from 'react';
import {View} from 'react-native';
import useDragAndDrop from '@hooks/useDragAndDrop';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React from 'react';
import {TNodeChildrenRenderer} from 'react-native-render-html';
import type {CustomRendererProps, TBlock} from 'react-native-render-html';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import cloneDeep from 'lodash/cloneDeep';
import isEmpty from 'lodash/isEmpty';
import React from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/components/LHNOptionsList/OptionRowLHN.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useFocusEffect} from '@react-navigation/native';
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import {ExpensiMark} from 'expensify-common';
import React, {useCallback, useRef, useState} from 'react';
import type {GestureResponderEvent, ViewStyle} from 'react-native';
import {StyleSheet, View} from 'react-native';
Expand Down
2 changes: 1 addition & 1 deletion src/components/MenuItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import {ExpensiMark} from 'expensify-common';
import type {ImageContentFit} from 'expo-image';
import type {ReactElement, ReactNode} from 'react';
import React, {forwardRef, useContext, useMemo} from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useIsFocused} from '@react-navigation/native';
import {format} from 'date-fns';
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {useCallback, useEffect, useMemo, useReducer, useState} from 'react';
import type {TextStyle} from 'react-native';
import {View} from 'react-native';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/MoneyReportView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {useMemo} from 'react';
import type {StyleProp, TextStyle} from 'react-native';
import {View} from 'react-native';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/ReportActionItemImage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable react/jsx-props-no-spreading */
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React from 'react';
import type {ViewStyle} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/TaskPreview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
Expand Down
2 changes: 1 addition & 1 deletion src/components/SelectionList/InviteMemberListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {useCallback} from 'react';
import {View} from 'react-native';
import MultipleAvatars from '@components/MultipleAvatars';
Expand Down
2 changes: 1 addition & 1 deletion src/components/SelectionList/UserListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {useCallback} from 'react';
import {View} from 'react-native';
import Icon from '@components/Icon';
Expand Down
2 changes: 1 addition & 1 deletion src/components/StateSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useIsFocused} from '@react-navigation/native';
import {CONST as COMMON_CONST} from 'expensify-common/lib/CONST';
import {CONST as COMMON_CONST} from 'expensify-common';
import React, {useEffect, useRef} from 'react';
import type {ForwardedRef} from 'react';
import type {View} from 'react-native';
Expand Down
2 changes: 1 addition & 1 deletion src/components/TextInput/BaseTextInput/index.native.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import type {ForwardedRef} from 'react';
import React, {forwardRef, useCallback, useEffect, useRef, useState} from 'react';
import type {GestureResponderEvent, LayoutChangeEvent, NativeSyntheticEvent, StyleProp, TextInput, TextInputFocusEventData, ViewStyle} from 'react-native';
Expand Down
2 changes: 1 addition & 1 deletion src/components/TextInput/BaseTextInput/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import type {ForwardedRef} from 'react';
import React, {forwardRef, useCallback, useEffect, useMemo, useRef, useState} from 'react';
import type {GestureResponderEvent, LayoutChangeEvent, NativeSyntheticEvent, StyleProp, TextInputFocusEventData, ViewStyle} from 'react-native';
Expand Down
2 changes: 1 addition & 1 deletion src/components/UnitPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {useMemo} from 'react';
import useLocalize from '@hooks/useLocalize';
import {getUnitTranslationKey} from '@libs/WorkspacesSettingsUtils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import React, {useCallback} from 'react';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
Expand Down
2 changes: 1 addition & 1 deletion src/components/createOnyxContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import type {ComponentType, ForwardedRef, ForwardRefExoticComponent, PropsWithoutRef, ReactNode, RefAttributes} from 'react';
import React, {createContext, forwardRef, useContext} from 'react';
import type {OnyxValue} from 'react-native-onyx';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useCopySelectionHelper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import {ExpensiMark} from 'expensify-common';
import {useEffect} from 'react';
import Clipboard from '@libs/Clipboard';
import KeyboardShortcut from '@libs/KeyboardShortcut';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useGeographicalStateFromRoute.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useRoute} from '@react-navigation/native';
import type {ParamListBase, RouteProp} from '@react-navigation/native';
import {CONST as COMMON_CONST} from 'expensify-common/lib/CONST';
import {CONST as COMMON_CONST} from 'expensify-common';

type CustomParamList = ParamListBase & Record<string, Record<string, string>>;
type State = keyof typeof COMMON_CONST.STATES;
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useHtmlPaste/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useNavigation} from '@react-navigation/native';
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import {ExpensiMark} from 'expensify-common';
import {useCallback, useEffect} from 'react';
import type UseHtmlPaste from './types';

Expand Down
3 changes: 1 addition & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {CONST as COMMON_CONST} from 'expensify-common/lib/CONST';
import Str from 'expensify-common/lib/str';
import {CONST as COMMON_CONST, Str} from 'expensify-common';
import CONST from '@src/CONST';
import type {Country} from '@src/CONST';
import type {ConnectionName, PolicyConnectionSyncStage} from '@src/types/onyx/Policy';
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import CONST from '@src/CONST';
import type {ConnectionName, PolicyConnectionSyncStage} from '@src/types/onyx/Policy';
import type {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ActiveClientManager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* only one tab is processing those saved requests or we would be duplicating data (or creating errors).
* This file ensures exactly that by tracking all the clientIDs connected, storing the most recent one last and it considers that last clientID the "leader".
*/
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import Onyx from 'react-native-onyx';
import * as ActiveClients from '@userActions/ActiveClients';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/BankAccountUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import type {OnyxEntry} from 'react-native-onyx';
import type * as OnyxTypes from '@src/types/onyx';

Expand Down
2 changes: 1 addition & 1 deletion src/libs/EmojiUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {getUnixTime} from 'date-fns';
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import memoize from 'lodash/memoize';
import Onyx from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/GetStyledTextArray.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import StringUtils from './StringUtils';

type StyledText = {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/KeyboardShortcut/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import * as KeyCommand from 'react-native-key-command';
import getOperatingSystem from '@libs/getOperatingSystem';
import localeCompare from '@libs/LocaleCompare';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/LocalePhoneNumber.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import Onyx from 'react-native-onyx';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down
3 changes: 2 additions & 1 deletion src/libs/Log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// action would likely cause confusion about which one to use. But most other API methods should happen inside an action file.

/* eslint-disable rulesdir/no-api-in-views */
import Logger from 'expensify-common/lib/Logger';
import {ExpensiMark, Logger} from 'expensify-common';
import Onyx from 'react-native-onyx';
import type {Merge} from 'type-fest';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -80,5 +80,6 @@ const Log = new Logger({
isDebug: true,
});
timeout = setTimeout(() => Log.info('Flushing logs older than 10 minutes', true, {}, true), 10 * 60 * 1000);
ExpensiMark.setLogger(Log);

export default Log;
3 changes: 1 addition & 2 deletions src/libs/LoginUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {PUBLIC_DOMAINS} from 'expensify-common/lib/CONST';
import Str from 'expensify-common/lib/str';
import {PUBLIC_DOMAINS, Str} from 'expensify-common';
import Onyx from 'react-native-onyx';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/NextStepUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {format, lastDayOfMonth, setDate} from 'date-fns';
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import Onyx from 'react-native-onyx';
import type {OnyxCollection} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Web and desktop implementation only. Do not import for direct use. Use LocalNotification.
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import type {ImageSourcePropType} from 'react-native';
import EXPENSIFY_ICON_URL from '@assets/images/expensify-logo-round-clearspace.png';
import * as AppUpdate from '@libs/actions/AppUpdate';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-continue */
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
// eslint-disable-next-line you-dont-need-lodash-underscore/get
import lodashGet from 'lodash/get';
import lodashOrderBy from 'lodash/orderBy';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/PersonalDetailsUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import type {OnyxEntry, OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {CurrentUserPersonalDetails} from '@components/withCurrentUserPersonalDetails';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/PhoneNumber.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// eslint-disable-next-line no-restricted-imports
import {parsePhoneNumber as originalParsePhoneNumber} from 'awesome-phonenumber';
import type {ParsedPhoneNumber, ParsedPhoneNumberInvalid, PhoneNumberParseOptions} from 'awesome-phonenumber';
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import CONST from '@src/CONST';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReceiptUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import _ from 'lodash';
import type {OnyxEntry} from 'react-native-onyx';
import CONST from '@src/CONST';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fastMerge from 'expensify-common/lib/fastMerge';
import {fastMerge} from 'expensify-common';
import _ from 'lodash';
import lodashFindLast from 'lodash/findLast';
import type {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
Expand Down
3 changes: 1 addition & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {format} from 'date-fns';
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import Str from 'expensify-common/lib/str';
import {ExpensiMark, Str} from 'expensify-common';
import {isEmpty} from 'lodash';
import lodashEscape from 'lodash/escape';
import lodashFindLastIndex from 'lodash/findLastIndex';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/SelectionScraper/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import render from 'dom-serializer';
import type {Node} from 'domhandler';
import {DataNode, Element} from 'domhandler';
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import {parseDocument} from 'htmlparser2';
import CONST from '@src/CONST';
import type GetCurrentSelection from './types';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {ChatReportSelector, PolicySelector, ReportActionsSelector} from '@hooks/useReportIDs';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/UserUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Str from 'expensify-common/lib/str';
import {Str} from 'expensify-common';
import type {OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import * as defaultAvatars from '@components/Icon/DefaultAvatars';
Expand Down
Loading

0 comments on commit 088939b

Please sign in to comment.