diff --git a/src/CONST.ts b/src/CONST.ts index ced657b06e19..cc18862db303 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -241,6 +241,7 @@ const CONST = { THREADS: 'threads', CUSTOM_STATUS: 'customStatus', NEW_DOT_CATEGORIES: 'newDotCategories', + NEW_DOT_TAGS: 'newDotTags', }, BUTTON_STATES: { DEFAULT: 'default', diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index ddc2aa4de620..2e0b75910bae 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -240,6 +240,8 @@ const ONYXKEYS = { POLICY_MEMBERS: 'policyMembers_', POLICY_CATEGORIES: 'policyCategories_', POLICY_RECENTLY_USED_CATEGORIES: 'policyRecentlyUsedCategories_', + POLICY_TAGS: 'policyTags_', + POLICY_RECENTLY_USED_TAGS: 'policyRecentlyUsedTags_', WORKSPACE_INVITE_MEMBERS_DRAFT: 'workspaceInviteMembersDraft_', REPORT: 'report_', REPORT_ACTIONS: 'reportActions_', @@ -376,6 +378,7 @@ type OnyxValues = { [ONYXKEYS.COLLECTION.DOWNLOAD]: OnyxTypes.Download; [ONYXKEYS.COLLECTION.POLICY]: OnyxTypes.Policy; [ONYXKEYS.COLLECTION.POLICY_CATEGORIES]: OnyxTypes.PolicyCategory; + [ONYXKEYS.COLLECTION.POLICY_TAGS]: OnyxTypes.PolicyTag; [ONYXKEYS.COLLECTION.POLICY_MEMBERS]: OnyxTypes.PolicyMember; [ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES]: OnyxTypes.RecentlyUsedCategories; [ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST]: OnyxTypes.PolicyMember; @@ -390,6 +393,7 @@ type OnyxValues = { [ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING]: boolean; [ONYXKEYS.COLLECTION.SECURITY_GROUP]: OnyxTypes.SecurityGroup; [ONYXKEYS.COLLECTION.TRANSACTION]: OnyxTypes.Transaction; + [ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS]: OnyxTypes.RecentlyUsedTags; [ONYXKEYS.COLLECTION.SELECTED_TAB]: string; // Forms diff --git a/src/ROUTES.ts b/src/ROUTES.ts index ed4fbb97a41a..6b86d88b31ec 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -98,6 +98,7 @@ export default { MONEY_REQUEST_CURRENCY: ':iouType/new/currency/:reportID?', MONEY_REQUEST_DESCRIPTION: ':iouType/new/description/:reportID?', MONEY_REQUEST_CATEGORY: ':iouType/new/category/:reportID?', + MONEY_REQUEST_TAG: ':iouType/new/tag/:reportID?', MONEY_REQUEST_MERCHANT: ':iouType/new/merchant/:reportID?', MONEY_REQUEST_MANUAL_TAB: ':iouType/new/:reportID?/manual', MONEY_REQUEST_SCAN_TAB: ':iouType/new/:reportID?/scan', @@ -117,6 +118,7 @@ export default { getMoneyRequestMerchantRoute: (iouType: string, reportID = '') => `${iouType}/new/merchant/${reportID}`, getMoneyRequestDistanceTabRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}/distance`, getMoneyRequestWaypointRoute: (iouType: string, waypointIndex: number) => `${iouType}/new/waypoint/${waypointIndex}`, + getMoneyRequestTagRoute: (iouType: string, reportID = '') => `${iouType}/new/tag/${reportID}`, SPLIT_BILL_DETAILS: `r/:reportID/split/:reportActionID`, getSplitBillDetailsRoute: (reportID: string, reportActionID: string) => `r/${reportID}/split/${reportActionID}`, getNewTaskRoute: (reportID: string) => `${NEW_TASK}/${reportID}`, diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 87dc0e6795b4..966f5f4340a7 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -8,6 +8,7 @@ import lodashGet from 'lodash/get'; import styles from '../styles/styles'; import * as ReportUtils from '../libs/ReportUtils'; import * as OptionsListUtils from '../libs/OptionsListUtils'; +import Permissions from '../libs/Permissions'; import OptionsSelector from './OptionsSelector'; import ONYXKEYS from '../ONYXKEYS'; import compose from '../libs/compose'; @@ -29,11 +30,11 @@ import Image from './Image'; import useLocalize from '../hooks/useLocalize'; import * as ReceiptUtils from '../libs/ReceiptUtils'; import categoryPropTypes from './categoryPropTypes'; +import tagPropTypes from './tagPropTypes'; import ConfirmedRoute from './ConfirmedRoute'; import transactionPropTypes from './transactionPropTypes'; import DistanceRequestUtils from '../libs/DistanceRequestUtils'; import * as IOU from '../libs/actions/IOU'; -import Permissions from '../libs/Permissions'; const propTypes = { /** Callback to inform parent modal of success */ @@ -69,6 +70,9 @@ const propTypes = { /** IOU Category */ iouCategory: PropTypes.string, + /** IOU Tag */ + iouTag: PropTypes.string, + /** Selected participants from MoneyRequestModal with login / accountID */ selectedParticipants: PropTypes.arrayOf(optionPropTypes).isRequired, @@ -109,10 +113,6 @@ const propTypes = { /** List styles for OptionsSelector */ listStyles: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]), - /* Onyx Props */ - /** Collection of categories attached to a policy */ - policyCategories: PropTypes.objectOf(categoryPropTypes), - /** ID of the transaction that represents the money request */ transactionID: PropTypes.string, @@ -133,6 +133,19 @@ const propTypes = { /** Whether the money request is a distance request */ isDistanceRequest: PropTypes.bool, + + /* Onyx Props */ + /** Collection of categories attached to a policy */ + policyCategories: PropTypes.objectOf(categoryPropTypes), + + /** Collection of tags attached to a policy */ + policyTags: PropTypes.objectOf( + PropTypes.shape({ + name: PropTypes.string, + required: PropTypes.bool, + tags: PropTypes.objectOf(tagPropTypes), + }), + ), }; const defaultProps = { @@ -141,6 +154,7 @@ const defaultProps = { onSelectParticipant: () => {}, iouType: CONST.IOU.MONEY_REQUEST_TYPE.REQUEST, iouCategory: '', + iouTag: '', payeePersonalDetails: null, canModifyParticipants: false, isReadOnly: false, @@ -156,6 +170,7 @@ const defaultProps = { receiptSource: '', listStyles: [], policyCategories: {}, + policyTags: {}, transactionID: '', transaction: {}, mileageRate: {unit: CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES, rate: 0, currency: 'USD'}, @@ -178,6 +193,12 @@ function MoneyRequestConfirmationList(props) { const shouldCalculateDistanceAmount = props.isDistanceRequest && props.iouAmount === 0; const shouldCategoryBeEditable = !_.isEmpty(props.policyCategories) && Permissions.canUseCategories(props.betas); + // Fetches the first tag list of the policy + const tagListKey = _.first(_.keys(props.policyTags)); + const tagList = lodashGet(props.policyTags, [tagListKey, 'tags'], []); + const tagListName = lodashGet(props.policyTags, [tagListKey, 'name'], ''); + const canUseTags = Permissions.canUseTags(props.betas); + const formattedAmount = CurrencyUtils.convertToDisplayString( shouldCalculateDistanceAmount ? DistanceRequestUtils.getDistanceRequestAmount(distance, unit, rate) : props.iouAmount, props.isDistanceRequest ? currency : props.iouCurrencyCode, @@ -499,6 +520,16 @@ function MoneyRequestConfirmationList(props) { disabled={didConfirm || props.isReadOnly} /> )} + {canUseTags && !!tagList && ( + Navigation.navigate(ROUTES.getMoneyRequestTagRoute(props.iouType, props.reportID))} + style={[styles.moneyRequestMenuItem, styles.mb2]} + disabled={didConfirm || props.isReadOnly} + /> + )} )} @@ -520,6 +551,9 @@ export default compose( policyCategories: { key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyID}`, }, + policyTags: { + key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`, + }, mileageRate: { key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, selector: DistanceRequestUtils.getDefaultMileageRate, diff --git a/src/components/TagPicker/index.js b/src/components/TagPicker/index.js new file mode 100644 index 000000000000..25021bd817d7 --- /dev/null +++ b/src/components/TagPicker/index.js @@ -0,0 +1,90 @@ +import React, {useMemo} from 'react'; +import _ from 'underscore'; +import lodashGet from 'lodash/get'; +import {withOnyx} from 'react-native-onyx'; +import ONYXKEYS from '../../ONYXKEYS'; +import styles from '../../styles/styles'; +import Navigation from '../../libs/Navigation/Navigation'; +import ROUTES from '../../ROUTES'; +import useLocalize from '../../hooks/useLocalize'; +import * as OptionsListUtils from '../../libs/OptionsListUtils'; +import OptionsSelector from '../OptionsSelector'; +import {propTypes, defaultProps} from './tagPickerPropTypes'; + +function TagPicker({policyTags, reportID, tag, iouType, iou}) { + const {translate} = useLocalize(); + + const selectedOptions = useMemo(() => { + if (!iou.tag) { + return []; + } + + return [ + { + name: iou.tag, + enabled: true, + }, + ]; + }, [iou.tag]); + + // Only shows one section, which will be the default behavior if there are + // less than 8 policy tags + // TODO: support sections with search + const sections = useMemo(() => { + const tagList = _.chain(lodashGet(policyTags, [tag, 'tags'], {})) + .values() + .map((t) => ({ + text: t.name, + keyForList: t.name, + tooltipText: t.name, + })) + .value(); + + return [ + { + data: tagList, + }, + ]; + }, [policyTags, tag]); + + const headerMessage = OptionsListUtils.getHeaderMessage(lodashGet(sections, '[0].data.length', 0) > 0, false, ''); + + const navigateBack = () => { + Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + }; + + const updateTag = () => { + // TODO: add logic to save the selected tag + navigateBack(); + }; + + return ( + + ); +} + +TagPicker.displayName = 'TagPicker'; +TagPicker.propTypes = propTypes; +TagPicker.defaultProps = defaultProps; + +export default withOnyx({ + policyTags: { + key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`, + }, + policyRecentlyUsedTags: { + key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${policyID}`, + }, + iou: { + key: ONYXKEYS.IOU, + }, +})(TagPicker); diff --git a/src/components/TagPicker/tagPickerPropTypes.js b/src/components/TagPicker/tagPickerPropTypes.js new file mode 100644 index 000000000000..ad57a0409f15 --- /dev/null +++ b/src/components/TagPicker/tagPickerPropTypes.js @@ -0,0 +1,43 @@ +import PropTypes from 'prop-types'; +import tagPropTypes from '../tagPropTypes'; +import {iouPropTypes, iouDefaultProps} from '../../pages/iou/propTypes'; + +const propTypes = { + /** The report ID of the IOU */ + reportID: PropTypes.string.isRequired, + + /** The policyID we are getting tags for */ + policyID: PropTypes.string.isRequired, + + /** The name of tag list we are getting tags for */ + tag: PropTypes.string.isRequired, + + /** The type of IOU report, i.e. bill, request, send */ + iouType: PropTypes.string.isRequired, + + /** Callback to submit the selected tag */ + onSubmit: PropTypes.func, + + /* Onyx Props */ + /** Collection of tags attached to a policy */ + policyTags: PropTypes.objectOf( + PropTypes.shape({ + name: PropTypes.string, + tags: PropTypes.objectOf(tagPropTypes), + }), + ), + + /** List of recently used tags */ + policyRecentlyUsedTags: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)), + + /** Holds data related to Money Request view state, rather than the underlying Money Request data. */ + iou: iouPropTypes, +}; + +const defaultProps = { + policyTags: {}, + policyRecentlyUsedTags: {}, + iou: iouDefaultProps, +}; + +export {propTypes, defaultProps}; diff --git a/src/components/tagPropTypes.js b/src/components/tagPropTypes.js new file mode 100644 index 000000000000..29d913dcd035 --- /dev/null +++ b/src/components/tagPropTypes.js @@ -0,0 +1,12 @@ +import PropTypes from 'prop-types'; + +export default PropTypes.shape({ + /** Name of a tag */ + name: PropTypes.string.isRequired, + + /** Flag that determines if a tag is active and able to be selected */ + enabled: PropTypes.bool.isRequired, + + /** "General Ledger code" that corresponds to this tag in an accounting system. Similar to an ID. */ + 'GL Code': PropTypes.string, +}); diff --git a/src/languages/en.ts b/src/languages/en.ts index 8d2782f4b8ae..03adaa1e66b1 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -71,6 +71,7 @@ import type { SetTheRequestParams, UpdatedTheRequestParams, RemovedTheRequestParams, + TagSelectionParams, TranslationBase, } from './types'; import * as ReportActionsUtils from '../libs/ReportActionsUtils'; @@ -243,6 +244,7 @@ export default { showMore: 'Show more', merchant: 'Merchant', category: 'Category', + tag: 'Tag', receipt: 'Receipt', replace: 'Replace', distance: 'Distance', @@ -544,6 +546,7 @@ export default { `changed the ${valueName} to ${newValueToDisplay} (previously ${oldValueToDisplay})`, threadRequestReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `${formattedAmount} request${comment ? ` for ${comment}` : ''}`, threadSentMoneyReportName: ({formattedAmount, comment}: ThreadSentMoneyReportNameParams) => `${formattedAmount} sent${comment ? ` for ${comment}` : ''}`, + tagSelection: ({tagName}: TagSelectionParams) => `Select a ${tagName} to add additional organization to your money`, error: { invalidSplit: 'Split amounts do not equal total amount', other: 'Unexpected error, please try again later', diff --git a/src/languages/es.ts b/src/languages/es.ts index f562ed5fd536..7315c42cebab 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -71,6 +71,7 @@ import type { SetTheRequestParams, UpdatedTheRequestParams, RemovedTheRequestParams, + TagSelectionParams, EnglishTranslation, } from './types'; @@ -233,6 +234,7 @@ export default { showMore: 'Mostrar más', merchant: 'Comerciante', category: 'Categoría', + tag: 'Etiqueta', receipt: 'Recibo', replace: 'Sustituir', distance: 'Distancia', @@ -537,6 +539,7 @@ export default { `cambío ${valueName === 'comerciante' ? 'el' : 'la'} ${valueName} a ${newValueToDisplay} (previamente ${oldValueToDisplay})`, threadRequestReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `Solicitud de ${formattedAmount}${comment ? ` para ${comment}` : ''}`, threadSentMoneyReportName: ({formattedAmount, comment}: ThreadSentMoneyReportNameParams) => `${formattedAmount} enviado${comment ? ` para ${comment}` : ''}`, + tagSelection: ({tagName}: TagSelectionParams) => `Seleccione una ${tagName} para organizar mejor tu dinero`, error: { invalidSplit: 'La suma de las partes no equivale al monto total', other: 'Error inesperado, por favor inténtalo más tarde', diff --git a/src/languages/types.ts b/src/languages/types.ts index 5d1963b404f4..565b5933b989 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -192,6 +192,8 @@ type RemovedTheRequestParams = {valueName: string; oldValueToDisplay: string}; type UpdatedTheRequestParams = {valueName: string; newValueToDisplay: string; oldValueToDisplay: string}; +type TagSelectionParams = {tagName: string}; + /* Translation Object types */ // eslint-disable-next-line @typescript-eslint/no-explicit-any type TranslationBaseValue = string | string[] | ((...args: any[]) => string); @@ -304,4 +306,5 @@ export type { SetTheRequestParams, UpdatedTheRequestParams, RemovedTheRequestParams, + TagSelectionParams, }; diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js index 2adaf0397a2c..851f7aff3a8d 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js @@ -90,6 +90,13 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator([ }, name: 'Money_Request_Category', }, + { + getComponent: () => { + const MoneyRequestTagPage = require('../../../pages/iou/MoneyRequestTagPage').default; + return MoneyRequestTagPage; + }, + name: 'Money_Request_Tag', + }, { getComponent: () => { const MoneyRequestMerchantPage = require('../../../pages/iou/MoneyRequestMerchantPage').default; diff --git a/src/libs/Navigation/linkingConfig.js b/src/libs/Navigation/linkingConfig.js index ee3054e02f96..00bd74163418 100644 --- a/src/libs/Navigation/linkingConfig.js +++ b/src/libs/Navigation/linkingConfig.js @@ -318,6 +318,7 @@ export default { Money_Request_Currency: ROUTES.MONEY_REQUEST_CURRENCY, Money_Request_Description: ROUTES.MONEY_REQUEST_DESCRIPTION, Money_Request_Category: ROUTES.MONEY_REQUEST_CATEGORY, + Money_Request_Tag: ROUTES.MONEY_REQUEST_TAG, Money_Request_Merchant: ROUTES.MONEY_REQUEST_MERCHANT, Money_Request_Waypoint: ROUTES.MONEY_REQUEST_WAYPOINT, IOU_Send_Enable_Payments: ROUTES.IOU_SEND_ENABLE_PAYMENTS, diff --git a/src/libs/Permissions.js b/src/libs/Permissions.js index a916d52f5e0a..0294236b1cd7 100644 --- a/src/libs/Permissions.js +++ b/src/libs/Permissions.js @@ -94,6 +94,14 @@ function canUseCategories(betas) { return _.contains(betas, CONST.BETAS.NEW_DOT_CATEGORIES) || canUseAllBetas(betas); } +/** + * @param {Array} betas + * @returns {Boolean} + */ +function canUseTags(betas) { + return _.contains(betas, CONST.BETAS.NEW_DOT_TAGS) || canUseAllBetas(betas); +} + /** * Link previews are temporarily disabled. * @returns {Boolean} @@ -113,5 +121,6 @@ export default { canUseTasks, canUseCustomStatus, canUseCategories, + canUseTags, canUseLinkPreviews, }; diff --git a/src/pages/iou/MoneyRequestTagPage.js b/src/pages/iou/MoneyRequestTagPage.js new file mode 100644 index 000000000000..a1795d50df8a --- /dev/null +++ b/src/pages/iou/MoneyRequestTagPage.js @@ -0,0 +1,105 @@ +import React from 'react'; +import _ from 'underscore'; +import PropTypes from 'prop-types'; +import lodashGet from 'lodash/get'; +import {withOnyx} from 'react-native-onyx'; +import compose from '../../libs/compose'; +import ROUTES from '../../ROUTES'; +import Navigation from '../../libs/Navigation/Navigation'; +import useLocalize from '../../hooks/useLocalize'; +import ScreenWrapper from '../../components/ScreenWrapper'; +import HeaderWithBackButton from '../../components/HeaderWithBackButton'; +import TagPicker from '../../components/TagPicker'; +import Text from '../../components/Text'; +import tagPropTypes from '../../components/tagPropTypes'; +import ONYXKEYS from '../../ONYXKEYS'; +import reportPropTypes from '../reportPropTypes'; +import styles from '../../styles/styles'; + +const propTypes = { + /** Navigation route context info provided by react navigation */ + route: PropTypes.shape({ + /** Route specific parameters used on this screen via route :iouType/new/tag/:reportID? */ + params: PropTypes.shape({ + /** The type of IOU report, i.e. bill, request, send */ + iouType: PropTypes.string, + + /** The report ID of the IOU */ + reportID: PropTypes.string, + }), + }).isRequired, + + /* Onyx props */ + /** The report currently being used */ + report: reportPropTypes, + + /** Collection of tags attached to a policy */ + policyTags: PropTypes.objectOf( + PropTypes.shape({ + name: PropTypes.string, + tags: PropTypes.objectOf(tagPropTypes), + }), + ), +}; + +const defaultProps = { + report: {}, + policyTags: {}, +}; + +function MoneyRequestTagPage({route, report, policyTags}) { + const {translate} = useLocalize(); + + const iouType = lodashGet(route, 'params.iouType', ''); + + // Fetches the first tag list of the policy + const tagListKey = _.first(_.keys(policyTags)); + const tagList = lodashGet(policyTags, tagListKey, {}); + const tagListName = lodashGet(tagList, 'name', ''); + + const navigateBack = () => { + Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, lodashGet(report, 'reportID', ''))); + }; + + return ( + + + {translate('iou.tagSelection', {tagListName} || translate('common.tag'))} + + + ); +} + +MoneyRequestTagPage.displayName = 'MoneyRequestTagPage'; +MoneyRequestTagPage.propTypes = propTypes; +MoneyRequestTagPage.defaultProps = defaultProps; + +export default compose( + withOnyx({ + iou: { + key: ONYXKEYS.IOU, + }, + }), + withOnyx({ + report: { + // Fetch report ID from IOU participants if no report ID is set in route + key: ({route, iou}) => `${ONYXKEYS.COLLECTION.REPORT}${lodashGet(route, 'params.reportID', '') || lodashGet(iou, 'participants.0.reportID', '')}`, + }, + }), + withOnyx({ + policyTags: { + key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${report ? report.policyID : '0'}`, + }, + }), +)(MoneyRequestTagPage); diff --git a/src/pages/iou/propTypes/index.js b/src/pages/iou/propTypes/index.js index c7559323ebc1..5ecd00d11876 100644 --- a/src/pages/iou/propTypes/index.js +++ b/src/pages/iou/propTypes/index.js @@ -18,6 +18,9 @@ const iouPropTypes = PropTypes.shape({ /** The merchant name */ merchant: PropTypes.string, + /** The tag */ + tag: PropTypes.string, + /** Date that the request was created */ created: PropTypes.string, @@ -34,6 +37,7 @@ const iouDefaultProps = { currency: CONST.CURRENCY.USD, comment: '', merchant: '', + tag: '', created: '', participants: [], receiptPath: '', diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 91847061a18b..1c653271ea7d 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -284,6 +284,7 @@ function MoneyRequestConfirmPage(props) { iouComment={props.iou.comment} iouCurrencyCode={props.iou.currency} iouCategory={props.iou.category} + iouTag={props.iou.tag} onConfirm={createTransaction} onSendMoney={sendMoney} onSelectParticipant={(option) => { diff --git a/src/types/onyx/IOU.ts b/src/types/onyx/IOU.ts index 66f85c98d70c..7151bb84d1f1 100644 --- a/src/types/onyx/IOU.ts +++ b/src/types/onyx/IOU.ts @@ -19,6 +19,7 @@ type IOU = { receiptSource?: string; transactionID?: string; participants?: Participant[]; + tag?: string; }; export default IOU; diff --git a/src/types/onyx/PolicyTag.ts b/src/types/onyx/PolicyTag.ts new file mode 100644 index 000000000000..fe6bee3a1f31 --- /dev/null +++ b/src/types/onyx/PolicyTag.ts @@ -0,0 +1,13 @@ +type PolicyTag = { + /** Name of a Tag */ + name: string; + + /** Flag that determines if a tag is active and able to be selected */ + enabled: boolean; + + /** "General Ledger code" that corresponds to this tag in an accounting system. Similar to an ID. */ + // eslint-disable-next-line @typescript-eslint/naming-convention + 'GL Code': string; +}; + +export default PolicyTag; diff --git a/src/types/onyx/RecentlyUsedTags.ts b/src/types/onyx/RecentlyUsedTags.ts new file mode 100644 index 000000000000..1d6112514609 --- /dev/null +++ b/src/types/onyx/RecentlyUsedTags.ts @@ -0,0 +1,3 @@ +type RecentlyUsedTags = Record; + +export default RecentlyUsedTags; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 9612c06d75a6..a980e086aff5 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -46,6 +46,8 @@ import Transaction from './Transaction'; import Form, {AddDebitCardForm} from './Form'; import RecentWaypoints from './RecentWaypoints'; import RecentlyUsedCategories from './RecentlyUsedCategories'; +import RecentlyUsedTags from './RecentlyUsedTags'; +import PolicyTag from './PolicyTag'; export type { Account, @@ -97,4 +99,6 @@ export type { OnyxUpdatesFromServer, RecentWaypoints, RecentlyUsedCategories, + RecentlyUsedTags, + PolicyTag, };