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

[No QA] Card Assignment Flow #48278

Merged
merged 30 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
faa7b95
feat: prepare assign-card route
koko57 Aug 23, 2024
1812f74
fix: resolve conflicts
koko57 Aug 23, 2024
871933c
feat: add translations
koko57 Aug 23, 2024
cc0aaee
feat: create onyx key for the form, create form steps
koko57 Aug 26, 2024
56fe0b6
feat: create company cards actions, handle back button press
koko57 Aug 27, 2024
83b72f5
feat: add next button to assignee step
koko57 Aug 27, 2024
a6eb447
Merge branch 'main' into feat/47377-card-assignement-flow
koko57 Aug 27, 2024
ee82902
feat: create transaction start date options
koko57 Aug 27, 2024
e01947b
fix: resolve conflicts
koko57 Aug 28, 2024
639a4e0
feat: create card list item
koko57 Aug 28, 2024
e70b932
feat: save data in Onyx and show it in confirmation step
koko57 Aug 28, 2024
8546924
feat: transaction start date page
koko57 Aug 29, 2024
5ca5edb
fix: go back to confirmation page when done editing or clicking back …
koko57 Aug 29, 2024
00df540
fix: minor fix
koko57 Aug 29, 2024
b825952
feat: focus initially selected item
koko57 Aug 29, 2024
2dd26ca
feat: empty cards screen for card selection step
koko57 Aug 29, 2024
ac9cd99
feat: validation for card selection and assignee steps
koko57 Aug 29, 2024
d777f70
feat: clear Onyx after assigning card
koko57 Aug 29, 2024
75e365a
fix: show step header
koko57 Aug 30, 2024
8d88cb0
fix: resolve conflicts
koko57 Aug 30, 2024
e35b89c
fix: lint
koko57 Aug 30, 2024
c76bc5c
fix: resolve conflicts
koko57 Sep 2, 2024
8811dd3
fix: style fixes
koko57 Sep 2, 2024
a097e7c
fix: minor fixes
koko57 Sep 2, 2024
a8491af
fix: spanish translations
koko57 Sep 4, 2024
ab16106
fix: resolve conflicts
koko57 Sep 4, 2024
f87eb6d
fix: typecheck
koko57 Sep 4, 2024
afe6112
fix: revert unnecessarily changed files
koko57 Sep 4, 2024
ace11f4
fix: submit button styles
koko57 Sep 4, 2024
034349a
fix: lint
koko57 Sep 4, 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
28 changes: 28 additions & 0 deletions assets/images/product-illustrations/broken-magnifying-glass.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2291,6 +2291,17 @@ const CONST = {
VISA: 'vcf',
AMEX: 'gl1025',
},
STEP_NAMES: ['1', '2', '3', '4'],
STEP: {
ASSIGNEE: 'Assignee',
CARD: 'Card',
TRANSACTION_START_DATE: 'TransactionStartDate',
CONFIRMATION: 'Confirmation',
},
TRANSACTION_START_DATE_OPTIONS: {
FROM_BEGINNING: 'fromBeginning',
CUSTOM: 'custom',
},
},
EXPENSIFY_CARD: {
BANK: 'Expensify Card',
Expand Down
7 changes: 7 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ const ONYXKEYS = {
/** Stores the information about the state of issuing a new card */
ISSUE_NEW_EXPENSIFY_CARD: 'issueNewExpensifyCard',

/** Stores the information about the state of assigning a company card */
ASSIGN_CARD: 'assignCard',

/** Stores the information if mobile selection mode is active */
MOBILE_SELECTION_MODE: 'mobileSelectionMode',

Expand Down Expand Up @@ -615,6 +618,8 @@ const ONYXKEYS = {
SUBSCRIPTION_SIZE_FORM_DRAFT: 'subscriptionSizeFormDraft',
ISSUE_NEW_EXPENSIFY_CARD_FORM: 'issueNewExpensifyCard',
ISSUE_NEW_EXPENSIFY_CARD_FORM_DRAFT: 'issueNewExpensifyCardDraft',
ASSIGN_CARD_FORM: 'assignCard',
ASSIGN_CARD_FORM_DRAFT: 'assignCardDraft',
EDIT_EXPENSIFY_CARD_NAME_FORM: 'editExpensifyCardName',
EDIT_EXPENSIFY_CARD_NAME_DRAFT_FORM: 'editExpensifyCardNameDraft',
EDIT_EXPENSIFY_CARD_LIMIT_FORM: 'editExpensifyCardLimit',
Expand Down Expand Up @@ -712,6 +717,7 @@ type OnyxFormValuesMapping = {
[ONYXKEYS.FORMS.NEW_CHAT_NAME_FORM]: FormTypes.NewChatNameForm;
[ONYXKEYS.FORMS.SUBSCRIPTION_SIZE_FORM]: FormTypes.SubscriptionSizeForm;
[ONYXKEYS.FORMS.ISSUE_NEW_EXPENSIFY_CARD_FORM]: FormTypes.IssueNewExpensifyCardForm;
[ONYXKEYS.FORMS.ASSIGN_CARD_FORM]: FormTypes.AssignCardForm;
[ONYXKEYS.FORMS.EDIT_EXPENSIFY_CARD_NAME_FORM]: FormTypes.EditExpensifyCardNameForm;
[ONYXKEYS.FORMS.EDIT_EXPENSIFY_CARD_LIMIT_FORM]: FormTypes.EditExpensifyCardLimitForm;
[ONYXKEYS.FORMS.SAGE_INTACCT_CREDENTIALS_FORM]: FormTypes.SageIntactCredentialsForm;
Expand Down Expand Up @@ -908,6 +914,7 @@ type OnyxValuesMapping = {
[ONYXKEYS.NVP_TRAVEL_SETTINGS]: OnyxTypes.TravelSettings;
[ONYXKEYS.REVIEW_DUPLICATES]: OnyxTypes.ReviewDuplicates;
[ONYXKEYS.ISSUE_NEW_EXPENSIFY_CARD]: OnyxTypes.IssueNewCard;
[ONYXKEYS.ASSIGN_CARD]: OnyxTypes.AssignCard;
[ONYXKEYS.MOBILE_SELECTION_MODE]: OnyxTypes.MobileSelectionMode;
[ONYXKEYS.NVP_FIRST_DAY_FREE_TRIAL]: string;
[ONYXKEYS.NVP_LAST_DAY_FREE_TRIAL]: string;
Expand Down
4 changes: 4 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,10 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/company-cards',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/company-cards` as const,
},
WORKSPACE_COMPANY_CARDS_ASSIGN_CARD: {
route: 'settings/workspaces/:policyID/company-cards/:feed/assign-card',
getRoute: (policyID: string, feed: string) => `settings/workspaces/${policyID}/company-cards/${feed}/assign-card` as const,
},
WORKSPACE_EXPENSIFY_CARD_DETAILS: {
route: 'settings/workspaces/:policyID/expensify-card/:cardID',
getRoute: (policyID: string, cardID: string, backTo?: string) => getUrlWithBackToParam(`settings/workspaces/${policyID}/expensify-card/${cardID}`, backTo),
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ const SCREENS = {
RATE_AND_UNIT_RATE: 'Workspace_RateAndUnit_Rate',
RATE_AND_UNIT_UNIT: 'Workspace_RateAndUnit_Unit',
COMPANY_CARDS: 'Workspace_CompanyCards',
COMPANY_CARDS_ASSIGN_CARD: 'Workspace_CompanyCards_AssignCard',
COMPANY_CARDS_SELECT_FEED: 'Workspace_CompanyCards_Select_Feed',
COMPANY_CARDS_SETTINGS: 'Workspace_CompanyCards_Settings',
COMPANY_CARDS_SETTINGS_FEED_NAME: 'Workspace_CompanyCards_Settings_Feed_Name',
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 @@ -9,6 +9,7 @@ import Abracadabra from '@assets/images/product-illustrations/abracadabra.svg';
import BankArrowPink from '@assets/images/product-illustrations/bank-arrow--pink.svg';
import BankMouseGreen from '@assets/images/product-illustrations/bank-mouse--green.svg';
import BankUserGreen from '@assets/images/product-illustrations/bank-user--green.svg';
import BrokenMagnifyingGlass from '@assets/images/product-illustrations/broken-magnifying-glass.svg';
import ConciergeBlue from '@assets/images/product-illustrations/concierge--blue.svg';
import ConciergeExclamation from '@assets/images/product-illustrations/concierge--exclamation.svg';
import CreditCardsBlue from '@assets/images/product-illustrations/credit-cards--blue.svg';
Expand Down Expand Up @@ -121,6 +122,7 @@ export {
BankMouseGreen,
BankUserGreen,
BigRocket,
BrokenMagnifyingGlass,
ChatBubbles,
CoffeeMug,
ConciergeBlue,
Expand Down
58 changes: 58 additions & 0 deletions src/components/InteractiveStepWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from 'react';
import {View} from 'react-native';
import useThemeStyles from '@hooks/useThemeStyles';
import CONST from '@src/CONST';
import HeaderWithBackButton from './HeaderWithBackButton';
import InteractiveStepSubHeader from './InteractiveStepSubHeader';
import ScreenWrapper from './ScreenWrapper';

type InteractiveStepWrapperProps = {
// Step content
children: React.ReactNode;

// ID of the wrapper
wrapperID: string;

// Function to handle back button press
handleBackButtonPress: () => void;

// Title of the back button header
headerTitle: string;

// Index of the highlighted step
startStepIndex?: number;

// Array of step names
stepNames?: readonly string[];
};

function InteractiveStepWrapper({children, wrapperID, handleBackButtonPress, headerTitle, startStepIndex, stepNames}: InteractiveStepWrapperProps) {
const styles = useThemeStyles();

return (
<ScreenWrapper
testID={wrapperID}
includeSafeAreaPaddingBottom={false}
shouldEnablePickerAvoiding={false}
shouldEnableMaxHeight
>
<HeaderWithBackButton
title={headerTitle}
onBackButtonPress={handleBackButtonPress}
/>
{stepNames && (
<View style={[styles.ph5, styles.mb5, styles.mt3, {height: CONST.BANK_ACCOUNT.STEPS_HEADER_HEIGHT}]}>
<InteractiveStepSubHeader
startStepIndex={startStepIndex}
stepNames={stepNames}
/>
</View>
)}
{children}
</ScreenWrapper>
);
}

InteractiveStepWrapper.displayName = 'InteractiveStepWrapper';

export default InteractiveStepWrapper;
19 changes: 19 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
AlreadySignedInParams,
ApprovalWorkflowErrorParams,
ApprovedAmountParams,
AssignCardParams,
BeginningOfChatHistoryAdminRoomPartOneParams,
BeginningOfChatHistoryAnnounceRoomPartOneParams,
BeginningOfChatHistoryAnnounceRoomPartTwo,
Expand Down Expand Up @@ -2792,6 +2793,24 @@
assignCard: 'Assign card',
cardNumber: 'Card number',
customFeed: 'Custom feed',
assignCard: 'Assign card',

Check failure on line 2796 in src/languages/en.ts

View workflow job for this annotation

GitHub Actions / typecheck

An object literal cannot have multiple properties with the same name.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assignCard: 'Assign card',

whoNeedsCardAssigned: 'Who needs a card assigned?',
chooseCard: 'Choose a card',
chooseCardFor: ({assignee, feed}: AssignCardParams) => `Choose a card for ${assignee} from the ${feed} cards feed.`,
noActiveCards: 'No active cards on this feed',
somethingMightBeBroken: 'Or something might be broken. Either way, if you have any questions, just',
contactConcierge: 'contact Concierge',
chooseTransactionStartDate: 'Choose a transaction start date',
startDateDescription: 'We will import all transaction from this date onwards. If no date is specified, we’ll go as far back as your bank allows.',
fromTheBeginning: 'From the beginning',
customStartDate: 'Custom start date',
letsDoubleCheck: 'Let’s double check that everything looks right.',
confirmationDescription: 'We’ll begin importing transactions immediately.',
cardholder: 'Cardholder',
card: 'Card',
startTransactionDate: 'Start transaction date',
cardName: 'Card name',
assignedYouCard: (assigner: string) => `${assigner} assigned you a company card! Imported transactions will appear in this chat.`,
},
expensifyCard: {
issueAndManageCards: 'Issue and manage your Expensify Cards',
Expand Down
19 changes: 19 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
AlreadySignedInParams,
ApprovalWorkflowErrorParams,
ApprovedAmountParams,
AssignCardParams,
BeginningOfChatHistoryAdminRoomPartOneParams,
BeginningOfChatHistoryAnnounceRoomPartOneParams,
BeginningOfChatHistoryAnnounceRoomPartTwo,
Expand Down Expand Up @@ -2839,6 +2840,24 @@
assignCard: 'Asignar tarjeta',
cardNumber: 'Número de la tarjeta',
customFeed: 'Fuente personalizada',
assignCard: 'Asignar tarjeta',

Check failure on line 2843 in src/languages/es.ts

View workflow job for this annotation

GitHub Actions / typecheck

An object literal cannot have multiple properties with the same name.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assignCard: 'Asignar tarjeta',

whoNeedsCardAssigned: '¿Quién necesita una tarjeta?',
chooseCard: 'Elige una tarjeta',
chooseCardFor: ({assignee, feed}: AssignCardParams) => `Elige una tarjeta para ${assignee} del feed de tarjetas ${feed}.`,
noActiveCards: 'No hay tarjetas activas en este feed',
somethingMightBeBroken: 'O algo podría estar roto. De cualquier manera, si tienes alguna pregunta,',
contactConcierge: 'contacta a Concierge',
chooseTransactionStartDate: 'Elige una fecha de inicio de transacciones',
startDateDescription: 'Importaremos todas las transacciones desde esta fecha en adelante. Si no se especifica una fecha, iremos tan atrás como lo permita tu banco.',
fromTheBeginning: 'Desde el principio',
customStartDate: 'Fecha de inicio personalizada',
letsDoubleCheck: 'Verifiquemos que todo esté bien.',
confirmationDescription: 'Comenzaremos a importar transacciones inmediatamente.',
cardholder: 'Titular de la tarjeta',
card: 'Tarjeta',
startTransactionDate: 'Fecha de inicio de transacciones',
cardName: 'Nombre de la tarjeta',
assignedYouCard: (assigner: string) => `¡${assigner} te ha asignado una tarjeta de empresa! Las transacciones importadas aparecerán en este chat.`,
},
expensifyCard: {
issueAndManageCards: 'Emitir y gestionar Tarjetas Expensify',
Expand Down
6 changes: 6 additions & 0 deletions src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ type ApprovalWorkflowErrorParams = {
name2: string;
};

type AssignCardParams = {
assignee: string;
feed: string;
};

export type {
AddressLineParams,
AdminCanceledRequestParams,
Expand Down Expand Up @@ -485,4 +490,5 @@ export type {
RemoveMembersWarningPrompt,
DeleteExpenseTranslationParams,
ApprovalWorkflowErrorParams,
AssignCardParams,
};
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.WORKSPACE.TAX_CODE]: () => require<ReactComponentModule>('../../../../pages/workspace/taxes/WorkspaceTaxCodePage').default,
[SCREENS.WORKSPACE.INVOICES_COMPANY_NAME]: () => require<ReactComponentModule>('../../../../pages/workspace/invoices/WorkspaceInvoicingDetailsName').default,
[SCREENS.WORKSPACE.INVOICES_COMPANY_WEBSITE]: () => require<ReactComponentModule>('../../../../pages/workspace/invoices/WorkspaceInvoicingDetailsWebsite').default,
[SCREENS.WORKSPACE.COMPANY_CARDS_ASSIGN_CARD]: () => require<ReactComponentModule>('../../../../pages/workspace/companyCards/assignCard/AssignCardFeedPage').default,
[SCREENS.WORKSPACE.COMPANY_CARDS_SELECT_FEED]: () => require<ReactComponentModule>('../../../../pages/workspace/companyCards/WorkspaceCompanyCardFeedSelectorPage').default,
[SCREENS.WORKSPACE.EXPENSIFY_CARD_ISSUE_NEW]: () => require<ReactComponentModule>('../../../../pages/workspace/expensifyCard/issueNew/IssueNewCardPage').default,
[SCREENS.WORKSPACE.EXPENSIFY_CARD_SETTINGS]: () => require<ReactComponentModule>('../../../../pages/workspace/expensifyCard/WorkspaceCardSettingsPage').default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial<Record<FullScreenName, string[]>> = {
SCREENS.WORKSPACE.REPORT_FIELDS_EDIT_INITIAL_VALUE,
],
[SCREENS.WORKSPACE.INVOICES]: [SCREENS.WORKSPACE.INVOICES_COMPANY_NAME, SCREENS.WORKSPACE.INVOICES_COMPANY_WEBSITE],
[SCREENS.WORKSPACE.COMPANY_CARDS]: [SCREENS.WORKSPACE.COMPANY_CARDS_SELECT_FEED, SCREENS.WORKSPACE.COMPANY_CARDS_SETTINGS, SCREENS.WORKSPACE.COMPANY_CARDS_SETTINGS_FEED_NAME],
[SCREENS.WORKSPACE.COMPANY_CARDS]: [
SCREENS.WORKSPACE.COMPANY_CARDS_SELECT_FEED,
SCREENS.WORKSPACE.COMPANY_CARDS_SETTINGS,
SCREENS.WORKSPACE.COMPANY_CARDS_SETTINGS_FEED_NAME,
SCREENS.WORKSPACE.COMPANY_CARDS_ASSIGN_CARD,
],
[SCREENS.WORKSPACE.EXPENSIFY_CARD]: [
SCREENS.WORKSPACE.EXPENSIFY_CARD_ISSUE_NEW,
SCREENS.WORKSPACE.EXPENSIFY_CARD_BANK_ACCOUNT,
Expand Down
Loading
Loading