Skip to content

Commit

Permalink
fixing linter
Browse files Browse the repository at this point in the history
  • Loading branch information
sumo-slonik committed Jan 7, 2025
1 parent aa7c70a commit 060cae7
Show file tree
Hide file tree
Showing 29 changed files with 93 additions and 87 deletions.
2 changes: 0 additions & 2 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6440,8 +6440,6 @@ const CONST = {
},

MIGRATED_USER_WELCOME_MODAL: 'migratedUserWelcomeModal',

DEFAULT_POLICY_ID: '-1',
} as const;

type Country = keyof typeof CONST.ALL_COUNTRIES;
Expand Down
52 changes: 26 additions & 26 deletions src/ROUTES.ts

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/components/Accordion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,29 @@ function Accordion({isExpanded, children, duration = 300, style}: AccordionProps
const styles = useThemeStyles();

const derivedHeight = useDerivedValue(() =>
withTiming(height.value * Number(isExpanded.value), {
withTiming(height.get() * Number(isExpanded.get()), {
duration,
easing: Easing.inOut(Easing.quad),
}),
);

const derivedOpacity = useDerivedValue(() =>
withTiming(isExpanded.value ? 1 : 0, {
withTiming(isExpanded.get() ? 1 : 0, {
duration,
easing: Easing.inOut(Easing.quad),
}),
);

const bodyStyle = useAnimatedStyle(() => ({
height: derivedHeight.value,
opacity: derivedOpacity.value,
height: derivedHeight.get(),
opacity: derivedOpacity.get(),
}));

return (
<Animated.View style={[bodyStyle, style]}>
<View
onLayout={(e) => {
height.value = e.nativeEvent.layout.height;
height.set(e.nativeEvent.layout.height);
}}
style={[styles.pAbsolute, styles.l0, styles.r0, styles.t0]}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConnectionLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type ConnectionLayoutProps = {
title?: TranslationPaths;

/** The current policyID */
policyID: string;
policyID: string | undefined;

/** Defines which types of access should be verified */
accessVariants?: AccessVariant[];
Expand Down
2 changes: 1 addition & 1 deletion src/libs/API/parameters/UpdateNetSuiteGenericTypeParams.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type UpdateNetSuiteGenericTypeParams<K extends string | number | symbol, Type> = {
[K2 in K]: Type;
} & {
policyID: string;
policyID: string | undefined;
};

export default UpdateNetSuiteGenericTypeParams;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type UpdateQuickbooksDesktopGenericTypeParams = {
policyID: string;
policyID: string | undefined;
settingValue: string;
idempotencyKey: string;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type UpdateQuickbooksOnlineGenericTypeParams = {
policyID: string;
policyID: string | undefined;
settingValue: string;
idempotencyKey: string;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type UpdateSageIntacctGenericTypeParams<K extends string | number | symbol, Type> = {
[K2 in K]: Type;
} & {
policyID: string;
policyID: string | undefined;
};

export default UpdateSageIntacctGenericTypeParams;
2 changes: 1 addition & 1 deletion src/libs/API/parameters/UpdateXeroGenericTypeParams.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type UpdateXeroGenericTypeParams = {
policyID: string;
policyID: string | undefined;
settingValue: string;
idempotencyKey: string;
};
Expand Down
10 changes: 5 additions & 5 deletions src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,15 +627,15 @@ function clearPolicyErrorField(policyID: string, fieldName: string) {
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {errorFields: {[fieldName]: null}});
}

function clearQBOErrorField(policyID: string, fieldName: string) {
function clearQBOErrorField(policyID: string | undefined, fieldName: string) {
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {connections: {quickbooksOnline: {config: {errorFields: {[fieldName]: null}}}}});
}

function clearQBDErrorField(policyID: string, fieldName: string) {
function clearQBDErrorField(policyID: string | undefined, fieldName: string) {
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {connections: {quickbooksDesktop: {config: {errorFields: {[fieldName]: null}}}}});
}

function clearXeroErrorField(policyID: string, fieldName: string) {
function clearXeroErrorField(policyID: string | undefined, fieldName: string) {
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {connections: {xero: {config: {errorFields: {[fieldName]: null}}}}});
}

Expand Down Expand Up @@ -665,11 +665,11 @@ function removeNetSuiteCustomFieldByIndex(allRecords: NetSuiteCustomSegment[] |
});
}

function clearSageIntacctErrorField(policyID: string, fieldName: string) {
function clearSageIntacctErrorField(policyID: string | undefined, fieldName: string) {
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {connections: {intacct: {config: {errorFields: {[fieldName]: null}}}}});
}

function clearNetSuiteAutoSyncErrorField(policyID: string) {
function clearNetSuiteAutoSyncErrorField(policyID: string | undefined) {
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {connections: {netsuite: {config: {errorFields: {autoSync: null}}}}});
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/connections/NetSuiteCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ function updateNetSuiteExportToNextOpenPeriod(policyID: string, value: boolean,
API.write(WRITE_COMMANDS.UPDATE_NETSUITE_EXPORT_TO_NEXT_OPEN_PERIOD, parameters, onyxData);
}

function updateNetSuiteAutoSync(policyID: string, value: boolean) {
function updateNetSuiteAutoSync(policyID: string | undefined, value: boolean) {
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down
10 changes: 5 additions & 5 deletions src/libs/actions/connections/QuickbooksDesktop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function buildOnyxDataForQuickbooksExportConfiguration<TSettingName extends keyo
}

function buildOnyxDataForQuickbooksDesktopMappingsConfiguration<TSettingName extends keyof Connections['quickbooksDesktop']['config']['mappings']>(
policyID: string,
policyID: string | undefined,
settingName: TSettingName,
settingValue: Partial<Connections['quickbooksDesktop']['config']['mappings'][TSettingName]>,
oldSettingValue?: Partial<Connections['quickbooksDesktop']['config']['mappings'][TSettingName]>,
Expand Down Expand Up @@ -245,7 +245,7 @@ function buildOnyxDataForQuickbooksDesktopMappingsConfiguration<TSettingName ext
}

function buildOnyxDataForQuickbooksConfiguration<TSettingName extends keyof Connections['quickbooksDesktop']['config']>(
policyID: string,
policyID: string | undefined,
settingName: TSettingName,
settingValue: Partial<Connections['quickbooksDesktop']['config'][TSettingName]>,
oldSettingValue?: Partial<Connections['quickbooksDesktop']['config'][TSettingName]>,
Expand Down Expand Up @@ -363,7 +363,7 @@ function updateQuickbooksCompanyCardExpenseAccount<
}

function updateQuickbooksDesktopShouldAutoCreateVendor<TSettingValue extends Connections['quickbooksDesktop']['config']['shouldAutoCreateVendor']>(
policyID: string,
policyID: string | undefined,
settingValue: TSettingValue,
) {
const onyxData = buildOnyxDataForQuickbooksConfiguration(policyID, CONST.QUICKBOOKS_DESKTOP_CONFIG.SHOULD_AUTO_CREATE_VENDOR, settingValue, !settingValue);
Expand Down Expand Up @@ -418,7 +418,7 @@ function updateQuickbooksDesktopEnableNewCategories<TSettingValue extends Connec
}

function updateQuickbooksDesktopSyncClasses<TSettingValue extends Connections['quickbooksDesktop']['config']['mappings']['classes']>(
policyID: string,
policyID: string | undefined,
settingValue: TSettingValue,
oldSettingValue?: TSettingValue,
) {
Expand All @@ -432,7 +432,7 @@ function updateQuickbooksDesktopSyncClasses<TSettingValue extends Connections['q
}

function updateQuickbooksDesktopSyncCustomers<TSettingValue extends Connections['quickbooksDesktop']['config']['mappings']['customers']>(
policyID: string,
policyID: string | undefined,
settingValue: TSettingValue,
oldSettingValue?: TSettingValue,
) {
Expand Down
8 changes: 4 additions & 4 deletions src/libs/actions/connections/QuickbooksOnline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function buildOnyxDataForMultipleQuickbooksConfigurations<TConfigUpdate extends
}

function buildOnyxDataForQuickbooksConfiguration<TSettingName extends keyof Connections['quickbooksOnline']['config']>(
policyID: string,
policyID: string | undefined,
settingName: TSettingName,
settingValue: Partial<Connections['quickbooksOnline']['config'][TSettingName]>,
oldSettingValue?: Partial<Connections['quickbooksOnline']['config'][TSettingName]>,
Expand Down Expand Up @@ -230,7 +230,7 @@ function updateQuickbooksOnlineReimbursableExpensesAccount<TSettingValue extends
}

function updateQuickbooksOnlineSyncLocations<TSettingValue extends Connections['quickbooksOnline']['config']['syncLocations']>(
policyID: string,
policyID: string | undefined,
settingValue: TSettingValue,
oldSettingValue?: TSettingValue,
) {
Expand All @@ -245,7 +245,7 @@ function updateQuickbooksOnlineSyncLocations<TSettingValue extends Connections['
}

function updateQuickbooksOnlineSyncCustomers<TSettingValue extends Connections['quickbooksOnline']['config']['syncCustomers']>(
policyID: string,
policyID: string | undefined,
settingValue: TSettingValue,
oldSettingValue?: TSettingValue,
) {
Expand All @@ -260,7 +260,7 @@ function updateQuickbooksOnlineSyncCustomers<TSettingValue extends Connections['
}

function updateQuickbooksOnlineSyncClasses<TSettingValue extends Connections['quickbooksOnline']['config']['syncClasses']>(
policyID: string,
policyID: string | undefined,
settingValue: TSettingValue,
oldSettingValue?: TSettingValue,
) {
Expand Down
32 changes: 21 additions & 11 deletions src/libs/actions/connections/SageIntacct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function connectToSageIntacct(policyID: string, credentials: SageIntacctCredenti
}

function prepareOnyxDataForMappingUpdate(
policyID: string,
policyID: string | undefined,
mappingName: keyof SageIntacctMappingType,
mappingValue: boolean | SageIntacctMappingValue,
oldMappingValue?: boolean | SageIntacctMappingValue,
Expand Down Expand Up @@ -134,7 +134,7 @@ function getCommandForMapping(mappingName: ValueOf<typeof CONST.SAGE_INTACCT_CON
}
}

function updateSageIntacctMappingValue(policyID: string, mappingName: SageIntacctMappingName, mappingValue: SageIntacctMappingValue, oldMappingValue?: SageIntacctMappingValue) {
function updateSageIntacctMappingValue(policyID: string | undefined, mappingName: SageIntacctMappingName, mappingValue: SageIntacctMappingValue, oldMappingValue?: SageIntacctMappingValue) {
const command = getCommandForMapping(mappingName);
if (!command) {
return;
Expand Down Expand Up @@ -532,7 +532,7 @@ function updateSageIntacctDefaultVendor(policyID: string, settingName: keyof Sag
}
}

function clearSageIntacctErrorField(policyID: string, key: SageIntacctOfflineStateKeys | keyof SageIntacctConnectionsConfig) {
function clearSageIntacctErrorField(policyID: string | undefined, key: SageIntacctOfflineStateKeys | keyof SageIntacctConnectionsConfig) {
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {connections: {intacct: {config: {errorFields: {[key]: null}}}}});
}

Expand All @@ -545,7 +545,12 @@ function removeSageIntacctUserDimensionsByName(dimensions: SageIntacctDimension[
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {connections: {intacct: {config: {mappings: {dimensions: Dimensions}}}}});
}

function prepareOnyxDataForConfigUpdate(policyID: string, settingName: keyof SageIntacctConnectionsConfig, settingValue: string | boolean | null, oldSettingValue?: string | boolean | null) {
function prepareOnyxDataForConfigUpdate(
policyID: string | undefined,
settingName: keyof SageIntacctConnectionsConfig,
settingValue: string | boolean | null,
oldSettingValue?: string | boolean | null,
) {
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down Expand Up @@ -614,7 +619,12 @@ function prepareOnyxDataForConfigUpdate(policyID: string, settingName: keyof Sag
return {optimisticData, failureData, successData};
}

function prepareOnyxDataForSyncUpdate(policyID: string, settingName: keyof Connections['intacct']['config']['sync'], settingValue: string | boolean, oldSettingValue?: string | boolean) {
function prepareOnyxDataForSyncUpdate(
policyID: string | undefined,
settingName: keyof Connections['intacct']['config']['sync'],
settingValue: string | boolean,
oldSettingValue?: string | boolean,
) {
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down Expand Up @@ -687,7 +697,7 @@ function prepareOnyxDataForSyncUpdate(policyID: string, settingName: keyof Conne
return {optimisticData, failureData, successData};
}

function prepareOnyxDataForAutoSyncUpdate(policyID: string, settingName: keyof Connections['intacct']['config']['autoSync'], settingValue: boolean) {
function prepareOnyxDataForAutoSyncUpdate(policyID: string | undefined, settingName: keyof Connections['intacct']['config']['autoSync'], settingValue: boolean) {
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down Expand Up @@ -760,7 +770,7 @@ function prepareOnyxDataForAutoSyncUpdate(policyID: string, settingName: keyof C
return {optimisticData, failureData, successData};
}

function updateSageIntacctAutoSync(policyID: string, enabled: boolean) {
function updateSageIntacctAutoSync(policyID: string | undefined, enabled: boolean) {
const {optimisticData, failureData, successData} = prepareOnyxDataForAutoSyncUpdate(policyID, CONST.SAGE_INTACCT_CONFIG.AUTO_SYNC_ENABLED, enabled);
const parameters = {
policyID,
Expand All @@ -770,7 +780,7 @@ function updateSageIntacctAutoSync(policyID: string, enabled: boolean) {
API.write(WRITE_COMMANDS.UPDATE_SAGE_INTACCT_AUTO_SYNC, parameters, {optimisticData, failureData, successData});
}

function updateSageIntacctImportEmployees(policyID: string, enabled: boolean) {
function updateSageIntacctImportEmployees(policyID: string | undefined, enabled: boolean) {
const {optimisticData, failureData, successData} = prepareOnyxDataForConfigUpdate(policyID, CONST.SAGE_INTACCT_CONFIG.IMPORT_EMPLOYEES, enabled, !enabled);
const parameters = {
policyID,
Expand All @@ -780,7 +790,7 @@ function updateSageIntacctImportEmployees(policyID: string, enabled: boolean) {
API.write(WRITE_COMMANDS.UPDATE_SAGE_INTACCT_IMPORT_EMPLOYEES, parameters, {optimisticData, failureData, successData});
}

function updateSageIntacctApprovalMode(policyID: string, enabled: boolean) {
function updateSageIntacctApprovalMode(policyID: string | undefined, enabled: boolean) {
const approvalModeSettingValue = enabled ? CONST.SAGE_INTACCT.APPROVAL_MODE.APPROVAL_MANUAL : '';
const oldApprovalModeSettingValue = enabled ? '' : CONST.SAGE_INTACCT.APPROVAL_MODE.APPROVAL_MANUAL;
const {optimisticData, failureData, successData} = prepareOnyxDataForConfigUpdate(
Expand All @@ -797,7 +807,7 @@ function updateSageIntacctApprovalMode(policyID: string, enabled: boolean) {
API.write(WRITE_COMMANDS.UPDATE_SAGE_INTACCT_APPROVAL_MODE, parameters, {optimisticData, failureData, successData});
}

function updateSageIntacctSyncReimbursedReports(policyID: string, enabled: boolean) {
function updateSageIntacctSyncReimbursedReports(policyID: string | undefined, enabled: boolean) {
const {optimisticData, failureData, successData} = prepareOnyxDataForSyncUpdate(policyID, CONST.SAGE_INTACCT_CONFIG.SYNC_REIMBURSED_REPORTS, enabled, !enabled);
const parameters = {
policyID,
Expand All @@ -807,7 +817,7 @@ function updateSageIntacctSyncReimbursedReports(policyID: string, enabled: boole
API.write(WRITE_COMMANDS.UPDATE_SAGE_INTACCT_SYNC_REIMBURSED_REPORTS, parameters, {optimisticData, failureData, successData});
}

function updateSageIntacctSyncReimbursementAccountID(policyID: string, vendorID: string, oldVendorID?: string) {
function updateSageIntacctSyncReimbursementAccountID(policyID: string | undefined, vendorID: string, oldVendorID?: string) {
const {optimisticData, failureData, successData} = prepareOnyxDataForSyncUpdate(policyID, CONST.SAGE_INTACCT_CONFIG.REIMBURSEMENT_ACCOUNT_ID, vendorID, oldVendorID);
const parameters = {
policyID,
Expand Down
10 changes: 5 additions & 5 deletions src/libs/actions/connections/Xero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function createXeroSyncErrorFields<TSettingName extends keyof Connections['xero'
}

function prepareXeroOptimisticData<TSettingName extends keyof Connections['xero']['config']>(
policyID: string,
policyID: string | undefined,
settingName: TSettingName,
settingValue: Partial<Connections['xero']['config'][TSettingName]>,
oldSettingValue?: Partial<Connections['xero']['config'][TSettingName]> | null,
Expand Down Expand Up @@ -251,7 +251,7 @@ function prepareXeroExportOptimisticData<TSettingName extends keyof Connections[
}

function prepareXeroSyncOptimisticData<TSettingName extends keyof Connections['xero']['config']['sync']>(
policyID: string,
policyID: string | undefined,
settingName: TSettingName,
settingValue: Partial<Connections['xero']['config']['sync'][TSettingName]>,
oldSettingValue?: Partial<Connections['xero']['config']['sync'][TSettingName]> | null,
Expand Down Expand Up @@ -317,7 +317,7 @@ function prepareXeroSyncOptimisticData<TSettingName extends keyof Connections['x
}

function updateXeroImportTrackingCategories(
policyID: string,
policyID: string | undefined,
importTrackingCategories: Partial<Connections['xero']['config']['importTrackingCategories']>,
oldImportTrackingCategories?: Partial<Connections['xero']['config']['importTrackingCategories']>,
) {
Expand Down Expand Up @@ -409,7 +409,7 @@ function updateXeroEnableNewCategories(
API.write(WRITE_COMMANDS.UPDATE_XERO_ENABLE_NEW_CATEGORIES, parameters, {optimisticData, failureData, successData});
}

function updateXeroAutoSync(policyID: string, autoSync: Partial<Connections['xero']['config']['autoSync']>, oldAutoSync?: Partial<Connections['xero']['config']['autoSync']>) {
function updateXeroAutoSync(policyID: string | undefined, autoSync: Partial<Connections['xero']['config']['autoSync']>, oldAutoSync?: Partial<Connections['xero']['config']['autoSync']>) {
const parameters: UpdateXeroGenericTypeParams = {
policyID,
settingValue: JSON.stringify(autoSync),
Expand Down Expand Up @@ -528,7 +528,7 @@ function updateXeroSyncReimbursementAccountID(
}

function updateXeroSyncSyncReimbursedReports(
policyID: string,
policyID: string | undefined,
syncReimbursedReports: Partial<Connections['xero']['config']['sync']['syncReimbursedReports']>,
oldSyncReimbursedReports?: Partial<Connections['xero']['config']['sync']['syncReimbursedReports']>,
) {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/connections/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ function syncConnection(policyID: string, connectionName: PolicyConnectionName |
}

function updateManyPolicyConnectionConfigs<TConnectionName extends ConnectionNameExceptNetSuite, TConfigUpdate extends Partial<Connections[TConnectionName]['config']>>(
policyID: string,
policyID: string | undefined,
connectionName: TConnectionName,
configUpdate: TConfigUpdate,
configCurrentData: TConfigUpdate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getReimbursedAccountName(bankAccounts: SageIntacctDataElement[], reimbu

function SageIntacctAdvancedPage({policy}: WithPolicyProps) {
const {translate} = useLocalize();
const policyID = policy?.id ?? '-1';
const policyID = policy?.id;
const styles = useThemeStyles();

const {importEmployees, autoSync, sync, pendingFields, errorFields} = policy?.connections?.intacct?.config ?? {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function SageIntacctToggleMappingsPage({route}: SageIntacctToggleMappingsPagePro

const policy = usePolicy(route.params.policyID);
const mappingName: SageIntacctMappingName = route.params.mapping;
const policyID: string = policy?.id ?? CONST.DEFAULT_POLICY_ID;
const policyID: string | undefined = policy?.id;
const config = policy?.connections?.intacct?.config;
const isImportMappingEnable = config?.mappings?.[mappingName] !== CONST.SAGE_INTACCT_MAPPING_VALUE.NONE;
const isAccordionExpanded = useSharedValue(isImportMappingEnable);
Expand Down
Loading

0 comments on commit 060cae7

Please sign in to comment.