Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into pac-guerreiro/refacto…
Browse files Browse the repository at this point in the history
…r/migrate-25370-25371-25372-25373-to-typescript
  • Loading branch information
fabioh8010 committed Apr 4, 2024
2 parents 71eef59 + f82f863 commit ce6cf3f
Show file tree
Hide file tree
Showing 20 changed files with 104 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CONST from '@github/libs/CONST';
import GithubUtils from '@github/libs/GithubUtils';
import {isEmptyObject} from '@src/types/utils/EmptyObject';

const run = function () {
const run = function (): Promise<void> {
const issueNumber = Number(core.getInput('ISSUE_NUMBER', {required: true}));

console.log(`Fetching issue number ${issueNumber}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import core from '@actions/core';
import * as core from '@actions/core';
import format from 'date-fns/format';
import fs from 'fs';
import CONST from '@github/libs/CONST';
Expand Down
27 changes: 25 additions & 2 deletions .github/actions/javascript/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14181,11 +14181,34 @@ function wrappy (fn, cb) {

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const core_1 = __importDefault(__nccwpck_require__(2186));
const core = __importStar(__nccwpck_require__(2186));
const format_1 = __importDefault(__nccwpck_require__(2168));
const fs_1 = __importDefault(__nccwpck_require__(7147));
const CONST_1 = __importDefault(__nccwpck_require__(9873));
Expand Down Expand Up @@ -14299,7 +14322,7 @@ async function run() {
}
catch (err) {
console.error('An unknown error occurred!', err);
core_1.default.setFailed(err);
core.setFailed(err);
}
}
if (require.main === require.cache[eval('__filename')]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import core from '@actions/core';
import * as core from '@actions/core';
import github from '@actions/github';
import {getJSONInput} from '@github/libs/ActionUtils';
import GithubUtils from '@github/libs/GithubUtils';
Expand Down
31 changes: 27 additions & 4 deletions .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11470,18 +11470,41 @@ function wrappy (fn, cb) {

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
const core_1 = __importDefault(__nccwpck_require__(2186));
const core = __importStar(__nccwpck_require__(2186));
const github_1 = __importDefault(__nccwpck_require__(5438));
const ActionUtils_1 = __nccwpck_require__(6981);
const GithubUtils_1 = __importDefault(__nccwpck_require__(9296));
const GitUtils_1 = __importDefault(__nccwpck_require__(1547));
async function run() {
try {
const inputTag = core_1.default.getInput('TAG', { required: true });
const inputTag = core.getInput('TAG', { required: true });
const isProductionDeploy = (0, ActionUtils_1.getJSONInput)('IS_PRODUCTION_DEPLOY', { required: false }, false);
const deployEnv = isProductionDeploy ? 'production' : 'staging';
console.log(`Looking for PRs deployed to ${deployEnv} in ${inputTag}...`);
Expand All @@ -11497,11 +11520,11 @@ async function run() {
console.log(`Looking for PRs deployed to ${deployEnv} between ${priorTag} and ${inputTag}`);
const prList = await GitUtils_1.default.getPullRequestsMergedBetween(priorTag ?? '', inputTag);
console.log('Found the pull request list: ', prList);
core_1.default.setOutput('PR_LIST', prList);
core.setOutput('PR_LIST', prList);
}
catch (error) {
console.error(error.message);
core_1.default.setFailed(error);
core.setFailed(error);
}
}
if (require.main === require.cache[eval('__filename')]) {
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001045907
versionName "1.4.59-7"
versionCode 1001045909
versionName "1.4.59-9"
}

flavorDimensions "default"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.4.59.7</string>
<string>1.4.59.9</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.59.7</string>
<string>1.4.59.9</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>1.4.59</string>
<key>CFBundleVersion</key>
<string>1.4.59.7</string>
<string>1.4.59.9</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
4 changes: 2 additions & 2 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
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.4.59-7",
"version": "1.4.59-9",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
2 changes: 1 addition & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,7 @@ const CONST = {
},
COLLECTION_KEYS: {
DESCRIPTION: 'description',
REIMBURSER_EMAIL: 'reimburserEmail',
REIMBURSER: 'reimburser',
REIMBURSEMENT_CHOICE: 'reimbursementChoice',
APPROVAL_MODE: 'approvalMode',
AUTOREPORTING: 'autoReporting',
Expand Down
6 changes: 3 additions & 3 deletions src/components/AddressForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ function AddressForm({

ErrorUtils.addErrorMessage(errors, 'firstName', 'bankAccount.error.firstName');

if (countrySpecificZipRegex && values.zipPostCode) {
if (!countrySpecificZipRegex.test(values.zipPostCode.trim().toUpperCase())) {
if (ValidationUtils.isRequiredFulfilled(values.zipPostCode.trim())) {
if (countrySpecificZipRegex) {
if (!countrySpecificZipRegex.test(values.zipPostCode?.trim().toUpperCase())) {
if (ValidationUtils.isRequiredFulfilled(values.zipPostCode?.trim())) {
errors.zipPostCode = ['privatePersonalDetails.error.incorrectZipFormat', countryZipFormat];
} else {
errors.zipPostCode = 'common.error.fieldRequired';
Expand Down
4 changes: 2 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1336,8 +1336,8 @@ function isPayer(session: OnyxEntry<Session>, iouReport: OnyxEntry<Report>) {
const isManager = iouReport?.managerID === session?.accountID;
if (isPaidGroupPolicy(iouReport)) {
if (policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES) {
const isReimburser = session?.email === policy?.reimburserEmail;
return (!policy?.reimburserEmail || isReimburser) && (isApproved || isManager);
const isReimburser = session?.email === policy?.achAccount?.reimburser;
return (!policy?.achAccount?.reimburser || isReimburser) && (isApproved || isManager);
}
if (policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL) {
return isAdmin && (isApproved || isManager);
Expand Down
28 changes: 12 additions & 16 deletions src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,18 +675,17 @@ function setWorkspaceApprovalMode(policyID: string, approver: string, approvalMo
API.write(WRITE_COMMANDS.SET_WORKSPACE_APPROVAL_MODE, params, {optimisticData, failureData, successData});
}

function setWorkspacePayer(policyID: string, reimburserEmail: string, reimburserAccountID: number) {
function setWorkspacePayer(policyID: string, reimburserEmail: string) {
const policy = getPolicy(policyID);

const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
reimburserEmail,
reimburserAccountID,
errorFields: {reimburserEmail: null},
pendingFields: {reimburserEmail: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE},
achAccount: {reimburser: reimburserEmail},
errorFields: {reimburser: null},
pendingFields: {reimburser: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE},
},
},
];
Expand All @@ -696,8 +695,8 @@ function setWorkspacePayer(policyID: string, reimburserEmail: string, reimburser
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
errorFields: {reimburserEmail: null},
pendingFields: {reimburserEmail: null},
errorFields: {reimburser: null},
pendingFields: {reimburser: null},
},
},
];
Expand All @@ -707,10 +706,9 @@ function setWorkspacePayer(policyID: string, reimburserEmail: string, reimburser
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
reimburserEmail: policy.reimburserEmail ?? null,
reimburserAccountID: policy.reimburserAccountID ?? null,
errorFields: {reimburserEmail: ErrorUtils.getMicroSecondOnyxError('workflowsPayerPage.genericErrorMessage')},
pendingFields: {reimburserEmail: null},
achAccount: {reimburser: policy.achAccount?.reimburser ?? null},
errorFields: {reimburser: ErrorUtils.getMicroSecondOnyxError('workflowsPayerPage.genericErrorMessage')},
pendingFields: {reimburser: null},
},
},
];
Expand All @@ -724,7 +722,7 @@ function clearPolicyErrorField(policyID: string, fieldName: string) {
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {errorFields: {[fieldName]: null}});
}

function setWorkspaceReimbursement(policyID: string, reimbursementChoice: ValueOf<typeof CONST.POLICY.REIMBURSEMENT_CHOICES>, reimburserAccountID: number, reimburserEmail: string) {
function setWorkspaceReimbursement(policyID: string, reimbursementChoice: ValueOf<typeof CONST.POLICY.REIMBURSEMENT_CHOICES>, reimburserEmail: string) {
const policy = getPolicy(policyID);

const optimisticData: OnyxUpdate[] = [
Expand All @@ -733,8 +731,7 @@ function setWorkspaceReimbursement(policyID: string, reimbursementChoice: ValueO
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
reimbursementChoice,
reimburserAccountID,
reimburserEmail,
achAccount: {reimburser: reimburserEmail},
errorFields: {reimbursementChoice: null},
pendingFields: {reimbursementChoice: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE},
},
Expand All @@ -758,8 +755,7 @@ function setWorkspaceReimbursement(policyID: string, reimbursementChoice: ValueO
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
reimbursementChoice: policy.reimbursementChoice ?? null,
reimburserAccountID: policy.reimburserAccountID ?? null,
reimburserEmail: policy.reimburserEmail ?? null,
achAccount: {reimburser: policy.achAccount?.reimburser ?? null},
errorFields: {reimbursementChoice: ErrorUtils.getMicroSecondOnyxError('common.genericErrorMessage')},
pendingFields: {reimbursementChoice: null},
},
Expand Down
3 changes: 1 addition & 2 deletions src/pages/AddPersonalBankAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Navigation from '@libs/Navigation/Navigation';
import * as BankAccounts from '@userActions/BankAccounts';
import * as PaymentMethods from '@userActions/PaymentMethods';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {PersonalBankAccount, PlaidData} from '@src/types/onyx';

type AddPersonalBankAccountPageWithOnyxProps = {
Expand Down Expand Up @@ -51,7 +50,7 @@ function AddPersonalBankAccountPage({personalBankAccount, plaidData}: AddPersona
} else if (shouldContinue && onSuccessFallbackRoute) {
PaymentMethods.continueSetup(onSuccessFallbackRoute);
} else {
Navigation.goBack(ROUTES.SETTINGS_WALLET);
Navigation.goBack();
}
},
[personalBankAccount],
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceInitialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, policyMembers, r
icon: Expensicons.Workflows,
action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_WORKFLOWS.getRoute(policyID)))),
routeName: SCREENS.WORKSPACE.WORKFLOWS,
brickRoadIndicator: !isEmptyObject(policy?.errorFields?.reimburserEmail ?? {}) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
brickRoadIndicator: !isEmptyObject(policy?.errorFields?.reimburser ?? {}) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
});
}

Expand Down
Loading

0 comments on commit ce6cf3f

Please sign in to comment.