, policy: OnyxEntry {
// If we're using the Supportal token and this is not a Supportal request
// let's just return a promise that will resolve itself.
if (NetworkStore.getSupportAuthToken() && !NetworkStore.isSupportRequest(request.command)) {
- return new Promise((resolve) => resolve());
+ return new Promise((resolve) => {
+ resolve();
+ });
}
return HttpUtils.xhr(request.command, finalParameters, request.type, request.shouldUseSecure);
diff --git a/src/libs/RequestThrottle.ts b/src/libs/RequestThrottle.ts
index 36935982afbb..4c524394cb2c 100644
--- a/src/libs/RequestThrottle.ts
+++ b/src/libs/RequestThrottle.ts
@@ -26,9 +26,10 @@ function sleep(): Promise {
requestRetryCount++;
return new Promise((resolve, reject) => {
if (requestRetryCount <= CONST.NETWORK.MAX_REQUEST_RETRIES) {
- return setTimeout(resolve, getRequestWaitTime());
+ setTimeout(resolve, getRequestWaitTime());
+ return;
}
- return reject();
+ reject();
});
}
diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.ts b/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.ts
index 5cbba61542b1..75013ebe621f 100644
--- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.ts
+++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.ts
@@ -1,4 +1,4 @@
-import ELECTRON_EVENTS from '../../../../desktop/ELECTRON_EVENTS';
+import ELECTRON_EVENTS from '@desktop/ELECTRON_EVENTS';
import type UpdateUnread from './types';
/**
diff --git a/src/libs/Visibility/index.desktop.ts b/src/libs/Visibility/index.desktop.ts
index c01b6001f456..e3cab6ec44a6 100644
--- a/src/libs/Visibility/index.desktop.ts
+++ b/src/libs/Visibility/index.desktop.ts
@@ -1,4 +1,4 @@
-import ELECTRON_EVENTS from '../../../desktop/ELECTRON_EVENTS';
+import ELECTRON_EVENTS from '@desktop/ELECTRON_EVENTS';
import type {HasFocus, IsVisible, OnVisibilityChange} from './types';
/**
diff --git a/src/libs/actions/Device/generateDeviceID/index.desktop.ts b/src/libs/actions/Device/generateDeviceID/index.desktop.ts
index f8af0a7faa81..45daf7062a5a 100644
--- a/src/libs/actions/Device/generateDeviceID/index.desktop.ts
+++ b/src/libs/actions/Device/generateDeviceID/index.desktop.ts
@@ -1,4 +1,4 @@
-import ELECTRON_EVENTS from '../../../../../desktop/ELECTRON_EVENTS';
+import ELECTRON_EVENTS from '@desktop/ELECTRON_EVENTS';
import type GenerateDeviceID from './types';
/**
diff --git a/src/libs/actions/Device/index.ts b/src/libs/actions/Device/index.ts
index 761e27d95a78..e7c19d20e4fe 100644
--- a/src/libs/actions/Device/index.ts
+++ b/src/libs/actions/Device/index.ts
@@ -12,7 +12,8 @@ let deviceID: string | null = null;
function getDeviceID(): Promise {
return new Promise((resolve) => {
if (deviceID) {
- return resolve(deviceID);
+ resolve(deviceID);
+ return;
}
const connectionID = Onyx.connect({
diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts
index 57cd4a6fc071..b9a2e8535b62 100644
--- a/src/libs/actions/Policy.ts
+++ b/src/libs/actions/Policy.ts
@@ -54,6 +54,7 @@ import type {
} from '@src/types/onyx';
import type {Errors} from '@src/types/onyx/OnyxCommon';
import type {Attributes, CustomUnit, Rate, Unit} from '@src/types/onyx/Policy';
+import type {OnyxData} from '@src/types/onyx/Request';
import type {EmptyObject} from '@src/types/utils/EmptyObject';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
@@ -2178,6 +2179,60 @@ function createWorkspaceFromIOUPayment(iouReport: Report | EmptyObject): string
return policyID;
}
+const setWorkspaceRequiresCategory = (policyID: string, requiresCategory: boolean) => {
+ const onyxData: OnyxData = {
+ optimisticData: [
+ {
+ onyxMethod: Onyx.METHOD.MERGE,
+ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
+ value: {
+ requiresCategory,
+ errors: {
+ requiresCategory: null,
+ },
+ pendingFields: {
+ requiresCategory: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
+ },
+ },
+ },
+ ],
+ successData: [
+ {
+ onyxMethod: Onyx.METHOD.MERGE,
+ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
+ value: {
+ errors: {
+ requiresCategory: null,
+ },
+ pendingFields: {
+ requiresCategory: null,
+ },
+ },
+ },
+ ],
+ failureData: [
+ {
+ onyxMethod: Onyx.METHOD.MERGE,
+ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
+ value: {
+ requiresCategory: !requiresCategory,
+ errors: ErrorUtils.getMicroSecondOnyxError('workspace.categories.genericFailureMessage'),
+ pendingFields: {
+ requiresCategory: null,
+ },
+ },
+ },
+ ],
+ };
+
+ const parameters = {
+ policyID,
+ requiresCategory,
+ };
+
+ API.write('SetWorkspaceRequiresCategory', parameters, onyxData);
+};
+
export {
removeMembers,
addMembersToWorkspace,
@@ -2221,4 +2276,5 @@ export {
setWorkspaceAutoReporting,
setWorkspaceApprovalMode,
updateWorkspaceDescription,
+ setWorkspaceRequiresCategory,
};
diff --git a/src/libs/actions/Session/clearCache/index.ts b/src/libs/actions/Session/clearCache/index.ts
index 6d288c6cbd3b..3daa8ec2d7d7 100644
--- a/src/libs/actions/Session/clearCache/index.ts
+++ b/src/libs/actions/Session/clearCache/index.ts
@@ -1,5 +1,8 @@
import type ClearCache from './types';
-const clearStorage: ClearCache = () => new Promise((res) => res());
+const clearStorage: ClearCache = () =>
+ new Promise((resolve) => {
+ resolve();
+ });
export default clearStorage;
diff --git a/src/libs/actions/Task.ts b/src/libs/actions/Task.ts
index 74e6a6c78eeb..9c9384912251 100644
--- a/src/libs/actions/Task.ts
+++ b/src/libs/actions/Task.ts
@@ -386,7 +386,7 @@ function editTask(report: OnyxTypes.Report, {title, description}: OnyxTypes.Task
const editTaskReportAction = ReportUtils.buildOptimisticEditedTaskReportAction(currentUserEmail);
// Sometimes title or description is undefined, so we need to check for that, and we provide it to multiple functions
- const reportName = (title ?? report?.reportName).trim();
+ const reportName = (title ?? report?.reportName)?.trim();
// Description can be unset, so we default to an empty string if so
const reportDescription = (description ?? report.description ?? '').trim();
diff --git a/src/libs/calculateAnchorPosition.ts b/src/libs/calculateAnchorPosition.ts
index 0f1e383522eb..3dc5924d023a 100644
--- a/src/libs/calculateAnchorPosition.ts
+++ b/src/libs/calculateAnchorPosition.ts
@@ -16,13 +16,15 @@ type AnchorOrigin = {
export default function calculateAnchorPosition(anchorComponent: View | RNText, anchorOrigin?: AnchorOrigin): Promise {
return new Promise((resolve) => {
if (!anchorComponent) {
- return resolve({horizontal: 0, vertical: 0});
+ resolve({horizontal: 0, vertical: 0});
+ return;
}
anchorComponent.measureInWindow((x, y, width, height) => {
if (anchorOrigin?.vertical === CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP && anchorOrigin?.horizontal === CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT) {
- return resolve({horizontal: x, vertical: y + height + (anchorOrigin?.shiftVertical ?? 0)});
+ resolve({horizontal: x, vertical: y + height + (anchorOrigin?.shiftVertical ?? 0)});
+ return;
}
- return resolve({horizontal: x + width, vertical: y + (anchorOrigin?.shiftVertical ?? 0)});
+ resolve({horizontal: x + width, vertical: y + (anchorOrigin?.shiftVertical ?? 0)});
});
});
}
diff --git a/src/pages/EnablePayments/TermsStep.js b/src/pages/EnablePayments/TermsStep.js
index a09e1801c3b0..9fa3a4becea3 100644
--- a/src/pages/EnablePayments/TermsStep.js
+++ b/src/pages/EnablePayments/TermsStep.js
@@ -7,6 +7,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
+import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import compose from '@libs/compose';
import * as ErrorUtils from '@libs/ErrorUtils';
@@ -32,6 +33,30 @@ const defaultProps = {
walletTerms: {},
};
+function HaveReadAndAgreeLabel() {
+ const {translate} = useLocalize();
+
+ return (
+
+ {`${translate('termsStep.haveReadAndAgree')}`}
+ {`${translate('termsStep.electronicDisclosures')}.`}
+
+ );
+}
+
+function AgreeToTheLabel() {
+ const {translate} = useLocalize();
+
+ return (
+
+ {`${translate('termsStep.agreeToThe')} `}
+ {`${translate('common.privacy')} `}
+ {`${translate('common.and')} `}
+ {`${translate('termsStep.walletAgreement')}.`}
+
+ );
+}
+
function TermsStep(props) {
const styles = useThemeStyles();
const [hasAcceptedDisclosure, setHasAcceptedDisclosure] = useState(false);
@@ -71,27 +96,12 @@ function TermsStep(props) {
accessibilityLabel={props.translate('termsStep.haveReadAndAgree')}
style={[styles.mb4, styles.mt4]}
onInputChange={toggleDisclosure}
- LabelComponent={() => (
-
- {`${props.translate('termsStep.haveReadAndAgree')}`}
- {`${props.translate('termsStep.electronicDisclosures')}.`}
-
- )}
+ LabelComponent={HaveReadAndAgreeLabel}
/>
(
-
- {`${props.translate('termsStep.agreeToThe')} `}
-
- {`${props.translate('common.privacy')} `}
-
- {`${props.translate('common.and')} `}
-
- {`${props.translate('termsStep.walletAgreement')}.`}
-
- )}
+ LabelComponent={AgreeToTheLabel}
/>
(
-
- )}
+ tabBar={TabSelector}
>
+ {`${translate('businessInfoStep.confirmCompanyIsNot')} `}
+ {`${translate('businessInfoStep.listOfRestrictedBusinesses')}.`}
+