Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/50699 loading state for provisioning policy #51407

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
118bb20
feat: add translations
koko57 Oct 17, 2024
12598bd
Merge branch 'main' into feat/50699-loading-state-for-provisioning-po…
koko57 Oct 21, 2024
60322dc
feat: add isLoading and errors to the requests configuring and updati…
koko57 Oct 21, 2024
25c894f
Merge branch 'main' into feat/50699-loading-state-for-provisioning-po…
koko57 Oct 22, 2024
f891ec6
feat: do not navigate the user to issue new card flow instantly
koko57 Oct 22, 2024
c6bed03
feat: style loading state, change translation
koko57 Oct 22, 2024
3dc1758
Merge branch 'main' into feat/50699-loading-state-for-provisioning-po…
koko57 Oct 23, 2024
e7d6b96
feat: create a separate component for loading state
koko57 Oct 23, 2024
a6fe42b
feat: add cardOnWaitlist onyx key
koko57 Oct 23, 2024
7fffc4d
feat: refactor component, get proper image and translations
koko57 Oct 23, 2024
d715cc7
Merge branch 'main' into feat/50699-loading-state-for-provisioning-po…
koko57 Oct 24, 2024
adb0384
fix: fix animation issue, add success state
koko57 Oct 24, 2024
41d295c
Merge branch 'main' into feat/50699-loading-state-for-provisioning-po…
koko57 Oct 28, 2024
c9d3125
Merge branch 'main' into feat/50699-loading-state-for-provisioning-po…
koko57 Oct 29, 2024
b91a9b1
Merge branch 'main' into feat/50699-loading-state-for-provisioning-po…
koko57 Oct 29, 2024
f5ed29e
Merge branch 'main' into feat/50699-loading-state-for-provisioning-po…
koko57 Oct 30, 2024
95fa96a
fix: amend nvp_expensify_onCardWaitlist_ key
koko57 Oct 30, 2024
c9d21a4
Merge branch 'main' into feat/50699-loading-state-for-provisioning-po…
koko57 Oct 30, 2024
09af7b2
fix: remove duplicated export
koko57 Oct 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions assets/images/simple-illustrations/emptystate__puzzlepieces.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2581,6 +2581,11 @@ const CONST = {
INDIVIDUAL: 'individual',
NONE: 'none',
},
VERIFICATION_STATE: {
LOADING: 'loading',
VERIFIED: 'verified',
ON_WAITLIST: 'onWaitlist',
},
STATE: {
STATE_NOT_ISSUED: 2,
OPEN: 3,
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Illustrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import ThreeLeggedLaptopWoman from '@assets/images/product-illustrations/three_l
import ToddBehindCloud from '@assets/images/product-illustrations/todd-behind-cloud.svg';
import ToddWithPhones from '@assets/images/product-illustrations/todd-with-phones.svg';
import BigVault from '@assets/images/simple-illustrations/emptystate__big-vault.svg';
import Puzzle from '@assets/images/simple-illustrations/emptystate__puzzlepieces.svg';
import Abacus from '@assets/images/simple-illustrations/simple-illustration__abacus.svg';
import Accounting from '@assets/images/simple-illustrations/simple-illustration__accounting.svg';
import Alert from '@assets/images/simple-illustrations/simple-illustration__alert.svg';
Expand Down Expand Up @@ -200,6 +201,7 @@ export {
TrashCan,
TeleScope,
Profile,
Puzzle,
PalmTree,
LockClosed,
Gears,
Expand Down
10 changes: 10 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3212,6 +3212,16 @@ const translations = {
issuedCardNoShippingDetails: ({assignee}: AssigneeParams) => `issued ${assignee} an Expensify Card! The card will be shipped once shipping details are added.`,
issuedCardVirtual: ({assignee, link}: IssueVirtualCardParams) => `issued ${assignee} a virtual ${link}! The card can be used right away.`,
addedShippingDetails: ({assignee}: AssigneeParams) => `${assignee} added shipping details. Expensify Card will arrive in 2-3 business days.`,
verifyingHeader: 'Verifying',
bankAccountVerifiedHeader: 'Bank account verified',
verifyingBankAccount: 'Verifying bank account...',
verifyingBankAccountDescription: 'Please wait while we confirm that this account can be used to issue Expensify Cards.',
bankAccountVerified: 'Bank account verified!',
bankAccountVerifiedDescription: 'You can now issue Expensify Cards to your workspace members.',
oneMoreStep: 'One more step...',
oneMoreStepDescription: 'Looks like we need to manually verify your bank account. Please head on over to Concierge where your instructions are waiting for you.',
gotIt: 'Got it',
goToConcierge: 'Go to Concierge',
},
categories: {
deleteCategories: 'Delete categories',
Expand Down
10 changes: 10 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3253,6 +3253,16 @@ const translations = {
issuedCardNoShippingDetails: ({assignee}: AssigneeParams) => `¡emitió a ${assignee} una Tarjeta Expensify! La tarjeta se enviará una vez que se agreguen los detalles de envío.`,
issuedCardVirtual: ({assignee, link}: IssueVirtualCardParams) => `¡emitió a ${assignee} una ${link} virtual! La tarjeta puede utilizarse inmediatamente.`,
addedShippingDetails: ({assignee}: AssigneeParams) => `${assignee} agregó los detalles de envío. La Tarjeta Expensify llegará en 2-3 días hábiles.`,
verifyingHeader: 'Verificando',
bankAccountVerifiedHeader: 'Cuenta bancaria verificada',
verifyingBankAccount: 'Verificando cuenta bancaria...',
verifyingBankAccountDescription: 'Por favor, espere mientras confirmamos que esta cuenta se puede utilizar para emitir tarjetas Expensify.',
bankAccountVerified: '¡Cuenta bancaria verificada!',
bankAccountVerifiedDescription: 'Ahora puedes emitir tarjetas de Expensify para los miembros de tu espacio de trabajo.',
oneMoreStep: 'Un paso más',
oneMoreStepDescription: 'Parece que tenemos que verificar manualmente tu cuenta bancaria. Dirígete a Concierge, donde te esperan las instrucciones.',
gotIt: 'Entendido',
goToConcierge: 'Ir a Concierge',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask for reviewing translations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
categories: {
deleteCategories: 'Eliminar categorías',
Expand Down
46 changes: 45 additions & 1 deletion src/libs/actions/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ function updateSettlementAccount(workspaceAccountID: number, policyID: string, s
key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
value: {
paymentBankAccountID: settlementBankAccountID,
isLoading: true,
},
},
];
Expand All @@ -310,6 +311,7 @@ function updateSettlementAccount(workspaceAccountID: number, policyID: string, s
key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
value: {
paymentBankAccountID: settlementBankAccountID,
isLoading: false,
},
},
];
Expand All @@ -320,6 +322,8 @@ function updateSettlementAccount(workspaceAccountID: number, policyID: string, s
key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
value: {
paymentBankAccountID: currentSettlementBankAccountID,
isLoading: false,
errors: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage'),
},
},
];
Expand Down Expand Up @@ -614,12 +618,52 @@ function configureExpensifyCardsForPolicy(policyID: string, bankAccountID?: numb
return;
}

const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);

const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
value: {
isLoading: true,
isSuccess: false,
},
},
];

const successData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
value: {
isLoading: false,
isSuccess: true,
},
},
];

const failureData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`,
value: {
isLoading: false,
errors: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage'),
isSuccess: false,
},
},
];

const parameters = {
policyID,
bankAccountID,
};

API.write(WRITE_COMMANDS.CONFIGURE_EXPENSIFY_CARDS_FOR_POLICY, parameters);
API.write(WRITE_COMMANDS.CONFIGURE_EXPENSIFY_CARDS_FOR_POLICY, parameters, {
optimisticData,
successData,
failureData,
});
}

function issueExpensifyCard(policyID: string, feedCountry: string, data?: IssueNewCardData) {
Expand Down
Loading
Loading