From 0989715f1649cdaf24203c20cfd079b5cf72dcd1 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 29 Jun 2023 12:11:58 +0200 Subject: [PATCH 001/122] Initial work on onyx types --- src/{ONYXKEYS.js => ONYXKEYS.ts} | 2 +- src/types/onyx/Account.ts | 29 +++++++++++++++++++++++++++++ src/types/onyx/OnyxValues.ts | 8 ++++++++ src/types/onyx/common.ts | 23 +++++++++++++++++++++++ src/types/utils.ts | 4 ++++ 5 files changed, 65 insertions(+), 1 deletion(-) rename src/{ONYXKEYS.js => ONYXKEYS.ts} (99%) create mode 100644 src/types/onyx/Account.ts create mode 100644 src/types/onyx/OnyxValues.ts create mode 100644 src/types/onyx/common.ts create mode 100644 src/types/utils.ts diff --git a/src/ONYXKEYS.js b/src/ONYXKEYS.ts similarity index 99% rename from src/ONYXKEYS.js rename to src/ONYXKEYS.ts index dd73bde936f9..f878596272ff 100755 --- a/src/ONYXKEYS.js +++ b/src/ONYXKEYS.ts @@ -235,4 +235,4 @@ export default { // Experimental memory only Onyx mode flag IS_USING_MEMORY_ONLY_KEYS: 'isUsingMemoryOnlyKeys', -}; +} as const; diff --git a/src/types/onyx/Account.ts b/src/types/onyx/Account.ts new file mode 100644 index 000000000000..0e4c40b70025 --- /dev/null +++ b/src/types/onyx/Account.ts @@ -0,0 +1,29 @@ +import * as CommonTypes from './common'; + +type Account = CommonTypes.BaseState & { + /** URL to the assigned guide's appointment booking calendar */ + guideCalendarLink: string; + + /** User recovery codes for setting up 2-FA */ + recoveryCodes?: string; + + /** Secret key to enable 2FA within the authenticator app */ + twoFactorAuthSecretKey?: string; + + /** Whether or not two factor authentication is required */ + requiresTwoFactorAuth: boolean; + + /** Whether the account is validated */ + validated: boolean; + + /** The primaryLogin associated with the account */ + primaryLogin: string; + + /** The message to be displayed when code requested */ + message?: string; + + /** Accounts that are on a domain with an Approved Accountant */ + doesDomainHaveApprovedAccountant?: boolean; +}; + +export default Account; diff --git a/src/types/onyx/OnyxValues.ts b/src/types/onyx/OnyxValues.ts new file mode 100644 index 000000000000..db6887dbaca5 --- /dev/null +++ b/src/types/onyx/OnyxValues.ts @@ -0,0 +1,8 @@ +import ONYXKEYS from '../../ONYXKEYS'; +import Account from './Account'; + +type OnyxValues = { + [ONYXKEYS.ACCOUNT]: Account; +}; + +export default OnyxValues; diff --git a/src/types/onyx/common.ts b/src/types/onyx/common.ts new file mode 100644 index 000000000000..9eb8f958afcc --- /dev/null +++ b/src/types/onyx/common.ts @@ -0,0 +1,23 @@ +import * as React from 'react'; + +type RedBrickRoadPendingAction = 'add' | 'delete' | 'update'; + +type BaseState = { + success: string; + + /** An error message to display to the user */ + errors?: Record; + + /** Whether or not data is loading */ + isLoading: boolean; + + pendingAction: RedBrickRoadPendingAction; +}; + +type Icon = { + source: string | React.ReactNode; + type: 'avatar' | 'workspace'; + name: string; +}; + +export type {RedBrickRoadPendingAction, BaseState, Icon}; diff --git a/src/types/utils.ts b/src/types/utils.ts new file mode 100644 index 000000000000..a6dea213f45b --- /dev/null +++ b/src/types/utils.ts @@ -0,0 +1,4 @@ +type NestedValues = T extends object ? NestedValues : T; + +// eslint-disable-next-line import/prefer-default-export +export type {NestedValues}; From 13ee74d8c8dc5635ebcc754df2cb3e2e6ab56e3b Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 29 Jun 2023 16:29:09 +0200 Subject: [PATCH 002/122] Change comments to JSDOC --- src/ONYXKEYS.ts | 135 +++++++++++++++++++++++++----------------------- 1 file changed, 69 insertions(+), 66 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index f878596272ff..5af1f387fd48 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -2,111 +2,111 @@ * This is a file containing constants for all the top level keys in our store */ export default { - // Holds information about the users account that is logging in + /** Holds information about the users account that is logging in */ ACCOUNT: 'account', - // Holds the reportID for the report between the user and their account manager + /** Holds the reportID for the report between the user and their account manager */ ACCOUNT_MANAGER_REPORT_ID: 'accountManagerReportID', - // Boolean flag only true when first set + /** Boolean flag only true when first set */ NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER: 'isFirstTimeNewExpensifyUser', - // Holds an array of client IDs which is used for multi-tabs on web in order to know - // which tab is the leader, and which ones are the followers + /** Holds an array of client IDs which is used for multi-tabs on web in order to know + * which tab is the leader, and which ones are the followers */ ACTIVE_CLIENTS: 'activeClients', - // A unique ID for the device + /** A unique ID for the device */ DEVICE_ID: 'deviceID', - // Boolean flag set whenever the sidebar has loaded + /** Boolean flag set whenever the sidebar has loaded */ IS_SIDEBAR_LOADED: 'isSidebarLoaded', - // Note: These are Persisted Requests - not all requests in the main queue as the key name might lead one to believe + /** Note: These are Persisted Requests - not all requests in the main queue as the key name might lead one to believe */ PERSISTED_REQUESTS: 'networkRequestQueue', - // Onyx updates from a response, or success or failure data from a request. + /** Onyx updates from a response, or success or failure data from a request. */ QUEUED_ONYX_UPDATES: 'queuedOnyxUpdates', - // Stores current date + /** Stores current date */ CURRENT_DATE: 'currentDate', - // Credentials to authenticate the user + /** Credentials to authenticate the user */ CREDENTIALS: 'credentials', - // Contains loading data for the IOU feature (MoneyRequestModal, IOUDetail, & IOUPreview Components) + /** Contains loading data for the IOU feature (MoneyRequestModal, IOUDetail, & IOUPreview Components) */ IOU: 'iou', - // Keeps track if there is modal currently visible or not + /** Keeps track if there is modal currently visible or not */ MODAL: 'modal', - // Has information about the network status (offline/online) + /** Has information about the network status (offline/online) */ NETWORK: 'network', - // Contains all the personalDetails the user has access to, keyed by accountID + /** Contains all the personalDetails the user has access to, keyed by accountID */ PERSONAL_DETAILS_LIST: 'personalDetailsList', - // Contains all the private personal details of the user + /** Contains all the private personal details of the user */ PRIVATE_PERSONAL_DETAILS: 'private_personalDetails', - // Contains all the info for Tasks + /** Contains all the info for Tasks */ TASK: 'task', - // Contains a list of all currencies available to the user - user can - // select a currency based on the list + /** Contains a list of all currencies available to the user - user can + * select a currency based on the list */ CURRENCY_LIST: 'currencyList', - // Indicates whether an update is available and ready to be installed. + /** Indicates whether an update is available and ready to be installed. */ UPDATE_AVAILABLE: 'updateAvailable', - // Indicates that a request to join a screen share with a GuidesPlus agent was received + /** Indicates that a request to join a screen share with a GuidesPlus agent was received */ SCREEN_SHARE_REQUEST: 'screenShareRequest', - // Saves the current country code which is displayed when the user types a phone number without - // an international code + /** Saves the current country code which is displayed when the user types a phone number without + * an international code */ COUNTRY_CODE: 'countryCode', - // Contains all the users settings for the Settings page and sub pages + /** Contains all the users settings for the Settings page and sub pages */ USER: 'user', - // Contains metadata (partner, login, validation date) for all of the user's logins + /** Contains metadata (partner, login, validation date) for all of the user's logins */ LOGIN_LIST: 'loginList', - // Information about the current session (authToken, accountID, email, loading, error) + /** Information about the current session (authToken, accountID, email, loading, error) */ SESSION: 'session', BETAS: 'betas', - // NVP keys - // Contains the user's payPalMe data + /** NVP keys + * Contains the user's payPalMe data */ PAYPAL: 'paypal', - // Contains the user preference for the LHN priority mode + /** Contains the user preference for the LHN priority mode */ NVP_PRIORITY_MODE: 'nvp_priorityMode', - // Contains the users's block expiration (if they have one) + /** Contains the users's block expiration (if they have one) */ NVP_BLOCKED_FROM_CONCIERGE: 'private_blockedFromConcierge', - // A unique identifier that each user has that's used to send notifications + /** A unique identifier that each user has that's used to send notifications */ NVP_PRIVATE_PUSH_NOTIFICATION_ID: 'private_pushNotificationID', - // The NVP with the last payment method used per policy + /** The NVP with the last payment method used per policy */ NVP_LAST_PAYMENT_METHOD: 'nvp_lastPaymentMethod', - // Does this user have push notifications enabled for this device? + /** Does this user have push notifications enabled for this device? */ PUSH_NOTIFICATIONS_ENABLED: 'pushNotificationsEnabled', - // Plaid data (access tokens, bank accounts ...) + /** Plaid data (access tokens, bank accounts ...) */ PLAID_DATA: 'plaidData', - // If we disabled Plaid because of too many attempts + /** If we disabled Plaid because of too many attempts */ IS_PLAID_DISABLED: 'isPlaidDisabled', - // Token needed to initialize Plaid link + /** Token needed to initialize Plaid link */ PLAID_LINK_TOKEN: 'plaidLinkToken', - // Token needed to initialize Onfido + /** Token needed to initialize Onfido */ ONFIDO_TOKEN: 'onfidoToken', - // Collection Keys + /** Collection Keys */ COLLECTION: { DOWNLOAD: 'download_', POLICY: 'policy_', @@ -123,74 +123,74 @@ export default { SECURITY_GROUP: 'securityGroup_', TRANSACTION: 'transactions_', - // This is deprecated, but needed for a migration, so we still need to include it here so that it will be initialized in Onyx.init + /** This is deprecated, but needed for a migration, so we still need to include it here so that it will be initialized in Onyx.init */ DEPRECATED_POLICY_MEMBER_LIST: 'policyMemberList_', }, - // Indicates which locale should be used + /** Indicates which locale should be used */ NVP_PREFERRED_LOCALE: 'preferredLocale', - // List of transactionIDs in process of rejection + /** List of transactionIDs in process of rejection */ TRANSACTIONS_BEING_REJECTED: 'transactionsBeingRejected', - // User's Expensify Wallet + /** User's Expensify Wallet */ USER_WALLET: 'userWallet', - // Object containing Onfido SDK Token + applicantID + /** Object containing Onfido SDK Token + applicantID */ WALLET_ONFIDO: 'walletOnfido', - // Stores information about additional details form entry + /** Stores information about additional details form entry */ WALLET_ADDITIONAL_DETAILS: 'walletAdditionalDetails', - // Object containing Wallet terms step state + /** Object containing Wallet terms step state */ WALLET_TERMS: 'walletTerms', - // The user's bank accounts + /** The user's bank accounts */ BANK_ACCOUNT_LIST: 'bankAccountList', - // The user's credit cards + /** The user's credit cards */ CARD_LIST: 'cardList', - // Stores information about the user's saved statements + /** Stores information about the user's saved statements */ WALLET_STATEMENT: 'walletStatement', - // Stores information about the active personal bank account being set up + /** Stores information about the active personal bank account being set up */ PERSONAL_BANK_ACCOUNT: 'personalBankAccount', - // Stores information about the active reimbursement account being set up + /** Stores information about the active reimbursement account being set up */ REIMBURSEMENT_ACCOUNT: 'reimbursementAccount', - // Stores draft information about the active reimbursement account being set up + /** Stores draft information about the active reimbursement account being set up */ REIMBURSEMENT_ACCOUNT_DRAFT: 'reimbursementAccountDraft', - // Store preferred skintone for emoji + /** Store preferred skintone for emoji */ PREFERRED_EMOJI_SKIN_TONE: 'preferredEmojiSkinTone', - // Store frequently used emojis for this user + /** Store frequently used emojis for this user */ FREQUENTLY_USED_EMOJIS: 'frequentlyUsedEmojis', - // Stores Workspace ID that will be tied to reimbursement account during setup + /** Stores Workspace ID that will be tied to reimbursement account during setup */ REIMBURSEMENT_ACCOUNT_WORKSPACE_ID: 'reimbursementAccountWorkspaceID', - // Set when we are loading payment methods + /** Set when we are loading payment methods */ IS_LOADING_PAYMENT_METHODS: 'isLoadingPaymentMethods', - // Is report data loading? + /** Is report data loading? */ IS_LOADING_REPORT_DATA: 'isLoadingReportData', - // Is Keyboard shortcuts modal open? + /** Is Keyboard shortcuts modal open? */ IS_SHORTCUTS_MODAL_OPEN: 'isShortcutsModalOpen', - // Is the test tools modal open? + /** Is the test tools modal open? */ IS_TEST_TOOLS_MODAL_OPEN: 'isTestToolsModalOpen', - // Stores information about active wallet transfer amount, selectedAccountID, status, etc + /** Stores information about active wallet transfer amount, selectedAccountID, status, etc */ WALLET_TRANSFER: 'walletTransfer', - // The policyID of the last workspace whose settings were accessed by the user + /** The policyID of the last workspace whose settings were accessed by the user */ LAST_ACCESSED_WORKSPACE_POLICY_ID: 'lastAccessedWorkspacePolicyID', - // List of Form ids + /** List of Form ids */ FORMS: { ADD_DEBIT_CARD_FORM: 'addDebitCardForm', REIMBURSEMENT_ACCOUNT_FORM: 'reimbursementAccount', @@ -214,23 +214,26 @@ export default { PAYPAL_FORM: 'payPalForm', }, - // Whether we should show the compose input or not + /** Whether we should show the compose input or not */ SHOULD_SHOW_COMPOSE_INPUT: 'shouldShowComposeInput', - // Is app in beta version + /** Is app in beta version */ IS_BETA: 'isBeta', // The theme setting set by the user in preferences. // This can be either "light", "dark" or "system" PREFERRED_THEME: 'preferredTheme', - // Whether we're checking if the room is public or not + /** Whether the auth token is valid */ + IS_TOKEN_VALID: 'isTokenValid', + + /** Whether we're checking if the room is public or not */ IS_CHECKING_PUBLIC_ROOM: 'isCheckingPublicRoom', - // A map of the user's security group IDs they belong to in specific domains + /** A map of the user's security group IDs they belong to in specific domains */ MY_DOMAIN_SECURITY_GROUPS: 'myDomainSecurityGroups', - // Report ID of the last report the user viewed as anonymous user + /** Report ID of the last report the user viewed as anonymous user */ LAST_OPENED_PUBLIC_ROOM_ID: 'lastOpenedPublicRoomID', // Experimental memory only Onyx mode flag From c8ed8f93555a8b2aa0c624eb98bc9c94845595a8 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 29 Jun 2023 16:30:14 +0200 Subject: [PATCH 003/122] Improve onyx common types + finish account type --- src/types/onyx/Account.ts | 22 ++++++++++++++------- src/types/onyx/{common.ts => OnyxCommon.ts} | 12 +++++------ 2 files changed, 21 insertions(+), 13 deletions(-) rename src/types/onyx/{common.ts => OnyxCommon.ts} (51%) diff --git a/src/types/onyx/Account.ts b/src/types/onyx/Account.ts index 0e4c40b70025..693d658c6380 100644 --- a/src/types/onyx/Account.ts +++ b/src/types/onyx/Account.ts @@ -1,8 +1,10 @@ -import * as CommonTypes from './common'; +import {ValueOf} from 'react-native-gesture-handler/lib/typescript/typeUtils'; +import CONST from '../../CONST'; +import * as OnyxCommon from './OnyxCommon'; -type Account = CommonTypes.BaseState & { +type Account = OnyxCommon.BaseState & { /** URL to the assigned guide's appointment booking calendar */ - guideCalendarLink: string; + guideCalendarLink?: string; /** User recovery codes for setting up 2-FA */ recoveryCodes?: string; @@ -10,20 +12,26 @@ type Account = CommonTypes.BaseState & { /** Secret key to enable 2FA within the authenticator app */ twoFactorAuthSecretKey?: string; - /** Whether or not two factor authentication is required */ - requiresTwoFactorAuth: boolean; + /** Whether this account has 2FA enabled or not */ + requiresTwoFactorAuth?: boolean; /** Whether the account is validated */ - validated: boolean; + validated?: boolean; /** The primaryLogin associated with the account */ - primaryLogin: string; + primaryLogin?: string; /** The message to be displayed when code requested */ message?: string; /** Accounts that are on a domain with an Approved Accountant */ doesDomainHaveApprovedAccountant?: boolean; + + /** Form that is being loaded */ + loadingForm?: ValueOf; + + /** Whether the user forgot their password */ + forgotPassword?: boolean; }; export default Account; diff --git a/src/types/onyx/common.ts b/src/types/onyx/OnyxCommon.ts similarity index 51% rename from src/types/onyx/common.ts rename to src/types/onyx/OnyxCommon.ts index 9eb8f958afcc..fbfe8633f060 100644 --- a/src/types/onyx/common.ts +++ b/src/types/onyx/OnyxCommon.ts @@ -1,23 +1,23 @@ import * as React from 'react'; -type RedBrickRoadPendingAction = 'add' | 'delete' | 'update'; +type PendingAction = 'add' | 'delete' | 'update'; type BaseState = { - success: string; + success?: string; /** An error message to display to the user */ errors?: Record; /** Whether or not data is loading */ - isLoading: boolean; + isLoading?: boolean; - pendingAction: RedBrickRoadPendingAction; + pendingAction?: PendingAction; }; type Icon = { - source: string | React.ReactNode; + source: React.ReactNode | string; type: 'avatar' | 'workspace'; name: string; }; -export type {RedBrickRoadPendingAction, BaseState, Icon}; +export type {BaseState, Icon}; From b8fdc466c96f532817c75df3b92ca618f0e60809 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 29 Jun 2023 16:30:35 +0200 Subject: [PATCH 004/122] Add type for ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID --- src/types/onyx/OnyxValues.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/onyx/OnyxValues.ts b/src/types/onyx/OnyxValues.ts index db6887dbaca5..664cb910d05e 100644 --- a/src/types/onyx/OnyxValues.ts +++ b/src/types/onyx/OnyxValues.ts @@ -3,6 +3,7 @@ import Account from './Account'; type OnyxValues = { [ONYXKEYS.ACCOUNT]: Account; + [ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID]: string; }; export default OnyxValues; From 2e2f1e03ec3fd2ad342133988c6e3dfc8ab9b2cf Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 29 Jun 2023 16:36:20 +0200 Subject: [PATCH 005/122] Add type for ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER --- src/types/onyx/OnyxValues.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/types/onyx/OnyxValues.ts b/src/types/onyx/OnyxValues.ts index 664cb910d05e..d7e896a98153 100644 --- a/src/types/onyx/OnyxValues.ts +++ b/src/types/onyx/OnyxValues.ts @@ -3,7 +3,8 @@ import Account from './Account'; type OnyxValues = { [ONYXKEYS.ACCOUNT]: Account; - [ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID]: string; + [ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID]?: string; + [ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER]?: boolean; }; export default OnyxValues; From fe9faf175a67a6aee79deebd452b7597d9cc2d57 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 29 Jun 2023 16:39:18 +0200 Subject: [PATCH 006/122] Add type for ONYXKEYS.ACTIVE_CLIENTS --- src/types/onyx/OnyxValues.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/onyx/OnyxValues.ts b/src/types/onyx/OnyxValues.ts index d7e896a98153..a2816fecd20f 100644 --- a/src/types/onyx/OnyxValues.ts +++ b/src/types/onyx/OnyxValues.ts @@ -5,6 +5,7 @@ type OnyxValues = { [ONYXKEYS.ACCOUNT]: Account; [ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID]?: string; [ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER]?: boolean; + [ONYXKEYS.ACTIVE_CLIENTS]: string[]; }; export default OnyxValues; From 6d8223d454faae20a2e788f8115cf63192af849b Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 29 Jun 2023 16:41:03 +0200 Subject: [PATCH 007/122] Add type for ONYXKEYS.DEVICE_ID --- src/types/onyx/OnyxValues.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/onyx/OnyxValues.ts b/src/types/onyx/OnyxValues.ts index a2816fecd20f..392f355eaea1 100644 --- a/src/types/onyx/OnyxValues.ts +++ b/src/types/onyx/OnyxValues.ts @@ -6,6 +6,7 @@ type OnyxValues = { [ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID]?: string; [ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER]?: boolean; [ONYXKEYS.ACTIVE_CLIENTS]: string[]; + [ONYXKEYS.DEVICE_ID]: string; }; export default OnyxValues; From 418fd374babdde02cf27abe65c859211b7e5e280 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 29 Jun 2023 16:42:19 +0200 Subject: [PATCH 008/122] Add type for ONYXKEYS.IS_SIDEBAR_LOADED --- src/types/onyx/OnyxValues.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/onyx/OnyxValues.ts b/src/types/onyx/OnyxValues.ts index 392f355eaea1..e65442c5316c 100644 --- a/src/types/onyx/OnyxValues.ts +++ b/src/types/onyx/OnyxValues.ts @@ -7,6 +7,7 @@ type OnyxValues = { [ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER]?: boolean; [ONYXKEYS.ACTIVE_CLIENTS]: string[]; [ONYXKEYS.DEVICE_ID]: string; + [ONYXKEYS.IS_SIDEBAR_LOADED]?: boolean; }; export default OnyxValues; From 46a9fd0570da9da96560ed9ab0ead40025ba02bc Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 29 Jun 2023 16:51:22 +0200 Subject: [PATCH 009/122] Add type for ONYXKEYS.QUEUED_ONYX_UPDATES --- src/types/onyx/OnyxValues.ts | 4 ++++ src/types/onyx/QueuedOnyxUpdates.ts | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 src/types/onyx/QueuedOnyxUpdates.ts diff --git a/src/types/onyx/OnyxValues.ts b/src/types/onyx/OnyxValues.ts index e65442c5316c..7e008951c1ee 100644 --- a/src/types/onyx/OnyxValues.ts +++ b/src/types/onyx/OnyxValues.ts @@ -1,5 +1,6 @@ import ONYXKEYS from '../../ONYXKEYS'; import Account from './Account'; +import QueuedOnyxUpdates from './QueuedOnyxUpdates'; type OnyxValues = { [ONYXKEYS.ACCOUNT]: Account; @@ -8,6 +9,9 @@ type OnyxValues = { [ONYXKEYS.ACTIVE_CLIENTS]: string[]; [ONYXKEYS.DEVICE_ID]: string; [ONYXKEYS.IS_SIDEBAR_LOADED]?: boolean; + // TODO: Type persisted requests properly + [ONYXKEYS.PERSISTED_REQUESTS]: unknown[]; + [ONYXKEYS.QUEUED_ONYX_UPDATES]: QueuedOnyxUpdates; }; export default OnyxValues; diff --git a/src/types/onyx/QueuedOnyxUpdates.ts b/src/types/onyx/QueuedOnyxUpdates.ts new file mode 100644 index 000000000000..09a6e1a3c509 --- /dev/null +++ b/src/types/onyx/QueuedOnyxUpdates.ts @@ -0,0 +1,6 @@ +// @ts-expect-error TODO: Remove after onyx is typed +import * as Onyx from 'react-native-onyx'; + +type QueuedOnyxUpdates = Array; + +export default QueuedOnyxUpdates; From e66f1f93c34a27ff51e0d67cb9f10c227adbd655 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 29 Jun 2023 16:53:39 +0200 Subject: [PATCH 010/122] Add type for ONYXKEYS.CURRENT_DATE --- src/types/onyx/OnyxValues.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/onyx/OnyxValues.ts b/src/types/onyx/OnyxValues.ts index 7e008951c1ee..e942161e2838 100644 --- a/src/types/onyx/OnyxValues.ts +++ b/src/types/onyx/OnyxValues.ts @@ -12,6 +12,7 @@ type OnyxValues = { // TODO: Type persisted requests properly [ONYXKEYS.PERSISTED_REQUESTS]: unknown[]; [ONYXKEYS.QUEUED_ONYX_UPDATES]: QueuedOnyxUpdates; + [ONYXKEYS.CURRENT_DATE]?: string; }; export default OnyxValues; From 82671a0e7a5358eaeeb48cc5122a66a78b6e0db5 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 30 Jun 2023 14:38:03 +0200 Subject: [PATCH 011/122] Change the structure a bit --- src/ONYXKEYS.ts | 27 ++++++++++++++++++++++++++- src/types/onyx/Account.ts | 2 +- src/types/onyx/OnyxValues.ts | 18 ------------------ src/types/onyx/index.ts | 5 +++++ src/types/utils.ts | 4 ++-- 5 files changed, 34 insertions(+), 22 deletions(-) delete mode 100644 src/types/onyx/OnyxValues.ts create mode 100644 src/types/onyx/index.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 5af1f387fd48..430bd9b61435 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -1,7 +1,11 @@ +import {ValueOf} from 'type-fest'; +import * as UtilTypes from './types/utils'; +import * as OnyxTypes from './types/onyx'; + /** * This is a file containing constants for all the top level keys in our store */ -export default { +const ONYXKEYS = { /** Holds information about the users account that is logging in */ ACCOUNT: 'account', @@ -239,3 +243,24 @@ export default { // Experimental memory only Onyx mode flag IS_USING_MEMORY_ONLY_KEYS: 'isUsingMemoryOnlyKeys', } as const; + +type OnyxKeysMap = typeof ONYXKEYS; +type CollectionKey = `${ValueOf}${string}`; +type OnyxKey = UtilTypes.DeepValueOf> | CollectionKey; + +type OnyxValues = { + [ONYXKEYS.ACCOUNT]: OnyxTypes.Account; + [ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID]?: string; + [ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER]?: boolean; + [ONYXKEYS.ACTIVE_CLIENTS]: string[]; + [ONYXKEYS.DEVICE_ID]: string; + [ONYXKEYS.IS_SIDEBAR_LOADED]?: boolean; + // TODO: Type persisted requests properly + [ONYXKEYS.PERSISTED_REQUESTS]: unknown[]; + [ONYXKEYS.QUEUED_ONYX_UPDATES]: OnyxTypes.QueuedOnyxUpdates; + [ONYXKEYS.CURRENT_DATE]?: string; + [ONYXKEYS.CREDENTIALS]?: OnyxTypes.Credentials; +}; + +export default ONYXKEYS; +export type {OnyxKey, OnyxValues}; diff --git a/src/types/onyx/Account.ts b/src/types/onyx/Account.ts index 693d658c6380..63d294ec71d8 100644 --- a/src/types/onyx/Account.ts +++ b/src/types/onyx/Account.ts @@ -1,4 +1,4 @@ -import {ValueOf} from 'react-native-gesture-handler/lib/typescript/typeUtils'; +import {ValueOf} from 'type-fest'; import CONST from '../../CONST'; import * as OnyxCommon from './OnyxCommon'; diff --git a/src/types/onyx/OnyxValues.ts b/src/types/onyx/OnyxValues.ts deleted file mode 100644 index e942161e2838..000000000000 --- a/src/types/onyx/OnyxValues.ts +++ /dev/null @@ -1,18 +0,0 @@ -import ONYXKEYS from '../../ONYXKEYS'; -import Account from './Account'; -import QueuedOnyxUpdates from './QueuedOnyxUpdates'; - -type OnyxValues = { - [ONYXKEYS.ACCOUNT]: Account; - [ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID]?: string; - [ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER]?: boolean; - [ONYXKEYS.ACTIVE_CLIENTS]: string[]; - [ONYXKEYS.DEVICE_ID]: string; - [ONYXKEYS.IS_SIDEBAR_LOADED]?: boolean; - // TODO: Type persisted requests properly - [ONYXKEYS.PERSISTED_REQUESTS]: unknown[]; - [ONYXKEYS.QUEUED_ONYX_UPDATES]: QueuedOnyxUpdates; - [ONYXKEYS.CURRENT_DATE]?: string; -}; - -export default OnyxValues; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts new file mode 100644 index 000000000000..2807357b6807 --- /dev/null +++ b/src/types/onyx/index.ts @@ -0,0 +1,5 @@ +import Account from './Account'; +import Credentials from './Credentials'; +import QueuedOnyxUpdates from './QueuedOnyxUpdates'; + +export type {Account, Credentials, QueuedOnyxUpdates}; diff --git a/src/types/utils.ts b/src/types/utils.ts index a6dea213f45b..98a658eed56f 100644 --- a/src/types/utils.ts +++ b/src/types/utils.ts @@ -1,4 +1,4 @@ -type NestedValues = T extends object ? NestedValues : T; +type DeepValueOf = T extends object ? DeepValueOf : T; // eslint-disable-next-line import/prefer-default-export -export type {NestedValues}; +export type {DeepValueOf}; From c78cd76de0782d8494b9d32cb3a5e8bdfc8bddbf Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 30 Jun 2023 16:24:14 +0200 Subject: [PATCH 012/122] Add type for ONYXKEYS.CREDENTIALS --- src/types/onyx/Credentials.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/types/onyx/Credentials.ts diff --git a/src/types/onyx/Credentials.ts b/src/types/onyx/Credentials.ts new file mode 100644 index 000000000000..1f6beb502907 --- /dev/null +++ b/src/types/onyx/Credentials.ts @@ -0,0 +1,14 @@ +type Credentials = { + /** The email/phone the user logged in with */ + login?: string; + password?: string; + twoFactorAuthCode?: string; + + /** The validate code */ + validateCode?: string; + + autoGeneratedLogin?: string; + autoGeneratedPassword?: string; +}; + +export default Credentials; From 47181cd773d68174fe16bdee9a8c6b53fae240a2 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 30 Jun 2023 17:03:00 +0200 Subject: [PATCH 013/122] Add type for ONYXKEYS.IOU --- src/ONYXKEYS.ts | 1 + src/types/onyx/IOU.ts | 18 ++++++++++++++++++ src/types/onyx/index.ts | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/IOU.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 430bd9b61435..983e620eca2e 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -260,6 +260,7 @@ type OnyxValues = { [ONYXKEYS.QUEUED_ONYX_UPDATES]: OnyxTypes.QueuedOnyxUpdates; [ONYXKEYS.CURRENT_DATE]?: string; [ONYXKEYS.CREDENTIALS]?: OnyxTypes.Credentials; + [ONYXKEYS.IOU]: OnyxTypes.IOU; }; export default ONYXKEYS; diff --git a/src/types/onyx/IOU.ts b/src/types/onyx/IOU.ts new file mode 100644 index 000000000000..031c5791440c --- /dev/null +++ b/src/types/onyx/IOU.ts @@ -0,0 +1,18 @@ +type Participant = { + accountID?: number; + login?: string; + isPolicyExpenseChat?: boolean; + isOwnPolicyExpenseChat?: boolean; + selected?: boolean; +}; + +type IOU = { + id?: string; + amount?: number; + /** Selected Currency Code of the current IOU */ + currency?: string; + comment?: string; + participants?: Participant[]; +}; + +export default IOU; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 2807357b6807..93488120a4d4 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -1,5 +1,6 @@ import Account from './Account'; import Credentials from './Credentials'; import QueuedOnyxUpdates from './QueuedOnyxUpdates'; +import IOU from './IOU'; -export type {Account, Credentials, QueuedOnyxUpdates}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU}; From 87d7c874b287c085aaccaf5205c8002620abcef6 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 30 Jun 2023 17:11:21 +0200 Subject: [PATCH 014/122] Add type for ONYXKEYS.MODAL --- src/ONYXKEYS.ts | 1 + src/types/onyx/Modal.ts | 9 +++++++++ src/types/onyx/index.ts | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/Modal.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 983e620eca2e..7281c9ce212b 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -261,6 +261,7 @@ type OnyxValues = { [ONYXKEYS.CURRENT_DATE]?: string; [ONYXKEYS.CREDENTIALS]?: OnyxTypes.Credentials; [ONYXKEYS.IOU]: OnyxTypes.IOU; + [ONYXKEYS.MODAL]: OnyxTypes.Modal; }; export default ONYXKEYS; diff --git a/src/types/onyx/Modal.ts b/src/types/onyx/Modal.ts new file mode 100644 index 000000000000..126b56d4c504 --- /dev/null +++ b/src/types/onyx/Modal.ts @@ -0,0 +1,9 @@ +type Modal = { + /** Indicates when an Alert modal is about to be visible */ + willAlertModalBecomeVisible?: boolean; + + /** Indicates if there is a modal currently visible or not */ + isVisible?: boolean; +}; + +export default Modal; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 93488120a4d4..0b15f6147669 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -2,5 +2,6 @@ import Account from './Account'; import Credentials from './Credentials'; import QueuedOnyxUpdates from './QueuedOnyxUpdates'; import IOU from './IOU'; +import Modal from './Modal'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal}; From 08c951a72a4821c3eb644de116fe7b9d8fd9112b Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 13:21:08 +0200 Subject: [PATCH 015/122] Add type for ONYXKEYS.NETWORK --- src/ONYXKEYS.ts | 1 + src/types/onyx/Network.ts | 12 ++++++++++++ src/types/onyx/index.ts | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/Network.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 7281c9ce212b..80167a0fd92b 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -262,6 +262,7 @@ type OnyxValues = { [ONYXKEYS.CREDENTIALS]?: OnyxTypes.Credentials; [ONYXKEYS.IOU]: OnyxTypes.IOU; [ONYXKEYS.MODAL]: OnyxTypes.Modal; + [ONYXKEYS.NETWORK]: OnyxTypes.Network; }; export default ONYXKEYS; diff --git a/src/types/onyx/Network.ts b/src/types/onyx/Network.ts new file mode 100644 index 000000000000..5af4c1170c3f --- /dev/null +++ b/src/types/onyx/Network.ts @@ -0,0 +1,12 @@ +type Network = { + /** Is the network currently offline or not */ + isOffline?: boolean; + + /** Should the network be forced offline */ + shouldForceOffline?: boolean; + + /** Whether we should fail all network requests */ + shouldFailAllRequests?: boolean; +}; + +export default Network; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 0b15f6147669..b5383e5b4ff9 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -3,5 +3,6 @@ import Credentials from './Credentials'; import QueuedOnyxUpdates from './QueuedOnyxUpdates'; import IOU from './IOU'; import Modal from './Modal'; +import Network from './Network'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network}; From 2c117f9e044f377f04c15de72fd0636bfc5355cc Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 13:36:31 +0200 Subject: [PATCH 016/122] Add type for ONYXKEYS.PERSONAL_DETAILS_LIST --- src/ONYXKEYS.ts | 1 + src/types/onyx/PersonalDetails.ts | 36 +++++++++++++++++++++++++++++++ src/types/onyx/index.ts | 3 ++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/PersonalDetails.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 80167a0fd92b..1d32bc4938a7 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -263,6 +263,7 @@ type OnyxValues = { [ONYXKEYS.IOU]: OnyxTypes.IOU; [ONYXKEYS.MODAL]: OnyxTypes.Modal; [ONYXKEYS.NETWORK]: OnyxTypes.Network; + [ONYXKEYS.PERSONAL_DETAILS_LIST]: Record; }; export default ONYXKEYS; diff --git a/src/types/onyx/PersonalDetails.ts b/src/types/onyx/PersonalDetails.ts new file mode 100644 index 000000000000..c401c09b1eec --- /dev/null +++ b/src/types/onyx/PersonalDetails.ts @@ -0,0 +1,36 @@ +type PersonalDetails = { + // First name of the current user from their personal details + firstName?: string; + + // Last name of the current user from their personal details + lastName?: string; + + // Display name of the current user from their personal details + displayName?: string; + + // Avatar URL of the current user from their personal details + avatar?: string; + + // Flag to set when Avatar uploading + avatarUploading?: boolean; + + // login of the current user from their personal details + login?: string; + + // pronouns of the current user from their personal details + pronouns?: string; + + // local currency for the user + localCurrencyCode?: string; + + // timezone of the current user from their personal details + timezone?: { + // Value of selected timezone + selected?: string; + + // Whether timezone is automatically set + automatic?: boolean; + }; +}; + +export default PersonalDetails; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index b5383e5b4ff9..28a77258cc18 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -4,5 +4,6 @@ import QueuedOnyxUpdates from './QueuedOnyxUpdates'; import IOU from './IOU'; import Modal from './Modal'; import Network from './Network'; +import PersonalDetails from './PersonalDetails'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails}; From 8f28192ac7bb3ce1193f19d30585216ce6073c31 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 13:39:30 +0200 Subject: [PATCH 017/122] Add type for ONYXKEYS.PRIVATE_PERSONAL_DETAILS --- src/ONYXKEYS.ts | 1 + src/types/onyx/PrivatePersonalDetails.ts | 16 ++++++++++++++++ src/types/onyx/index.ts | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/PrivatePersonalDetails.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 1d32bc4938a7..b93b6da96bfc 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -264,6 +264,7 @@ type OnyxValues = { [ONYXKEYS.MODAL]: OnyxTypes.Modal; [ONYXKEYS.NETWORK]: OnyxTypes.Network; [ONYXKEYS.PERSONAL_DETAILS_LIST]: Record; + [ONYXKEYS.PRIVATE_PERSONAL_DETAILS]: OnyxTypes.PrivatePersonalDetails; }; export default ONYXKEYS; diff --git a/src/types/onyx/PrivatePersonalDetails.ts b/src/types/onyx/PrivatePersonalDetails.ts new file mode 100644 index 000000000000..75cc11e3e63e --- /dev/null +++ b/src/types/onyx/PrivatePersonalDetails.ts @@ -0,0 +1,16 @@ +type PrivatePersonalDetails = { + legalFirstName?: string; + legalLastName?: string; + dob?: string; + + /** User's home address */ + address?: { + street?: string; + city?: string; + state?: string; + zip?: string; + country?: string; + }; +}; + +export default PrivatePersonalDetails; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 28a77258cc18..999e496c2a40 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -5,5 +5,6 @@ import IOU from './IOU'; import Modal from './Modal'; import Network from './Network'; import PersonalDetails from './PersonalDetails'; +import PrivatePersonalDetails from './PrivatePersonalDetails'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails}; From 83d87c62227fb68571f9047aa3063b1713f53f41 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 13:48:06 +0200 Subject: [PATCH 018/122] Add type for ONYXKEYS.TASK --- src/ONYXKEYS.ts | 1 + src/types/onyx/Report.ts | 79 ++++++++++++++++++++++++++++++++++++++++ src/types/onyx/Task.ts | 26 +++++++++++++ src/types/onyx/index.ts | 3 +- 4 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/Report.ts create mode 100644 src/types/onyx/Task.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index b93b6da96bfc..271cc8584cbd 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -265,6 +265,7 @@ type OnyxValues = { [ONYXKEYS.NETWORK]: OnyxTypes.Network; [ONYXKEYS.PERSONAL_DETAILS_LIST]: Record; [ONYXKEYS.PRIVATE_PERSONAL_DETAILS]: OnyxTypes.PrivatePersonalDetails; + [ONYXKEYS.TASK]: OnyxTypes.Task; }; export default ONYXKEYS; diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts new file mode 100644 index 000000000000..c1dbc76b5dfd --- /dev/null +++ b/src/types/onyx/Report.ts @@ -0,0 +1,79 @@ +import * as CommonTypes from './OnyxCommon'; + +type Report = { + /** The specific type of chat */ + chatType: '' | 'policyAnnounce' | 'policyAdmins' | 'domainAll' | 'policyRoom' | 'policyExpenseChat'; + + /** Whether there is an outstanding amount in IOU */ + hasOutstandingIOU: boolean; + + /** List of icons for report participants */ + icons: CommonTypes.Icon[]; + + /** Are we loading more report actions? */ + isLoadingMoreReportActions: boolean; + + /** Flag to check if the report actions data are loading */ + isLoadingReportActions: boolean; + + /** Whether the user is not an admin of policyExpenseChat chat */ + isOwnPolicyExpenseChat: boolean; + + /** Indicates if the report is pinned to the LHN or not */ + isPinned: boolean; + + /** The email of the last message's actor */ + lastActorEmail: string; + + /** The text of the last message on the report */ + lastMessageText: string; + + /** The time of the last message on the report */ + lastVisibleActionCreated: string; + + /** The last time the report was visited */ + lastReadTime: string; + + /** The current user's notification preference for this report */ + notificationPreference: string | number; + + /** The policy name to use for an archived report */ + oldPolicyName: string; + + /** The email address of the report owner */ + ownerEmail: string; + + /** List of primarylogins of participants of the report */ + participants: string[]; + + /** Linked policy's ID */ + policyID: string; + + /** Name of the report */ + reportName: string; + + /** ID of the report */ + reportID: string; + + /** The state that the report is currently in */ + stateNum: + | 0 // OPEN + | 1 // PROCESSING + | 2; // SUBMITTED + + /** The status of the current report */ + statusNum: + | 0 // OPEN + | 1 // SUBMITTED + | 2 // CLOSED + | 3 // APPROVED + | 4; // REIMBURSED + + /** Which user role is capable of posting messages on the report */ + writeCapability: 'all' | 'admins'; + + /** The report type */ + type: string; +}; + +export default Report; diff --git a/src/types/onyx/Task.ts b/src/types/onyx/Task.ts new file mode 100644 index 000000000000..bebc11901878 --- /dev/null +++ b/src/types/onyx/Task.ts @@ -0,0 +1,26 @@ +import Report from './Report'; + +type Task = { + /** Title of the Task */ + title?: string; + + /** Description of the Task */ + description?: string; + + /** Share destination of the Task */ + shareDestination?: string; + + /** The task report if it's currently being edited */ + report?: Report; + + /** Assignee of the task */ + assignee?: string; + + /** The account id of the assignee */ + assigneeAccountID?: string; + + /** Report id only when a task was created from a report */ + parentReportID?: string; +}; + +export default Task; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 999e496c2a40..7cc3de44b262 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -6,5 +6,6 @@ import Modal from './Modal'; import Network from './Network'; import PersonalDetails from './PersonalDetails'; import PrivatePersonalDetails from './PrivatePersonalDetails'; +import Task from './Task'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task}; From d9dbcec2423dfa673c1b253af253757951f5256a Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 13:52:59 +0200 Subject: [PATCH 019/122] Add type for ONYXKEYS.CURRENCY_LIST --- src/ONYXKEYS.ts | 1 + src/types/onyx/Currency.ts | 12 ++++++++++++ src/types/onyx/index.ts | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/Currency.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 271cc8584cbd..d5a2d4eb22e2 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -266,6 +266,7 @@ type OnyxValues = { [ONYXKEYS.PERSONAL_DETAILS_LIST]: Record; [ONYXKEYS.PRIVATE_PERSONAL_DETAILS]: OnyxTypes.PrivatePersonalDetails; [ONYXKEYS.TASK]: OnyxTypes.Task; + [ONYXKEYS.CURRENCY_LIST]: Record; }; export default ONYXKEYS; diff --git a/src/types/onyx/Currency.ts b/src/types/onyx/Currency.ts new file mode 100644 index 000000000000..6651fe1d8383 --- /dev/null +++ b/src/types/onyx/Currency.ts @@ -0,0 +1,12 @@ +type Currency = { + // Symbol for the currency + symbol?: string; + + // Name of the currency + name?: string; + + // ISO4217 Code for the currency + ISO4217?: string; +}; + +export default Currency; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 7cc3de44b262..e700de979dd0 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -7,5 +7,6 @@ import Network from './Network'; import PersonalDetails from './PersonalDetails'; import PrivatePersonalDetails from './PrivatePersonalDetails'; import Task from './Task'; +import Currency from './Currency'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency}; From dbb9b630cd30af24e3622cf1cd9ea9240a6e44e8 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 13:54:10 +0200 Subject: [PATCH 020/122] Add type for ONYXKEYS.UPDATE_AVAILABLE --- src/ONYXKEYS.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index d5a2d4eb22e2..c9ffed1e2a3f 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -267,6 +267,7 @@ type OnyxValues = { [ONYXKEYS.PRIVATE_PERSONAL_DETAILS]: OnyxTypes.PrivatePersonalDetails; [ONYXKEYS.TASK]: OnyxTypes.Task; [ONYXKEYS.CURRENCY_LIST]: Record; + [ONYXKEYS.UPDATE_AVAILABLE]: boolean; }; export default ONYXKEYS; From 9d33b9d3240b1c29f0ea214c56816b89cd84783d Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 13:58:13 +0200 Subject: [PATCH 021/122] Add type for ONYXKEYS.SCREEN_SHARE_REQUEST --- src/ONYXKEYS.ts | 1 + src/types/onyx/ScreenShareRequest.ts | 9 +++++++++ src/types/onyx/index.ts | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/ScreenShareRequest.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index c9ffed1e2a3f..68633905ec2d 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -268,6 +268,7 @@ type OnyxValues = { [ONYXKEYS.TASK]: OnyxTypes.Task; [ONYXKEYS.CURRENCY_LIST]: Record; [ONYXKEYS.UPDATE_AVAILABLE]: boolean; + [ONYXKEYS.SCREEN_SHARE_REQUEST]: OnyxTypes.ScreenShareRequest; }; export default ONYXKEYS; diff --git a/src/types/onyx/ScreenShareRequest.ts b/src/types/onyx/ScreenShareRequest.ts new file mode 100644 index 000000000000..564ba99c22ac --- /dev/null +++ b/src/types/onyx/ScreenShareRequest.ts @@ -0,0 +1,9 @@ +type ScreenShareRequest = { + /** Access token required to join a screen share room, generated by the backend */ + accessToken: string; + + /** Name of the screen share room to join */ + roomName: string; +}; + +export default ScreenShareRequest; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index e700de979dd0..fd6d2e9c7150 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -8,5 +8,6 @@ import PersonalDetails from './PersonalDetails'; import PrivatePersonalDetails from './PrivatePersonalDetails'; import Task from './Task'; import Currency from './Currency'; +import ScreenShareRequest from './ScreenShareRequest'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest}; From 1e0f66bb8099d6a11898b9c39d9ffb3d6d90c562 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 14:02:27 +0200 Subject: [PATCH 022/122] Add type for ONYXKEYS.COUNTRY_CODE --- src/ONYXKEYS.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 68633905ec2d..eb56bc744e5a 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -269,6 +269,7 @@ type OnyxValues = { [ONYXKEYS.CURRENCY_LIST]: Record; [ONYXKEYS.UPDATE_AVAILABLE]: boolean; [ONYXKEYS.SCREEN_SHARE_REQUEST]: OnyxTypes.ScreenShareRequest; + [ONYXKEYS.COUNTRY_CODE]: number; }; export default ONYXKEYS; From c9c04251829da62de1bb7f7c57733b99bbc5207a Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 14:11:58 +0200 Subject: [PATCH 023/122] Add type for ONYXKEYS.USER --- src/ONYXKEYS.ts | 1 + src/types/onyx/User.ts | 30 ++++++++++++++++++++++++++++++ src/types/onyx/index.ts | 3 ++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/User.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index eb56bc744e5a..184cec95640e 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -270,6 +270,7 @@ type OnyxValues = { [ONYXKEYS.UPDATE_AVAILABLE]: boolean; [ONYXKEYS.SCREEN_SHARE_REQUEST]: OnyxTypes.ScreenShareRequest; [ONYXKEYS.COUNTRY_CODE]: number; + [ONYXKEYS.USER]: OnyxTypes.User; }; export default ONYXKEYS; diff --git a/src/types/onyx/User.ts b/src/types/onyx/User.ts new file mode 100644 index 000000000000..cb5cd1d8c29a --- /dev/null +++ b/src/types/onyx/User.ts @@ -0,0 +1,30 @@ +type User = { + /** Whether or not the user is subscribed to news updates */ + isSubscribedToNewsletter?: boolean; + + /** Whether we should use the staging version of the secure API server */ + shouldUseStagingServer?: boolean; + + /** Is the user account validated? */ + validated?: boolean; + + /** Whether or not the user is on a public domain email account or not */ + isFromPublicDomain?: boolean; + + /** Whether or not the user use expensify card */ + isUsingExpensifyCard?: boolean; + + /** Whever Expensify Card approval flow is ongoing - checking loginList for private domains */ + isCheckingDomain?: boolean; + + /** Whether or not the user has lounge access */ + hasLoungeAccess?: boolean; + + /** error associated with adding a secondary login */ + error?: string; + + /** Whether the form is being submitted */ + loading?: boolean; +}; + +export default User; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index fd6d2e9c7150..c5bfb9de219a 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -9,5 +9,6 @@ import PrivatePersonalDetails from './PrivatePersonalDetails'; import Task from './Task'; import Currency from './Currency'; import ScreenShareRequest from './ScreenShareRequest'; +import User from './User'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest, User}; From f9976ede428928979ea2a9c067f5d3b612f60dd9 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 14:27:33 +0200 Subject: [PATCH 024/122] Add type for ONYXKEYS.LOGIN --- src/ONYXKEYS.ts | 11 ++++++----- src/types/onyx/Login.ts | 18 ++++++++++++++++++ src/types/onyx/index.ts | 3 ++- 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 src/types/onyx/Login.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 184cec95640e..ce1e6e054902 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -250,16 +250,16 @@ type OnyxKey = UtilTypes.DeepValueOf> | Collecti type OnyxValues = { [ONYXKEYS.ACCOUNT]: OnyxTypes.Account; - [ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID]?: string; - [ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER]?: boolean; + [ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID]: string; + [ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER]: boolean; [ONYXKEYS.ACTIVE_CLIENTS]: string[]; [ONYXKEYS.DEVICE_ID]: string; - [ONYXKEYS.IS_SIDEBAR_LOADED]?: boolean; + [ONYXKEYS.IS_SIDEBAR_LOADED]: boolean; // TODO: Type persisted requests properly [ONYXKEYS.PERSISTED_REQUESTS]: unknown[]; [ONYXKEYS.QUEUED_ONYX_UPDATES]: OnyxTypes.QueuedOnyxUpdates; - [ONYXKEYS.CURRENT_DATE]?: string; - [ONYXKEYS.CREDENTIALS]?: OnyxTypes.Credentials; + [ONYXKEYS.CURRENT_DATE]: string; + [ONYXKEYS.CREDENTIALS]: OnyxTypes.Credentials; [ONYXKEYS.IOU]: OnyxTypes.IOU; [ONYXKEYS.MODAL]: OnyxTypes.Modal; [ONYXKEYS.NETWORK]: OnyxTypes.Network; @@ -271,6 +271,7 @@ type OnyxValues = { [ONYXKEYS.SCREEN_SHARE_REQUEST]: OnyxTypes.ScreenShareRequest; [ONYXKEYS.COUNTRY_CODE]: number; [ONYXKEYS.USER]: OnyxTypes.User; + [ONYXKEYS.LOGIN_LIST]: OnyxTypes.Login; }; export default ONYXKEYS; diff --git a/src/types/onyx/Login.ts b/src/types/onyx/Login.ts new file mode 100644 index 000000000000..80f94defc201 --- /dev/null +++ b/src/types/onyx/Login.ts @@ -0,0 +1,18 @@ +type Login = { + /** Phone/Email associated with user */ + partnerUserID?: string; + + /** Value of partner name */ + partnerName?: string; + + /** Date login was validated, used to show info indicator status */ + validatedDate?: string; + + /** Field-specific server side errors keyed by microtime */ + errorFields?: Record>; + + /** Field-specific pending states for offline UI status */ + pendingFields?: Record>; +}; + +export default Login; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index c5bfb9de219a..ec2a0cdc98ca 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -10,5 +10,6 @@ import Task from './Task'; import Currency from './Currency'; import ScreenShareRequest from './ScreenShareRequest'; import User from './User'; +import Login from './Login'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest, User}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest, User, Login}; From 6990be1ef9da79384f76cf3e584a7a88da4b3ea7 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 14:55:33 +0200 Subject: [PATCH 025/122] Add type for ONYXKEYS.SESSION --- src/ONYXKEYS.ts | 1 + src/types/onyx/Report.ts | 4 ++-- src/types/onyx/Session.ts | 15 +++++++++++++++ src/types/onyx/index.ts | 3 ++- 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 src/types/onyx/Session.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index ce1e6e054902..4767860a127b 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -272,6 +272,7 @@ type OnyxValues = { [ONYXKEYS.COUNTRY_CODE]: number; [ONYXKEYS.USER]: OnyxTypes.User; [ONYXKEYS.LOGIN_LIST]: OnyxTypes.Login; + [ONYXKEYS.SESSION]: OnyxTypes.Session; }; export default ONYXKEYS; diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index c1dbc76b5dfd..8f484ba2271c 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -1,4 +1,4 @@ -import * as CommonTypes from './OnyxCommon'; +import * as OnyxCommon from './OnyxCommon'; type Report = { /** The specific type of chat */ @@ -8,7 +8,7 @@ type Report = { hasOutstandingIOU: boolean; /** List of icons for report participants */ - icons: CommonTypes.Icon[]; + icons: OnyxCommon.Icon[]; /** Are we loading more report actions? */ isLoadingMoreReportActions: boolean; diff --git a/src/types/onyx/Session.ts b/src/types/onyx/Session.ts new file mode 100644 index 000000000000..2e8296271687 --- /dev/null +++ b/src/types/onyx/Session.ts @@ -0,0 +1,15 @@ +type Session = { + /** The user's email for the current session */ + email?: string; + + /** Currently logged in user authToken */ + authToken?: string; + + /** Currently logged in user encrypted authToken */ + encryptedAuthToken?: string; + + /** Currently logged in user accountID */ + accountID?: number; +}; + +export default Session; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index ec2a0cdc98ca..b7056c01e50a 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -11,5 +11,6 @@ import Currency from './Currency'; import ScreenShareRequest from './ScreenShareRequest'; import User from './User'; import Login from './Login'; +import Session from './Session'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest, User, Login}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest, User, Login, Session}; From 40e7bdc1953ceeb189e83d7d137dbe7062ef8e00 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 4 Jul 2023 15:03:26 +0200 Subject: [PATCH 026/122] Add type for ONYXKEYS.BETAS --- src/ONYXKEYS.ts | 2 ++ src/types/onyx/Beta.ts | 6 ++++++ src/types/onyx/index.ts | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/Beta.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 4767860a127b..0334fddf1479 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -1,6 +1,7 @@ import {ValueOf} from 'type-fest'; import * as UtilTypes from './types/utils'; import * as OnyxTypes from './types/onyx'; +import CONST from './CONST'; /** * This is a file containing constants for all the top level keys in our store @@ -273,6 +274,7 @@ type OnyxValues = { [ONYXKEYS.USER]: OnyxTypes.User; [ONYXKEYS.LOGIN_LIST]: OnyxTypes.Login; [ONYXKEYS.SESSION]: OnyxTypes.Session; + [ONYXKEYS.BETAS]: OnyxTypes.Beta[]; }; export default ONYXKEYS; diff --git a/src/types/onyx/Beta.ts b/src/types/onyx/Beta.ts new file mode 100644 index 000000000000..d40d05a9ed3d --- /dev/null +++ b/src/types/onyx/Beta.ts @@ -0,0 +1,6 @@ +import {ValueOf} from 'type-fest'; +import CONST from '../../CONST'; + +type Beta = ValueOf; + +export default Beta; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index b7056c01e50a..0f06298297b2 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -12,5 +12,6 @@ import ScreenShareRequest from './ScreenShareRequest'; import User from './User'; import Login from './Login'; import Session from './Session'; +import Beta from './Beta'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest, User, Login, Session}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest, User, Login, Session, Beta}; From c98189afb5ff4513c2650f6b7e36b3eb6ee30774 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 11:12:02 +0200 Subject: [PATCH 027/122] Add type for ONYXKEYS.PAYPAL --- src/ONYXKEYS.ts | 1 + src/types/onyx/OnyxCommon.ts | 6 ++++-- src/types/onyx/Paypal.ts | 27 +++++++++++++++++++++++++++ src/types/onyx/index.ts | 3 ++- 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 src/types/onyx/Paypal.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 0334fddf1479..97623409b8e1 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -275,6 +275,7 @@ type OnyxValues = { [ONYXKEYS.LOGIN_LIST]: OnyxTypes.Login; [ONYXKEYS.SESSION]: OnyxTypes.Session; [ONYXKEYS.BETAS]: OnyxTypes.Beta[]; + [ONYXKEYS.PAYPAL]: OnyxTypes.Paypal; }; export default ONYXKEYS; diff --git a/src/types/onyx/OnyxCommon.ts b/src/types/onyx/OnyxCommon.ts index fbfe8633f060..260012849865 100644 --- a/src/types/onyx/OnyxCommon.ts +++ b/src/types/onyx/OnyxCommon.ts @@ -1,6 +1,8 @@ +import {ValueOf} from 'type-fest'; import * as React from 'react'; +import CONST from '../../CONST'; -type PendingAction = 'add' | 'delete' | 'update'; +type PendingAction = ValueOf; type BaseState = { success?: string; @@ -20,4 +22,4 @@ type Icon = { name: string; }; -export type {BaseState, Icon}; +export type {BaseState, Icon, PendingAction}; diff --git a/src/types/onyx/Paypal.ts b/src/types/onyx/Paypal.ts new file mode 100644 index 000000000000..61130723ddb1 --- /dev/null +++ b/src/types/onyx/Paypal.ts @@ -0,0 +1,27 @@ +import CONST from '../../CONST'; +import * as OnyxCommon from './OnyxCommon'; + +type PaypalAccountData = { + username?: string; +}; + +type Paypal = { + /** This is always 'PayPal.me' */ + title?: string; + + /** The paypalMe address */ + description?: string; + + /** This is always 'payPalMe' */ + methodID?: typeof CONST.PAYMENT_METHODS.PAYPAL; + + /** This is always 'payPalMe' */ + accountType?: typeof CONST.PAYMENT_METHODS.PAYPAL; + + key?: string; + isDefault?: boolean; + pendingAction?: OnyxCommon.PendingAction; + accountData?: PaypalAccountData; +}; + +export default Paypal; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 0f06298297b2..45ae86c9f677 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -13,5 +13,6 @@ import User from './User'; import Login from './Login'; import Session from './Session'; import Beta from './Beta'; +import Paypal from './Paypal'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest, User, Login, Session, Beta}; +export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest, User, Login, Session, Beta, Paypal}; From 85bfc4ea77a4cf8a2429b2ca872a0da2f2118cbd Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 12:34:28 +0200 Subject: [PATCH 028/122] Add type for ONYXKEYS.NVP_PRIORITY_MODE --- src/ONYXKEYS.ts | 86 +++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 46 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 97623409b8e1..ed346f95e7fc 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -111,27 +111,6 @@ const ONYXKEYS = { /** Token needed to initialize Onfido */ ONFIDO_TOKEN: 'onfidoToken', - /** Collection Keys */ - COLLECTION: { - DOWNLOAD: 'download_', - POLICY: 'policy_', - POLICY_MEMBERS: 'policyMembers_', - WORKSPACE_INVITE_MEMBERS_DRAFT: 'workspaceInviteMembersDraft_', - REPORT: 'report_', - REPORT_ACTIONS: 'reportActions_', - REPORT_ACTIONS_DRAFTS: 'reportActionsDrafts_', - REPORT_ACTIONS_REACTIONS: 'reportActionsReactions_', - REPORT_DRAFT_COMMENT: 'reportDraftComment_', - REPORT_DRAFT_COMMENT_NUMBER_OF_LINES: 'reportDraftCommentNumberOfLines_', - REPORT_IS_COMPOSER_FULL_SIZE: 'reportIsComposerFullSize_', - REPORT_USER_IS_TYPING: 'reportUserIsTyping_', - SECURITY_GROUP: 'securityGroup_', - TRANSACTION: 'transactions_', - - /** This is deprecated, but needed for a migration, so we still need to include it here so that it will be initialized in Onyx.init */ - DEPRECATED_POLICY_MEMBER_LIST: 'policyMemberList_', - }, - /** Indicates which locale should be used */ NVP_PREFERRED_LOCALE: 'preferredLocale', @@ -195,6 +174,45 @@ const ONYXKEYS = { /** The policyID of the last workspace whose settings were accessed by the user */ LAST_ACCESSED_WORKSPACE_POLICY_ID: 'lastAccessedWorkspacePolicyID', + /** Whether we should show the compose input or not */ + SHOULD_SHOW_COMPOSE_INPUT: 'shouldShowComposeInput', + + /** Is app in beta version */ + IS_BETA: 'isBeta', + + /** Whether the auth token is valid */ + IS_TOKEN_VALID: 'isTokenValid', + + /** Whether we're checking if the room is public or not */ + IS_CHECKING_PUBLIC_ROOM: 'isCheckingPublicRoom', + + /** A map of the user's security group IDs they belong to in specific domains */ + MY_DOMAIN_SECURITY_GROUPS: 'myDomainSecurityGroups', + + /** Report ID of the last report the user viewed as anonymous user */ + LAST_OPENED_PUBLIC_ROOM_ID: 'lastOpenedPublicRoomID', + + /** Collection Keys */ + COLLECTION: { + DOWNLOAD: 'download_', + POLICY: 'policy_', + POLICY_MEMBERS: 'policyMembers_', + WORKSPACE_INVITE_MEMBERS_DRAFT: 'workspaceInviteMembersDraft_', + REPORT: 'report_', + REPORT_ACTIONS: 'reportActions_', + REPORT_ACTIONS_DRAFTS: 'reportActionsDrafts_', + REPORT_ACTIONS_REACTIONS: 'reportActionsReactions_', + REPORT_DRAFT_COMMENT: 'reportDraftComment_', + REPORT_DRAFT_COMMENT_NUMBER_OF_LINES: 'reportDraftCommentNumberOfLines_', + REPORT_IS_COMPOSER_FULL_SIZE: 'reportIsComposerFullSize_', + REPORT_USER_IS_TYPING: 'reportUserIsTyping_', + SECURITY_GROUP: 'securityGroup_', + TRANSACTION: 'transactions_', + + /** This is deprecated, but needed for a migration, so we still need to include it here so that it will be initialized in Onyx.init */ + DEPRECATED_POLICY_MEMBER_LIST: 'policyMemberList_', + }, + /** List of Form ids */ FORMS: { ADD_DEBIT_CARD_FORM: 'addDebitCardForm', @@ -218,31 +236,6 @@ const ONYXKEYS = { NEW_CONTACT_METHOD_FORM: 'newContactMethodForm', PAYPAL_FORM: 'payPalForm', }, - - /** Whether we should show the compose input or not */ - SHOULD_SHOW_COMPOSE_INPUT: 'shouldShowComposeInput', - - /** Is app in beta version */ - IS_BETA: 'isBeta', - - // The theme setting set by the user in preferences. - // This can be either "light", "dark" or "system" - PREFERRED_THEME: 'preferredTheme', - - /** Whether the auth token is valid */ - IS_TOKEN_VALID: 'isTokenValid', - - /** Whether we're checking if the room is public or not */ - IS_CHECKING_PUBLIC_ROOM: 'isCheckingPublicRoom', - - /** A map of the user's security group IDs they belong to in specific domains */ - MY_DOMAIN_SECURITY_GROUPS: 'myDomainSecurityGroups', - - /** Report ID of the last report the user viewed as anonymous user */ - LAST_OPENED_PUBLIC_ROOM_ID: 'lastOpenedPublicRoomID', - - // Experimental memory only Onyx mode flag - IS_USING_MEMORY_ONLY_KEYS: 'isUsingMemoryOnlyKeys', } as const; type OnyxKeysMap = typeof ONYXKEYS; @@ -276,6 +269,7 @@ type OnyxValues = { [ONYXKEYS.SESSION]: OnyxTypes.Session; [ONYXKEYS.BETAS]: OnyxTypes.Beta[]; [ONYXKEYS.PAYPAL]: OnyxTypes.Paypal; + [ONYXKEYS.NVP_PRIORITY_MODE]: ValueOf; }; export default ONYXKEYS; From 548fd4ac46292bbec7fc8710526611aa0fb892c1 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 12:38:25 +0200 Subject: [PATCH 029/122] Add type for ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE --- src/ONYXKEYS.ts | 1 + src/types/onyx/BlockedFromConcierge.ts | 6 ++++++ src/types/onyx/index.ts | 21 ++++++++++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/BlockedFromConcierge.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index ed346f95e7fc..15533ac75273 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -270,6 +270,7 @@ type OnyxValues = { [ONYXKEYS.BETAS]: OnyxTypes.Beta[]; [ONYXKEYS.PAYPAL]: OnyxTypes.Paypal; [ONYXKEYS.NVP_PRIORITY_MODE]: ValueOf; + [ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE]: OnyxTypes.BlockedFromConcierge; }; export default ONYXKEYS; diff --git a/src/types/onyx/BlockedFromConcierge.ts b/src/types/onyx/BlockedFromConcierge.ts new file mode 100644 index 000000000000..faa0681b79cf --- /dev/null +++ b/src/types/onyx/BlockedFromConcierge.ts @@ -0,0 +1,6 @@ +type BlockedFromConcierge = { + /** The date that the user will be unblocked */ + expiresAt?: string; +}; + +export default BlockedFromConcierge; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 45ae86c9f677..370e9cc7315b 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -14,5 +14,24 @@ import Login from './Login'; import Session from './Session'; import Beta from './Beta'; import Paypal from './Paypal'; +import BlockedFromConcierge from './BlockedFromConcierge'; -export type {Account, Credentials, QueuedOnyxUpdates, IOU, Modal, Network, PersonalDetails, PrivatePersonalDetails, Task, Currency, ScreenShareRequest, User, Login, Session, Beta, Paypal}; +export type { + Account, + Credentials, + QueuedOnyxUpdates, + IOU, + Modal, + Network, + PersonalDetails, + PrivatePersonalDetails, + Task, + Currency, + ScreenShareRequest, + User, + Login, + Session, + Beta, + Paypal, + BlockedFromConcierge, +}; From 53b466f7c17b2e611ab877d5c432f05c2edfe9c8 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 12:39:56 +0200 Subject: [PATCH 030/122] Add type for ONYXKEYS.NVP_PRIVATE_PUSH_NOTIFICATION_ID --- src/ONYXKEYS.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 15533ac75273..f14deb5101fd 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -271,6 +271,7 @@ type OnyxValues = { [ONYXKEYS.PAYPAL]: OnyxTypes.Paypal; [ONYXKEYS.NVP_PRIORITY_MODE]: ValueOf; [ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE]: OnyxTypes.BlockedFromConcierge; + [ONYXKEYS.NVP_PRIVATE_PUSH_NOTIFICATION_ID]: string; }; export default ONYXKEYS; From a748462768052b7486b1a2063e8314a34a1fa573 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 12:41:01 +0200 Subject: [PATCH 031/122] Add type for ONYXKEYS.NVP_LAST_PAYMENT_METHOD --- src/ONYXKEYS.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index f14deb5101fd..dd482cfdbeb1 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -272,6 +272,7 @@ type OnyxValues = { [ONYXKEYS.NVP_PRIORITY_MODE]: ValueOf; [ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE]: OnyxTypes.BlockedFromConcierge; [ONYXKEYS.NVP_PRIVATE_PUSH_NOTIFICATION_ID]: string; + [ONYXKEYS.NVP_LAST_PAYMENT_METHOD]: Record; }; export default ONYXKEYS; From 3c73f40a2c8e9c493be66b8ea4633229a6c998da Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 12:42:09 +0200 Subject: [PATCH 032/122] Add type for ONYXKEYS.PUSH_NOTIFICATIONS_ENABLED --- src/ONYXKEYS.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index dd482cfdbeb1..1e1773faa826 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -273,6 +273,7 @@ type OnyxValues = { [ONYXKEYS.NVP_BLOCKED_FROM_CONCIERGE]: OnyxTypes.BlockedFromConcierge; [ONYXKEYS.NVP_PRIVATE_PUSH_NOTIFICATION_ID]: string; [ONYXKEYS.NVP_LAST_PAYMENT_METHOD]: Record; + [ONYXKEYS.PUSH_NOTIFICATIONS_ENABLED]: boolean; }; export default ONYXKEYS; From d53b28df54e6a562fc7de1de59cfc19bc471e8e9 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 12:51:19 +0200 Subject: [PATCH 033/122] Add type for ONYXKEYS.PLAID_DATA --- src/ONYXKEYS.ts | 1 + src/types/onyx/BankAccount.ts | 24 ++++++++++++++++++++++++ src/types/onyx/PlaidData.ts | 18 ++++++++++++++++++ src/types/onyx/index.ts | 2 ++ 4 files changed, 45 insertions(+) create mode 100644 src/types/onyx/BankAccount.ts create mode 100644 src/types/onyx/PlaidData.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 1e1773faa826..053abfd17e03 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -274,6 +274,7 @@ type OnyxValues = { [ONYXKEYS.NVP_PRIVATE_PUSH_NOTIFICATION_ID]: string; [ONYXKEYS.NVP_LAST_PAYMENT_METHOD]: Record; [ONYXKEYS.PUSH_NOTIFICATIONS_ENABLED]: boolean; + [ONYXKEYS.PLAID_DATA]: OnyxTypes.PlaidData; }; export default ONYXKEYS; diff --git a/src/types/onyx/BankAccount.ts b/src/types/onyx/BankAccount.ts new file mode 100644 index 000000000000..b83f8ee8c68d --- /dev/null +++ b/src/types/onyx/BankAccount.ts @@ -0,0 +1,24 @@ +type BankAccount = { + /** Masked account number */ + accountNumber: string; + + /** Name of account */ + addressName: string; + + /** Is the account a savings account? */ + isSavings: boolean; + + /** Unique identifier for this account in Plaid */ + plaidAccountID: string; + + /** Routing number for the account */ + routingNumber: string; + + /** last 4 digits of the account number */ + mask: string; + + /** Plaid access token, used to then retrieve Assets and Balances */ + plaidAccessToken: string; +}; + +export default BankAccount; diff --git a/src/types/onyx/PlaidData.ts b/src/types/onyx/PlaidData.ts new file mode 100644 index 000000000000..764bdda0abc2 --- /dev/null +++ b/src/types/onyx/PlaidData.ts @@ -0,0 +1,18 @@ +import BankAccount from './BankAccount'; +import * as OnyxCommon from './OnyxCommon'; + +type PlaidData = OnyxCommon.BaseState & { + /** Name of the bank */ + bankName?: string; + + /** + * Access token returned by Plaid once the user has logged into their bank. + * This token can be used along with internal credentials to query for Plaid Balance or Assets + */ + plaidAccessToken?: string; + + /** List of plaid bank accounts */ + bankAccounts?: BankAccount[]; +}; + +export default PlaidData; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 370e9cc7315b..d7cc9fc9ad38 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -15,6 +15,7 @@ import Session from './Session'; import Beta from './Beta'; import Paypal from './Paypal'; import BlockedFromConcierge from './BlockedFromConcierge'; +import PlaidData from './PlaidData'; export type { Account, @@ -34,4 +35,5 @@ export type { Beta, Paypal, BlockedFromConcierge, + PlaidData, }; From 68350a00f6a0613947a82184a59d7c859c72a269 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 12:53:43 +0200 Subject: [PATCH 034/122] Add all values and type booleans --- src/ONYXKEYS.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 053abfd17e03..bfd818e5caba 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -275,6 +275,36 @@ type OnyxValues = { [ONYXKEYS.NVP_LAST_PAYMENT_METHOD]: Record; [ONYXKEYS.PUSH_NOTIFICATIONS_ENABLED]: boolean; [ONYXKEYS.PLAID_DATA]: OnyxTypes.PlaidData; + [ONYXKEYS.IS_PLAID_DISABLED]: boolean; + // [ONYXKEYS.PLAID_LINK_TOKEN]: OnyxTypes; + // [ONYXKEYS.ONFIDO_TOKEN]: OnyxTypes; + // [ONYXKEYS.NVP_PREFERRED_LOCALE]: OnyxTypes; + // [ONYXKEYS.TRANSACTIONS_BEING_REJECTED]: OnyxTypes; + // [ONYXKEYS.USER_WALLET]: OnyxTypes; + // [ONYXKEYS.WALLET_ONFIDO]: OnyxTypes; + // [ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes; + // [ONYXKEYS.WALLET_TERMS]: OnyxTypes; + // [ONYXKEYS.BANK_ACCOUNT_LIST]: OnyxTypes; + // [ONYXKEYS.CARD_LIST]: OnyxTypes; + // [ONYXKEYS.WALLET_STATEMENT]: OnyxTypes; + // [ONYXKEYS.PERSONAL_BANK_ACCOUNT]: OnyxTypes; + // [ONYXKEYS.REIMBURSEMENT_ACCOUNT]: OnyxTypes; + // [ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT]: OnyxTypes; + // [ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE]: OnyxTypes; + // [ONYXKEYS.FREQUENTLY_USED_EMOJIS]: OnyxTypes; + // [ONYXKEYS.REIMBURSEMENT_ACCOUNT_WORKSPACE_ID]: OnyxTypes; + [ONYXKEYS.IS_LOADING_PAYMENT_METHODS]: boolean; + [ONYXKEYS.IS_LOADING_REPORT_DATA]: boolean; + [ONYXKEYS.IS_SHORTCUTS_MODAL_OPEN]: boolean; + [ONYXKEYS.IS_TEST_TOOLS_MODAL_OPEN]: boolean; + // [ONYXKEYS.WALLET_TRANSFER]: OnyxTypes; + // [ONYXKEYS.LAST_ACCESSED_WORKSPACE_POLICY_ID]: OnyxTypes; + // [ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT]: OnyxTypes; + [ONYXKEYS.IS_BETA]: boolean; + [ONYXKEYS.IS_TOKEN_VALID]: boolean; + [ONYXKEYS.IS_CHECKING_PUBLIC_ROOM]: boolean; + // [ONYXKEYS.MY_DOMAIN_SECURITY_GROUPS]: OnyxTypes; + // [ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID]: OnyxTypes; }; export default ONYXKEYS; From c17349aa8d63a5c6cf25266d6594616365e74390 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 12:55:19 +0200 Subject: [PATCH 035/122] Add type for ONYXKEYS.PLAID_LINK_TOKEN --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index bfd818e5caba..5a2bfef68507 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -276,7 +276,7 @@ type OnyxValues = { [ONYXKEYS.PUSH_NOTIFICATIONS_ENABLED]: boolean; [ONYXKEYS.PLAID_DATA]: OnyxTypes.PlaidData; [ONYXKEYS.IS_PLAID_DISABLED]: boolean; - // [ONYXKEYS.PLAID_LINK_TOKEN]: OnyxTypes; + [ONYXKEYS.PLAID_LINK_TOKEN]: string; // [ONYXKEYS.ONFIDO_TOKEN]: OnyxTypes; // [ONYXKEYS.NVP_PREFERRED_LOCALE]: OnyxTypes; // [ONYXKEYS.TRANSACTIONS_BEING_REJECTED]: OnyxTypes; From 358bd6edff27ad893d752cc844d6b25cc54e0b6c Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 12:55:44 +0200 Subject: [PATCH 036/122] Add type for ONYXKEYS.ONFIDO_TOKEN --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 5a2bfef68507..7534bf2b31e6 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -277,7 +277,7 @@ type OnyxValues = { [ONYXKEYS.PLAID_DATA]: OnyxTypes.PlaidData; [ONYXKEYS.IS_PLAID_DISABLED]: boolean; [ONYXKEYS.PLAID_LINK_TOKEN]: string; - // [ONYXKEYS.ONFIDO_TOKEN]: OnyxTypes; + [ONYXKEYS.ONFIDO_TOKEN]: string; // [ONYXKEYS.NVP_PREFERRED_LOCALE]: OnyxTypes; // [ONYXKEYS.TRANSACTIONS_BEING_REJECTED]: OnyxTypes; // [ONYXKEYS.USER_WALLET]: OnyxTypes; From 4e0728ad5d50f500d07f2231e9d918af42d1061b Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 12:57:31 +0200 Subject: [PATCH 037/122] Add type for ONYXKEYS.NVP_PREFERRED_LOCALE --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 7534bf2b31e6..41aa4edfc60d 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -278,7 +278,7 @@ type OnyxValues = { [ONYXKEYS.IS_PLAID_DISABLED]: boolean; [ONYXKEYS.PLAID_LINK_TOKEN]: string; [ONYXKEYS.ONFIDO_TOKEN]: string; - // [ONYXKEYS.NVP_PREFERRED_LOCALE]: OnyxTypes; + [ONYXKEYS.NVP_PREFERRED_LOCALE]: ValueOf; // [ONYXKEYS.TRANSACTIONS_BEING_REJECTED]: OnyxTypes; // [ONYXKEYS.USER_WALLET]: OnyxTypes; // [ONYXKEYS.WALLET_ONFIDO]: OnyxTypes; From 8d0712caa3f6bbadb14ac0f5a2e63d013b00eb2f Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 12:58:16 +0200 Subject: [PATCH 038/122] Remove TRANSACTIONS_BEING_REJECTED as it is not used --- src/ONYXKEYS.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 41aa4edfc60d..2e0d999ee55c 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -114,9 +114,6 @@ const ONYXKEYS = { /** Indicates which locale should be used */ NVP_PREFERRED_LOCALE: 'preferredLocale', - /** List of transactionIDs in process of rejection */ - TRANSACTIONS_BEING_REJECTED: 'transactionsBeingRejected', - /** User's Expensify Wallet */ USER_WALLET: 'userWallet', @@ -279,7 +276,6 @@ type OnyxValues = { [ONYXKEYS.PLAID_LINK_TOKEN]: string; [ONYXKEYS.ONFIDO_TOKEN]: string; [ONYXKEYS.NVP_PREFERRED_LOCALE]: ValueOf; - // [ONYXKEYS.TRANSACTIONS_BEING_REJECTED]: OnyxTypes; // [ONYXKEYS.USER_WALLET]: OnyxTypes; // [ONYXKEYS.WALLET_ONFIDO]: OnyxTypes; // [ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes; From 439e2e346b095862245918bd02cefd48dda4cc70 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:03:48 +0200 Subject: [PATCH 039/122] Add type for ONYXKEYS.USER_WALLET --- src/ONYXKEYS.ts | 2 +- src/types/onyx/UserWallet.ts | 33 +++++++++++++++++++++++++++++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/UserWallet.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 2e0d999ee55c..008be8d539ea 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -276,7 +276,7 @@ type OnyxValues = { [ONYXKEYS.PLAID_LINK_TOKEN]: string; [ONYXKEYS.ONFIDO_TOKEN]: string; [ONYXKEYS.NVP_PREFERRED_LOCALE]: ValueOf; - // [ONYXKEYS.USER_WALLET]: OnyxTypes; + [ONYXKEYS.USER_WALLET]: OnyxTypes.UserWallet; // [ONYXKEYS.WALLET_ONFIDO]: OnyxTypes; // [ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes; // [ONYXKEYS.WALLET_TERMS]: OnyxTypes; diff --git a/src/types/onyx/UserWallet.ts b/src/types/onyx/UserWallet.ts new file mode 100644 index 000000000000..652e05663a9e --- /dev/null +++ b/src/types/onyx/UserWallet.ts @@ -0,0 +1,33 @@ +import {ValueOf} from 'type-fest'; +import CONST from '../../CONST'; + +type UserWallet = { + /** The user's available wallet balance */ + availableBalance?: number; + + /** The user's current wallet balance */ + currentBalance?: number; + + /** What step in the activation flow are we on? */ + currentStep?: ValueOf; + + /** Error code returned by the server */ + errorCode?: string; + + /** If we should show the FailedKYC view after the user submitted their info with a non fixable error */ + shouldShowFailedKYC?: boolean; + + /** Status of wallet - e.g. SILVER or GOLD */ + tierName?: ValueOf; + + /** Whether we should show the ActivateStep success view after the user finished the KYC flow */ + shouldShowWalletActivationSuccess?: boolean; + + /** The ID of the linked account */ + walletLinkedAccountID?: number; + + /** The type of the linked account (debitCard or bankAccount) */ + walletLinkedAccountType?: string; +}; + +export default UserWallet; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index d7cc9fc9ad38..9866bc5a0050 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -16,6 +16,7 @@ import Beta from './Beta'; import Paypal from './Paypal'; import BlockedFromConcierge from './BlockedFromConcierge'; import PlaidData from './PlaidData'; +import UserWallet from './UserWallet'; export type { Account, @@ -36,4 +37,5 @@ export type { Paypal, BlockedFromConcierge, PlaidData, + UserWallet, }; From 3631ceb6d5b276520ce94a590f47247bd14a28eb Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:08:44 +0200 Subject: [PATCH 040/122] Add type for ONYXKEYS.WALLET_ONFIDO --- src/ONYXKEYS.ts | 2 +- src/types/onyx/OnfidoWallet.ts | 21 +++++++++++++++++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/OnfidoWallet.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 008be8d539ea..09d1eef7acbe 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -277,7 +277,7 @@ type OnyxValues = { [ONYXKEYS.ONFIDO_TOKEN]: string; [ONYXKEYS.NVP_PREFERRED_LOCALE]: ValueOf; [ONYXKEYS.USER_WALLET]: OnyxTypes.UserWallet; - // [ONYXKEYS.WALLET_ONFIDO]: OnyxTypes; + [ONYXKEYS.WALLET_ONFIDO]: OnyxTypes.OnfidoWallet; // [ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes; // [ONYXKEYS.WALLET_TERMS]: OnyxTypes; // [ONYXKEYS.BANK_ACCOUNT_LIST]: OnyxTypes; diff --git a/src/types/onyx/OnfidoWallet.ts b/src/types/onyx/OnfidoWallet.ts new file mode 100644 index 000000000000..e9cfedee7120 --- /dev/null +++ b/src/types/onyx/OnfidoWallet.ts @@ -0,0 +1,21 @@ +type OnfidoWallet = { + /** Unique identifier returned from openOnfidoFlow then re-sent to ActivateWallet with Onfido response data */ + applicantID?: string; + + /** Token used to initialize the Onfido SDK token */ + sdkToken?: string; + + /** Loading state to provide feedback when we are waiting for a request to finish */ + loading?: boolean; + + /** Error message to inform the user of any problem that might occur */ + error?: string; + + /** A list of Onfido errors that the user can fix in order to attempt the Onfido flow again */ + fixableErrors?: string[]; + + /** Whether the user has accepted the privacy policy of Onfido or not */ + hasAcceptedPrivacyPolicy?: boolean; +}; + +export default OnfidoWallet; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 9866bc5a0050..db6cdc54b357 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -17,6 +17,7 @@ import Paypal from './Paypal'; import BlockedFromConcierge from './BlockedFromConcierge'; import PlaidData from './PlaidData'; import UserWallet from './UserWallet'; +import OnfidoWallet from './OnfidoWallet'; export type { Account, @@ -38,4 +39,5 @@ export type { BlockedFromConcierge, PlaidData, UserWallet, + OnfidoWallet, }; From 77840a3d8f59cade0d6df17e68668fa2caad2080 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:13:05 +0200 Subject: [PATCH 041/122] Add type for ONYXKEYS.WALLET_ADDITIONAL_DETAILS --- src/ONYXKEYS.ts | 2 +- src/types/onyx/WalletAdditionalDetails.ts | 23 +++++++++++++++++++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/WalletAdditionalDetails.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 09d1eef7acbe..510c508fb010 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -278,7 +278,7 @@ type OnyxValues = { [ONYXKEYS.NVP_PREFERRED_LOCALE]: ValueOf; [ONYXKEYS.USER_WALLET]: OnyxTypes.UserWallet; [ONYXKEYS.WALLET_ONFIDO]: OnyxTypes.OnfidoWallet; - // [ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes; + [ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes.WalletAdditionalDetails; // [ONYXKEYS.WALLET_TERMS]: OnyxTypes; // [ONYXKEYS.BANK_ACCOUNT_LIST]: OnyxTypes; // [ONYXKEYS.CARD_LIST]: OnyxTypes; diff --git a/src/types/onyx/WalletAdditionalDetails.ts b/src/types/onyx/WalletAdditionalDetails.ts new file mode 100644 index 000000000000..4b7012d23738 --- /dev/null +++ b/src/types/onyx/WalletAdditionalDetails.ts @@ -0,0 +1,23 @@ +import * as OnyxCommon from './OnyxCommon'; + +type WalletAdditionalDetails = OnyxCommon.BaseState & { + /** Questions returned by Ideology */ + questions?: { + prompt: string; + type: string; + answer: string[]; + }; + + /** ExpectID ID number related to those questions */ + idNumber?: string; + + /** Error code to determine additional behavior */ + errorCode?: string; + + /** Which field needs attention? */ + errorFields?: { + [fieldName: string]: boolean; + }; +}; + +export default WalletAdditionalDetails; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index db6cdc54b357..c3358eab4aae 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -18,6 +18,7 @@ import BlockedFromConcierge from './BlockedFromConcierge'; import PlaidData from './PlaidData'; import UserWallet from './UserWallet'; import OnfidoWallet from './OnfidoWallet'; +import WalletAdditionalDetails from './WalletAdditionalDetails'; export type { Account, @@ -40,4 +41,5 @@ export type { PlaidData, UserWallet, OnfidoWallet, + WalletAdditionalDetails, }; From 49a0be196fa8d4962488a2c9e5a244309b67baf7 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:17:02 +0200 Subject: [PATCH 042/122] Add type for ONYXKEYS.WALLET_TERMS --- src/ONYXKEYS.ts | 2 +- src/types/onyx/WalletTerms.ts | 9 +++++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/WalletTerms.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 510c508fb010..8057cdc29b7e 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -279,7 +279,7 @@ type OnyxValues = { [ONYXKEYS.USER_WALLET]: OnyxTypes.UserWallet; [ONYXKEYS.WALLET_ONFIDO]: OnyxTypes.OnfidoWallet; [ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes.WalletAdditionalDetails; - // [ONYXKEYS.WALLET_TERMS]: OnyxTypes; + [ONYXKEYS.WALLET_TERMS]: OnyxTypes.WalletTerms; // [ONYXKEYS.BANK_ACCOUNT_LIST]: OnyxTypes; // [ONYXKEYS.CARD_LIST]: OnyxTypes; // [ONYXKEYS.WALLET_STATEMENT]: OnyxTypes; diff --git a/src/types/onyx/WalletTerms.ts b/src/types/onyx/WalletTerms.ts new file mode 100644 index 000000000000..4f020051b531 --- /dev/null +++ b/src/types/onyx/WalletTerms.ts @@ -0,0 +1,9 @@ +type WalletTerms = { + /** Any error message to show */ + errors?: string[]; + + /** When the user accepts the Wallet's terms in order to pay an IOU, this is the ID of the chatReport the IOU is linked to */ + chatReportID?: string; +}; + +export default WalletTerms; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index c3358eab4aae..3246d943b203 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -19,6 +19,7 @@ import PlaidData from './PlaidData'; import UserWallet from './UserWallet'; import OnfidoWallet from './OnfidoWallet'; import WalletAdditionalDetails from './WalletAdditionalDetails'; +import WalletTerms from './WalletTerms'; export type { Account, @@ -42,4 +43,5 @@ export type { UserWallet, OnfidoWallet, WalletAdditionalDetails, + WalletTerms, }; From 96ddb62af31676ad77c1e68a6a885c419fd85125 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:21:06 +0200 Subject: [PATCH 043/122] Add type for ONYXKEYS.BANK_ACCOUNT_LIST --- src/ONYXKEYS.ts | 2 +- src/types/onyx/BankAccount.ts | 25 ++++++++----------------- src/types/onyx/PlaidBankAccount.ts | 24 ++++++++++++++++++++++++ src/types/onyx/PlaidData.ts | 4 ++-- src/types/onyx/index.ts | 2 ++ 5 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 src/types/onyx/PlaidBankAccount.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 8057cdc29b7e..f90014b6a44c 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -280,7 +280,7 @@ type OnyxValues = { [ONYXKEYS.WALLET_ONFIDO]: OnyxTypes.OnfidoWallet; [ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes.WalletAdditionalDetails; [ONYXKEYS.WALLET_TERMS]: OnyxTypes.WalletTerms; - // [ONYXKEYS.BANK_ACCOUNT_LIST]: OnyxTypes; + [ONYXKEYS.BANK_ACCOUNT_LIST]: Record; // [ONYXKEYS.CARD_LIST]: OnyxTypes; // [ONYXKEYS.WALLET_STATEMENT]: OnyxTypes; // [ONYXKEYS.PERSONAL_BANK_ACCOUNT]: OnyxTypes; diff --git a/src/types/onyx/BankAccount.ts b/src/types/onyx/BankAccount.ts index b83f8ee8c68d..bf43b28d8438 100644 --- a/src/types/onyx/BankAccount.ts +++ b/src/types/onyx/BankAccount.ts @@ -1,24 +1,15 @@ type BankAccount = { - /** Masked account number */ - accountNumber: string; + /** The name of the institution (bank of america, etc */ + addressName?: string; - /** Name of account */ - addressName: string; + /** The masked bank account number */ + accountNumber?: string; - /** Is the account a savings account? */ - isSavings: boolean; + /** The bankAccountID in the bankAccounts db */ + bankAccountID?: number; - /** Unique identifier for this account in Plaid */ - plaidAccountID: string; - - /** Routing number for the account */ - routingNumber: string; - - /** last 4 digits of the account number */ - mask: string; - - /** Plaid access token, used to then retrieve Assets and Balances */ - plaidAccessToken: string; + /** The bank account type */ + type?: string; }; export default BankAccount; diff --git a/src/types/onyx/PlaidBankAccount.ts b/src/types/onyx/PlaidBankAccount.ts new file mode 100644 index 000000000000..7710effeb751 --- /dev/null +++ b/src/types/onyx/PlaidBankAccount.ts @@ -0,0 +1,24 @@ +type PlaidBankAccount = { + /** Masked account number */ + accountNumber: string; + + /** Name of account */ + addressName: string; + + /** Is the account a savings account? */ + isSavings: boolean; + + /** Unique identifier for this account in Plaid */ + plaidAccountID: string; + + /** Routing number for the account */ + routingNumber: string; + + /** last 4 digits of the account number */ + mask: string; + + /** Plaid access token, used to then retrieve Assets and Balances */ + plaidAccessToken: string; +}; + +export default PlaidBankAccount; diff --git a/src/types/onyx/PlaidData.ts b/src/types/onyx/PlaidData.ts index 764bdda0abc2..f4b8239597c5 100644 --- a/src/types/onyx/PlaidData.ts +++ b/src/types/onyx/PlaidData.ts @@ -1,4 +1,4 @@ -import BankAccount from './BankAccount'; +import PlaidBankAccount from './PlaidBankAccount'; import * as OnyxCommon from './OnyxCommon'; type PlaidData = OnyxCommon.BaseState & { @@ -12,7 +12,7 @@ type PlaidData = OnyxCommon.BaseState & { plaidAccessToken?: string; /** List of plaid bank accounts */ - bankAccounts?: BankAccount[]; + bankAccounts?: PlaidBankAccount[]; }; export default PlaidData; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 3246d943b203..47cd60149abb 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -20,6 +20,7 @@ import UserWallet from './UserWallet'; import OnfidoWallet from './OnfidoWallet'; import WalletAdditionalDetails from './WalletAdditionalDetails'; import WalletTerms from './WalletTerms'; +import BankAccount from './BankAccount'; export type { Account, @@ -44,4 +45,5 @@ export type { OnfidoWallet, WalletAdditionalDetails, WalletTerms, + BankAccount, }; From 7ad0a1c25a50b2e001e76d78c1917f3e8ad62928 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:39:22 +0200 Subject: [PATCH 044/122] Add type for ONYXKEYS.CARD_LIST --- src/ONYXKEYS.ts | 2 +- src/types/onyx/Card.ts | 12 ++++++++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/Card.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index f90014b6a44c..d903b6962429 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -281,7 +281,7 @@ type OnyxValues = { [ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes.WalletAdditionalDetails; [ONYXKEYS.WALLET_TERMS]: OnyxTypes.WalletTerms; [ONYXKEYS.BANK_ACCOUNT_LIST]: Record; - // [ONYXKEYS.CARD_LIST]: OnyxTypes; + [ONYXKEYS.CARD_LIST]: Record; // [ONYXKEYS.WALLET_STATEMENT]: OnyxTypes; // [ONYXKEYS.PERSONAL_BANK_ACCOUNT]: OnyxTypes; // [ONYXKEYS.REIMBURSEMENT_ACCOUNT]: OnyxTypes; diff --git a/src/types/onyx/Card.ts b/src/types/onyx/Card.ts new file mode 100644 index 000000000000..3c3111510da1 --- /dev/null +++ b/src/types/onyx/Card.ts @@ -0,0 +1,12 @@ +type Card = { + /** The name of the institution (bank of america, etc) */ + cardName?: string; + + /** The masked credit card number */ + cardNumber?: string; + + /** The ID of the card in the cards DB */ + cardID?: number; +}; + +export default Card; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 47cd60149abb..53a48ee24318 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -21,6 +21,7 @@ import OnfidoWallet from './OnfidoWallet'; import WalletAdditionalDetails from './WalletAdditionalDetails'; import WalletTerms from './WalletTerms'; import BankAccount from './BankAccount'; +import Card from './Card'; export type { Account, @@ -46,4 +47,5 @@ export type { WalletAdditionalDetails, WalletTerms, BankAccount, + Card, }; From 8beae0837164ef224151129b8001387096c221c0 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:40:38 +0200 Subject: [PATCH 045/122] Add type for ONYXKEYS.WALLET_STATEMENT --- src/ONYXKEYS.ts | 2 +- src/types/onyx/WalletStatement.ts | 6 ++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/WalletStatement.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index d903b6962429..07d010ff8b42 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -282,7 +282,7 @@ type OnyxValues = { [ONYXKEYS.WALLET_TERMS]: OnyxTypes.WalletTerms; [ONYXKEYS.BANK_ACCOUNT_LIST]: Record; [ONYXKEYS.CARD_LIST]: Record; - // [ONYXKEYS.WALLET_STATEMENT]: OnyxTypes; + [ONYXKEYS.WALLET_STATEMENT]: OnyxTypes.WalletStatement; // [ONYXKEYS.PERSONAL_BANK_ACCOUNT]: OnyxTypes; // [ONYXKEYS.REIMBURSEMENT_ACCOUNT]: OnyxTypes; // [ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT]: OnyxTypes; diff --git a/src/types/onyx/WalletStatement.ts b/src/types/onyx/WalletStatement.ts new file mode 100644 index 000000000000..d42aae32a823 --- /dev/null +++ b/src/types/onyx/WalletStatement.ts @@ -0,0 +1,6 @@ +type WalletStatement = { + /** Whether we are currently generating a PDF version of the statement */ + isGenerating: boolean; +}; + +export default WalletStatement; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 53a48ee24318..97247df8850d 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -22,6 +22,7 @@ import WalletAdditionalDetails from './WalletAdditionalDetails'; import WalletTerms from './WalletTerms'; import BankAccount from './BankAccount'; import Card from './Card'; +import WalletStatement from './WalletStatement'; export type { Account, @@ -48,4 +49,5 @@ export type { WalletTerms, BankAccount, Card, + WalletStatement, }; From 2efd61d9e0b6d5151d79d88b921a7f3eae971534 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:43:36 +0200 Subject: [PATCH 046/122] Add type for ONYXKEYS.PERSONAL_BANK_ACCOUNT --- src/ONYXKEYS.ts | 2 +- src/types/onyx/PersonalBankAccount.ts | 15 +++++++++++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/PersonalBankAccount.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 07d010ff8b42..fffc4cd8d45b 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -283,7 +283,7 @@ type OnyxValues = { [ONYXKEYS.BANK_ACCOUNT_LIST]: Record; [ONYXKEYS.CARD_LIST]: Record; [ONYXKEYS.WALLET_STATEMENT]: OnyxTypes.WalletStatement; - // [ONYXKEYS.PERSONAL_BANK_ACCOUNT]: OnyxTypes; + [ONYXKEYS.PERSONAL_BANK_ACCOUNT]: OnyxTypes.PersonalBankAccount; // [ONYXKEYS.REIMBURSEMENT_ACCOUNT]: OnyxTypes; // [ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT]: OnyxTypes; // [ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE]: OnyxTypes; diff --git a/src/types/onyx/PersonalBankAccount.ts b/src/types/onyx/PersonalBankAccount.ts new file mode 100644 index 000000000000..06f505a04196 --- /dev/null +++ b/src/types/onyx/PersonalBankAccount.ts @@ -0,0 +1,15 @@ +type PersonalBankAccount = { + /** An error message to display to the user */ + error?: string; + + /** Whether we should show the view that the bank account was successfully added */ + shouldShowSuccess?: boolean; + + /** Whether the form is loading */ + isLoading?: boolean; + + /** The account ID of the selected bank account from Plaid */ + plaidAccountID?: string; +}; + +export default PersonalBankAccount; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 97247df8850d..5d3956ddf3e4 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -23,6 +23,7 @@ import WalletTerms from './WalletTerms'; import BankAccount from './BankAccount'; import Card from './Card'; import WalletStatement from './WalletStatement'; +import PersonalBankAccount from './PersonalBankAccount'; export type { Account, @@ -50,4 +51,5 @@ export type { BankAccount, Card, WalletStatement, + PersonalBankAccount, }; From 61adcc2bd57b6aa4026cd9db20bb8474f49fe515 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:44:35 +0200 Subject: [PATCH 047/122] Add type for ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index fffc4cd8d45b..183ac59e1dc3 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -300,7 +300,7 @@ type OnyxValues = { [ONYXKEYS.IS_TOKEN_VALID]: boolean; [ONYXKEYS.IS_CHECKING_PUBLIC_ROOM]: boolean; // [ONYXKEYS.MY_DOMAIN_SECURITY_GROUPS]: OnyxTypes; - // [ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID]: OnyxTypes; + [ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID]: string; }; export default ONYXKEYS; From fa5da57aaa570ca4d6ee24b7481e3865167b43f5 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:45:32 +0200 Subject: [PATCH 048/122] Add type for ONYXKEYS.MY_DOMAIN_SECURITY_GROUPS --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 183ac59e1dc3..9e0049f59ed6 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -299,7 +299,7 @@ type OnyxValues = { [ONYXKEYS.IS_BETA]: boolean; [ONYXKEYS.IS_TOKEN_VALID]: boolean; [ONYXKEYS.IS_CHECKING_PUBLIC_ROOM]: boolean; - // [ONYXKEYS.MY_DOMAIN_SECURITY_GROUPS]: OnyxTypes; + [ONYXKEYS.MY_DOMAIN_SECURITY_GROUPS]: Record; [ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID]: string; }; From 065b49af20f2922a8565890becad9cd6a7b4cf21 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:45:57 +0200 Subject: [PATCH 049/122] Add type for ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 9e0049f59ed6..7a818034a8c9 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -295,7 +295,7 @@ type OnyxValues = { [ONYXKEYS.IS_TEST_TOOLS_MODAL_OPEN]: boolean; // [ONYXKEYS.WALLET_TRANSFER]: OnyxTypes; // [ONYXKEYS.LAST_ACCESSED_WORKSPACE_POLICY_ID]: OnyxTypes; - // [ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT]: OnyxTypes; + [ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT]: boolean; [ONYXKEYS.IS_BETA]: boolean; [ONYXKEYS.IS_TOKEN_VALID]: boolean; [ONYXKEYS.IS_CHECKING_PUBLIC_ROOM]: boolean; From d86d350dd46405a3e1940cf4ce96943c9e6ea199 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:46:26 +0200 Subject: [PATCH 050/122] Add type for ONYXKEYS.LAST_ACCESSED_WORKSPACE_POLICY_ID --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 7a818034a8c9..9b1c437c01d4 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -294,7 +294,7 @@ type OnyxValues = { [ONYXKEYS.IS_SHORTCUTS_MODAL_OPEN]: boolean; [ONYXKEYS.IS_TEST_TOOLS_MODAL_OPEN]: boolean; // [ONYXKEYS.WALLET_TRANSFER]: OnyxTypes; - // [ONYXKEYS.LAST_ACCESSED_WORKSPACE_POLICY_ID]: OnyxTypes; + [ONYXKEYS.LAST_ACCESSED_WORKSPACE_POLICY_ID]: string; [ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT]: boolean; [ONYXKEYS.IS_BETA]: boolean; [ONYXKEYS.IS_TOKEN_VALID]: boolean; From e7be14731e6468de56b317058dd75717746ee648 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:47:29 +0200 Subject: [PATCH 051/122] Add type for ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 9b1c437c01d4..a2407fd7ec4c 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -286,7 +286,7 @@ type OnyxValues = { [ONYXKEYS.PERSONAL_BANK_ACCOUNT]: OnyxTypes.PersonalBankAccount; // [ONYXKEYS.REIMBURSEMENT_ACCOUNT]: OnyxTypes; // [ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT]: OnyxTypes; - // [ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE]: OnyxTypes; + [ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE]: string | number; // [ONYXKEYS.FREQUENTLY_USED_EMOJIS]: OnyxTypes; // [ONYXKEYS.REIMBURSEMENT_ACCOUNT_WORKSPACE_ID]: OnyxTypes; [ONYXKEYS.IS_LOADING_PAYMENT_METHODS]: boolean; From 084e6e3e77c405d20f79ccd31d8c962f48718e13 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 13:56:06 +0200 Subject: [PATCH 052/122] Add type for ONYXKEYS.FREQUENTLY_USED_EMOJIS --- src/ONYXKEYS.ts | 2 +- src/types/onyx/FrequentlyUsedEmoji.ts | 15 +++++++++++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/FrequentlyUsedEmoji.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index a2407fd7ec4c..afa7d67d2432 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -287,7 +287,7 @@ type OnyxValues = { // [ONYXKEYS.REIMBURSEMENT_ACCOUNT]: OnyxTypes; // [ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT]: OnyxTypes; [ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE]: string | number; - // [ONYXKEYS.FREQUENTLY_USED_EMOJIS]: OnyxTypes; + [ONYXKEYS.FREQUENTLY_USED_EMOJIS]: OnyxTypes.FrequentlyUsedEmoji[]; // [ONYXKEYS.REIMBURSEMENT_ACCOUNT_WORKSPACE_ID]: OnyxTypes; [ONYXKEYS.IS_LOADING_PAYMENT_METHODS]: boolean; [ONYXKEYS.IS_LOADING_REPORT_DATA]: boolean; diff --git a/src/types/onyx/FrequentlyUsedEmoji.ts b/src/types/onyx/FrequentlyUsedEmoji.ts new file mode 100644 index 000000000000..ff4dd774ef0f --- /dev/null +++ b/src/types/onyx/FrequentlyUsedEmoji.ts @@ -0,0 +1,15 @@ +type FrequentlyUsedEmoji = { + /** The emoji code */ + code: string; + + /** The name of the emoji */ + name: string; + + /** The number of times the emoji has been used */ + count: number; + + /** The timestamp of when the emoji was last used */ + lastUpdatedAt: number; +}; + +export default FrequentlyUsedEmoji; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 5d3956ddf3e4..f568fbf9a2a7 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -24,6 +24,7 @@ import BankAccount from './BankAccount'; import Card from './Card'; import WalletStatement from './WalletStatement'; import PersonalBankAccount from './PersonalBankAccount'; +import FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; export type { Account, @@ -52,4 +53,5 @@ export type { Card, WalletStatement, PersonalBankAccount, + FrequentlyUsedEmoji, }; From 77a00474fa11056bac09c41e689afacfce903944 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 14:04:22 +0200 Subject: [PATCH 053/122] Add type for ONYXKEYS.REIMBURSEMENT_ACCOUNT & REIMBURSEMENT_ACCOUNT_DRAFT --- src/ONYXKEYS.ts | 6 +-- src/types/onyx/ReimbursementAccount.ts | 35 ++++++++++++++++ src/types/onyx/ReimbursementAccountDraft.ts | 45 +++++++++++++++++++++ src/types/onyx/index.ts | 4 ++ 4 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 src/types/onyx/ReimbursementAccount.ts create mode 100644 src/types/onyx/ReimbursementAccountDraft.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index afa7d67d2432..39b295a44fde 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -284,11 +284,11 @@ type OnyxValues = { [ONYXKEYS.CARD_LIST]: Record; [ONYXKEYS.WALLET_STATEMENT]: OnyxTypes.WalletStatement; [ONYXKEYS.PERSONAL_BANK_ACCOUNT]: OnyxTypes.PersonalBankAccount; - // [ONYXKEYS.REIMBURSEMENT_ACCOUNT]: OnyxTypes; - // [ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT]: OnyxTypes; + [ONYXKEYS.REIMBURSEMENT_ACCOUNT]: OnyxTypes.ReimbursementAccount; + [ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT]: OnyxTypes.ReimbursementAccountDraft; [ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE]: string | number; [ONYXKEYS.FREQUENTLY_USED_EMOJIS]: OnyxTypes.FrequentlyUsedEmoji[]; - // [ONYXKEYS.REIMBURSEMENT_ACCOUNT_WORKSPACE_ID]: OnyxTypes; + [ONYXKEYS.REIMBURSEMENT_ACCOUNT_WORKSPACE_ID]: string; [ONYXKEYS.IS_LOADING_PAYMENT_METHODS]: boolean; [ONYXKEYS.IS_LOADING_REPORT_DATA]: boolean; [ONYXKEYS.IS_SHORTCUTS_MODAL_OPEN]: boolean; diff --git a/src/types/onyx/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts new file mode 100644 index 000000000000..002d6265951c --- /dev/null +++ b/src/types/onyx/ReimbursementAccount.ts @@ -0,0 +1,35 @@ +type AchData = { + /** Step of the setup flow that we are on. Determines which view is presented. */ + currentStep?: string; + + /** Bank account state */ + state?: string; + + /** Bank account ID of the VBA that we are validating is required */ + bankAccountID?: number; +}; + +type ReimbursementAccount = { + /** Whether we are loading the data via the API */ + isLoading?: boolean; + + /** A date that indicates the user has been throttled */ + throttledDate?: string; + + /** Additional data for the account in setup */ + achData?: AchData; + + /** Disable validation button if max attempts exceeded */ + maxAttemptsReached?: boolean; + + /** Alert message to display above submit button */ + error?: string; + + /** Which field needs attention? */ + errorFields?: Record; + + /** Any additional error message to show */ + errors?: Record; +}; + +export default ReimbursementAccount; diff --git a/src/types/onyx/ReimbursementAccountDraft.ts b/src/types/onyx/ReimbursementAccountDraft.ts new file mode 100644 index 000000000000..281ea497f530 --- /dev/null +++ b/src/types/onyx/ReimbursementAccountDraft.ts @@ -0,0 +1,45 @@ +type ReimbursementAccountDraft = { + bankAccountID?: number; + + /** Props needed for BankAccountStep */ + accountNumber?: string; + routingNumber?: string; + acceptTerms?: boolean; + plaidAccountID?: string; + plaidMask?: string; + + /** Props needed for CompanyStep */ + companyName?: string; + addressStreet?: string; + addressCity?: string; + addressState?: string; + addressZipCode?: string; + companyPhone?: string; + website?: string; + companyTaxID?: string; + incorporationType?: string; + incorporationDate?: string | Date; + incorporationState?: string; + hasNoConnectionToCannabis?: boolean; + + /** Props needed for RequestorStep */ + firstName?: string; + lastName?: string; + requestorAddressStreet?: string; + requestorAddressCity?: string; + requestorAddressState?: string; + requestorAddressZipCode?: string; + dob?: string | Date; + ssnLast4?: string; + isControllingOfficer?: boolean; + isOnfidoSetupComplete?: boolean; + + /** Props needed for ACHContractStep */ + ownsMoreThan25Percent?: boolean; + hasOtherBeneficialOwners?: boolean; + acceptTermsAndConditions?: boolean; + certifyTrueInformation?: boolean; + beneficialOwners?: string[]; +}; + +export default ReimbursementAccountDraft; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index f568fbf9a2a7..9441ecbc0c2d 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -25,6 +25,8 @@ import Card from './Card'; import WalletStatement from './WalletStatement'; import PersonalBankAccount from './PersonalBankAccount'; import FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; +import ReimbursementAccount from './ReimbursementAccount'; +import ReimbursementAccountDraft from './ReimbursementAccountDraft'; export type { Account, @@ -54,4 +56,6 @@ export type { WalletStatement, PersonalBankAccount, FrequentlyUsedEmoji, + ReimbursementAccount, + ReimbursementAccountDraft, }; From 5d3877adcd2322ce749248a319467ca01fa2f3c0 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 14:08:49 +0200 Subject: [PATCH 054/122] Add type for ONYXKEYS.WALLET_TRANSFER --- src/ONYXKEYS.ts | 2 +- src/types/onyx/WalletTransfer.ts | 23 +++++++++++++++++++++++ src/types/onyx/index.ts | 4 +++- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 src/types/onyx/WalletTransfer.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 39b295a44fde..708323ca4d76 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -293,7 +293,7 @@ type OnyxValues = { [ONYXKEYS.IS_LOADING_REPORT_DATA]: boolean; [ONYXKEYS.IS_SHORTCUTS_MODAL_OPEN]: boolean; [ONYXKEYS.IS_TEST_TOOLS_MODAL_OPEN]: boolean; - // [ONYXKEYS.WALLET_TRANSFER]: OnyxTypes; + [ONYXKEYS.WALLET_TRANSFER]: OnyxTypes.WalletTransfer; [ONYXKEYS.LAST_ACCESSED_WORKSPACE_POLICY_ID]: string; [ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT]: boolean; [ONYXKEYS.IS_BETA]: boolean; diff --git a/src/types/onyx/WalletTransfer.ts b/src/types/onyx/WalletTransfer.ts new file mode 100644 index 000000000000..c64b01fcdebf --- /dev/null +++ b/src/types/onyx/WalletTransfer.ts @@ -0,0 +1,23 @@ +import CONST from '../../CONST'; + +type WalletTransfer = { + /** Selected accountID for transfer */ + selectedAccountID?: string; + + /** Selected accountType for transfer */ + selectedAccountType?: string; + + /** Type to filter the payment Method list */ + filterPaymentMethodType?: typeof CONST.PAYMENT_METHODS.DEBIT_CARD | typeof CONST.PAYMENT_METHODS.BANK_ACCOUNT; + + /** Whether the success screen is shown to user. */ + shouldShowSuccess?: boolean; + + /** An error message to display to the user */ + errors?: Record; + + /** Whether or not data is loading */ + loading?: boolean; +}; + +export default WalletTransfer; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 9441ecbc0c2d..7c4b639e2abf 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -27,6 +27,7 @@ import PersonalBankAccount from './PersonalBankAccount'; import FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; import ReimbursementAccount from './ReimbursementAccount'; import ReimbursementAccountDraft from './ReimbursementAccountDraft'; +import WalletTransfer from './WalletTransfer'; export type { Account, @@ -55,7 +56,8 @@ export type { Card, WalletStatement, PersonalBankAccount, - FrequentlyUsedEmoji, ReimbursementAccount, ReimbursementAccountDraft, + FrequentlyUsedEmoji, + WalletTransfer, }; From e7b0ae54f2a6e63414a3ee83dd8258519d55c2ae Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 14:42:30 +0200 Subject: [PATCH 055/122] Add type for FORMS --- src/ONYXKEYS.ts | 21 +++++++++++++++++++++ src/types/onyx/Form.ts | 19 +++++++++++++++++++ src/types/onyx/WalletAdditionalDetails.ts | 4 +--- src/types/onyx/index.ts | 3 +++ 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 src/types/onyx/Form.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 708323ca4d76..f45a804a9135 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -301,6 +301,27 @@ type OnyxValues = { [ONYXKEYS.IS_CHECKING_PUBLIC_ROOM]: boolean; [ONYXKEYS.MY_DOMAIN_SECURITY_GROUPS]: Record; [ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID]: string; + + // Forms + [ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM]: OnyxTypes.AddDebitCardForm; + // [ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM]: OnyxTypes.Form; // TODO: REIMBURSEMENT_ACCOUNT_FORM has the same value as REIMBURSEMENT_ACCOUNT + [ONYXKEYS.FORMS.WORKSPACE_SETTINGS_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.WORKSPACE_RATE_AND_UNIT_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.CLOSE_ACCOUNT_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.PROFILE_SETTINGS_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.DISPLAY_NAME_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.ROOM_NAME_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.WELCOME_MESSAGE_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.LEGAL_NAME_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.WORKSPACE_INVITE_MESSAGE_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.DATE_OF_BIRTH_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.HOME_ADDRESS_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.NEW_ROOM_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.ROOM_SETTINGS_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.NEW_TASK_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.EDIT_TASK_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.MONEY_REQUEST_DESCRIPTION_FORM]: OnyxTypes.Form; + [ONYXKEYS.FORMS.NEW_CONTACT_METHOD_FORM]: OnyxTypes.Form; }; export default ONYXKEYS; diff --git a/src/types/onyx/Form.ts b/src/types/onyx/Form.ts new file mode 100644 index 000000000000..f7fe7d7a4f38 --- /dev/null +++ b/src/types/onyx/Form.ts @@ -0,0 +1,19 @@ +type Form = { + /** Controls the loading state of the form */ + isLoading?: boolean; + + /** Server side errors keyed by microtime */ + errors?: Record; + + /** Field-specific server side errors keyed by microtime */ + errorFields?: Record>; +}; + +type AddDebitCardForm = Form & { + /** Whether or not the form has been submitted */ + setupComplete: boolean; +}; + +export default Form; + +export type {AddDebitCardForm}; diff --git a/src/types/onyx/WalletAdditionalDetails.ts b/src/types/onyx/WalletAdditionalDetails.ts index 4b7012d23738..6c975e193b9e 100644 --- a/src/types/onyx/WalletAdditionalDetails.ts +++ b/src/types/onyx/WalletAdditionalDetails.ts @@ -15,9 +15,7 @@ type WalletAdditionalDetails = OnyxCommon.BaseState & { errorCode?: string; /** Which field needs attention? */ - errorFields?: { - [fieldName: string]: boolean; - }; + errorFields?: Record; }; export default WalletAdditionalDetails; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 7c4b639e2abf..4caa9b84250b 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -28,6 +28,7 @@ import FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; import ReimbursementAccount from './ReimbursementAccount'; import ReimbursementAccountDraft from './ReimbursementAccountDraft'; import WalletTransfer from './WalletTransfer'; +import Form, {AddDebitCardForm} from './Form'; export type { Account, @@ -60,4 +61,6 @@ export type { ReimbursementAccountDraft, FrequentlyUsedEmoji, WalletTransfer, + Form, + AddDebitCardForm, }; From 4f0ea3ee43f860bcd61555bf3c9506e6378d48b1 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 14:49:17 +0200 Subject: [PATCH 056/122] Add types for ONYXKEYS.COLLECTIONS --- src/ONYXKEYS.ts | 19 +++++++++++++++++++ .../BaseAnchorForAttachmentsOnly.js | 2 +- src/types/onyx/Download.ts | 6 ++++++ src/types/onyx/index.ts | 2 ++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/Download.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index f45a804a9135..d672ced1f67b 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -302,6 +302,25 @@ type OnyxValues = { [ONYXKEYS.MY_DOMAIN_SECURITY_GROUPS]: Record; [ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID]: string; + // Collections + [download: `${typeof ONYXKEYS.COLLECTION.DOWNLOAD}${string}`]: OnyxTypes.Download; + // [policy: `${typeof ONYXKEYS.COLLECTION.POLICY}${string}`]: OnyxTypes; + // [policyMembers: `${typeof ONYXKEYS.COLLECTION.POLICY_MEMBERS}${string}`]: OnyxTypes; + // [workspaceInviteMembersDraft: `${typeof ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${string}`]: OnyxTypes; + // [report: `${typeof ONYXKEYS.COLLECTION.REPORT}${string}`]: OnyxTypes; + // [ReportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes; + // [ReportActionsDrafts: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`]: OnyxTypes; + // [ReportActionsReactions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${string}`]: OnyxTypes; + // [ReportDraftComment: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${string}`]: OnyxTypes; + // [reportDraftCommentNumberOfLines: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES}${string}`]: OnyxTypes; + // [reportIsComposerFull: `${typeof ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${string}`]: OnyxTypes; + // [reportUserIsTyping: `${typeof ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${string}`]: OnyxTypes; + // [securityGroup: `${typeof ONYXKEYS.COLLECTION.SECURITY_GROUP}${string}`]: OnyxTypes; + // [transaction: `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`]: OnyxTypes; + + /** This is deprecated, but needed for a migration, so we still need to include it here so that it will be initialized in Onyx.init */ + DEPRECATED_POLICY_MEMBER_LIST: 'policyMemberList_'; + // Forms [ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM]: OnyxTypes.AddDebitCardForm; // [ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM]: OnyxTypes.Form; // TODO: REIMBURSEMENT_ACCOUNT_FORM has the same value as REIMBURSEMENT_ACCOUNT diff --git a/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.js b/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.js index 8507713c887e..bbf6def70a33 100644 --- a/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.js +++ b/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.js @@ -19,8 +19,8 @@ const propTypes = { /** Press out handler for the link */ onPressOut: PropTypes.func, - /** If a file download is happening */ download: PropTypes.shape({ + /** If a file download is happening */ isDownloading: PropTypes.bool.isRequired, }), diff --git a/src/types/onyx/Download.ts b/src/types/onyx/Download.ts new file mode 100644 index 000000000000..9c6c2f61f716 --- /dev/null +++ b/src/types/onyx/Download.ts @@ -0,0 +1,6 @@ +type Download = { + /** If a file download is happening */ + isDownloading: boolean; +}; + +export default Download; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 4caa9b84250b..ea4ea5fad740 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -28,6 +28,7 @@ import FrequentlyUsedEmoji from './FrequentlyUsedEmoji'; import ReimbursementAccount from './ReimbursementAccount'; import ReimbursementAccountDraft from './ReimbursementAccountDraft'; import WalletTransfer from './WalletTransfer'; +import Download from './Download'; import Form, {AddDebitCardForm} from './Form'; export type { @@ -63,4 +64,5 @@ export type { WalletTransfer, Form, AddDebitCardForm, + Download, }; From dec3f7af8ec96277038cb40b96ae3f37470d63ad Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 14:52:22 +0200 Subject: [PATCH 057/122] Add types for ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST --- src/ONYXKEYS.ts | 4 +--- src/types/onyx/PolicyMember.ts | 5 +++++ src/types/onyx/index.ts | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 src/types/onyx/PolicyMember.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index d672ced1f67b..599c4e19cd61 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -317,9 +317,7 @@ type OnyxValues = { // [reportUserIsTyping: `${typeof ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${string}`]: OnyxTypes; // [securityGroup: `${typeof ONYXKEYS.COLLECTION.SECURITY_GROUP}${string}`]: OnyxTypes; // [transaction: `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`]: OnyxTypes; - - /** This is deprecated, but needed for a migration, so we still need to include it here so that it will be initialized in Onyx.init */ - DEPRECATED_POLICY_MEMBER_LIST: 'policyMemberList_'; + [deprecatedPolicyMemberList: `${typeof ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}${string}`]: OnyxTypes.PolicyMember; // Forms [ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM]: OnyxTypes.AddDebitCardForm; diff --git a/src/types/onyx/PolicyMember.ts b/src/types/onyx/PolicyMember.ts new file mode 100644 index 000000000000..b6eacb482bba --- /dev/null +++ b/src/types/onyx/PolicyMember.ts @@ -0,0 +1,5 @@ +type PolicyMember = { + role?: string; +}; + +export default PolicyMember; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index ea4ea5fad740..1df4a88a692d 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -29,6 +29,7 @@ import ReimbursementAccount from './ReimbursementAccount'; import ReimbursementAccountDraft from './ReimbursementAccountDraft'; import WalletTransfer from './WalletTransfer'; import Download from './Download'; +import PolicyMember from './PolicyMember'; import Form, {AddDebitCardForm} from './Form'; export type { @@ -62,7 +63,8 @@ export type { ReimbursementAccountDraft, FrequentlyUsedEmoji, WalletTransfer, + Download, + PolicyMember, Form, AddDebitCardForm, - Download, }; From 8b1dfb49231dfb4fea3c0066272a375b9c85305f Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 15:10:15 +0200 Subject: [PATCH 058/122] Move comment back to original place --- .../AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.js b/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.js index bbf6def70a33..8507713c887e 100644 --- a/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.js +++ b/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.js @@ -19,8 +19,8 @@ const propTypes = { /** Press out handler for the link */ onPressOut: PropTypes.func, + /** If a file download is happening */ download: PropTypes.shape({ - /** If a file download is happening */ isDownloading: PropTypes.bool.isRequired, }), From 56b79d00450b142b5daf488885d808f46d7b7aa7 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 16:17:00 +0200 Subject: [PATCH 059/122] Add types for ONYXKEYS.COLLECTION.POLICY --- src/ONYXKEYS.ts | 6 +++--- src/types/onyx/Policy.ts | 32 ++++++++++++++++++++++++++++++++ src/types/onyx/PolicyMember.ts | 10 ++++++++++ src/types/onyx/index.ts | 2 ++ 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 src/types/onyx/Policy.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 599c4e19cd61..08facfc10ea3 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -304,8 +304,9 @@ type OnyxValues = { // Collections [download: `${typeof ONYXKEYS.COLLECTION.DOWNLOAD}${string}`]: OnyxTypes.Download; - // [policy: `${typeof ONYXKEYS.COLLECTION.POLICY}${string}`]: OnyxTypes; - // [policyMembers: `${typeof ONYXKEYS.COLLECTION.POLICY_MEMBERS}${string}`]: OnyxTypes; + [policy: `${typeof ONYXKEYS.COLLECTION.POLICY}${string}`]: OnyxTypes.Policy; + [policyMembers: `${typeof ONYXKEYS.COLLECTION.POLICY_MEMBERS}${string}`]: OnyxTypes.PolicyMember; + [deprecatedPolicyMemberList: `${typeof ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}${string}`]: OnyxTypes.PolicyMember; // [workspaceInviteMembersDraft: `${typeof ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${string}`]: OnyxTypes; // [report: `${typeof ONYXKEYS.COLLECTION.REPORT}${string}`]: OnyxTypes; // [ReportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes; @@ -317,7 +318,6 @@ type OnyxValues = { // [reportUserIsTyping: `${typeof ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${string}`]: OnyxTypes; // [securityGroup: `${typeof ONYXKEYS.COLLECTION.SECURITY_GROUP}${string}`]: OnyxTypes; // [transaction: `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`]: OnyxTypes; - [deprecatedPolicyMemberList: `${typeof ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}${string}`]: OnyxTypes.PolicyMember; // Forms [ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM]: OnyxTypes.AddDebitCardForm; diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts new file mode 100644 index 000000000000..03b05daa86ab --- /dev/null +++ b/src/types/onyx/Policy.ts @@ -0,0 +1,32 @@ +import {ValueOf} from 'type-fest'; +import CONST from '../../CONST'; +import * as OnyxCommon from './OnyxCommon'; + +type Policy = { + /** The ID of the policy */ + id?: string; + + /** The name of the policy */ + name?: string; + + /** The current user's role in the policy */ + role?: ValueOf; + + /** The policy type */ + type?: ValueOf; + + /** The email of the policy owner */ + owner?: string; + + /** The output currency for the policy */ + outputCurrency?: string; + + /** The URL for the policy avatar */ + avatar?: string; + + /** Error objects keyed by field name containing errors keyed by microtime */ + errorFields?: Record>; + pendingAction?: OnyxCommon.PendingAction; +}; + +export default Policy; diff --git a/src/types/onyx/PolicyMember.ts b/src/types/onyx/PolicyMember.ts index b6eacb482bba..6f3995fda4cf 100644 --- a/src/types/onyx/PolicyMember.ts +++ b/src/types/onyx/PolicyMember.ts @@ -1,5 +1,15 @@ type PolicyMember = { + /** Role of the user in the policy */ role?: string; + + /** + * Errors from api calls on the specific user + * {: 'error message', : 'error message 2'} + */ + errors?: Record; + + /** Is this action pending? */ + pendingAction?: string; }; export default PolicyMember; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 1df4a88a692d..44bccf23f467 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -30,6 +30,7 @@ import ReimbursementAccountDraft from './ReimbursementAccountDraft'; import WalletTransfer from './WalletTransfer'; import Download from './Download'; import PolicyMember from './PolicyMember'; +import Policy from './Policy'; import Form, {AddDebitCardForm} from './Form'; export type { @@ -65,6 +66,7 @@ export type { WalletTransfer, Download, PolicyMember, + Policy, Form, AddDebitCardForm, }; From 629165158679667905aff4b445216e9630562e8a Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 16:18:32 +0200 Subject: [PATCH 060/122] Add types for ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 08facfc10ea3..e1291ccf4223 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -307,7 +307,7 @@ type OnyxValues = { [policy: `${typeof ONYXKEYS.COLLECTION.POLICY}${string}`]: OnyxTypes.Policy; [policyMembers: `${typeof ONYXKEYS.COLLECTION.POLICY_MEMBERS}${string}`]: OnyxTypes.PolicyMember; [deprecatedPolicyMemberList: `${typeof ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}${string}`]: OnyxTypes.PolicyMember; - // [workspaceInviteMembersDraft: `${typeof ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${string}`]: OnyxTypes; + [workspaceInviteMembersDraft: `${typeof ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${string}`]: Record; // [report: `${typeof ONYXKEYS.COLLECTION.REPORT}${string}`]: OnyxTypes; // [ReportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes; // [ReportActionsDrafts: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`]: OnyxTypes; From c875d5a680683c96635b880e4d3f06f1e78276e4 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 16:21:54 +0200 Subject: [PATCH 061/122] Add types for ONYXKEYS.COLLECTION.REPORT --- src/ONYXKEYS.ts | 2 +- src/types/onyx/Report.ts | 54 ++++++++++++++++++---------------------- src/types/onyx/index.ts | 2 ++ 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index e1291ccf4223..6ed54b53b1e6 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -308,7 +308,7 @@ type OnyxValues = { [policyMembers: `${typeof ONYXKEYS.COLLECTION.POLICY_MEMBERS}${string}`]: OnyxTypes.PolicyMember; [deprecatedPolicyMemberList: `${typeof ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}${string}`]: OnyxTypes.PolicyMember; [workspaceInviteMembersDraft: `${typeof ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${string}`]: Record; - // [report: `${typeof ONYXKEYS.COLLECTION.REPORT}${string}`]: OnyxTypes; + [report: `${typeof ONYXKEYS.COLLECTION.REPORT}${string}`]: OnyxTypes.Report; // [ReportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes; // [ReportActionsDrafts: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`]: OnyxTypes; // [ReportActionsReactions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${string}`]: OnyxTypes; diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 8f484ba2271c..c800686e588f 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -1,79 +1,73 @@ +import {ValueOf} from 'type-fest'; +import CONST from '../../CONST'; import * as OnyxCommon from './OnyxCommon'; type Report = { /** The specific type of chat */ - chatType: '' | 'policyAnnounce' | 'policyAdmins' | 'domainAll' | 'policyRoom' | 'policyExpenseChat'; + chatType?: ValueOf; /** Whether there is an outstanding amount in IOU */ - hasOutstandingIOU: boolean; + hasOutstandingIOU?: boolean; /** List of icons for report participants */ - icons: OnyxCommon.Icon[]; + icons?: OnyxCommon.Icon[]; /** Are we loading more report actions? */ - isLoadingMoreReportActions: boolean; + isLoadingMoreReportActions?: boolean; /** Flag to check if the report actions data are loading */ - isLoadingReportActions: boolean; + isLoadingReportActions?: boolean; /** Whether the user is not an admin of policyExpenseChat chat */ - isOwnPolicyExpenseChat: boolean; + isOwnPolicyExpenseChat?: boolean; /** Indicates if the report is pinned to the LHN or not */ - isPinned: boolean; + isPinned?: boolean; /** The email of the last message's actor */ - lastActorEmail: string; + lastActorEmail?: string; /** The text of the last message on the report */ - lastMessageText: string; + lastMessageText?: string; /** The time of the last message on the report */ - lastVisibleActionCreated: string; + lastVisibleActionCreated?: string; /** The last time the report was visited */ - lastReadTime: string; + lastReadTime?: string; /** The current user's notification preference for this report */ - notificationPreference: string | number; + notificationPreference?: string | number; /** The policy name to use for an archived report */ - oldPolicyName: string; + oldPolicyName?: string; /** The email address of the report owner */ - ownerEmail: string; + ownerEmail?: string; /** List of primarylogins of participants of the report */ - participants: string[]; + participants?: Array; /** Linked policy's ID */ - policyID: string; + policyID?: string; /** Name of the report */ - reportName: string; + reportName?: string; /** ID of the report */ - reportID: string; + reportID?: string; /** The state that the report is currently in */ - stateNum: - | 0 // OPEN - | 1 // PROCESSING - | 2; // SUBMITTED + stateNum?: ValueOf; /** The status of the current report */ - statusNum: - | 0 // OPEN - | 1 // SUBMITTED - | 2 // CLOSED - | 3 // APPROVED - | 4; // REIMBURSED + statusNum?: ValueOf; /** Which user role is capable of posting messages on the report */ - writeCapability: 'all' | 'admins'; + writeCapability?: ValueOf; /** The report type */ - type: string; + type?: string; }; export default Report; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 44bccf23f467..010c9923e0cc 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -31,6 +31,7 @@ import WalletTransfer from './WalletTransfer'; import Download from './Download'; import PolicyMember from './PolicyMember'; import Policy from './Policy'; +import Report from './Report'; import Form, {AddDebitCardForm} from './Form'; export type { @@ -67,6 +68,7 @@ export type { Download, PolicyMember, Policy, + Report, Form, AddDebitCardForm, }; From 0a522fa9595a6958f875d8a2d59586157b4fa225 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 16:31:26 +0200 Subject: [PATCH 062/122] Add types for ONYXKEYS.COLLECTION.REPORT_ACTIONS --- src/ONYXKEYS.ts | 2 +- src/types/onyx/ReportAction.ts | 35 ++++++++++++++++++++++++++ src/types/onyx/ReportActionFragment.ts | 32 +++++++++++++++++++++++ src/types/onyx/index.ts | 2 ++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/ReportAction.ts create mode 100644 src/types/onyx/ReportActionFragment.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 6ed54b53b1e6..967a3d0bc04e 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -309,7 +309,7 @@ type OnyxValues = { [deprecatedPolicyMemberList: `${typeof ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}${string}`]: OnyxTypes.PolicyMember; [workspaceInviteMembersDraft: `${typeof ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${string}`]: Record; [report: `${typeof ONYXKEYS.COLLECTION.REPORT}${string}`]: OnyxTypes.Report; - // [ReportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes; + [ReportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes.ReportAction; // [ReportActionsDrafts: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`]: OnyxTypes; // [ReportActionsReactions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${string}`]: OnyxTypes; // [ReportDraftComment: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${string}`]: OnyxTypes; diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts new file mode 100644 index 000000000000..e41faf7c359f --- /dev/null +++ b/src/types/onyx/ReportAction.ts @@ -0,0 +1,35 @@ +import ReportActionFragment from './ReportActionFragment'; + +type ReportAction = { + /** The ID of the reportAction. It is the string representation of the a 64-bit integer. */ + reportActionID?: string; + + /** Name of the action e.g. ADDCOMMENT */ + actionName?: string; + + /** Person who created the action */ + person?: ReportActionFragment[]; + + /** ISO-formatted datetime */ + created?: string; + + /** report action message */ + message?: ReportActionFragment[]; + + /** Original message associated with this action */ + originalMessage?: { + // The ID of the iou transaction + IOUTransactionID?: string; + }; + + /** Whether we have received a response back from the server */ + isLoading?: boolean; + + /** Error message that's come back from the server. */ + error?: string; + + /** accountIDs of the people to which the whisper was sent to (if any). Returns empty array if it is not a whisper */ + whisperedToAccountIDs: number[]; +}; + +export default ReportAction; diff --git a/src/types/onyx/ReportActionFragment.ts b/src/types/onyx/ReportActionFragment.ts new file mode 100644 index 000000000000..df3e3a66633f --- /dev/null +++ b/src/types/onyx/ReportActionFragment.ts @@ -0,0 +1,32 @@ +type ReportActionFragment = { + /** The type of the action item fragment. Used to render a corresponding component */ + type: string; + + /** The text content of the fragment. */ + text: string; + + /** Used to apply additional styling. Style refers to a predetermined constant and not a class name. e.g. 'normal' + * or 'strong' + */ + style: string; + + /** ID of a report */ + reportID: string; + + /** ID of a policy */ + policyID: string; + + /** The target of a link fragment e.g. '_blank' */ + target: string; + + /** The destination of a link fragment e.g. 'https://www.expensify.com' */ + href: string; + + /** An additional avatar url - not the main avatar url but used within a message. */ + iconUrl: string; + + /** Fragment edited flag */ + isEdited: boolean; +}; + +export default ReportActionFragment; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 010c9923e0cc..3c13e5e671a8 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -32,6 +32,7 @@ import Download from './Download'; import PolicyMember from './PolicyMember'; import Policy from './Policy'; import Report from './Report'; +import ReportAction from './ReportAction'; import Form, {AddDebitCardForm} from './Form'; export type { @@ -69,6 +70,7 @@ export type { PolicyMember, Policy, Report, + ReportAction, Form, AddDebitCardForm, }; From f21bb7014c9b4c2b814024e48d445c63463e519f Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 16:32:56 +0200 Subject: [PATCH 063/122] Add types for ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 967a3d0bc04e..4c05c243e5c0 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -310,7 +310,7 @@ type OnyxValues = { [workspaceInviteMembersDraft: `${typeof ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${string}`]: Record; [report: `${typeof ONYXKEYS.COLLECTION.REPORT}${string}`]: OnyxTypes.Report; [ReportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes.ReportAction; - // [ReportActionsDrafts: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`]: OnyxTypes; + [ReportActionsDrafts: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`]: string; // [ReportActionsReactions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${string}`]: OnyxTypes; // [ReportDraftComment: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${string}`]: OnyxTypes; // [reportDraftCommentNumberOfLines: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES}${string}`]: OnyxTypes; From 3dbccd964b0d150a3384da643b6089a0229fecbb Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 16:33:44 +0200 Subject: [PATCH 064/122] Remove COLLECTION.REPORT_ACTIONS_REACTIONS as it is not used --- src/ONYXKEYS.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 4c05c243e5c0..25a20dabb101 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -198,7 +198,6 @@ const ONYXKEYS = { REPORT: 'report_', REPORT_ACTIONS: 'reportActions_', REPORT_ACTIONS_DRAFTS: 'reportActionsDrafts_', - REPORT_ACTIONS_REACTIONS: 'reportActionsReactions_', REPORT_DRAFT_COMMENT: 'reportDraftComment_', REPORT_DRAFT_COMMENT_NUMBER_OF_LINES: 'reportDraftCommentNumberOfLines_', REPORT_IS_COMPOSER_FULL_SIZE: 'reportIsComposerFullSize_', @@ -311,7 +310,6 @@ type OnyxValues = { [report: `${typeof ONYXKEYS.COLLECTION.REPORT}${string}`]: OnyxTypes.Report; [ReportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes.ReportAction; [ReportActionsDrafts: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`]: string; - // [ReportActionsReactions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${string}`]: OnyxTypes; // [ReportDraftComment: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${string}`]: OnyxTypes; // [reportDraftCommentNumberOfLines: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES}${string}`]: OnyxTypes; // [reportIsComposerFull: `${typeof ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${string}`]: OnyxTypes; From 422a1fc84a1cc8e03f571ef52e051c6c018b316f Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 16:35:43 +0200 Subject: [PATCH 065/122] Add types for ONYXKEYS.COLLECTION.REPORT related collections --- src/ONYXKEYS.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 25a20dabb101..936ba66b3ca1 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -310,10 +310,10 @@ type OnyxValues = { [report: `${typeof ONYXKEYS.COLLECTION.REPORT}${string}`]: OnyxTypes.Report; [ReportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes.ReportAction; [ReportActionsDrafts: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`]: string; - // [ReportDraftComment: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${string}`]: OnyxTypes; - // [reportDraftCommentNumberOfLines: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES}${string}`]: OnyxTypes; - // [reportIsComposerFull: `${typeof ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${string}`]: OnyxTypes; - // [reportUserIsTyping: `${typeof ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${string}`]: OnyxTypes; + [ReportDraftComment: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${string}`]: string; + [reportDraftCommentNumberOfLines: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES}${string}`]: number; + [reportIsComposerFull: `${typeof ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${string}`]: boolean; + [reportUserIsTyping: `${typeof ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${string}`]: boolean; // [securityGroup: `${typeof ONYXKEYS.COLLECTION.SECURITY_GROUP}${string}`]: OnyxTypes; // [transaction: `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`]: OnyxTypes; From 854a8f98b41060c40c5bffd2ff1c32a69e11a818 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 16:37:44 +0200 Subject: [PATCH 066/122] Add types for ONYXKEYS.COLLECTION.SECURITY_GROUP --- src/ONYXKEYS.ts | 2 +- src/types/onyx/SecurityGroup.ts | 5 +++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/SecurityGroup.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 936ba66b3ca1..53672a014f9d 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -314,7 +314,7 @@ type OnyxValues = { [reportDraftCommentNumberOfLines: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES}${string}`]: number; [reportIsComposerFull: `${typeof ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${string}`]: boolean; [reportUserIsTyping: `${typeof ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${string}`]: boolean; - // [securityGroup: `${typeof ONYXKEYS.COLLECTION.SECURITY_GROUP}${string}`]: OnyxTypes; + [securityGroup: `${typeof ONYXKEYS.COLLECTION.SECURITY_GROUP}${string}`]: OnyxTypes.SecurityGroup; // [transaction: `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`]: OnyxTypes; // Forms diff --git a/src/types/onyx/SecurityGroup.ts b/src/types/onyx/SecurityGroup.ts new file mode 100644 index 000000000000..b2362c1eb628 --- /dev/null +++ b/src/types/onyx/SecurityGroup.ts @@ -0,0 +1,5 @@ +type SecurityGroup = { + hasRestrictedPrimaryLogin: boolean; +}; + +export default SecurityGroup; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 3c13e5e671a8..99aa17302d4c 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -33,6 +33,7 @@ import PolicyMember from './PolicyMember'; import Policy from './Policy'; import Report from './Report'; import ReportAction from './ReportAction'; +import SecurityGroup from './SecurityGroup'; import Form, {AddDebitCardForm} from './Form'; export type { @@ -71,6 +72,7 @@ export type { Policy, Report, ReportAction, + SecurityGroup, Form, AddDebitCardForm, }; From 9276a2221a44220a6aef84c0528464a8a3e40dfe Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 5 Jul 2023 16:44:14 +0200 Subject: [PATCH 067/122] Add types for ONYXKEYS.COLLECTION.TRANSACTION --- src/ONYXKEYS.ts | 2 +- src/types/onyx/Transaction.ts | 19 +++++++++++++++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/types/onyx/Transaction.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 53672a014f9d..8f1327499b27 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -315,7 +315,7 @@ type OnyxValues = { [reportIsComposerFull: `${typeof ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${string}`]: boolean; [reportUserIsTyping: `${typeof ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${string}`]: boolean; [securityGroup: `${typeof ONYXKEYS.COLLECTION.SECURITY_GROUP}${string}`]: OnyxTypes.SecurityGroup; - // [transaction: `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`]: OnyxTypes; + [transaction: `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`]: OnyxTypes.Transaction; // Forms [ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM]: OnyxTypes.AddDebitCardForm; diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts new file mode 100644 index 000000000000..f1bdd6a72089 --- /dev/null +++ b/src/types/onyx/Transaction.ts @@ -0,0 +1,19 @@ +import * as OnyxCommon from './OnyxCommon'; + +type Comment = { + comment?: string; +}; + +type Transaction = { + transactionID?: string; + amount?: number; + currency?: string; + reportID?: string; + comment?: Comment; + merchant?: string; + created?: string; + pendingAction?: OnyxCommon.PendingAction; + errors?: Record; +}; + +export default Transaction; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 99aa17302d4c..1c518c47d396 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -34,6 +34,7 @@ import Policy from './Policy'; import Report from './Report'; import ReportAction from './ReportAction'; import SecurityGroup from './SecurityGroup'; +import Transaction from './Transaction'; import Form, {AddDebitCardForm} from './Form'; export type { @@ -73,6 +74,7 @@ export type { Report, ReportAction, SecurityGroup, + Transaction, Form, AddDebitCardForm, }; From 0b4146a107e96194becfc23578d817cba6e72b77 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 6 Jul 2023 16:03:12 +0200 Subject: [PATCH 068/122] Changes after initial review --- src/types/onyx/PersonalDetails.ts | 31 ++++++++++++++++++++----------- src/types/onyx/PolicyMember.ts | 4 +++- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/types/onyx/PersonalDetails.ts b/src/types/onyx/PersonalDetails.ts index c401c09b1eec..01df176b687f 100644 --- a/src/types/onyx/PersonalDetails.ts +++ b/src/types/onyx/PersonalDetails.ts @@ -1,34 +1,43 @@ type PersonalDetails = { - // First name of the current user from their personal details + /** ID of the current user from their personal details */ + accountID: number; + + /** First name of the current user from their personal details */ firstName?: string; - // Last name of the current user from their personal details + /** Last name of the current user from their personal details */ lastName?: string; - // Display name of the current user from their personal details + /** Display name of the current user from their personal details */ displayName?: string; - // Avatar URL of the current user from their personal details + /** Is current user validated */ + validated?: boolean; + + /** Phone number of the current user from their personal details */ + phoneNumber?: string; + + /** Avatar URL of the current user from their personal details */ avatar?: string; - // Flag to set when Avatar uploading + /** Flag to set when Avatar uploading */ avatarUploading?: boolean; - // login of the current user from their personal details + /** login of the current user from their personal details */ login?: string; - // pronouns of the current user from their personal details + /** pronouns of the current user from their personal details */ pronouns?: string; - // local currency for the user + /** local currency for the user */ localCurrencyCode?: string; - // timezone of the current user from their personal details + /** timezone of the current user from their personal details */ timezone?: { - // Value of selected timezone + /** Value of selected timezone */ selected?: string; - // Whether timezone is automatically set + /** Whether timezone is automatically set */ automatic?: boolean; }; }; diff --git a/src/types/onyx/PolicyMember.ts b/src/types/onyx/PolicyMember.ts index 6f3995fda4cf..4503ca829e18 100644 --- a/src/types/onyx/PolicyMember.ts +++ b/src/types/onyx/PolicyMember.ts @@ -1,3 +1,5 @@ +import * as OnyxCommon from './OnyxCommon'; + type PolicyMember = { /** Role of the user in the policy */ role?: string; @@ -9,7 +11,7 @@ type PolicyMember = { errors?: Record; /** Is this action pending? */ - pendingAction?: string; + pendingAction?: OnyxCommon.PendingAction; }; export default PolicyMember; From c3a7a87bd75aa3b5e854cfb77193d14a99fb9ddd Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 7 Jul 2023 16:42:06 +0200 Subject: [PATCH 069/122] Type errors better --- src/types/onyx/Form.ts | 4 +++- src/types/onyx/Login.ts | 6 ++++-- src/types/onyx/OnyxCommon.ts | 4 +++- src/types/onyx/Policy.ts | 2 +- src/types/onyx/ReimbursementAccount.ts | 4 +++- src/types/onyx/WalletAdditionalDetails.ts | 2 +- src/types/onyx/WalletTerms.ts | 2 +- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/types/onyx/Form.ts b/src/types/onyx/Form.ts index f7fe7d7a4f38..da71eab9d819 100644 --- a/src/types/onyx/Form.ts +++ b/src/types/onyx/Form.ts @@ -1,3 +1,5 @@ +import * as OnyxCommon from './OnyxCommon'; + type Form = { /** Controls the loading state of the form */ isLoading?: boolean; @@ -6,7 +8,7 @@ type Form = { errors?: Record; /** Field-specific server side errors keyed by microtime */ - errorFields?: Record>; + errorFields?: OnyxCommon.FieldErrors; }; type AddDebitCardForm = Form & { diff --git a/src/types/onyx/Login.ts b/src/types/onyx/Login.ts index 80f94defc201..6283f38a9ec2 100644 --- a/src/types/onyx/Login.ts +++ b/src/types/onyx/Login.ts @@ -1,3 +1,5 @@ +import * as OnyxCommon from './OnyxCommon'; + type Login = { /** Phone/Email associated with user */ partnerUserID?: string; @@ -9,10 +11,10 @@ type Login = { validatedDate?: string; /** Field-specific server side errors keyed by microtime */ - errorFields?: Record>; + errorFields?: OnyxCommon.FieldErrors; /** Field-specific pending states for offline UI status */ - pendingFields?: Record>; + pendingFields?: OnyxCommon.FieldErrors; }; export default Login; diff --git a/src/types/onyx/OnyxCommon.ts b/src/types/onyx/OnyxCommon.ts index 260012849865..b010d652ff91 100644 --- a/src/types/onyx/OnyxCommon.ts +++ b/src/types/onyx/OnyxCommon.ts @@ -4,6 +4,8 @@ import CONST from '../../CONST'; type PendingAction = ValueOf; +type FieldErrors = Record>; + type BaseState = { success?: string; @@ -22,4 +24,4 @@ type Icon = { name: string; }; -export type {BaseState, Icon, PendingAction}; +export type {BaseState, Icon, PendingAction, FieldErrors}; diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 03b05daa86ab..437925317cf3 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -25,7 +25,7 @@ type Policy = { avatar?: string; /** Error objects keyed by field name containing errors keyed by microtime */ - errorFields?: Record>; + errorFields?: OnyxCommon.FieldErrors; pendingAction?: OnyxCommon.PendingAction; }; diff --git a/src/types/onyx/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts index 002d6265951c..ff3ed374e213 100644 --- a/src/types/onyx/ReimbursementAccount.ts +++ b/src/types/onyx/ReimbursementAccount.ts @@ -1,3 +1,5 @@ +import * as OnyxCommon from './OnyxCommon'; + type AchData = { /** Step of the setup flow that we are on. Determines which view is presented. */ currentStep?: string; @@ -26,7 +28,7 @@ type ReimbursementAccount = { error?: string; /** Which field needs attention? */ - errorFields?: Record; + errorFields?: OnyxCommon.FieldErrors; /** Any additional error message to show */ errors?: Record; diff --git a/src/types/onyx/WalletAdditionalDetails.ts b/src/types/onyx/WalletAdditionalDetails.ts index 6c975e193b9e..512e253000ce 100644 --- a/src/types/onyx/WalletAdditionalDetails.ts +++ b/src/types/onyx/WalletAdditionalDetails.ts @@ -15,7 +15,7 @@ type WalletAdditionalDetails = OnyxCommon.BaseState & { errorCode?: string; /** Which field needs attention? */ - errorFields?: Record; + errorFields?: OnyxCommon.FieldErrors; }; export default WalletAdditionalDetails; diff --git a/src/types/onyx/WalletTerms.ts b/src/types/onyx/WalletTerms.ts index 4f020051b531..34b78a07194e 100644 --- a/src/types/onyx/WalletTerms.ts +++ b/src/types/onyx/WalletTerms.ts @@ -1,6 +1,6 @@ type WalletTerms = { /** Any error message to show */ - errors?: string[]; + errors?: Record; /** When the user accepts the Wallet's terms in order to pay an IOU, this is the ID of the chatReport the IOU is linked to */ chatReportID?: string; From 00ec1a40f04f7668ae308a46c3aa2042a5df8388 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 7 Jul 2023 16:42:20 +0200 Subject: [PATCH 070/122] Add missing types from ReportAction --- src/types/onyx/ReportAction.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index e41faf7c359f..839337b7ff4c 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -30,6 +30,14 @@ type ReportAction = { /** accountIDs of the people to which the whisper was sent to (if any). Returns empty array if it is not a whisper */ whisperedToAccountIDs: number[]; + + childReportID?: number + childType?: string + childOldestFourEmails?: string + childOldestFourAccountIDs?: string + childCommenterCount?: number, + childLastVisibleActionCreated?: string + childVisibleActionCount?: number }; export default ReportAction; From 243377b97c684aca8bb6c8f05bacf37e6803f2e3 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 7 Jul 2023 16:43:19 +0200 Subject: [PATCH 071/122] Replace REIMBURSEMENT_ACCOUNT_FORM with REIMBURSEMENT_ACCOUNT --- src/ONYXKEYS.ts | 2 -- src/pages/ReimbursementAccount/ACHContractStep.js | 2 +- src/pages/ReimbursementAccount/BankAccountManualStep.js | 2 +- src/pages/ReimbursementAccount/BankAccountPlaidStep.js | 2 +- src/pages/ReimbursementAccount/CompanyStep.js | 2 +- src/pages/ReimbursementAccount/RequestorStep.js | 2 +- 6 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 8f1327499b27..5fe280f1ce78 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -212,7 +212,6 @@ const ONYXKEYS = { /** List of Form ids */ FORMS: { ADD_DEBIT_CARD_FORM: 'addDebitCardForm', - REIMBURSEMENT_ACCOUNT_FORM: 'reimbursementAccount', WORKSPACE_SETTINGS_FORM: 'workspaceSettingsForm', WORKSPACE_RATE_AND_UNIT_FORM: 'workspaceRateAndUnitForm', CLOSE_ACCOUNT_FORM: 'closeAccount', @@ -319,7 +318,6 @@ type OnyxValues = { // Forms [ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM]: OnyxTypes.AddDebitCardForm; - // [ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM]: OnyxTypes.Form; // TODO: REIMBURSEMENT_ACCOUNT_FORM has the same value as REIMBURSEMENT_ACCOUNT [ONYXKEYS.FORMS.WORKSPACE_SETTINGS_FORM]: OnyxTypes.Form; [ONYXKEYS.FORMS.WORKSPACE_RATE_AND_UNIT_FORM]: OnyxTypes.Form; [ONYXKEYS.FORMS.CLOSE_ACCOUNT_FORM]: OnyxTypes.Form; diff --git a/src/pages/ReimbursementAccount/ACHContractStep.js b/src/pages/ReimbursementAccount/ACHContractStep.js index 6083661b0d0d..1ef43843571c 100644 --- a/src/pages/ReimbursementAccount/ACHContractStep.js +++ b/src/pages/ReimbursementAccount/ACHContractStep.js @@ -154,7 +154,7 @@ function ACHContractStep(props) { guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT} />
Date: Fri, 7 Jul 2023 16:51:19 +0200 Subject: [PATCH 072/122] Add missing Report types --- src/types/onyx/Report.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index c800686e588f..52189b468fc2 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -68,6 +68,19 @@ type Report = { /** The report type */ type?: string; + + parentReportID?: number; + parentReportActionID?: string; + isOptimisticReport?: boolean; + hasDraft?: boolean; + managerID?: number; + lastVisibleActionLastModified?: string; + displayName?: string; + lastMessageHtml?: string; + welcomeMessage?: string; + lastActorAccountID?: string; + ownerAccountID?: number; + participantAccountIDs?: number[]; }; export default Report; From ac27dd3de8b4575c0bf84dbc4259c34f17168a3f Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 7 Jul 2023 16:57:54 +0200 Subject: [PATCH 073/122] Rename FieldErrors to ErrorFields --- src/types/onyx/Form.ts | 2 +- src/types/onyx/Login.ts | 4 ++-- src/types/onyx/OnyxCommon.ts | 5 +++-- src/types/onyx/Policy.ts | 2 +- src/types/onyx/ReimbursementAccount.ts | 2 +- src/types/onyx/WalletAdditionalDetails.ts | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/types/onyx/Form.ts b/src/types/onyx/Form.ts index da71eab9d819..2a23d489a146 100644 --- a/src/types/onyx/Form.ts +++ b/src/types/onyx/Form.ts @@ -8,7 +8,7 @@ type Form = { errors?: Record; /** Field-specific server side errors keyed by microtime */ - errorFields?: OnyxCommon.FieldErrors; + errorFields?: OnyxCommon.ErrorFields; }; type AddDebitCardForm = Form & { diff --git a/src/types/onyx/Login.ts b/src/types/onyx/Login.ts index 6283f38a9ec2..60ea5985315e 100644 --- a/src/types/onyx/Login.ts +++ b/src/types/onyx/Login.ts @@ -11,10 +11,10 @@ type Login = { validatedDate?: string; /** Field-specific server side errors keyed by microtime */ - errorFields?: OnyxCommon.FieldErrors; + errorFields?: OnyxCommon.ErrorFields; /** Field-specific pending states for offline UI status */ - pendingFields?: OnyxCommon.FieldErrors; + pendingFields?: OnyxCommon.ErrorFields; }; export default Login; diff --git a/src/types/onyx/OnyxCommon.ts b/src/types/onyx/OnyxCommon.ts index b010d652ff91..272bce7cadcf 100644 --- a/src/types/onyx/OnyxCommon.ts +++ b/src/types/onyx/OnyxCommon.ts @@ -4,13 +4,14 @@ import CONST from '../../CONST'; type PendingAction = ValueOf; -type FieldErrors = Record>; +type ErrorFields = Record>; type BaseState = { success?: string; /** An error message to display to the user */ errors?: Record; + errorFields?: ErrorFields; /** Whether or not data is loading */ isLoading?: boolean; @@ -24,4 +25,4 @@ type Icon = { name: string; }; -export type {BaseState, Icon, PendingAction, FieldErrors}; +export type {BaseState, Icon, PendingAction, ErrorFields}; diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 437925317cf3..382495ae6e22 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -25,7 +25,7 @@ type Policy = { avatar?: string; /** Error objects keyed by field name containing errors keyed by microtime */ - errorFields?: OnyxCommon.FieldErrors; + errorFields?: OnyxCommon.ErrorFields; pendingAction?: OnyxCommon.PendingAction; }; diff --git a/src/types/onyx/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts index ff3ed374e213..08c3bd5a759f 100644 --- a/src/types/onyx/ReimbursementAccount.ts +++ b/src/types/onyx/ReimbursementAccount.ts @@ -28,7 +28,7 @@ type ReimbursementAccount = { error?: string; /** Which field needs attention? */ - errorFields?: OnyxCommon.FieldErrors; + errorFields?: OnyxCommon.ErrorFields; /** Any additional error message to show */ errors?: Record; diff --git a/src/types/onyx/WalletAdditionalDetails.ts b/src/types/onyx/WalletAdditionalDetails.ts index 512e253000ce..bd6db725cdbd 100644 --- a/src/types/onyx/WalletAdditionalDetails.ts +++ b/src/types/onyx/WalletAdditionalDetails.ts @@ -15,7 +15,7 @@ type WalletAdditionalDetails = OnyxCommon.BaseState & { errorCode?: string; /** Which field needs attention? */ - errorFields?: OnyxCommon.FieldErrors; + errorFields?: OnyxCommon.ErrorFields; }; export default WalletAdditionalDetails; From d21862929c7adb535bd8f31321b1ec1047f597f5 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 7 Jul 2023 17:01:24 +0200 Subject: [PATCH 074/122] Correct types after review --- src/types/onyx/BankAccount.ts | 17 +++++++++++++++++ src/types/onyx/Task.ts | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/types/onyx/BankAccount.ts b/src/types/onyx/BankAccount.ts index bf43b28d8438..f31720ce4469 100644 --- a/src/types/onyx/BankAccount.ts +++ b/src/types/onyx/BankAccount.ts @@ -2,14 +2,31 @@ type BankAccount = { /** The name of the institution (bank of america, etc */ addressName?: string; + /** Alias for addressName */ + title?: string; + /** The masked bank account number */ accountNumber?: string; /** The bankAccountID in the bankAccounts db */ bankAccountID?: number; + /** Alias for bankAccountID */ + methodID?: number; + /** The bank account type */ type?: string; + + isDefault?: boolean; + + /** string like 'Account ending in XXXX' */ + description?: string; + + /** string like 'bankAccount-{}' where is the bankAccountID */ + key?: string; + + /** All data related to the bank account */ + accountData?: Record; }; export default BankAccount; diff --git a/src/types/onyx/Task.ts b/src/types/onyx/Task.ts index bebc11901878..f773677515e2 100644 --- a/src/types/onyx/Task.ts +++ b/src/types/onyx/Task.ts @@ -2,7 +2,7 @@ import Report from './Report'; type Task = { /** Title of the Task */ - title?: string; + title: string; /** Description of the Task */ description?: string; From 842985e9ef98c27625fd3c7e86e068f198d460f6 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 7 Jul 2023 17:08:41 +0200 Subject: [PATCH 075/122] Type persisted requests --- src/ONYXKEYS.ts | 3 +-- src/types/onyx/Request.ts | 8 ++++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/types/onyx/Request.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 5fe280f1ce78..5053b984e34a 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -244,8 +244,7 @@ type OnyxValues = { [ONYXKEYS.ACTIVE_CLIENTS]: string[]; [ONYXKEYS.DEVICE_ID]: string; [ONYXKEYS.IS_SIDEBAR_LOADED]: boolean; - // TODO: Type persisted requests properly - [ONYXKEYS.PERSISTED_REQUESTS]: unknown[]; + [ONYXKEYS.PERSISTED_REQUESTS]: OnyxTypes.Request[]; [ONYXKEYS.QUEUED_ONYX_UPDATES]: OnyxTypes.QueuedOnyxUpdates; [ONYXKEYS.CURRENT_DATE]: string; [ONYXKEYS.CREDENTIALS]: OnyxTypes.Credentials; diff --git a/src/types/onyx/Request.ts b/src/types/onyx/Request.ts new file mode 100644 index 000000000000..e730dfd807fb --- /dev/null +++ b/src/types/onyx/Request.ts @@ -0,0 +1,8 @@ +type Request = { + command?: string; + data?: Record; + type?: string; + shouldUseSecure?: boolean; +}; + +export default Request; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 1c518c47d396..9c60262f0cc4 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -1,4 +1,5 @@ import Account from './Account'; +import Request from './Request'; import Credentials from './Credentials'; import QueuedOnyxUpdates from './QueuedOnyxUpdates'; import IOU from './IOU'; @@ -39,6 +40,7 @@ import Form, {AddDebitCardForm} from './Form'; export type { Account, + Request, Credentials, QueuedOnyxUpdates, IOU, From 6321e346f4aff72d9bea205a1ecbde15a26dcbfb Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 10 Jul 2023 11:30:50 +0200 Subject: [PATCH 076/122] Fix namings and comments --- src/types/onyx/Currency.ts | 6 +++--- src/types/onyx/PersonalDetails.ts | 8 ++++---- src/types/onyx/PlaidBankAccount.ts | 2 +- src/types/onyx/ReimbursementAccount.ts | 4 ++-- src/types/onyx/ReportAction.ts | 16 ++++++++-------- src/types/utils.ts | 3 ++- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/types/onyx/Currency.ts b/src/types/onyx/Currency.ts index 6651fe1d8383..dee964334ade 100644 --- a/src/types/onyx/Currency.ts +++ b/src/types/onyx/Currency.ts @@ -1,11 +1,11 @@ type Currency = { - // Symbol for the currency + /** Symbol for the currency */ symbol?: string; - // Name of the currency + /** Name of the currency */ name?: string; - // ISO4217 Code for the currency + /** ISO4217 Code for the currency */ ISO4217?: string; }; diff --git a/src/types/onyx/PersonalDetails.ts b/src/types/onyx/PersonalDetails.ts index 01df176b687f..f50592f2f597 100644 --- a/src/types/onyx/PersonalDetails.ts +++ b/src/types/onyx/PersonalDetails.ts @@ -23,16 +23,16 @@ type PersonalDetails = { /** Flag to set when Avatar uploading */ avatarUploading?: boolean; - /** login of the current user from their personal details */ + /** Login of the current user from their personal details */ login?: string; - /** pronouns of the current user from their personal details */ + /** Pronouns of the current user from their personal details */ pronouns?: string; - /** local currency for the user */ + /** Local currency for the user */ localCurrencyCode?: string; - /** timezone of the current user from their personal details */ + /** Timezone of the current user from their personal details */ timezone?: { /** Value of selected timezone */ selected?: string; diff --git a/src/types/onyx/PlaidBankAccount.ts b/src/types/onyx/PlaidBankAccount.ts index 7710effeb751..d89e8ac3082d 100644 --- a/src/types/onyx/PlaidBankAccount.ts +++ b/src/types/onyx/PlaidBankAccount.ts @@ -14,7 +14,7 @@ type PlaidBankAccount = { /** Routing number for the account */ routingNumber: string; - /** last 4 digits of the account number */ + /** Last 4 digits of the account number */ mask: string; /** Plaid access token, used to then retrieve Assets and Balances */ diff --git a/src/types/onyx/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts index 08c3bd5a759f..804a30013334 100644 --- a/src/types/onyx/ReimbursementAccount.ts +++ b/src/types/onyx/ReimbursementAccount.ts @@ -1,6 +1,6 @@ import * as OnyxCommon from './OnyxCommon'; -type AchData = { +type ACHData = { /** Step of the setup flow that we are on. Determines which view is presented. */ currentStep?: string; @@ -19,7 +19,7 @@ type ReimbursementAccount = { throttledDate?: string; /** Additional data for the account in setup */ - achData?: AchData; + achData?: ACHData; /** Disable validation button if max attempts exceeded */ maxAttemptsReached?: boolean; diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index 839337b7ff4c..2c4e41c8e3a7 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -18,7 +18,7 @@ type ReportAction = { /** Original message associated with this action */ originalMessage?: { - // The ID of the iou transaction + /** The ID of the iou transaction */ IOUTransactionID?: string; }; @@ -31,13 +31,13 @@ type ReportAction = { /** accountIDs of the people to which the whisper was sent to (if any). Returns empty array if it is not a whisper */ whisperedToAccountIDs: number[]; - childReportID?: number - childType?: string - childOldestFourEmails?: string - childOldestFourAccountIDs?: string - childCommenterCount?: number, - childLastVisibleActionCreated?: string - childVisibleActionCount?: number + childReportID?: number; + childType?: string; + childOldestFourEmails?: string; + childOldestFourAccountIDs?: string; + childCommenterCount?: number; + childLastVisibleActionCreated?: string; + childVisibleActionCount?: number; }; export default ReportAction; diff --git a/src/types/utils.ts b/src/types/utils.ts index 98a658eed56f..d7b427d70fab 100644 --- a/src/types/utils.ts +++ b/src/types/utils.ts @@ -1,4 +1,5 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable import/prefer-default-export */ type DeepValueOf = T extends object ? DeepValueOf : T; -// eslint-disable-next-line import/prefer-default-export export type {DeepValueOf}; From b5646714f63abe91073567cb68beadc92d237c81 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 12 Jul 2023 14:19:56 +0200 Subject: [PATCH 077/122] Add changes to UserWallet --- src/types/onyx/UserWallet.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/types/onyx/UserWallet.ts b/src/types/onyx/UserWallet.ts index 652e05663a9e..39555c9e9348 100644 --- a/src/types/onyx/UserWallet.ts +++ b/src/types/onyx/UserWallet.ts @@ -20,6 +20,9 @@ type UserWallet = { /** Status of wallet - e.g. SILVER or GOLD */ tierName?: ValueOf; + /** The user's wallet tier */ + tier?: number; + /** Whether we should show the ActivateStep success view after the user finished the KYC flow */ shouldShowWalletActivationSuccess?: boolean; @@ -28,6 +31,18 @@ type UserWallet = { /** The type of the linked account (debitCard or bankAccount) */ walletLinkedAccountType?: string; + + /** An error message to display to the user */ + errors?: Record; + + /** The user's bank account ID */ + bankAccountID?: number; + + /** The user's current wallet limit */ + walletLimit?: number; + + /** The user's current wallet limit enforcement period */ + walletLimitEnforcementPeriod?: number; }; export default UserWallet; From 96b72c905d60952f876dd05dff78846396fd13d4 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 12 Jul 2023 14:20:23 +0200 Subject: [PATCH 078/122] Fix type utils structure --- src/ONYXKEYS.ts | 4 ++-- src/types/utils.ts | 5 ----- src/types/utils/DeepValueOf.ts | 4 ++++ 3 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 src/types/utils.ts create mode 100644 src/types/utils/DeepValueOf.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 5053b984e34a..ffceff36d465 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -1,5 +1,5 @@ import {ValueOf} from 'type-fest'; -import * as UtilTypes from './types/utils'; +import DeepValueOf from './types/utils/DeepValueOf'; import * as OnyxTypes from './types/onyx'; import CONST from './CONST'; @@ -235,7 +235,7 @@ const ONYXKEYS = { type OnyxKeysMap = typeof ONYXKEYS; type CollectionKey = `${ValueOf}${string}`; -type OnyxKey = UtilTypes.DeepValueOf> | CollectionKey; +type OnyxKey = DeepValueOf> | CollectionKey; type OnyxValues = { [ONYXKEYS.ACCOUNT]: OnyxTypes.Account; diff --git a/src/types/utils.ts b/src/types/utils.ts deleted file mode 100644 index d7b427d70fab..000000000000 --- a/src/types/utils.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-types */ -/* eslint-disable import/prefer-default-export */ -type DeepValueOf = T extends object ? DeepValueOf : T; - -export type {DeepValueOf}; diff --git a/src/types/utils/DeepValueOf.ts b/src/types/utils/DeepValueOf.ts new file mode 100644 index 000000000000..eb44eac7e751 --- /dev/null +++ b/src/types/utils/DeepValueOf.ts @@ -0,0 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/ban-types +type DeepValueOf = T extends object ? DeepValueOf : T; + +export default DeepValueOf; From 88b548d68509bb753f848a1d4da8ed5212865ffb Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 12 Jul 2023 14:26:19 +0200 Subject: [PATCH 079/122] Add more changes to UserWallet --- src/types/onyx/UserWallet.ts | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/types/onyx/UserWallet.ts b/src/types/onyx/UserWallet.ts index 39555c9e9348..151eefd15be2 100644 --- a/src/types/onyx/UserWallet.ts +++ b/src/types/onyx/UserWallet.ts @@ -1,24 +1,25 @@ import {ValueOf} from 'type-fest'; import CONST from '../../CONST'; +type WalletLinkedAccountType = 'debitCard' | 'bankAccount'; + +type ErrorCode = 'ssnError' | 'kbaNeeded' | 'kycFailed'; + type UserWallet = { /** The user's available wallet balance */ - availableBalance?: number; + availableBalance: number; /** The user's current wallet balance */ - currentBalance?: number; + currentBalance: number; /** What step in the activation flow are we on? */ - currentStep?: ValueOf; - - /** Error code returned by the server */ - errorCode?: string; + currentStep: ValueOf; /** If we should show the FailedKYC view after the user submitted their info with a non fixable error */ shouldShowFailedKYC?: boolean; /** Status of wallet - e.g. SILVER or GOLD */ - tierName?: ValueOf; + tierName: ValueOf; /** The user's wallet tier */ tier?: number; @@ -27,13 +28,10 @@ type UserWallet = { shouldShowWalletActivationSuccess?: boolean; /** The ID of the linked account */ - walletLinkedAccountID?: number; + walletLinkedAccountID: number; /** The type of the linked account (debitCard or bankAccount) */ - walletLinkedAccountType?: string; - - /** An error message to display to the user */ - errors?: Record; + walletLinkedAccountType: WalletLinkedAccountType; /** The user's bank account ID */ bankAccountID?: number; @@ -43,6 +41,12 @@ type UserWallet = { /** The user's current wallet limit enforcement period */ walletLimitEnforcementPeriod?: number; + + /** Error code returned by the server */ + errorCode?: ErrorCode; + + /** An error message to display to the user */ + errors?: Record; }; export default UserWallet; From 178b6977a7d2177bf7b7c2d78e2ed5b0c9f9cf90 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 12 Jul 2023 14:28:02 +0200 Subject: [PATCH 080/122] Add accountId to Credentials --- src/types/onyx/Credentials.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/onyx/Credentials.ts b/src/types/onyx/Credentials.ts index 1f6beb502907..f6a9ce669ad0 100644 --- a/src/types/onyx/Credentials.ts +++ b/src/types/onyx/Credentials.ts @@ -9,6 +9,7 @@ type Credentials = { autoGeneratedLogin?: string; autoGeneratedPassword?: string; + accountID?: number; }; export default Credentials; From c258aaf79ec7a3691cc22f1be2fa94b7d26a1f91 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 12 Jul 2023 15:40:47 +0200 Subject: [PATCH 081/122] Update Account type --- src/types/onyx/Account.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/types/onyx/Account.ts b/src/types/onyx/Account.ts index 63d294ec71d8..24986fc7a2fe 100644 --- a/src/types/onyx/Account.ts +++ b/src/types/onyx/Account.ts @@ -32,6 +32,15 @@ type Account = OnyxCommon.BaseState & { /** Whether the user forgot their password */ forgotPassword?: boolean; + + /** Whether the account exists */ + accountExists?: boolean; + + /** Is the account / domain under domain control? */ + domainControlled?: boolean; + + /** Whether the validation code has expired */ + validateCodeExpired?: boolean; }; export default Account; From e2d2edb1b85d6594330dfbd65cb7e62ea1860058 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 12 Jul 2023 16:24:04 +0200 Subject: [PATCH 082/122] Update ACHData type --- src/types/onyx/ReimbursementAccount.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/types/onyx/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts index 804a30013334..7a65045338c5 100644 --- a/src/types/onyx/ReimbursementAccount.ts +++ b/src/types/onyx/ReimbursementAccount.ts @@ -1,8 +1,10 @@ +import {ValueOf} from 'type-fest'; import * as OnyxCommon from './OnyxCommon'; +import CONST from '../../CONST'; type ACHData = { /** Step of the setup flow that we are on. Determines which view is presented. */ - currentStep?: string; + currentStep?: ValueOf; /** Bank account state */ state?: string; From 4568e0e8fe35aede8588cfae976a8458c8506872 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 12 Jul 2023 16:34:05 +0200 Subject: [PATCH 083/122] Update Currency type --- src/types/onyx/Currency.ts | 9 ++++++--- src/types/onyx/Task.ts | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/types/onyx/Currency.ts b/src/types/onyx/Currency.ts index dee964334ade..770fcc33a9a9 100644 --- a/src/types/onyx/Currency.ts +++ b/src/types/onyx/Currency.ts @@ -1,12 +1,15 @@ type Currency = { /** Symbol for the currency */ - symbol?: string; + symbol: string; /** Name of the currency */ - name?: string; + name: string; /** ISO4217 Code for the currency */ - ISO4217?: string; + ISO4217: string; + + /** Number of decimals the currency can have, if this is missing, we assume it has 2 decimals */ + decimals?: number; }; export default Currency; diff --git a/src/types/onyx/Task.ts b/src/types/onyx/Task.ts index f773677515e2..34f5643d2f6f 100644 --- a/src/types/onyx/Task.ts +++ b/src/types/onyx/Task.ts @@ -7,6 +7,7 @@ type Task = { /** Description of the Task */ description?: string; + // TODO: Make sure this field exists in the API /** Share destination of the Task */ shareDestination?: string; From 38b628064e3ee6b873aacb86246c30153e081294 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 12 Jul 2023 16:35:43 +0200 Subject: [PATCH 084/122] Update User type --- src/types/onyx/User.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/types/onyx/User.ts b/src/types/onyx/User.ts index cb5cd1d8c29a..f770b22b2272 100644 --- a/src/types/onyx/User.ts +++ b/src/types/onyx/User.ts @@ -1,18 +1,18 @@ type User = { /** Whether or not the user is subscribed to news updates */ - isSubscribedToNewsletter?: boolean; + isSubscribedToNewsletter: boolean; /** Whether we should use the staging version of the secure API server */ shouldUseStagingServer?: boolean; /** Is the user account validated? */ - validated?: boolean; + validated: boolean; /** Whether or not the user is on a public domain email account or not */ - isFromPublicDomain?: boolean; + isFromPublicDomain: boolean; /** Whether or not the user use expensify card */ - isUsingExpensifyCard?: boolean; + isUsingExpensifyCard: boolean; /** Whever Expensify Card approval flow is ongoing - checking loginList for private domains */ isCheckingDomain?: boolean; From e511910216147568337a922ebb110a1f9243e2fb Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 13 Jul 2023 09:45:21 +0200 Subject: [PATCH 085/122] Add new onyx keys: PREFERRED_THEME and IS_USING_MEMORY_ONLY_KEYS --- src/ONYXKEYS.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index ffceff36d465..d4a7b696e582 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -189,6 +189,13 @@ const ONYXKEYS = { /** Report ID of the last report the user viewed as anonymous user */ LAST_OPENED_PUBLIC_ROOM_ID: 'lastOpenedPublicRoomID', + // The theme setting set by the user in preferences. + // This can be either "light", "dark" or "system" + PREFERRED_THEME: 'preferredTheme', + + // Experimental memory only Onyx mode flag + IS_USING_MEMORY_ONLY_KEYS: 'isUsingMemoryOnlyKeys', + /** Collection Keys */ COLLECTION: { DOWNLOAD: 'download_', @@ -298,6 +305,8 @@ type OnyxValues = { [ONYXKEYS.IS_CHECKING_PUBLIC_ROOM]: boolean; [ONYXKEYS.MY_DOMAIN_SECURITY_GROUPS]: Record; [ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID]: string; + [ONYXKEYS.PREFERRED_THEME]: ValueOf; + [ONYXKEYS.IS_USING_MEMORY_ONLY_KEYS]: boolean; // Collections [download: `${typeof ONYXKEYS.COLLECTION.DOWNLOAD}${string}`]: OnyxTypes.Download; From e97b29c7965eb1703f3a2ebb658486b4add8bb26 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 13 Jul 2023 09:54:08 +0200 Subject: [PATCH 086/122] Change OnfidoWallet to WalletOnfido --- src/ONYXKEYS.ts | 2 +- src/types/onyx/Session.ts | 2 ++ src/types/onyx/{OnfidoWallet.ts => WalletOnfido.ts} | 4 ++-- src/types/onyx/index.ts | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) rename src/types/onyx/{OnfidoWallet.ts => WalletOnfido.ts} (93%) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index d4a7b696e582..3c22b67799cd 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -281,7 +281,7 @@ type OnyxValues = { [ONYXKEYS.ONFIDO_TOKEN]: string; [ONYXKEYS.NVP_PREFERRED_LOCALE]: ValueOf; [ONYXKEYS.USER_WALLET]: OnyxTypes.UserWallet; - [ONYXKEYS.WALLET_ONFIDO]: OnyxTypes.OnfidoWallet; + [ONYXKEYS.WALLET_ONFIDO]: OnyxTypes.WalletOnfido; [ONYXKEYS.WALLET_ADDITIONAL_DETAILS]: OnyxTypes.WalletAdditionalDetails; [ONYXKEYS.WALLET_TERMS]: OnyxTypes.WalletTerms; [ONYXKEYS.BANK_ACCOUNT_LIST]: Record; diff --git a/src/types/onyx/Session.ts b/src/types/onyx/Session.ts index 2e8296271687..75cb4f4818ad 100644 --- a/src/types/onyx/Session.ts +++ b/src/types/onyx/Session.ts @@ -10,6 +10,8 @@ type Session = { /** Currently logged in user accountID */ accountID?: number; + + autoAuthState?: string; }; export default Session; diff --git a/src/types/onyx/OnfidoWallet.ts b/src/types/onyx/WalletOnfido.ts similarity index 93% rename from src/types/onyx/OnfidoWallet.ts rename to src/types/onyx/WalletOnfido.ts index e9cfedee7120..78f60e233aa7 100644 --- a/src/types/onyx/OnfidoWallet.ts +++ b/src/types/onyx/WalletOnfido.ts @@ -1,4 +1,4 @@ -type OnfidoWallet = { +type WalletOnfido = { /** Unique identifier returned from openOnfidoFlow then re-sent to ActivateWallet with Onfido response data */ applicantID?: string; @@ -18,4 +18,4 @@ type OnfidoWallet = { hasAcceptedPrivacyPolicy?: boolean; }; -export default OnfidoWallet; +export default WalletOnfido; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 9c60262f0cc4..ddcc728fb437 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -18,7 +18,7 @@ import Paypal from './Paypal'; import BlockedFromConcierge from './BlockedFromConcierge'; import PlaidData from './PlaidData'; import UserWallet from './UserWallet'; -import OnfidoWallet from './OnfidoWallet'; +import WalletOnfido from './WalletOnfido'; import WalletAdditionalDetails from './WalletAdditionalDetails'; import WalletTerms from './WalletTerms'; import BankAccount from './BankAccount'; @@ -59,7 +59,7 @@ export type { BlockedFromConcierge, PlaidData, UserWallet, - OnfidoWallet, + WalletOnfido, WalletAdditionalDetails, WalletTerms, BankAccount, From 3ad2a94fdc91fe9571e1ccfe60cdffd51b7285d8 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 13 Jul 2023 09:56:26 +0200 Subject: [PATCH 087/122] Adjust WalletOnfido --- src/types/onyx/WalletOnfido.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/types/onyx/WalletOnfido.ts b/src/types/onyx/WalletOnfido.ts index 78f60e233aa7..827be5b99c21 100644 --- a/src/types/onyx/WalletOnfido.ts +++ b/src/types/onyx/WalletOnfido.ts @@ -1,21 +1,24 @@ type WalletOnfido = { /** Unique identifier returned from openOnfidoFlow then re-sent to ActivateWallet with Onfido response data */ - applicantID?: string; + applicantID: string; /** Token used to initialize the Onfido SDK token */ - sdkToken?: string; + sdkToken: string; /** Loading state to provide feedback when we are waiting for a request to finish */ - loading?: boolean; + isLoading?: boolean; /** Error message to inform the user of any problem that might occur */ - error?: string; + errors?: Record; /** A list of Onfido errors that the user can fix in order to attempt the Onfido flow again */ fixableErrors?: string[]; /** Whether the user has accepted the privacy policy of Onfido or not */ hasAcceptedPrivacyPolicy?: boolean; + + /** If we should show the FailedKYC view after the user submitted their info with a non fixable error */ + shouldShowFailedKYC?: boolean; }; export default WalletOnfido; From af9ec420d508e9523247aba10681da9fa4b27ea0 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 13 Jul 2023 10:03:07 +0200 Subject: [PATCH 088/122] Adjust PersonalDetails --- src/types/onyx/PersonalDetails.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/onyx/PersonalDetails.ts b/src/types/onyx/PersonalDetails.ts index f50592f2f597..64911dbfecb1 100644 --- a/src/types/onyx/PersonalDetails.ts +++ b/src/types/onyx/PersonalDetails.ts @@ -9,7 +9,7 @@ type PersonalDetails = { lastName?: string; /** Display name of the current user from their personal details */ - displayName?: string; + displayName: string; /** Is current user validated */ validated?: boolean; @@ -18,7 +18,7 @@ type PersonalDetails = { phoneNumber?: string; /** Avatar URL of the current user from their personal details */ - avatar?: string; + avatar: string; /** Flag to set when Avatar uploading */ avatarUploading?: boolean; From 9854cdfe3ab440da25a4329db08d64b4bb7cd25a Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 13 Jul 2023 10:03:14 +0200 Subject: [PATCH 089/122] Adjust IOU --- src/types/onyx/IOU.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/types/onyx/IOU.ts b/src/types/onyx/IOU.ts index 031c5791440c..373b5d990160 100644 --- a/src/types/onyx/IOU.ts +++ b/src/types/onyx/IOU.ts @@ -1,13 +1,14 @@ type Participant = { - accountID?: number; + accountID: number; login?: string; isPolicyExpenseChat?: boolean; isOwnPolicyExpenseChat?: boolean; selected?: boolean; + reportID?: string; }; type IOU = { - id?: string; + id: string; amount?: number; /** Selected Currency Code of the current IOU */ currency?: string; From ce377f99b5bf76c3b7e9d8a3835e7a45455c3373 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 17 Jul 2023 12:27:45 +0200 Subject: [PATCH 090/122] Adjust BlockedFromConcierge --- src/types/onyx/BlockedFromConcierge.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/types/onyx/BlockedFromConcierge.ts b/src/types/onyx/BlockedFromConcierge.ts index faa0681b79cf..0e8ac3699584 100644 --- a/src/types/onyx/BlockedFromConcierge.ts +++ b/src/types/onyx/BlockedFromConcierge.ts @@ -1,6 +1,8 @@ type BlockedFromConcierge = { /** The date that the user will be unblocked */ - expiresAt?: string; + expiresAt: string; + + count: 1 | 2 | 3; }; export default BlockedFromConcierge; From 3197d7b43271f13d608b6d3fc3219fa85e420819 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 17 Jul 2023 12:53:51 +0200 Subject: [PATCH 091/122] Adjust FrequentlyUsedEmoji --- src/types/onyx/FrequentlyUsedEmoji.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/types/onyx/FrequentlyUsedEmoji.ts b/src/types/onyx/FrequentlyUsedEmoji.ts index ff4dd774ef0f..2276095df9b5 100644 --- a/src/types/onyx/FrequentlyUsedEmoji.ts +++ b/src/types/onyx/FrequentlyUsedEmoji.ts @@ -8,8 +8,11 @@ type FrequentlyUsedEmoji = { /** The number of times the emoji has been used */ count: number; - /** The timestamp of when the emoji was last used */ + /** The timestamp in UNIX format when the emoji was last used */ lastUpdatedAt: number; + + /** The emoji skin tone type */ + types?: string[]; }; export default FrequentlyUsedEmoji; From bd127d37bfd8c63319e9d4fc9974d524850d46d7 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 17 Jul 2023 13:01:59 +0200 Subject: [PATCH 092/122] Adjust Paypal --- src/types/onyx/Paypal.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/types/onyx/Paypal.ts b/src/types/onyx/Paypal.ts index 61130723ddb1..26236a63b7fc 100644 --- a/src/types/onyx/Paypal.ts +++ b/src/types/onyx/Paypal.ts @@ -2,26 +2,26 @@ import CONST from '../../CONST'; import * as OnyxCommon from './OnyxCommon'; type PaypalAccountData = { - username?: string; + username: string; }; type Paypal = { /** This is always 'PayPal.me' */ - title?: string; + title: string; /** The paypalMe address */ - description?: string; + description: string; /** This is always 'payPalMe' */ - methodID?: typeof CONST.PAYMENT_METHODS.PAYPAL; + methodID: typeof CONST.PAYMENT_METHODS.PAYPAL; /** This is always 'payPalMe' */ - accountType?: typeof CONST.PAYMENT_METHODS.PAYPAL; + accountType: typeof CONST.PAYMENT_METHODS.PAYPAL; - key?: string; - isDefault?: boolean; + key: string; + isDefault: boolean; pendingAction?: OnyxCommon.PendingAction; - accountData?: PaypalAccountData; + accountData: PaypalAccountData; }; export default Paypal; From 436e009c68169f729bec64541a3b93058a6fa86b Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 17 Jul 2023 16:38:18 +0200 Subject: [PATCH 093/122] Fix a typo --- src/types/onyx/WalletAdditionalDetails.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/onyx/WalletAdditionalDetails.ts b/src/types/onyx/WalletAdditionalDetails.ts index bd6db725cdbd..8176475f622b 100644 --- a/src/types/onyx/WalletAdditionalDetails.ts +++ b/src/types/onyx/WalletAdditionalDetails.ts @@ -1,7 +1,7 @@ import * as OnyxCommon from './OnyxCommon'; type WalletAdditionalDetails = OnyxCommon.BaseState & { - /** Questions returned by Ideology */ + /** Questions returned by Idology */ questions?: { prompt: string; type: string; From 6da3ffb38b5547f00f6a13d2583ca8baa3baf4ff Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 18 Jul 2023 13:12:16 +0200 Subject: [PATCH 094/122] Adjust BankAccount --- src/types/onyx/BankAccount.ts | 58 +++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/src/types/onyx/BankAccount.ts b/src/types/onyx/BankAccount.ts index f31720ce4469..ccaaa7ebab78 100644 --- a/src/types/onyx/BankAccount.ts +++ b/src/types/onyx/BankAccount.ts @@ -1,32 +1,72 @@ -type BankAccount = { +type AdditionalData = { + isP2PDebitCard?: boolean; + beneficialOwners?: string[]; + currency?: string; + bankName?: string; + fieldsType?: string; + country?: string; +}; + +type AccountData = { + /** The masked bank account number */ + accountNumber?: string; + /** The name of the institution (bank of america, etc */ addressName?: string; - /** Alias for addressName */ - title?: string; + /** Can we use this account to pay other people? */ + allowDebit?: boolean; - /** The masked bank account number */ - accountNumber?: string; + /** Can we use this account to receive money from other people? */ + defaultCredit?: boolean; + + /** Is a saving account */ + isSavings?: boolean; + + /** Return whether or not this bank account has been risk checked */ + riskChecked?: boolean; + + /** Account routing number */ + routingNumber?: string; + + /** The status of the bank account */ + state?: string; + + /** All user emails that have access to this bank account */ + sharees?: string[]; + + processor?: string; /** The bankAccountID in the bankAccounts db */ bankAccountID?: number; - /** Alias for bankAccountID */ - methodID?: number; + /** All data related to the bank account */ + additionalData?: AdditionalData; /** The bank account type */ type?: string; +}; - isDefault?: boolean; +type BankAccount = { + /** The bank account type */ + accountType?: string; /** string like 'Account ending in XXXX' */ description?: string; + isDefault?: boolean; + /** string like 'bankAccount-{}' where is the bankAccountID */ key?: string; + /** Alias for bankAccountID */ + methodID?: number; + + /** Alias for addressName */ + title?: string; + /** All data related to the bank account */ - accountData?: Record; + accountData?: AccountData; }; export default BankAccount; From c5e745eb36228021876c98565ce26765bcdc8cac Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 18 Jul 2023 13:55:01 +0200 Subject: [PATCH 095/122] Adjust ReportAction --- src/types/onyx/ReportAction.ts | 65 +++++++++++++++++++++++--- src/types/onyx/ReportActionFragment.ts | 32 ------------- 2 files changed, 58 insertions(+), 39 deletions(-) delete mode 100644 src/types/onyx/ReportActionFragment.ts diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index 2c4e41c8e3a7..fc0b663dc1ce 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -1,26 +1,74 @@ -import ReportActionFragment from './ReportActionFragment'; +type Message = { + /** The type of the action item fragment. Used to render a corresponding component */ + type: string; + + /** The text content of the fragment. */ + text: string; + + /** Used to apply additional styling. Style refers to a predetermined constant and not a class name. e.g. 'normal' + * or 'strong' + */ + style: string; + + /** ID of a report */ + reportID: string; + + /** ID of a policy */ + policyID: string; + + /** The target of a link fragment e.g. '_blank' */ + target: string; + + /** The destination of a link fragment e.g. 'https://www.expensify.com' */ + href: string; + + /** An additional avatar url - not the main avatar url but used within a message. */ + iconUrl: string; + + /** Fragment edited flag */ + isEdited: boolean; +}; + +type OriginalMessage = { + /** The ID of the iou transaction */ + IOUTransactionID?: string; + + IOUReportID?: number; + amount?: number; + comment?: string; + currency?: string; + lastModified?: string; + participantAccountIDs?: number[]; + participants?: string[]; + type?: string; +}; + +type Person = { + type?: string; + style?: string; + text?: string; +}; type ReportAction = { /** The ID of the reportAction. It is the string representation of the a 64-bit integer. */ reportActionID?: string; + actorAccountID?: number; + /** Name of the action e.g. ADDCOMMENT */ actionName?: string; /** Person who created the action */ - person?: ReportActionFragment[]; + person?: Person[]; /** ISO-formatted datetime */ created?: string; /** report action message */ - message?: ReportActionFragment[]; + message?: Message[]; /** Original message associated with this action */ - originalMessage?: { - /** The ID of the iou transaction */ - IOUTransactionID?: string; - }; + originalMessage?: OriginalMessage; /** Whether we have received a response back from the server */ isLoading?: boolean; @@ -31,6 +79,9 @@ type ReportAction = { /** accountIDs of the people to which the whisper was sent to (if any). Returns empty array if it is not a whisper */ whisperedToAccountIDs: number[]; + avatar?: string; + automatic?: boolean; + shouldShow?: boolean; childReportID?: number; childType?: string; childOldestFourEmails?: string; diff --git a/src/types/onyx/ReportActionFragment.ts b/src/types/onyx/ReportActionFragment.ts deleted file mode 100644 index df3e3a66633f..000000000000 --- a/src/types/onyx/ReportActionFragment.ts +++ /dev/null @@ -1,32 +0,0 @@ -type ReportActionFragment = { - /** The type of the action item fragment. Used to render a corresponding component */ - type: string; - - /** The text content of the fragment. */ - text: string; - - /** Used to apply additional styling. Style refers to a predetermined constant and not a class name. e.g. 'normal' - * or 'strong' - */ - style: string; - - /** ID of a report */ - reportID: string; - - /** ID of a policy */ - policyID: string; - - /** The target of a link fragment e.g. '_blank' */ - target: string; - - /** The destination of a link fragment e.g. 'https://www.expensify.com' */ - href: string; - - /** An additional avatar url - not the main avatar url but used within a message. */ - iconUrl: string; - - /** Fragment edited flag */ - isEdited: boolean; -}; - -export default ReportActionFragment; From 43e281296ea78daaea7d550a27491b4d58e57ff0 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 18 Jul 2023 13:56:24 +0200 Subject: [PATCH 096/122] Adjust Transaction --- src/types/onyx/Transaction.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index f1bdd6a72089..916570b185ff 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -14,6 +14,9 @@ type Transaction = { created?: string; pendingAction?: OnyxCommon.PendingAction; errors?: Record; + modifiedAmount?: number; + modifiedCreated?: string; + modifiedCurrency?: string; }; export default Transaction; From 9e1743023c4b81198ff2a8da4d250202815cfb11 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 18 Jul 2023 14:45:02 +0200 Subject: [PATCH 097/122] Adjust Card --- src/types/onyx/Card.ts | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/types/onyx/Card.ts b/src/types/onyx/Card.ts index 3c3111510da1..71ef3d4d98e7 100644 --- a/src/types/onyx/Card.ts +++ b/src/types/onyx/Card.ts @@ -1,12 +1,32 @@ -type Card = { - /** The name of the institution (bank of america, etc) */ - cardName?: string; +type AdditionalData = { + isBillingCard?: boolean; + isP2PDebitCard?: boolean; +}; + +type AccountData = { + additionalData?: AdditionalData; + addressName?: string; + addressState?: string; + addressStreet?: string; + addressZip?: number; + cardMonth?: number; /** The masked credit card number */ cardNumber?: string; - /** The ID of the card in the cards DB */ - cardID?: number; + cardYear?: number; + created?: string; + currency?: string; + fundID?: number; +}; + +type Card = { + accountData?: AccountData; + accountType?: string; + description?: string; + key?: string; + methodID?: number; + title?: string; }; export default Card; From f81d0671cff5d423c6eb23841c7fc98e70f50d65 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 18 Jul 2023 14:45:11 +0200 Subject: [PATCH 098/122] Adjust BlockedFromConcierge --- src/types/onyx/BlockedFromConcierge.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/onyx/BlockedFromConcierge.ts b/src/types/onyx/BlockedFromConcierge.ts index 0e8ac3699584..4eebd537604c 100644 --- a/src/types/onyx/BlockedFromConcierge.ts +++ b/src/types/onyx/BlockedFromConcierge.ts @@ -2,6 +2,7 @@ type BlockedFromConcierge = { /** The date that the user will be unblocked */ expiresAt: string; + /** Number of times the user has been blocked. */ count: 1 | 2 | 3; }; From aba2593ff05026ae0d526ad8bd9fd991cd943328 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 18 Jul 2023 14:48:23 +0200 Subject: [PATCH 099/122] Adjust Transaction --- src/types/onyx/Transaction.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 916570b185ff..05c0f9ae3f6d 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -5,18 +5,18 @@ type Comment = { }; type Transaction = { - transactionID?: string; - amount?: number; - currency?: string; - reportID?: string; - comment?: Comment; - merchant?: string; - created?: string; - pendingAction?: OnyxCommon.PendingAction; - errors?: Record; - modifiedAmount?: number; - modifiedCreated?: string; - modifiedCurrency?: string; + transactionID: string; + amount: number; + currency: string; + reportID: string; + comment: Comment; + merchant: string; + created: string; + pendingAction: OnyxCommon.PendingAction; + errors: Record; + modifiedAmount: number; + modifiedCreated: string; + modifiedCurrency: string; }; export default Transaction; From 0824e2c681350a8e1199407c42268a88b3133a24 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 18 Jul 2023 14:52:27 +0200 Subject: [PATCH 100/122] Adjust ReimbursementAccountDraft --- src/types/onyx/ReimbursementAccountDraft.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/onyx/ReimbursementAccountDraft.ts b/src/types/onyx/ReimbursementAccountDraft.ts index 281ea497f530..2f873333285e 100644 --- a/src/types/onyx/ReimbursementAccountDraft.ts +++ b/src/types/onyx/ReimbursementAccountDraft.ts @@ -21,6 +21,7 @@ type ReimbursementAccountDraft = { incorporationDate?: string | Date; incorporationState?: string; hasNoConnectionToCannabis?: boolean; + bank?: string; /** Props needed for RequestorStep */ firstName?: string; From 7fb38e8c1108a1cfb99ca77b74778dfb8fc191e0 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 18 Jul 2023 16:06:22 +0200 Subject: [PATCH 101/122] Adjust ReimbursementAccount --- src/types/onyx/ReimbursementAccount.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/types/onyx/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts index 7a65045338c5..ee22e98c9add 100644 --- a/src/types/onyx/ReimbursementAccount.ts +++ b/src/types/onyx/ReimbursementAccount.ts @@ -4,7 +4,9 @@ import CONST from '../../CONST'; type ACHData = { /** Step of the setup flow that we are on. Determines which view is presented. */ - currentStep?: ValueOf; + currentStep: ValueOf; + + subStep?: ValueOf; /** Bank account state */ state?: string; From 70d24437db7168d6f06c6bee199c0e30253ab44b Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 18 Jul 2023 16:11:21 +0200 Subject: [PATCH 102/122] Adjust PrivatePersonalDetails --- src/types/onyx/PrivatePersonalDetails.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/types/onyx/PrivatePersonalDetails.ts b/src/types/onyx/PrivatePersonalDetails.ts index 75cc11e3e63e..50ec77212efd 100644 --- a/src/types/onyx/PrivatePersonalDetails.ts +++ b/src/types/onyx/PrivatePersonalDetails.ts @@ -1,16 +1,18 @@ +type Address = { + street: string; + city: string; + state: string; + zip: string; + country: string; +}; + type PrivatePersonalDetails = { legalFirstName?: string; legalLastName?: string; dob?: string; /** User's home address */ - address?: { - street?: string; - city?: string; - state?: string; - zip?: string; - country?: string; - }; + address?: Address; }; export default PrivatePersonalDetails; From 2e3265705eebefec7629f67ba3a93e5d0d434b46 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 19 Jul 2023 15:27:59 +0200 Subject: [PATCH 103/122] Adjust Policy --- src/types/onyx/Policy.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 382495ae6e22..f0fd2b2eabff 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -26,7 +26,12 @@ type Policy = { /** Error objects keyed by field name containing errors keyed by microtime */ errorFields?: OnyxCommon.ErrorFields; + pendingAction?: OnyxCommon.PendingAction; + errors: Record; + isFromFullPolicy?: boolean; + lastModified?: string; + customUnits?: Record; }; export default Policy; From 2f736a1d35845cd171aab632a68313d6066353e7 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 19 Jul 2023 15:37:54 +0200 Subject: [PATCH 104/122] Adjust types after feedback --- src/types/onyx/PlaidData.ts | 2 +- src/types/onyx/ReportAction.ts | 32 +++++++++++++++++++++++--------- src/types/onyx/Transaction.ts | 6 +++--- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/types/onyx/PlaidData.ts b/src/types/onyx/PlaidData.ts index f4b8239597c5..b3e28fa7ce4a 100644 --- a/src/types/onyx/PlaidData.ts +++ b/src/types/onyx/PlaidData.ts @@ -9,7 +9,7 @@ type PlaidData = OnyxCommon.BaseState & { * Access token returned by Plaid once the user has logged into their bank. * This token can be used along with internal credentials to query for Plaid Balance or Assets */ - plaidAccessToken?: string; + plaidAccessToken: string; /** List of plaid bank accounts */ bankAccounts?: PlaidBankAccount[]; diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index fc0b663dc1ce..28a901f67cf4 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -1,3 +1,13 @@ +type User = { + accountID: number; + skinTone: number; +}; + +type Reaction = { + emoji: string; + users: User[]; +}; + type Message = { /** The type of the action item fragment. Used to render a corresponding component */ type: string; @@ -8,25 +18,29 @@ type Message = { /** Used to apply additional styling. Style refers to a predetermined constant and not a class name. e.g. 'normal' * or 'strong' */ - style: string; + style?: string; /** ID of a report */ - reportID: string; + reportID?: string; /** ID of a policy */ - policyID: string; + policyID?: string; /** The target of a link fragment e.g. '_blank' */ - target: string; + target?: string; /** The destination of a link fragment e.g. 'https://www.expensify.com' */ - href: string; + href?: string; /** An additional avatar url - not the main avatar url but used within a message. */ - iconUrl: string; + iconUrl?: string; /** Fragment edited flag */ isEdited: boolean; + + isDeletedParentAction: boolean; + whisperedTo: number[]; + reactions: Reaction[]; }; type OriginalMessage = { @@ -34,13 +48,13 @@ type OriginalMessage = { IOUTransactionID?: string; IOUReportID?: number; - amount?: number; + amount: number; comment?: string; - currency?: string; + currency: string; lastModified?: string; participantAccountIDs?: number[]; participants?: string[]; - type?: string; + type: string; }; type Person = { diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 05c0f9ae3f6d..810ff55a4fcd 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -14,9 +14,9 @@ type Transaction = { created: string; pendingAction: OnyxCommon.PendingAction; errors: Record; - modifiedAmount: number; - modifiedCreated: string; - modifiedCurrency: string; + modifiedAmount?: number; + modifiedCreated?: string; + modifiedCurrency?: string; }; export default Transaction; From 0c9e3bc8a4d51845921ffea80e5e7505a610f2a9 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 20 Jul 2023 15:09:22 +0200 Subject: [PATCH 105/122] Extract original message to a separate file --- src/types/onyx/OriginalMessage.ts | 123 ++++++++++++++++++++++++++++++ src/types/onyx/ReportAction.ts | 26 ++----- 2 files changed, 128 insertions(+), 21 deletions(-) create mode 100644 src/types/onyx/OriginalMessage.ts diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts new file mode 100644 index 000000000000..5304864b7829 --- /dev/null +++ b/src/types/onyx/OriginalMessage.ts @@ -0,0 +1,123 @@ +import {ValueOf} from 'type-fest'; +import CONST from '../../CONST'; + +type OriginalMessageIOU = { + actionName: ValueOf; + originalMessage: { + /** The ID of the iou transaction */ + IOUTransactionID?: string; + + IOUReportID?: number; + amount: number; + comment?: string; + currency: string; + lastModified?: string; + participantAccountIDs?: number[]; + participants?: string[]; + type: string; + }; +}; + +type FlagSeverityName = 'spam' | 'inconsiderate' | 'bullying' | 'intimidation' | 'harassment' | 'assault'; +type FlagSeverity = { + accountID: number; + timestamp: string; +}; + +type Decision = { + decision: string; + timestamp: string; +}; + +type User = { + accountID: number; + skinTone: number; +}; + +type Reaction = { + emoji: string; + users: User[]; +}; + +type OriginalMessageAddComment = { + actionName: ValueOf; + originalMessage: { + html: string; + lastModified?: string; + taskReportID?: string; + edits?: string[]; + childReportID?: string; + isDeletedParentAction?: boolean; + flags?: Record; + moderationDecisions?: Decision[]; + whisperedTo: number[]; + reactions: Reaction[]; + }; +}; + +type OriginalMessageClosed = { + actionName: ValueOf; + originalMessage: { + policyName: string; + reason: 'default' | 'accountClosed' | 'accountMerged' | 'removedPolicy' | 'policyDeleted'; + lastModified?: string; + }; +}; + +type OriginalMessageCreated = { + actionName: ValueOf; + originalMessage: undefined; +}; + +type OriginalMessageRenamed = { + actionName: ValueOf; + originalMessage: { + html: string; + lastModified: string; + oldName: string; + newName: string; + }; +}; + +type ChronosOOOTimestamp = { + date: string; + timezone: string; + // eslint-disable-next-line @typescript-eslint/naming-convention + timezone_type: number; +}; + +type ChronosOOOEvent = { + id: string; + lengthInDays: number; + summary: string; + start: ChronosOOOTimestamp; + end: ChronosOOOTimestamp; +}; + +type OriginalMessageChronosOOOList = { + actionName: ValueOf; + originalMessage: { + edits: string[]; + events: ChronosOOOEvent[]; + html: string; + lastModified: string; + }; +}; + +type OriginalMessageReportPreview = { + actionName: ValueOf; + originalMessage: { + linkedReportID: string; + }; +}; + +type OriginalMessage = + | OriginalMessageIOU + | OriginalMessageAddComment + | OriginalMessageClosed + | OriginalMessageCreated + | OriginalMessageRenamed + | OriginalMessageChronosOOOList + | OriginalMessageReportPreview; + +export default OriginalMessage; diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index 28a901f67cf4..44a942e84721 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -1,3 +1,5 @@ +import OriginalMessage from './OriginalMessage'; + type User = { accountID: number; skinTone: number; @@ -43,35 +45,18 @@ type Message = { reactions: Reaction[]; }; -type OriginalMessage = { - /** The ID of the iou transaction */ - IOUTransactionID?: string; - - IOUReportID?: number; - amount: number; - comment?: string; - currency: string; - lastModified?: string; - participantAccountIDs?: number[]; - participants?: string[]; - type: string; -}; - type Person = { type?: string; style?: string; text?: string; }; -type ReportAction = { +type ReportActionBase = { /** The ID of the reportAction. It is the string representation of the a 64-bit integer. */ reportActionID?: string; actorAccountID?: number; - /** Name of the action e.g. ADDCOMMENT */ - actionName?: string; - /** Person who created the action */ person?: Person[]; @@ -81,9 +66,6 @@ type ReportAction = { /** report action message */ message?: Message[]; - /** Original message associated with this action */ - originalMessage?: OriginalMessage; - /** Whether we have received a response back from the server */ isLoading?: boolean; @@ -105,4 +87,6 @@ type ReportAction = { childVisibleActionCount?: number; }; +type ReportAction = ReportActionBase & OriginalMessage; + export default ReportAction; From 0f8b1dd68b3b6c2d3139d2d51293396d0254f299 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 20 Jul 2023 16:46:39 +0200 Subject: [PATCH 106/122] Add remaining original messages types --- src/types/onyx/OriginalMessage.ts | 32 +++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 5304864b7829..e000fe52431a 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -2,7 +2,7 @@ import {ValueOf} from 'type-fest'; import CONST from '../../CONST'; type OriginalMessageIOU = { - actionName: ValueOf; + actionName: typeof CONST.REPORT.ACTIONS.TYPE.IOU; originalMessage: { /** The ID of the iou transaction */ IOUTransactionID?: string; @@ -40,7 +40,7 @@ type Reaction = { }; type OriginalMessageAddComment = { - actionName: ValueOf; + actionName: typeof CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT; originalMessage: { html: string; lastModified?: string; @@ -56,7 +56,7 @@ type OriginalMessageAddComment = { }; type OriginalMessageClosed = { - actionName: ValueOf; + actionName: typeof CONST.REPORT.ACTIONS.TYPE.CLOSED; originalMessage: { policyName: string; reason: 'default' | 'accountClosed' | 'accountMerged' | 'removedPolicy' | 'policyDeleted'; @@ -65,12 +65,12 @@ type OriginalMessageClosed = { }; type OriginalMessageCreated = { - actionName: ValueOf; + actionName: typeof CONST.REPORT.ACTIONS.TYPE.CREATED; originalMessage: undefined; }; type OriginalMessageRenamed = { - actionName: ValueOf; + actionName: typeof CONST.REPORT.ACTIONS.TYPE.RENAMED; originalMessage: { html: string; lastModified: string; @@ -95,7 +95,7 @@ type ChronosOOOEvent = { }; type OriginalMessageChronosOOOList = { - actionName: ValueOf; + actionName: typeof CONST.REPORT.ACTIONS.TYPE.CHRONOSOOOLIST; originalMessage: { edits: string[]; events: ChronosOOOEvent[]; @@ -105,12 +105,26 @@ type OriginalMessageChronosOOOList = { }; type OriginalMessageReportPreview = { - actionName: ValueOf; + actionName: typeof CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW; originalMessage: { linkedReportID: string; }; }; +type OriginalMessagePolicyChangeLog = { + actionName: ValueOf; + originalMessage: unknown; +}; + +type OriginalMessagePolicyTask = { + actionName: + | typeof CONST.REPORT.ACTIONS.TYPE.TASKEDITED + | typeof CONST.REPORT.ACTIONS.TYPE.TASKCANCELED + | typeof CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED + | typeof CONST.REPORT.ACTIONS.TYPE.TASKREOPENED; + originalMessage: unknown; +}; + type OriginalMessage = | OriginalMessageIOU | OriginalMessageAddComment @@ -118,6 +132,8 @@ type OriginalMessage = | OriginalMessageCreated | OriginalMessageRenamed | OriginalMessageChronosOOOList - | OriginalMessageReportPreview; + | OriginalMessageReportPreview + | OriginalMessagePolicyChangeLog + | OriginalMessagePolicyTask; export default OriginalMessage; From ae25eb47671067e79325e20f73be6450d3184760 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 21 Jul 2023 15:12:52 +0200 Subject: [PATCH 107/122] Make fields optional --- src/types/onyx/OriginalMessage.ts | 2 +- src/types/onyx/ReportAction.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index e000fe52431a..fa21e2339083 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -51,7 +51,7 @@ type OriginalMessageAddComment = { flags?: Record; moderationDecisions?: Decision[]; whisperedTo: number[]; - reactions: Reaction[]; + reactions?: Reaction[]; }; }; diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index 44a942e84721..174b08265272 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -73,7 +73,7 @@ type ReportActionBase = { error?: string; /** accountIDs of the people to which the whisper was sent to (if any). Returns empty array if it is not a whisper */ - whisperedToAccountIDs: number[]; + whisperedToAccountIDs?: number[]; avatar?: string; automatic?: boolean; From 539f77590ecd796f35a90000727e1371a1160081 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 24 Jul 2023 11:38:14 +0200 Subject: [PATCH 108/122] Adjust ReimbursementAccountDraft --- src/types/onyx/OriginalMessage.ts | 2 +- src/types/onyx/ReimbursementAccountDraft.ts | 28 +++++---------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index fa21e2339083..c16ca6751a1e 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -66,7 +66,7 @@ type OriginalMessageClosed = { type OriginalMessageCreated = { actionName: typeof CONST.REPORT.ACTIONS.TYPE.CREATED; - originalMessage: undefined; + originalMessage: unknown; }; type OriginalMessageRenamed = { diff --git a/src/types/onyx/ReimbursementAccountDraft.ts b/src/types/onyx/ReimbursementAccountDraft.ts index 2f873333285e..d55c2b5b3567 100644 --- a/src/types/onyx/ReimbursementAccountDraft.ts +++ b/src/types/onyx/ReimbursementAccountDraft.ts @@ -1,19 +1,10 @@ type ReimbursementAccountDraft = { - bankAccountID?: number; - - /** Props needed for BankAccountStep */ accountNumber?: string; routingNumber?: string; acceptTerms?: boolean; plaidAccountID?: string; plaidMask?: string; - - /** Props needed for CompanyStep */ companyName?: string; - addressStreet?: string; - addressCity?: string; - addressState?: string; - addressZipCode?: string; companyPhone?: string; website?: string; companyTaxID?: string; @@ -21,26 +12,19 @@ type ReimbursementAccountDraft = { incorporationDate?: string | Date; incorporationState?: string; hasNoConnectionToCannabis?: boolean; - bank?: string; - - /** Props needed for RequestorStep */ - firstName?: string; - lastName?: string; - requestorAddressStreet?: string; - requestorAddressCity?: string; - requestorAddressState?: string; - requestorAddressZipCode?: string; - dob?: string | Date; - ssnLast4?: string; isControllingOfficer?: boolean; isOnfidoSetupComplete?: boolean; - - /** Props needed for ACHContractStep */ ownsMoreThan25Percent?: boolean; hasOtherBeneficialOwners?: boolean; acceptTermsAndConditions?: boolean; certifyTrueInformation?: boolean; beneficialOwners?: string[]; + isSavings?: boolean; + bankName?: string; + plaidAccessToken?: string; + amount1?: string; + amount2?: string; + amount3?: string; }; export default ReimbursementAccountDraft; From e25861fa1eefada03c79d3daad2a5e0bb543d878 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 24 Jul 2023 18:06:27 +0200 Subject: [PATCH 109/122] Remove BaseState completely --- src/types/onyx/Account.ts | 8 +++++++- src/types/onyx/OnyxCommon.ts | 15 ++------------- src/types/onyx/PlaidData.ts | 5 ++++- src/types/onyx/Policy.ts | 2 +- src/types/onyx/Transaction.ts | 2 +- src/types/onyx/WalletAdditionalDetails.ts | 4 +++- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/types/onyx/Account.ts b/src/types/onyx/Account.ts index 24986fc7a2fe..29f21d703466 100644 --- a/src/types/onyx/Account.ts +++ b/src/types/onyx/Account.ts @@ -2,7 +2,7 @@ import {ValueOf} from 'type-fest'; import CONST from '../../CONST'; import * as OnyxCommon from './OnyxCommon'; -type Account = OnyxCommon.BaseState & { +type Account = { /** URL to the assigned guide's appointment booking calendar */ guideCalendarLink?: string; @@ -41,6 +41,12 @@ type Account = OnyxCommon.BaseState & { /** Whether the validation code has expired */ validateCodeExpired?: boolean; + + /** Whether a sign is loading */ + isLoading?: boolean; + + errors?: OnyxCommon.Errors; + success?: string; }; export default Account; diff --git a/src/types/onyx/OnyxCommon.ts b/src/types/onyx/OnyxCommon.ts index 272bce7cadcf..36e9c6ae74ea 100644 --- a/src/types/onyx/OnyxCommon.ts +++ b/src/types/onyx/OnyxCommon.ts @@ -6,18 +6,7 @@ type PendingAction = ValueOf; type ErrorFields = Record>; -type BaseState = { - success?: string; - - /** An error message to display to the user */ - errors?: Record; - errorFields?: ErrorFields; - - /** Whether or not data is loading */ - isLoading?: boolean; - - pendingAction?: PendingAction; -}; +type Errors = Record; type Icon = { source: React.ReactNode | string; @@ -25,4 +14,4 @@ type Icon = { name: string; }; -export type {BaseState, Icon, PendingAction, ErrorFields}; +export type {Icon, PendingAction, ErrorFields, Errors}; diff --git a/src/types/onyx/PlaidData.ts b/src/types/onyx/PlaidData.ts index b3e28fa7ce4a..a4a6d8e6fe8c 100644 --- a/src/types/onyx/PlaidData.ts +++ b/src/types/onyx/PlaidData.ts @@ -1,7 +1,7 @@ import PlaidBankAccount from './PlaidBankAccount'; import * as OnyxCommon from './OnyxCommon'; -type PlaidData = OnyxCommon.BaseState & { +type PlaidData = { /** Name of the bank */ bankName?: string; @@ -13,6 +13,9 @@ type PlaidData = OnyxCommon.BaseState & { /** List of plaid bank accounts */ bankAccounts?: PlaidBankAccount[]; + + isLoading?: boolean; + errors: OnyxCommon.Errors; }; export default PlaidData; diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index f0fd2b2eabff..cacbb5d15199 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -28,7 +28,7 @@ type Policy = { errorFields?: OnyxCommon.ErrorFields; pendingAction?: OnyxCommon.PendingAction; - errors: Record; + errors: OnyxCommon.Errors; isFromFullPolicy?: boolean; lastModified?: string; customUnits?: Record; diff --git a/src/types/onyx/Transaction.ts b/src/types/onyx/Transaction.ts index 810ff55a4fcd..0e0c7a423829 100644 --- a/src/types/onyx/Transaction.ts +++ b/src/types/onyx/Transaction.ts @@ -13,7 +13,7 @@ type Transaction = { merchant: string; created: string; pendingAction: OnyxCommon.PendingAction; - errors: Record; + errors: OnyxCommon.Errors; modifiedAmount?: number; modifiedCreated?: string; modifiedCurrency?: string; diff --git a/src/types/onyx/WalletAdditionalDetails.ts b/src/types/onyx/WalletAdditionalDetails.ts index 8176475f622b..e766ba4cfe50 100644 --- a/src/types/onyx/WalletAdditionalDetails.ts +++ b/src/types/onyx/WalletAdditionalDetails.ts @@ -1,6 +1,6 @@ import * as OnyxCommon from './OnyxCommon'; -type WalletAdditionalDetails = OnyxCommon.BaseState & { +type WalletAdditionalDetails = { /** Questions returned by Idology */ questions?: { prompt: string; @@ -16,6 +16,8 @@ type WalletAdditionalDetails = OnyxCommon.BaseState & { /** Which field needs attention? */ errorFields?: OnyxCommon.ErrorFields; + isLoading?: boolean; + errors?: OnyxCommon.Errors; }; export default WalletAdditionalDetails; From ba79ba624adad965b18cca1d7f3b8776dac9fa59 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 25 Jul 2023 16:44:42 +0200 Subject: [PATCH 110/122] Last adjustmnets to types --- src/types/onyx/Form.ts | 2 +- src/types/onyx/PolicyMember.ts | 2 +- src/types/onyx/ReimbursementAccount.ts | 4 +++- src/types/onyx/ReportAction.ts | 1 + src/types/onyx/UserWallet.ts | 3 ++- src/types/onyx/WalletOnfido.ts | 4 +++- src/types/onyx/WalletTerms.ts | 4 +++- src/types/onyx/WalletTransfer.ts | 3 ++- 8 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/types/onyx/Form.ts b/src/types/onyx/Form.ts index 2a23d489a146..cda8c3c1017e 100644 --- a/src/types/onyx/Form.ts +++ b/src/types/onyx/Form.ts @@ -5,7 +5,7 @@ type Form = { isLoading?: boolean; /** Server side errors keyed by microtime */ - errors?: Record; + errors?: OnyxCommon.Errors; /** Field-specific server side errors keyed by microtime */ errorFields?: OnyxCommon.ErrorFields; diff --git a/src/types/onyx/PolicyMember.ts b/src/types/onyx/PolicyMember.ts index 4503ca829e18..055465020c36 100644 --- a/src/types/onyx/PolicyMember.ts +++ b/src/types/onyx/PolicyMember.ts @@ -8,7 +8,7 @@ type PolicyMember = { * Errors from api calls on the specific user * {: 'error message', : 'error message 2'} */ - errors?: Record; + errors?: OnyxCommon.Errors; /** Is this action pending? */ pendingAction?: OnyxCommon.PendingAction; diff --git a/src/types/onyx/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts index ee22e98c9add..048cc3409466 100644 --- a/src/types/onyx/ReimbursementAccount.ts +++ b/src/types/onyx/ReimbursementAccount.ts @@ -35,7 +35,9 @@ type ReimbursementAccount = { errorFields?: OnyxCommon.ErrorFields; /** Any additional error message to show */ - errors?: Record; + errors?: OnyxCommon.Errors; + + pendingAction?: boolean; }; export default ReimbursementAccount; diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index 174b08265272..80ebc368a1b6 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -85,6 +85,7 @@ type ReportActionBase = { childCommenterCount?: number; childLastVisibleActionCreated?: string; childVisibleActionCount?: number; + pendingAction?: boolean; }; type ReportAction = ReportActionBase & OriginalMessage; diff --git a/src/types/onyx/UserWallet.ts b/src/types/onyx/UserWallet.ts index 151eefd15be2..8624f16000c9 100644 --- a/src/types/onyx/UserWallet.ts +++ b/src/types/onyx/UserWallet.ts @@ -1,5 +1,6 @@ import {ValueOf} from 'type-fest'; import CONST from '../../CONST'; +import * as OnyxCommon from './OnyxCommon'; type WalletLinkedAccountType = 'debitCard' | 'bankAccount'; @@ -46,7 +47,7 @@ type UserWallet = { errorCode?: ErrorCode; /** An error message to display to the user */ - errors?: Record; + errors?: OnyxCommon.Errors; }; export default UserWallet; diff --git a/src/types/onyx/WalletOnfido.ts b/src/types/onyx/WalletOnfido.ts index 827be5b99c21..7a65c0f710ef 100644 --- a/src/types/onyx/WalletOnfido.ts +++ b/src/types/onyx/WalletOnfido.ts @@ -1,3 +1,5 @@ +import * as OnyxCommon from './OnyxCommon'; + type WalletOnfido = { /** Unique identifier returned from openOnfidoFlow then re-sent to ActivateWallet with Onfido response data */ applicantID: string; @@ -9,7 +11,7 @@ type WalletOnfido = { isLoading?: boolean; /** Error message to inform the user of any problem that might occur */ - errors?: Record; + errors?: OnyxCommon.Errors; /** A list of Onfido errors that the user can fix in order to attempt the Onfido flow again */ fixableErrors?: string[]; diff --git a/src/types/onyx/WalletTerms.ts b/src/types/onyx/WalletTerms.ts index 34b78a07194e..5394f126c33c 100644 --- a/src/types/onyx/WalletTerms.ts +++ b/src/types/onyx/WalletTerms.ts @@ -1,6 +1,8 @@ +import * as OnyxCommon from './OnyxCommon'; + type WalletTerms = { /** Any error message to show */ - errors?: Record; + errors?: OnyxCommon.Errors; /** When the user accepts the Wallet's terms in order to pay an IOU, this is the ID of the chatReport the IOU is linked to */ chatReportID?: string; diff --git a/src/types/onyx/WalletTransfer.ts b/src/types/onyx/WalletTransfer.ts index c64b01fcdebf..d5214869d2fd 100644 --- a/src/types/onyx/WalletTransfer.ts +++ b/src/types/onyx/WalletTransfer.ts @@ -1,4 +1,5 @@ import CONST from '../../CONST'; +import * as OnyxCommon from './OnyxCommon'; type WalletTransfer = { /** Selected accountID for transfer */ @@ -14,7 +15,7 @@ type WalletTransfer = { shouldShowSuccess?: boolean; /** An error message to display to the user */ - errors?: Record; + errors?: OnyxCommon.Errors; /** Whether or not data is loading */ loading?: boolean; From 68e82559ed05ab573f292aaef27f4db2824f93e9 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 27 Jul 2023 09:27:03 +0200 Subject: [PATCH 111/122] Fix a typo --- src/types/onyx/OriginalMessage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index c16ca6751a1e..167542a9f49e 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -119,7 +119,7 @@ type OriginalMessagePolicyChangeLog = { type OriginalMessagePolicyTask = { actionName: | typeof CONST.REPORT.ACTIONS.TYPE.TASKEDITED - | typeof CONST.REPORT.ACTIONS.TYPE.TASKCANCELED + | typeof CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED | typeof CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED | typeof CONST.REPORT.ACTIONS.TYPE.TASKREOPENED; originalMessage: unknown; From 2e14ef0a9345c4cf0ee9f1daf99731ca569d99c1 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 1 Aug 2023 14:13:38 +0200 Subject: [PATCH 112/122] Fix eslint errors --- src/types/onyx/OriginalMessage.ts | 2 ++ src/types/onyx/WalletTransfer.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 167542a9f49e..f15ca9963db9 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -1,3 +1,5 @@ +// TODO: Remove this after CONST.ts is migrated to TS +/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */ import {ValueOf} from 'type-fest'; import CONST from '../../CONST'; diff --git a/src/types/onyx/WalletTransfer.ts b/src/types/onyx/WalletTransfer.ts index d5214869d2fd..ea0878d9cc4d 100644 --- a/src/types/onyx/WalletTransfer.ts +++ b/src/types/onyx/WalletTransfer.ts @@ -9,6 +9,8 @@ type WalletTransfer = { selectedAccountType?: string; /** Type to filter the payment Method list */ + // TODO: Remove this after CONST.ts is migrated to TS + // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents filterPaymentMethodType?: typeof CONST.PAYMENT_METHODS.DEBIT_CARD | typeof CONST.PAYMENT_METHODS.BANK_ACCOUNT; /** Whether the success screen is shown to user. */ From e8b27af8568b2133a620f5847197f3b71a54304b Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 1 Aug 2023 14:46:37 +0200 Subject: [PATCH 113/122] Adjust the PR after last review --- src/types/onyx/ReimbursementAccount.ts | 3 ++- src/types/onyx/ReportAction.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/types/onyx/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts index 048cc3409466..4f2a05d7f4e1 100644 --- a/src/types/onyx/ReimbursementAccount.ts +++ b/src/types/onyx/ReimbursementAccount.ts @@ -6,6 +6,7 @@ type ACHData = { /** Step of the setup flow that we are on. Determines which view is presented. */ currentStep: ValueOf; + /** Optional subStep we would like the user to start back on */ subStep?: ValueOf; /** Bank account state */ @@ -37,7 +38,7 @@ type ReimbursementAccount = { /** Any additional error message to show */ errors?: OnyxCommon.Errors; - pendingAction?: boolean; + pendingAction?: OnyxCommon.PendingAction; }; export default ReimbursementAccount; diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index 80ebc368a1b6..ab517bb8705a 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -1,4 +1,5 @@ import OriginalMessage from './OriginalMessage'; +import * as OnyxCommon from './OnyxCommon'; type User = { accountID: number; @@ -85,7 +86,8 @@ type ReportActionBase = { childCommenterCount?: number; childLastVisibleActionCreated?: string; childVisibleActionCount?: number; - pendingAction?: boolean; + + pendingAction?: OnyxCommon.PendingAction; }; type ReportAction = ReportActionBase & OriginalMessage; From bcd4a901b287851e3af43f66529cc3b4847d6cd8 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 2 Aug 2023 16:42:19 +0200 Subject: [PATCH 114/122] Add types for ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS --- src/ONYXKEYS.ts | 14 ++++++-------- src/types/onyx/ReportActionReactions.ts | 15 +++++++++++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 src/types/onyx/ReportActionReactions.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 058eccf9c626..d6839d7d2876 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -132,7 +132,7 @@ const ONYXKEYS = { /** The user's credit cards */ CARD_LIST: 'cardList', - // The user's credit cards (renamed from cardList) + /** The user's credit cards (renamed from cardList) */ FUND_LIST: 'fundList', /** Stores information about the user's saved statements */ @@ -180,9 +180,6 @@ const ONYXKEYS = { /** Is app in beta version */ IS_BETA: 'isBeta', - /** Whether the auth token is valid */ - IS_TOKEN_VALID: 'isTokenValid', - /** Whether we're checking if the room is public or not */ IS_CHECKING_PUBLIC_ROOM: 'isCheckingPublicRoom', @@ -208,6 +205,7 @@ const ONYXKEYS = { REPORT: 'report_', REPORT_ACTIONS: 'reportActions_', REPORT_ACTIONS_DRAFTS: 'reportActionsDrafts_', + REPORT_ACTIONS_REACTIONS: 'reportActionsReactions_', REPORT_DRAFT_COMMENT: 'reportDraftComment_', REPORT_DRAFT_COMMENT_NUMBER_OF_LINES: 'reportDraftCommentNumberOfLines_', REPORT_IS_COMPOSER_FULL_SIZE: 'reportIsComposerFullSize_', @@ -305,7 +303,6 @@ type OnyxValues = { [ONYXKEYS.LAST_ACCESSED_WORKSPACE_POLICY_ID]: string; [ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT]: boolean; [ONYXKEYS.IS_BETA]: boolean; - [ONYXKEYS.IS_TOKEN_VALID]: boolean; [ONYXKEYS.IS_CHECKING_PUBLIC_ROOM]: boolean; [ONYXKEYS.MY_DOMAIN_SECURITY_GROUPS]: Record; [ONYXKEYS.LAST_OPENED_PUBLIC_ROOM_ID]: string; @@ -319,9 +316,10 @@ type OnyxValues = { [deprecatedPolicyMemberList: `${typeof ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}${string}`]: OnyxTypes.PolicyMember; [workspaceInviteMembersDraft: `${typeof ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${string}`]: Record; [report: `${typeof ONYXKEYS.COLLECTION.REPORT}${string}`]: OnyxTypes.Report; - [ReportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes.ReportAction; - [ReportActionsDrafts: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`]: string; - [ReportDraftComment: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${string}`]: string; + [reportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes.ReportAction; + [reportActionsDrafts: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`]: string; + [reportActionsReactions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${string}`]: OnyxTypes.ReportActionReactions; + [reportDraftComment: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${string}`]: string; [reportDraftCommentNumberOfLines: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES}${string}`]: number; [reportIsComposerFull: `${typeof ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${string}`]: boolean; [reportUserIsTyping: `${typeof ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${string}`]: boolean; diff --git a/src/types/onyx/ReportActionReactions.ts b/src/types/onyx/ReportActionReactions.ts new file mode 100644 index 000000000000..196e2707bbd2 --- /dev/null +++ b/src/types/onyx/ReportActionReactions.ts @@ -0,0 +1,15 @@ +type User = { + /** The skin tone which was used and also the timestamp of when it was added */ + skinTones: Record; +}; + +type ReportActionReaction = { + /** The time the emoji was added */ + createdAt: string; + /** All the users who have added this emoji */ + users: Record; +}; + +type ReportActionReactions = Record; + +export default ReportActionReactions; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index ddcc728fb437..7c92f1da6fb0 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -34,6 +34,7 @@ import PolicyMember from './PolicyMember'; import Policy from './Policy'; import Report from './Report'; import ReportAction from './ReportAction'; +import ReportActionReactions from './ReportActionReactions'; import SecurityGroup from './SecurityGroup'; import Transaction from './Transaction'; import Form, {AddDebitCardForm} from './Form'; @@ -75,6 +76,7 @@ export type { Policy, Report, ReportAction, + ReportActionReactions, SecurityGroup, Transaction, Form, From c7fb74a2115ccf03847f308eb8a94d5e426b6331 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 3 Aug 2023 10:14:13 +0200 Subject: [PATCH 115/122] Overwrite react-native-onyx in global.d.ts --- src/global.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/global.d.ts b/src/global.d.ts index 0e32eb6f7457..0dc745d5e0ea 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -1,3 +1,5 @@ +import {OnyxKey, OnyxCollectionKey, OnyxValues} from './ONYXKEYS'; + declare module '*.png' { const value: import('react-native').ImageSourcePropType; export default value; @@ -15,3 +17,12 @@ declare module '*.svg' { } declare module 'react-native-device-info/jest/react-native-device-info-mock'; + +declare module 'react-native-onyx' { + // eslint-disable-next-line @typescript-eslint/consistent-type-definitions + interface CustomTypeOptions { + keys: OnyxKey; + collectionKeys: OnyxCollectionKey; + values: OnyxValues; + } +} From 1cee790ecf43e91e2ad1a8b361a2ae94a0e3fc1b Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 3 Aug 2023 10:15:17 +0200 Subject: [PATCH 116/122] Change how onyx collection values are defined --- src/ONYXKEYS.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index d6839d7d2876..92271bd4c368 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -242,8 +242,8 @@ const ONYXKEYS = { } as const; type OnyxKeysMap = typeof ONYXKEYS; -type CollectionKey = `${ValueOf}${string}`; -type OnyxKey = DeepValueOf> | CollectionKey; +type OnyxCollectionKey = ValueOf; +type OnyxKey = DeepValueOf>; type OnyxValues = { [ONYXKEYS.ACCOUNT]: OnyxTypes.Account; @@ -310,21 +310,21 @@ type OnyxValues = { [ONYXKEYS.IS_USING_MEMORY_ONLY_KEYS]: boolean; // Collections - [download: `${typeof ONYXKEYS.COLLECTION.DOWNLOAD}${string}`]: OnyxTypes.Download; - [policy: `${typeof ONYXKEYS.COLLECTION.POLICY}${string}`]: OnyxTypes.Policy; - [policyMembers: `${typeof ONYXKEYS.COLLECTION.POLICY_MEMBERS}${string}`]: OnyxTypes.PolicyMember; - [deprecatedPolicyMemberList: `${typeof ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}${string}`]: OnyxTypes.PolicyMember; - [workspaceInviteMembersDraft: `${typeof ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${string}`]: Record; - [report: `${typeof ONYXKEYS.COLLECTION.REPORT}${string}`]: OnyxTypes.Report; - [reportActions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS}${string}`]: OnyxTypes.ReportAction; - [reportActionsDrafts: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`]: string; - [reportActionsReactions: `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${string}`]: OnyxTypes.ReportActionReactions; - [reportDraftComment: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${string}`]: string; - [reportDraftCommentNumberOfLines: `${typeof ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES}${string}`]: number; - [reportIsComposerFull: `${typeof ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${string}`]: boolean; - [reportUserIsTyping: `${typeof ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${string}`]: boolean; - [securityGroup: `${typeof ONYXKEYS.COLLECTION.SECURITY_GROUP}${string}`]: OnyxTypes.SecurityGroup; - [transaction: `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`]: OnyxTypes.Transaction; + [ONYXKEYS.COLLECTION.DOWNLOAD]: OnyxTypes.Download; + [ONYXKEYS.COLLECTION.POLICY]: OnyxTypes.Policy; + [ONYXKEYS.COLLECTION.POLICY_MEMBERS]: OnyxTypes.PolicyMember; + [ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST]: OnyxTypes.PolicyMember; + [ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT]: Record; + [ONYXKEYS.COLLECTION.REPORT]: OnyxTypes.Report; + [ONYXKEYS.COLLECTION.REPORT_ACTIONS]: OnyxTypes.ReportAction; + [ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS]: string; + [ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS]: OnyxTypes.ReportActionReactions; + [ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT]: string; + [ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES]: number; + [ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE]: boolean; + [ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING]: boolean; + [ONYXKEYS.COLLECTION.SECURITY_GROUP]: OnyxTypes.SecurityGroup; + [ONYXKEYS.COLLECTION.TRANSACTION]: OnyxTypes.Transaction; // Forms [ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM]: OnyxTypes.AddDebitCardForm; @@ -348,4 +348,4 @@ type OnyxValues = { }; export default ONYXKEYS; -export type {OnyxKey, OnyxValues}; +export type {OnyxKey, OnyxCollectionKey, OnyxValues}; From 4eb4797e728fe644814f79d146ba6b8bad15582c Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 7 Aug 2023 10:32:33 +0200 Subject: [PATCH 117/122] Remove flipper-plugin-bridgespy-client package --- package-lock.json | 53 ++++++++++++++----------- package.json | 7 ++-- src/setup/platformSetup/index.native.js | 5 --- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0ef6f796166d..6373f12ad672 100644 --- a/package-lock.json +++ b/package-lock.json @@ -183,7 +183,6 @@ "eslint-plugin-react-native-a11y": "^3.3.0", "eslint-plugin-storybook": "^0.5.13", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0", - "flipper-plugin-bridgespy-client": "^0.1.9", "html-webpack-plugin": "^5.5.0", "jest": "29.4.1", "jest-circus": "29.4.1", @@ -206,7 +205,7 @@ "style-loader": "^2.0.0", "time-analytics-webpack-plugin": "^0.1.17", "type-fest": "^3.12.0", - "typescript": "^4.8.4", + "typescript": "^5.1.6", "wait-port": "^0.2.9", "webpack": "^5.76.0", "webpack-bundle-analyzer": "^4.5.0", @@ -21578,6 +21577,19 @@ "typescript": "^4.0.2" } }, + "node_modules/config-file-ts/node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/confusing-browser-globals": { "version": "1.0.11", "dev": true, @@ -26519,16 +26531,6 @@ "dev": true, "license": "ISC" }, - "node_modules/flipper-plugin-bridgespy-client": { - "version": "0.1.9", - "dev": true, - "license": "MIT", - "peerDependencies": { - "react-native": ">=0.62.0", - "react-native-flipper": ">=0.54.0 <1.0.0", - "typescript": ">=3.5.0 <5.0.0" - } - }, "node_modules/flow-enums-runtime": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/flow-enums-runtime/-/flow-enums-runtime-0.0.5.tgz", @@ -42905,16 +42907,16 @@ } }, "node_modules/typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/ua-parser-js": { @@ -59831,6 +59833,14 @@ "requires": { "glob": "^7.1.6", "typescript": "^4.0.2" + }, + "dependencies": { + "typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true + } } }, "confusing-browser-globals": { @@ -63185,11 +63195,6 @@ "version": "3.2.6", "dev": true }, - "flipper-plugin-bridgespy-client": { - "version": "0.1.9", - "dev": true, - "requires": {} - }, "flow-enums-runtime": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/flow-enums-runtime/-/flow-enums-runtime-0.0.5.tgz", @@ -74135,9 +74140,9 @@ } }, "typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "dev": true }, "ua-parser-js": { diff --git a/package.json b/package.json index 1241875c10b9..2b6fd58ff47f 100644 --- a/package.json +++ b/package.json @@ -154,8 +154,8 @@ "@babel/preset-env": "^7.20.0", "@babel/preset-flow": "^7.12.13", "@babel/preset-react": "^7.10.4", - "@babel/runtime": "^7.20.0", "@babel/preset-typescript": "^7.21.5", + "@babel/runtime": "^7.20.0", "@electron/notarize": "^1.2.3", "@jest/globals": "^29.5.0", "@octokit/core": "4.0.4", @@ -175,12 +175,12 @@ "@svgr/webpack": "^6.0.0", "@testing-library/jest-native": "5.4.1", "@testing-library/react-native": "11.5.1", - "@types/metro-config": "^0.76.3", "@types/concurrently": "^7.0.0", "@types/jest": "^29.5.2", "@types/jest-when": "^3.5.2", "@types/js-yaml": "^4.0.5", "@types/lodash": "^4.14.195", + "@types/metro-config": "^0.76.3", "@types/mock-fs": "^4.13.1", "@types/pusher-js": "^5.1.0", "@types/react": "^18.2.12", @@ -222,7 +222,6 @@ "eslint-plugin-react-native-a11y": "^3.3.0", "eslint-plugin-storybook": "^0.5.13", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0", - "flipper-plugin-bridgespy-client": "^0.1.9", "html-webpack-plugin": "^5.5.0", "jest": "29.4.1", "jest-circus": "29.4.1", @@ -245,7 +244,7 @@ "style-loader": "^2.0.0", "time-analytics-webpack-plugin": "^0.1.17", "type-fest": "^3.12.0", - "typescript": "^4.8.4", + "typescript": "^5.1.6", "wait-port": "^0.2.9", "webpack": "^5.76.0", "webpack-bundle-analyzer": "^4.5.0", diff --git a/src/setup/platformSetup/index.native.js b/src/setup/platformSetup/index.native.js index d164600c7706..470bef78848f 100644 --- a/src/setup/platformSetup/index.native.js +++ b/src/setup/platformSetup/index.native.js @@ -21,10 +21,5 @@ export default function () { PushNotification.init(); subscribeToReportCommentPushNotifications(); - // Setup Flipper plugins when on dev - if (__DEV__ && typeof jest === 'undefined') { - require('flipper-plugin-bridgespy-client'); - } - Performance.setupPerformanceObserver(); } From 6a2ddf1fdc522d18f7dc708c0ddff2534d098250 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 8 Aug 2023 09:17:16 +0200 Subject: [PATCH 118/122] Adjust types after review --- src/types/onyx/OriginalMessage.ts | 1 + src/types/onyx/Report.ts | 6 +++--- src/types/onyx/ReportAction.ts | 14 ++------------ src/types/onyx/Task.ts | 2 +- src/types/onyx/WalletTransfer.ts | 2 +- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index f15ca9963db9..d52489c36da9 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -139,3 +139,4 @@ type OriginalMessage = | OriginalMessagePolicyTask; export default OriginalMessage; +export type {Reaction}; diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 52189b468fc2..8660837ba874 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -46,7 +46,7 @@ type Report = { ownerEmail?: string; /** List of primarylogins of participants of the report */ - participants?: Array; + participants?: string[]; /** Linked policy's ID */ policyID?: string; @@ -69,7 +69,7 @@ type Report = { /** The report type */ type?: string; - parentReportID?: number; + parentReportID?: string; parentReportActionID?: string; isOptimisticReport?: boolean; hasDraft?: boolean; @@ -78,7 +78,7 @@ type Report = { displayName?: string; lastMessageHtml?: string; welcomeMessage?: string; - lastActorAccountID?: string; + lastActorAccountID?: number; ownerAccountID?: number; participantAccountIDs?: number[]; }; diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index ab517bb8705a..5f0072959917 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -1,16 +1,6 @@ -import OriginalMessage from './OriginalMessage'; +import OriginalMessage, {Reaction} from './OriginalMessage'; import * as OnyxCommon from './OnyxCommon'; -type User = { - accountID: number; - skinTone: number; -}; - -type Reaction = { - emoji: string; - users: User[]; -}; - type Message = { /** The type of the action item fragment. Used to render a corresponding component */ type: string; @@ -79,7 +69,7 @@ type ReportActionBase = { avatar?: string; automatic?: boolean; shouldShow?: boolean; - childReportID?: number; + childReportID?: string; childType?: string; childOldestFourEmails?: string; childOldestFourAccountIDs?: string; diff --git a/src/types/onyx/Task.ts b/src/types/onyx/Task.ts index 34f5643d2f6f..9d5c83ee4a40 100644 --- a/src/types/onyx/Task.ts +++ b/src/types/onyx/Task.ts @@ -18,7 +18,7 @@ type Task = { assignee?: string; /** The account id of the assignee */ - assigneeAccountID?: string; + assigneeAccountID?: number; /** Report id only when a task was created from a report */ parentReportID?: string; diff --git a/src/types/onyx/WalletTransfer.ts b/src/types/onyx/WalletTransfer.ts index ea0878d9cc4d..c5d92250f91d 100644 --- a/src/types/onyx/WalletTransfer.ts +++ b/src/types/onyx/WalletTransfer.ts @@ -3,7 +3,7 @@ import * as OnyxCommon from './OnyxCommon'; type WalletTransfer = { /** Selected accountID for transfer */ - selectedAccountID?: string; + selectedAccountID?: string | number; /** Selected accountType for transfer */ selectedAccountType?: string; From 77456a9d5f8ce85c7f0ae631dad163901f19cbfe Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 8 Aug 2023 09:48:36 +0200 Subject: [PATCH 119/122] Add MAPBOX_ACCESS_TOKEN & ONYX_UPDATES --- src/ONYXKEYS.ts | 14 ++++++++++++++ src/types/onyx/MapboxAccessToken.ts | 7 +++++++ src/types/onyx/index.ts | 2 ++ 3 files changed, 23 insertions(+) create mode 100644 src/types/onyx/MapboxAccessToken.ts diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 7275cb9934ee..3812cefcdec2 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -206,6 +206,17 @@ const ONYXKEYS = { // Receipt upload modal RECEIPT_MODAL: 'receiptModal', + // The access token to be used with the Mapbox library + MAPBOX_ACCESS_TOKEN: 'mapboxAccessToken', + + ONYX_UPDATES: { + // The ID of the last Onyx update that was applied to this client + LAST_UPDATE_ID: 'onyxUpdatesLastUpdateID', + + // The ID of the previous Onyx update that was applied to this client + PREVIOUS_UPDATE_ID: 'onyxUpdatesPreviousUpdateID', + }, + /** Collection Keys */ COLLECTION: { DOWNLOAD: 'download_', @@ -321,6 +332,9 @@ type OnyxValues = { [ONYXKEYS.IS_USING_MEMORY_ONLY_KEYS]: boolean; [ONYXKEYS.SELECTED_TAB]: string; [ONYXKEYS.RECEIPT_MODAL]: OnyxTypes.ReceiptModal; + [ONYXKEYS.MAPBOX_ACCESS_TOKEN]: OnyxTypes.MapboxAccessToken; + [ONYXKEYS.ONYX_UPDATES.LAST_UPDATE_ID]: number; + [ONYXKEYS.ONYX_UPDATES.PREVIOUS_UPDATE_ID]: number; // Collections [ONYXKEYS.COLLECTION.DOWNLOAD]: OnyxTypes.Download; diff --git a/src/types/onyx/MapboxAccessToken.ts b/src/types/onyx/MapboxAccessToken.ts new file mode 100644 index 000000000000..bea23bcf86c4 --- /dev/null +++ b/src/types/onyx/MapboxAccessToken.ts @@ -0,0 +1,7 @@ +type MapboxAccessToken = { + token: string; + expiration: string; + errors: string[]; +}; + +export default MapboxAccessToken; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 9400b88b5d5a..2a9ba87f8160 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -30,6 +30,7 @@ import ReimbursementAccount from './ReimbursementAccount'; import ReimbursementAccountDraft from './ReimbursementAccountDraft'; import WalletTransfer from './WalletTransfer'; import ReceiptModal from './ReceiptModal'; +import MapboxAccessToken from './MapboxAccessToken'; import Download from './Download'; import PolicyMember from './PolicyMember'; @@ -75,6 +76,7 @@ export type { FrequentlyUsedEmoji, WalletTransfer, ReceiptModal, + MapboxAccessToken, Download, PolicyMember, Policy, From e0708721e4e49c8a1628beed9b7171fec2198227 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 8 Aug 2023 10:21:50 +0200 Subject: [PATCH 120/122] Install typed version of react-native-onyx --- package-lock.json | 17 ++++++++--------- package.json | 2 +- src/types/onyx/QueuedOnyxUpdates.ts | 3 +-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index e2e5ef6540c8..41f49d5bfbc8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -80,7 +80,7 @@ "react-native-key-command": "^1.0.1", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "1.0.52", + "react-native-onyx": "git+https://github.com/fabioh8010/react-native-onyx#86aa5492d7013b59bcb34d015963cc4808651e26", "react-native-pager-view": "^6.2.0", "react-native-pdf": "^6.6.2", "react-native-performance": "^4.0.0", @@ -38082,13 +38082,13 @@ } }, "node_modules/react-native-onyx": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.52.tgz", - "integrity": "sha512-lfIg+tSd+HZF00pr2oFoLY3iTdGYGC6Dd44/YktTsVKB/yIcUq61wBMOitX54Z54ac2/eHKFPicEr2xvBhE2VQ==", + "version": "1.0.57", + "resolved": "git+ssh://git@github.com/fabioh8010/react-native-onyx.git#86aa5492d7013b59bcb34d015963cc4808651e26", + "integrity": "sha512-lK7phq7gjbF2zrv+kz+guj5O0LlBJc6baU2d/nUPNvPMTK7WbF1sixXBp/ZPMOkGGmSReAENNIW0x/cuFUeegg==", + "license": "MIT", "dependencies": { "ascii-table": "0.0.9", "fast-equals": "^4.0.3", - "lodash": "^4.17.21", "underscore": "^1.13.1" }, "engines": { @@ -71007,13 +71007,12 @@ } }, "react-native-onyx": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.52.tgz", - "integrity": "sha512-lfIg+tSd+HZF00pr2oFoLY3iTdGYGC6Dd44/YktTsVKB/yIcUq61wBMOitX54Z54ac2/eHKFPicEr2xvBhE2VQ==", + "version": "git+ssh://git@github.com/fabioh8010/react-native-onyx.git#86aa5492d7013b59bcb34d015963cc4808651e26", + "integrity": "sha512-lK7phq7gjbF2zrv+kz+guj5O0LlBJc6baU2d/nUPNvPMTK7WbF1sixXBp/ZPMOkGGmSReAENNIW0x/cuFUeegg==", + "from": "react-native-onyx@git+https://github.com/fabioh8010/react-native-onyx#86aa5492d7013b59bcb34d015963cc4808651e26", "requires": { "ascii-table": "0.0.9", "fast-equals": "^4.0.3", - "lodash": "^4.17.21", "underscore": "^1.13.1" } }, diff --git a/package.json b/package.json index 4f3e7e074933..379dde64dd30 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "react-native-key-command": "^1.0.1", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "1.0.52", + "react-native-onyx": "git+https://github.com/fabioh8010/react-native-onyx#86aa5492d7013b59bcb34d015963cc4808651e26", "react-native-pager-view": "^6.2.0", "react-native-pdf": "^6.6.2", "react-native-performance": "^4.0.0", diff --git a/src/types/onyx/QueuedOnyxUpdates.ts b/src/types/onyx/QueuedOnyxUpdates.ts index 09a6e1a3c509..40daa2e09335 100644 --- a/src/types/onyx/QueuedOnyxUpdates.ts +++ b/src/types/onyx/QueuedOnyxUpdates.ts @@ -1,5 +1,4 @@ -// @ts-expect-error TODO: Remove after onyx is typed -import * as Onyx from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; type QueuedOnyxUpdates = Array; From 278183e42390a8d550a2324ba2b6026f1337a7eb Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 16 Aug 2023 11:50:42 +0200 Subject: [PATCH 121/122] Fix CustomStatusDraft missing file --- src/types/onyx/{DraftStatus.ts => CustomStatusDraft.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/types/onyx/{DraftStatus.ts => CustomStatusDraft.ts} (100%) diff --git a/src/types/onyx/DraftStatus.ts b/src/types/onyx/CustomStatusDraft.ts similarity index 100% rename from src/types/onyx/DraftStatus.ts rename to src/types/onyx/CustomStatusDraft.ts From 23290ba80be8863c31d083735eb8eec6934b16a2 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 17 Aug 2023 12:57:23 +0200 Subject: [PATCH 122/122] Reinstall deps --- package-lock.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/package-lock.json b/package-lock.json index 50e6f015f15c..84fc85923630 100644 --- a/package-lock.json +++ b/package-lock.json @@ -146,6 +146,7 @@ "@types/jest-when": "^3.5.2", "@types/js-yaml": "^4.0.5", "@types/lodash": "^4.14.195", + "@types/metro-config": "^0.76.3", "@types/mock-fs": "^4.13.1", "@types/pusher-js": "^5.1.0", "@types/react": "^18.2.12", @@ -20108,6 +20109,16 @@ "integrity": "sha512-76CqzuD6Q7LC+AtbPqrvD9AqsN0k8bsYo2bM2J8pmNldP1aIPAbzUQ7QbobyXL4eLr1wK5x8FZFe8eF/ubRuBg==", "dev": true }, + "node_modules/@types/metro-config": { + "version": "0.76.3", + "resolved": "https://registry.npmjs.org/@types/metro-config/-/metro-config-0.76.3.tgz", + "integrity": "sha512-tq9IyKm1JzNRpM7V7LALxXiAyTlV5eZwoqntpnRIbnqDsIyNlnPkWQEoX77f40pzcUuAH4CiHRDxW5VskPlgtQ==", + "deprecated": "This is a stub types definition. metro-config provides its own type definitions, so you do not need this installed.", + "dev": true, + "dependencies": { + "metro-config": "*" + } + }, "node_modules/@types/mime": { "version": "3.0.1", "dev": true, @@ -63785,6 +63796,15 @@ "integrity": "sha512-76CqzuD6Q7LC+AtbPqrvD9AqsN0k8bsYo2bM2J8pmNldP1aIPAbzUQ7QbobyXL4eLr1wK5x8FZFe8eF/ubRuBg==", "dev": true }, + "@types/metro-config": { + "version": "0.76.3", + "resolved": "https://registry.npmjs.org/@types/metro-config/-/metro-config-0.76.3.tgz", + "integrity": "sha512-tq9IyKm1JzNRpM7V7LALxXiAyTlV5eZwoqntpnRIbnqDsIyNlnPkWQEoX77f40pzcUuAH4CiHRDxW5VskPlgtQ==", + "dev": true, + "requires": { + "metro-config": "*" + } + }, "@types/mime": { "version": "3.0.1", "dev": true