Skip to content

Commit

Permalink
Merge branch 'main' into fix/workspaces-offline-indicator-padding
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Mar 19, 2024
2 parents 59f0b06 + 6b7f01f commit c0e7bae
Show file tree
Hide file tree
Showing 28 changed files with 323 additions and 408 deletions.
4 changes: 4 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,10 @@ const CONST = {
TERMS_URL: `${USE_EXPENSIFY_URL}/terms`,
PRIVACY_URL: `${USE_EXPENSIFY_URL}/privacy`,
LICENSES_URL: `${USE_EXPENSIFY_URL}/licenses`,
ACH_TERMS_URL: `${USE_EXPENSIFY_URL}/achterms`,
WALLET_AGREEMENT_URL: `${USE_EXPENSIFY_URL}/walletagreement`,
HELP_LINK_URL: `${USE_EXPENSIFY_URL}/usa-patriot-act`,
ELECTRONIC_DISCLOSURES_URL: `${USE_EXPENSIFY_URL}/esignagreement`,
GITHUB_RELEASE_URL: 'https://api.github.com/repos/expensify/app/releases/latest',
ADD_SECONDARY_LOGIN_URL: encodeURI('settings?param={"section":"account","openModal":"secondaryLogin"}'),
MANAGE_CARDS_URL: 'domain_companycards',
Expand Down
3 changes: 3 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ const ONYXKEYS = {
EXIT_SURVEY_REASON_FORM_DRAFT: 'exitSurveyReasonFormDraft',
EXIT_SURVEY_RESPONSE_FORM: 'exitSurveyResponseForm',
EXIT_SURVEY_RESPONSE_FORM_DRAFT: 'exitSurveyResponseFormDraft',
WALLET_ADDITIONAL_DETAILS: 'walletAdditionalDetails',
WALLET_ADDITIONAL_DETAILS_DRAFT: 'walletAdditionalDetailsDraft',
POLICY_TAG_NAME_FORM: 'policyTagNameForm',
POLICY_TAG_NAME_FORM_DRAFT: 'policyTagNameFormDraft',
WORKSPACE_NEW_TAX_FORM: 'workspaceNewTaxForm',
Expand Down Expand Up @@ -462,6 +464,7 @@ type OnyxFormValuesMapping = {
[ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM]: FormTypes.ReimbursementAccountForm;
[ONYXKEYS.FORMS.PERSONAL_BANK_ACCOUNT]: FormTypes.PersonalBankAccountForm;
[ONYXKEYS.FORMS.WORKSPACE_DESCRIPTION_FORM]: FormTypes.WorkspaceDescriptionForm;
[ONYXKEYS.FORMS.WALLET_ADDITIONAL_DETAILS]: FormTypes.AdditionalDetailStepForm;
[ONYXKEYS.FORMS.POLICY_TAG_NAME_FORM]: FormTypes.PolicyTagNameForm;
[ONYXKEYS.FORMS.WORKSPACE_NEW_TAX_FORM]: FormTypes.WorkspaceNewTaxForm;
[ONYXKEYS.FORMS.POLICY_CREATE_DISTANCE_RATE_FORM]: FormTypes.PolicyCreateDistanceRateForm;
Expand Down
2 changes: 1 addition & 1 deletion src/components/withCurrentUserPersonalDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ export default function <TProps extends WithCurrentUserPersonalDetailsProps, TRe
}

export {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps};
export type {WithCurrentUserPersonalDetailsProps};
export type {WithCurrentUserPersonalDetailsProps, CurrentUserPersonalDetails};
1 change: 1 addition & 0 deletions src/libs/API/parameters/OpenPlaidBankLoginParams.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
type OpenPlaidBankLoginParams = {
redirectURI: string | undefined;
androidPackage?: string;
allowDebit: boolean;
bankAccountID: number;
};
Expand Down
3 changes: 2 additions & 1 deletion src/libs/PersonalDetailsUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Str from 'expensify-common/lib/str';
import type {OnyxEntry, OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {CurrentUserPersonalDetails} from '@components/withCurrentUserPersonalDetails';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {PersonalDetails, PersonalDetailsList, PrivatePersonalDetails} from '@src/types/onyx';
Expand Down Expand Up @@ -249,7 +250,7 @@ function createDisplayName(login: string, passedPersonalDetails: Pick<PersonalDe
* If the login is the same as the displayName, then they don't exist,
* so we return empty strings instead.
*/
function extractFirstAndLastNameFromAvailableDetails({login, displayName, firstName, lastName}: PersonalDetails): FirstAndLastName {
function extractFirstAndLastNameFromAvailableDetails({login, displayName, firstName, lastName}: CurrentUserPersonalDetails): FirstAndLastName {
// It's possible for firstName to be empty string, so we must use "||" to consider lastName instead.
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if (firstName || lastName) {
Expand Down
3 changes: 2 additions & 1 deletion src/libs/actions/Plaid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import ONYXKEYS from '@src/ONYXKEYS';
*/
function openPlaidBankLogin(allowDebit: boolean, bankAccountID: number) {
// redirect_uri needs to be in kebab case convention because that's how it's passed to the backend
const {redirectURI} = getPlaidLinkTokenParameters();
const {redirectURI, androidPackage} = getPlaidLinkTokenParameters();

const params: OpenPlaidBankLoginParams = {
redirectURI,
androidPackage,
allowDebit,
bankAccountID,
};
Expand Down
2 changes: 2 additions & 0 deletions src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ function deleteWorkspace(policyID: string, policyName: string) {
statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
hasDraft: false,
oldPolicyName: allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]?.name ?? '',
policyName: '',
},
});

Expand Down Expand Up @@ -368,6 +369,7 @@ function deleteWorkspace(policyID: string, policyName: string) {
statusNum,
hasDraft,
oldPolicyName,
policyName: report?.policyName,
},
});
});
Expand Down
10 changes: 5 additions & 5 deletions src/libs/actions/Wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function openOnfidoFlow() {
API.read(READ_COMMANDS.OPEN_ONFIDO_FLOW, {}, {optimisticData, finallyData});
}

function setAdditionalDetailsQuestions(questions: WalletAdditionalQuestionDetails[], idNumber: string) {
function setAdditionalDetailsQuestions(questions: WalletAdditionalQuestionDetails[] | null, idNumber?: string) {
Onyx.merge(ONYXKEYS.WALLET_ADDITIONAL_DETAILS, {questions, idNumber});
}

Expand All @@ -79,7 +79,7 @@ function updatePersonalDetails(personalDetails: UpdatePersonalDetailsForWalletPa
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.WALLET_ADDITIONAL_DETAILS,
key: ONYXKEYS.FORMS.WALLET_ADDITIONAL_DETAILS,
value: {
isLoading: true,
errors: null,
Expand All @@ -91,7 +91,7 @@ function updatePersonalDetails(personalDetails: UpdatePersonalDetailsForWalletPa
const finallyData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.WALLET_ADDITIONAL_DETAILS,
key: ONYXKEYS.FORMS.WALLET_ADDITIONAL_DETAILS,
value: {
isLoading: false,
},
Expand Down Expand Up @@ -232,7 +232,7 @@ function answerQuestionsForWallet(answers: WalletQuestionAnswer[], idNumber: str
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.WALLET_ADDITIONAL_DETAILS,
key: ONYXKEYS.FORMS.WALLET_ADDITIONAL_DETAILS,
value: {
isLoading: true,
},
Expand All @@ -242,7 +242,7 @@ function answerQuestionsForWallet(answers: WalletQuestionAnswer[], idNumber: str
const finallyData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.WALLET_ADDITIONAL_DETAILS,
key: ONYXKEYS.FORMS.WALLET_ADDITIONAL_DETAILS,
value: {
isLoading: false,
},
Expand Down
72 changes: 0 additions & 72 deletions src/pages/EnablePayments/ActivateStep.js

This file was deleted.

59 changes: 59 additions & 0 deletions src/pages/EnablePayments/ActivateStep.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import ConfirmationPage from '@components/ConfirmationPage';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import LottieAnimations from '@components/LottieAnimations';
import useLocalize from '@hooks/useLocalize';
import * as PaymentMethods from '@userActions/PaymentMethods';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {UserWallet, WalletTerms} from '@src/types/onyx';

type ActivateStepOnyxProps = {
/** Information about the user accepting the terms for payments */
walletTerms: OnyxEntry<WalletTerms>;
};

type ActivateStepProps = ActivateStepOnyxProps & {
/** The user's wallet */
userWallet: OnyxEntry<UserWallet>;
};

function ActivateStep({userWallet, walletTerms}: ActivateStepProps) {
const {translate} = useLocalize();
const isActivatedWallet = userWallet?.tierName && [CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM].some((name) => name === userWallet.tierName);

const animation = isActivatedWallet ? LottieAnimations.Fireworks : LottieAnimations.ReviewingBankInfo;
let continueButtonText = '';

if (walletTerms?.chatReportID) {
continueButtonText = translate('activateStep.continueToPayment');
} else if (walletTerms?.source === CONST.KYC_WALL_SOURCE.ENABLE_WALLET) {
continueButtonText = translate('common.continue');
} else {
continueButtonText = translate('activateStep.continueToTransfer');
}

return (
<>
<HeaderWithBackButton title={translate('activateStep.headerTitle')} />
<ConfirmationPage
animation={animation}
heading={translate(`activateStep.${isActivatedWallet ? 'activated' : 'checkBackLater'}Title`)}
description={translate(`activateStep.${isActivatedWallet ? 'activated' : 'checkBackLater'}Message`)}
shouldShowButton={isActivatedWallet}
buttonText={continueButtonText}
onButtonPress={() => PaymentMethods.continueSetup()}
/>
</>
);
}

ActivateStep.displayName = 'ActivateStep';

export default withOnyx<ActivateStepProps, ActivateStepOnyxProps>({
walletTerms: {
key: ONYXKEYS.WALLET_TERMS,
},
})(ActivateStep);
Loading

0 comments on commit c0e7bae

Please sign in to comment.