From bfaeff6efbdea6672ebf444a19f32f69af763e9d Mon Sep 17 00:00:00 2001 From: Jakub Kosmydel <104823336+kosmydel@users.noreply.github.com> Date: Tue, 29 Aug 2023 14:43:30 +0200 Subject: [PATCH 01/98] fix country flags --- assets/emojis/es.js | 1010 +++++++++++++++++++++---------------------- 1 file changed, 505 insertions(+), 505 deletions(-) diff --git a/assets/emojis/es.js b/assets/emojis/es.js index c38aec7aa754..515f5d8f82ed 100644 --- a/assets/emojis/es.js +++ b/assets/emojis/es.js @@ -6208,1032 +6208,1032 @@ const esEmojis = { keywords: ['Bandera'], }, '🇦🇩': { - name: 'bandera-ad', - keywords: ['Bandera'], + name: 'andorra', + keywords: ['bandera', 'bandera-ad'], }, '🇦🇪': { - name: 'bandera-ae', - keywords: ['Bandera'], + name: 'emiratos_árabes_unidos', + keywords: ['bandera', 'bandera-ae'], }, '🇦🇫': { - name: 'bandera-af', - keywords: ['Bandera'], + name: 'afganistán', + keywords: ['bandera', 'bandera-af'], }, '🇦🇬': { - name: 'bandera-ag', - keywords: ['Bandera'], + name: 'antigua_y_barbuda', + keywords: ['bandera', 'bandera-ag'], }, '🇦🇮': { - name: 'bandera-ai', - keywords: ['Bandera'], + name: 'anguila', + keywords: ['bandera', 'bandera-ai'], }, '🇦🇱': { - name: 'bandera-al', - keywords: ['Bandera'], + name: 'albania', + keywords: ['bandera', 'bandera-al'], }, '🇦🇲': { - name: 'bandera-am', - keywords: ['Bandera'], + name: 'armenia', + keywords: ['bandera', 'bandera-am'], }, '🇦🇴': { - name: 'bandera-ao', - keywords: ['Bandera'], + name: 'angola', + keywords: ['bandera', 'bandera-ao'], }, '🇦🇶': { - name: 'bandera-aq', - keywords: ['Bandera'], + name: 'antártida', + keywords: ['bandera', 'bandera-aq'], }, '🇦🇷': { - name: 'bandera-ar', - keywords: ['Bandera'], + name: 'argentina', + keywords: ['bandera', 'bandera-ar'], }, '🇦🇸': { - name: 'bandera-as', - keywords: ['Bandera'], + name: 'samoa_americana', + keywords: ['bandera', 'bandera-as'], }, '🇦🇹': { - name: 'bandera-at', - keywords: ['Bandera'], + name: 'austria', + keywords: ['bandera', 'bandera-at'], }, '🇦🇺': { - name: 'bandera-au', - keywords: ['Bandera'], + name: 'australia', + keywords: ['bandera', 'bandera-au'], }, '🇦🇼': { - name: 'bandera-aw', - keywords: ['Bandera'], + name: 'aruba', + keywords: ['bandera', 'bandera-aw'], }, '🇦🇽': { - name: 'bandera-ax', - keywords: ['Bandera'], + name: 'islas_de_åland', + keywords: ['bandera', 'bandera-ax'], }, '🇦🇿': { - name: 'bandera-az', - keywords: ['Bandera'], + name: 'azerbaiyán', + keywords: ['bandera', 'bandera-az'], }, '🇧🇦': { - name: 'bandera-ba', - keywords: ['Bandera'], + name: 'bosnia_y_herzegovina', + keywords: ['bandera', 'bandera-ba'], }, '🇧🇧': { - name: 'bandera-bb', - keywords: ['Bandera'], + name: 'barbados', + keywords: ['bandera', 'bandera-bb'], }, '🇧🇩': { - name: 'bandera-bd', - keywords: ['Bandera'], + name: 'bangladesh', + keywords: ['bandera', 'bandera-bd'], }, '🇧🇪': { - name: 'bandera-be', - keywords: ['Bandera'], + name: 'bélgica', + keywords: ['bandera', 'bandera-be'], }, '🇧🇫': { - name: 'bandera-bf', - keywords: ['Bandera'], + name: 'burkina_faso', + keywords: ['bandera', 'bandera-bf'], }, '🇧🇬': { - name: 'bandera-bg', - keywords: ['Bandera'], + name: 'bulgaria', + keywords: ['bandera', 'bandera-bg'], }, '🇧🇭': { - name: 'bandera-bh', - keywords: ['Bandera'], + name: 'bahrein', + keywords: ['bandera', 'bandera-bh'], }, '🇧🇮': { - name: 'bandera-bi', - keywords: ['Bandera'], + name: 'burundi', + keywords: ['bandera', 'bandera-bi'], }, '🇧🇯': { - name: 'bandera-bj', - keywords: ['Bandera'], + name: 'benin', + keywords: ['bandera', 'bandera-bj'], }, '🇧🇱': { - name: 'bandera-bl', - keywords: ['Bandera'], + name: 'san_bartolomé', + keywords: ['bandera', 'bandera-bl'], }, '🇧🇲': { - name: 'bandera-bm', - keywords: ['Bandera'], + name: 'islas_bermudas', + keywords: ['bandera', 'bandera-bm'], }, '🇧🇳': { - name: 'bandera-bn', - keywords: ['Bandera'], + name: 'brunéi', + keywords: ['bandera', 'bandera-bn'], }, '🇧🇴': { - name: 'bandera-bo', - keywords: ['Bandera'], + name: 'bolivia', + keywords: ['bandera', 'bandera-bo'], }, '🇧🇶': { - name: 'bandera-bq', - keywords: ['Bandera'], + name: 'bonaire,_san_eustaquio_y_saba', + keywords: ['bandera', 'bandera-bq'], }, '🇧🇷': { - name: 'bandera-br', - keywords: ['Bandera'], + name: 'brazil', + keywords: ['bandera', 'bandera-br'], }, '🇧🇸': { - name: 'bandera-bs', - keywords: ['Bandera'], + name: 'bahamas', + keywords: ['bandera', 'bandera-bs'], }, '🇧🇹': { - name: 'bandera-bt', - keywords: ['Bandera'], + name: 'bhután', + keywords: ['bandera', 'bandera-bt'], }, '🇧🇻': { name: 'bandera-bv', - keywords: ['Bandera'], + keywords: ['Bandera', 'bandera-bv'], }, '🇧🇼': { - name: 'bandera-bw', - keywords: ['Bandera'], + name: 'botsuana', + keywords: ['bandera', 'bandera-bw'], }, '🇧🇾': { - name: 'bandera-by', - keywords: ['Bandera'], + name: 'bielorrusia', + keywords: ['bandera', 'bandera-by'], }, '🇧🇿': { - name: 'bandera-bz', - keywords: ['Bandera'], + name: 'belice', + keywords: ['bandera', 'bandera-bz'], }, '🇨🇦': { - name: 'bandera-ca', - keywords: ['Bandera'], + name: 'canadá', + keywords: ['bandera', 'bandera-ca'], }, '🇨🇨': { - name: 'bandera-cc', - keywords: ['Bandera'], + name: 'islas_cocos_(keeling)', + keywords: ['bandera', 'bandera-cc'], }, '🇨🇩': { - name: 'bandera-cd', - keywords: ['Bandera'], + name: 'república_democrática_del_congo', + keywords: ['bandera', 'bandera-cd'], }, '🇨🇫': { - name: 'bandera-cf', - keywords: ['Bandera'], + name: 'república_centroafricana', + keywords: ['bandera', 'bandera-cf'], }, '🇨🇬': { - name: 'bandera-cg', - keywords: ['Bandera'], + name: 'república_del_congo', + keywords: ['bandera', 'bandera-cg'], }, '🇨🇭': { - name: 'bandera-ch', - keywords: ['Bandera'], + name: 'suiza', + keywords: ['bandera', 'bandera-ch'], }, '🇨🇮': { - name: 'bandera-ci', - keywords: ['Bandera'], + name: 'costa_de_marfil', + keywords: ['bandera', 'bandera-ci'], }, '🇨🇰': { - name: 'bandera-ck', - keywords: ['Bandera'], + name: 'islas_cook', + keywords: ['bandera', 'bandera-ck'], }, '🇨🇱': { - name: 'bandera-cl', - keywords: ['Bandera'], + name: 'chile', + keywords: ['bandera', 'bandera-cl'], }, '🇨🇲': { - name: 'bandera-cm', - keywords: ['Bandera'], + name: 'camerún', + keywords: ['bandera', 'bandera-cm'], }, '🇨🇳': { - name: 'cn', - keywords: ['Bandera'], + name: 'china', + keywords: ['bandera', 'bandera-cn'], }, '🇨🇴': { - name: 'bandera-co', - keywords: ['Bandera'], + name: 'colombia', + keywords: ['bandera', 'bandera-co'], }, '🇨🇵': { name: 'bandera-cp', - keywords: ['Bandera'], + keywords: ['Bandera', 'bandera-cp'], }, '🇨🇷': { - name: 'bandera-cr', - keywords: ['Bandera'], + name: 'costa_rica', + keywords: ['bandera', 'bandera-cr'], }, '🇨🇺': { - name: 'bandera-cu', - keywords: ['Bandera'], + name: 'cuba', + keywords: ['bandera', 'bandera-cu'], }, '🇨🇻': { - name: 'bandera-cv', - keywords: ['Bandera'], + name: 'cabo_verde', + keywords: ['bandera', 'bandera-cv'], }, '🇨🇼': { - name: 'bandera-cw', - keywords: ['Bandera'], + name: 'curazao', + keywords: ['bandera', 'bandera-cw'], }, '🇨🇽': { - name: 'bandera-cx', - keywords: ['Bandera'], + name: 'isla_de_navidad', + keywords: ['bandera', 'bandera-cx'], }, '🇨🇾': { - name: 'bandera-cy', - keywords: ['Bandera'], + name: 'chipre', + keywords: ['bandera', 'bandera-cy'], }, '🇨🇿': { - name: 'bandera-cz', - keywords: ['Bandera'], + name: 'república_checa', + keywords: ['bandera', 'bandera-cz'], }, '🇩🇪': { - name: 'de', - keywords: ['Bandera'], + name: 'alemania', + keywords: ['bandera', 'bandera-de'], }, '🇩🇬': { name: 'bandera-dg', - keywords: ['Bandera'], + keywords: ['Bandera', 'bandera-dg'], }, '🇩🇯': { - name: 'bandera-dj', - keywords: ['Bandera'], + name: 'yibuti', + keywords: ['bandera', 'bandera-dj'], }, '🇩🇰': { - name: 'bandera-dk', - keywords: ['Bandera'], + name: 'dinamarca', + keywords: ['bandera', 'bandera-dk'], }, '🇩🇲': { - name: 'bandera-dm', - keywords: ['Bandera'], + name: 'dominica', + keywords: ['bandera', 'bandera-dm'], }, '🇩🇴': { - name: 'bandera-do', - keywords: ['Bandera'], + name: 'república_dominicana', + keywords: ['bandera', 'bandera-do'], }, '🇩🇿': { - name: 'bandera-dz', - keywords: ['Bandera'], + name: 'argelia', + keywords: ['bandera', 'bandera-dz'], }, '🇪🇦': { name: 'bandera-ea', - keywords: ['Bandera'], + keywords: ['Bandera', 'bandera-ea'], }, '🇪🇨': { - name: 'bandera-ec', - keywords: ['Bandera'], + name: 'ecuador', + keywords: ['bandera', 'bandera-ec'], }, '🇪🇪': { - name: 'bandera-ee', - keywords: ['Bandera'], + name: 'estonia', + keywords: ['bandera', 'bandera-ee'], }, '🇪🇬': { - name: 'bandera-eg', - keywords: ['Bandera'], + name: 'egipto', + keywords: ['bandera', 'bandera-eg'], }, '🇪🇭': { - name: 'bandera-eh', - keywords: ['Bandera'], + name: 'sahara_occidental', + keywords: ['bandera', 'bandera-eh'], }, '🇪🇷': { - name: 'bandera-er', - keywords: ['Bandera'], + name: 'eritrea', + keywords: ['bandera', 'bandera-er'], }, '🇪🇸': { - name: 'es', - keywords: ['Bandera'], + name: 'españa', + keywords: ['bandera', 'bandera-es'], }, '🇪🇹': { - name: 'bandera-et', - keywords: ['Bandera'], + name: 'etiopía', + keywords: ['bandera', 'bandera-et'], }, '🇪🇺': { name: 'bandera-eu', - keywords: ['Bandera'], + keywords: ['Bandera', 'bandera-eu'], }, '🇫🇮': { - name: 'bandera-fi', - keywords: ['Bandera'], + name: 'finlandia', + keywords: ['bandera', 'bandera-fi'], }, '🇫🇯': { - name: 'bandera-fj', - keywords: ['Bandera'], + name: 'fiyi', + keywords: ['bandera', 'bandera-fj'], }, '🇫🇰': { - name: 'bandera-fk', - keywords: ['Bandera'], + name: 'islas_malvinas', + keywords: ['bandera', 'bandera-fk'], }, '🇫🇲': { - name: 'bandera-fm', - keywords: ['Bandera'], + name: 'micronesia', + keywords: ['bandera', 'bandera-fm'], }, '🇫🇴': { - name: 'bandera-fo', - keywords: ['Bandera'], + name: 'islas_feroe', + keywords: ['bandera', 'bandera-fo'], }, '🇫🇷': { - name: 'fr', - keywords: ['Bandera'], + name: 'francia', + keywords: ['bandera', 'bandera-fr'], }, '🇬🇦': { - name: 'bandera-ga', - keywords: ['Bandera'], + name: 'gabón', + keywords: ['bandera', 'bandera-ga'], }, '🇬🇧': { - name: 'gb', - keywords: ['Bandera'], + name: 'reino_unido', + keywords: ['bandera', 'bandera-gb'], }, '🇬🇩': { - name: 'bandera-gd', - keywords: ['Bandera'], + name: 'granada', + keywords: ['bandera', 'bandera-gd'], }, '🇬🇪': { - name: 'bandera-ge', - keywords: ['Bandera'], + name: 'georgia', + keywords: ['bandera', 'bandera-ge'], }, '🇬🇫': { - name: 'bandera-gf', - keywords: ['Bandera'], + name: 'guayana_francesa', + keywords: ['bandera', 'bandera-gf'], }, '🇬🇬': { - name: 'bandera-gg', - keywords: ['Bandera'], + name: 'guernsey', + keywords: ['bandera', 'bandera-gg'], }, '🇬🇭': { - name: 'bandera-gh', - keywords: ['Bandera'], + name: 'ghana', + keywords: ['bandera', 'bandera-gh'], }, '🇬🇮': { - name: 'bandera-gi', - keywords: ['Bandera'], + name: 'gibraltar', + keywords: ['bandera', 'bandera-gi'], }, '🇬🇱': { - name: 'bandera-gl', - keywords: ['Bandera'], + name: 'groenlandia', + keywords: ['bandera', 'bandera-gl'], }, '🇬🇲': { - name: 'bandera-gm', - keywords: ['Bandera'], + name: 'gambia', + keywords: ['bandera', 'bandera-gm'], }, '🇬🇳': { - name: 'bandera-gn', - keywords: ['Bandera'], + name: 'guinea', + keywords: ['bandera', 'bandera-gn'], }, '🇬🇵': { - name: 'bandera-gp', - keywords: ['Bandera'], + name: 'guadeloupe', + keywords: ['bandera', 'bandera-gp'], }, '🇬🇶': { - name: 'bandera-gq', - keywords: ['Bandera'], + name: 'guinea_ecuatorial', + keywords: ['bandera', 'bandera-gq'], }, '🇬🇷': { - name: 'bandera-gr', - keywords: ['Bandera'], + name: 'greece', + keywords: ['bandera', 'bandera-gr'], }, '🇬🇸': { - name: 'bandera-gs', - keywords: ['Bandera'], + name: 'islas_georgias_del_sur_y_sandwich_del_sur', + keywords: ['bandera', 'bandera-gs'], }, '🇬🇹': { - name: 'bandera-gt', - keywords: ['Bandera'], + name: 'guatemala', + keywords: ['bandera', 'bandera-gt'], }, '🇬🇺': { - name: 'bandera-gu', - keywords: ['Bandera'], + name: 'guam', + keywords: ['bandera', 'bandera-gu'], }, '🇬🇼': { - name: 'bandera-gw', - keywords: ['Bandera'], + name: 'guinea-bissau', + keywords: ['bandera', 'bandera-gw'], }, '🇬🇾': { - name: 'bandera-gy', - keywords: ['Bandera'], + name: 'guyana', + keywords: ['bandera', 'bandera-gy'], }, '🇭🇰': { - name: 'bandera-hk', - keywords: ['Bandera'], + name: 'hong_kong', + keywords: ['bandera', 'bandera-hk'], }, '🇭🇲': { name: 'bandera-hm', - keywords: ['Bandera'], + keywords: ['Bandera', 'bandera-hm'], }, '🇭🇳': { - name: 'bandera-hn', - keywords: ['Bandera'], + name: 'honduras', + keywords: ['bandera', 'bandera-hn'], }, '🇭🇷': { - name: 'bandera-hr', - keywords: ['Bandera'], + name: 'croacia', + keywords: ['bandera', 'bandera-hr'], }, '🇭🇹': { - name: 'bandera-ht', - keywords: ['Bandera'], + name: 'haiti', + keywords: ['bandera', 'bandera-ht'], }, '🇭🇺': { - name: 'bandera-hu', - keywords: ['Bandera'], + name: 'hungría', + keywords: ['bandera', 'bandera-hu'], }, '🇮🇨': { name: 'bandera-ic', - keywords: ['Bandera'], + keywords: ['Bandera', 'bandera-ic'], }, '🇮🇩': { - name: 'bandera-id', - keywords: ['Bandera'], + name: 'indonesia', + keywords: ['bandera', 'bandera-id'], }, '🇮🇪': { - name: 'bandera-ie', - keywords: ['Bandera'], + name: 'irlanda', + keywords: ['bandera', 'bandera-ie'], }, '🇮🇱': { - name: 'bandera-il', - keywords: ['Bandera'], + name: 'israel', + keywords: ['bandera', 'bandera-il'], }, '🇮🇲': { - name: 'bandera-im', - keywords: ['Bandera'], + name: 'isla_de_man', + keywords: ['bandera', 'bandera-im'], }, '🇮🇳': { - name: 'bandera-in', - keywords: ['Bandera'], + name: 'india', + keywords: ['bandera', 'bandera-in'], }, '🇮🇴': { - name: 'bandera-io', - keywords: ['Bandera'], + name: 'territorio_británico_del_océano_índico', + keywords: ['bandera', 'bandera-io'], }, '🇮🇶': { - name: 'bandera-iq', - keywords: ['Bandera'], + name: 'irak', + keywords: ['bandera', 'bandera-iq'], }, '🇮🇷': { - name: 'bandera-ir', - keywords: ['Bandera'], + name: 'irán', + keywords: ['bandera', 'bandera-ir'], }, '🇮🇸': { - name: 'bandera-is', - keywords: ['Bandera'], + name: 'islandia', + keywords: ['bandera', 'bandera-is'], }, '🇮🇹': { - name: 'it', - keywords: ['Bandera'], + name: 'italia', + keywords: ['bandera', 'bandera-it'], }, '🇯🇪': { - name: 'bandera-je', - keywords: ['Bandera'], + name: 'jersey', + keywords: ['bandera', 'bandera-je'], }, '🇯🇲': { - name: 'bandera-jm', - keywords: ['Bandera'], + name: 'jamaica', + keywords: ['bandera', 'bandera-jm'], }, '🇯🇴': { - name: 'bandera-jo', - keywords: ['Bandera'], + name: 'jordania', + keywords: ['bandera', 'bandera-jo'], }, '🇯🇵': { - name: 'jp', - keywords: ['Bandera'], + name: 'japón', + keywords: ['bandera', 'bandera-jp'], }, '🇰🇪': { - name: 'bandera-ke', - keywords: ['Bandera'], + name: 'kenia', + keywords: ['bandera', 'bandera-ke'], }, '🇰🇬': { - name: 'bandera-kg', - keywords: ['Bandera'], + name: 'kirguistán', + keywords: ['bandera', 'bandera-kg'], }, '🇰🇭': { - name: 'bandera-kh', - keywords: ['Bandera'], + name: 'camboya', + keywords: ['bandera', 'bandera-kh'], }, '🇰🇮': { name: 'bandera-kl', - keywords: ['Bandera'], + keywords: ['Bandera', 'bandera-kl'], }, '🇰🇲': { - name: 'bandera-km', - keywords: ['Bandera'], + name: 'comoras', + keywords: ['bandera', 'bandera-km'], }, '🇰🇳': { - name: 'bandera-kn', - keywords: ['Bandera'], + name: 'san_cristóbal_y_nieves', + keywords: ['bandera', 'bandera-kn'], }, '🇰🇵': { - name: 'bandera-kp', - keywords: ['Bandera'], + name: 'corea_del_norte', + keywords: ['bandera', 'bandera-kp'], }, '🇰🇷': { - name: 'kr', - keywords: ['Bandera'], + name: 'corea_del_sur', + keywords: ['bandera', 'bandera-kr'], }, '🇰🇼': { - name: 'bandera-kw', - keywords: ['Bandera'], + name: 'kuwait', + keywords: ['bandera', 'bandera-kw'], }, '🇰🇾': { - name: 'bandera-ky', - keywords: ['Bandera'], + name: 'islas_caimán', + keywords: ['bandera', 'bandera-ky'], }, '🇰🇿': { - name: 'bandera-kz', - keywords: ['Bandera'], + name: 'kazajistán', + keywords: ['bandera', 'bandera-kz'], }, '🇱🇦': { - name: 'bandera-la', - keywords: ['Bandera'], + name: 'laos', + keywords: ['bandera', 'bandera-la'], }, '🇱🇧': { - name: 'bandera-lb', - keywords: ['Bandera'], + name: 'líbano', + keywords: ['bandera', 'bandera-lb'], }, '🇱🇨': { - name: 'bandera-lc', - keywords: ['Bandera'], + name: 'santa_lucía', + keywords: ['bandera', 'bandera-lc'], }, '🇱🇮': { - name: 'bandera-li', - keywords: ['Bandera'], + name: 'liechtenstein', + keywords: ['bandera', 'bandera-li'], }, '🇱🇰': { - name: 'bandera-lk', - keywords: ['Bandera'], + name: 'sri_lanka', + keywords: ['bandera', 'bandera-lk'], }, '🇱🇷': { - name: 'bandera-lr', - keywords: ['Bandera'], + name: 'liberia', + keywords: ['bandera', 'bandera-lr'], }, '🇱🇸': { - name: 'bandera-ls', - keywords: ['Bandera'], + name: 'lesoto', + keywords: ['bandera', 'bandera-ls'], }, '🇱🇹': { - name: 'bandera-lt', - keywords: ['Bandera'], + name: 'lituania', + keywords: ['bandera', 'bandera-lt'], }, '🇱🇺': { - name: 'bandera-lu', - keywords: ['Bandera'], + name: 'luxemburgo', + keywords: ['bandera', 'bandera-lu'], }, '🇱🇻': { - name: 'bandera-lv', - keywords: ['Bandera'], + name: 'letonia', + keywords: ['bandera', 'bandera-lv'], }, '🇱🇾': { - name: 'bandera-ly', - keywords: ['Bandera'], + name: 'libia', + keywords: ['bandera', 'bandera-ly'], }, '🇲🇦': { - name: 'bandera-ma', - keywords: ['Bandera'], + name: 'marruecos', + keywords: ['bandera', 'bandera-ma'], }, '🇲🇨': { - name: 'bandera-mc', - keywords: ['Bandera'], + name: 'mónaco', + keywords: ['bandera', 'bandera-mc'], }, '🇲🇩': { - name: 'bandera-md', - keywords: ['Bandera'], + name: 'moldavia', + keywords: ['bandera', 'bandera-md'], }, '🇲🇪': { - name: 'bandera-me', - keywords: ['Bandera'], + name: 'montenegro', + keywords: ['bandera', 'bandera-me'], }, '🇲🇫': { - name: 'bandera-mf', - keywords: ['Bandera'], + name: 'san_martín_(francia)', + keywords: ['bandera', 'bandera-mf'], }, '🇲🇬': { - name: 'bandera-mg', - keywords: ['Bandera'], + name: 'madagascar', + keywords: ['bandera', 'bandera-mg'], }, '🇲🇭': { - name: 'bandera-mh', - keywords: ['Bandera'], + name: 'islas_marshall', + keywords: ['bandera', 'bandera-mh'], }, '🇲🇰': { - name: 'bandera-mk', - keywords: ['Bandera'], + name: 'macedônia', + keywords: ['bandera', 'bandera-mk'], }, '🇲🇱': { - name: 'bandera-ml', - keywords: ['Bandera'], + name: 'mali', + keywords: ['bandera', 'bandera-ml'], }, '🇲🇲': { - name: 'bandera-mm', - keywords: ['Bandera'], + name: 'birmania', + keywords: ['bandera', 'bandera-mm'], }, '🇲🇳': { - name: 'bandera-mn', - keywords: ['Bandera'], + name: 'mongolia', + keywords: ['bandera', 'bandera-mn'], }, '🇲🇴': { - name: 'bandera-mo', - keywords: ['Bandera'], + name: 'macao', + keywords: ['bandera', 'bandera-mo'], }, '🇲🇵': { - name: 'bandera-mp', - keywords: ['Bandera'], + name: 'islas_marianas_del_norte', + keywords: ['bandera', 'bandera-mp'], }, '🇲🇶': { - name: 'bandera-mq', - keywords: ['Bandera'], + name: 'martinica', + keywords: ['bandera', 'bandera-mq'], }, '🇲🇷': { - name: 'bandera-mr', - keywords: ['Bandera'], + name: 'mauritania', + keywords: ['bandera', 'bandera-mr'], }, '🇲🇸': { - name: 'bandera-ms', - keywords: ['Bandera'], + name: 'montserrat', + keywords: ['bandera', 'bandera-ms'], }, '🇲🇹': { - name: 'bandera-mt', - keywords: ['Bandera'], + name: 'malta', + keywords: ['bandera', 'bandera-mt'], }, '🇲🇺': { - name: 'bandera-mu', - keywords: ['Bandera'], + name: 'mauritius', + keywords: ['bandera', 'bandera-mu'], }, '🇲🇻': { - name: 'bandera-mv', - keywords: ['Bandera'], + name: 'islas_maldivas', + keywords: ['bandera', 'bandera-mv'], }, '🇲🇼': { - name: 'bandera-mw', - keywords: ['Bandera'], + name: 'malawi', + keywords: ['bandera', 'bandera-mw'], }, '🇲🇽': { - name: 'bandera-mx', - keywords: ['Bandera'], + name: 'méxico', + keywords: ['bandera', 'bandera-mx'], }, '🇲🇾': { - name: 'bandera-my', - keywords: ['Bandera'], + name: 'malasia', + keywords: ['bandera', 'bandera-my'], }, '🇲🇿': { - name: 'bandera-mz', - keywords: ['Bandera'], + name: 'mozambique', + keywords: ['bandera', 'bandera-mz'], }, '🇳🇦': { - name: 'bandera-na', - keywords: ['Bandera'], + name: 'namibia', + keywords: ['bandera', 'bandera-na'], }, '🇳🇨': { - name: 'bandera-nc', - keywords: ['Bandera'], + name: 'nueva_caledonia', + keywords: ['bandera', 'bandera-nc'], }, '🇳🇪': { - name: 'bandera-ne', - keywords: ['Bandera'], + name: 'niger', + keywords: ['bandera', 'bandera-ne'], }, '🇳🇫': { - name: 'bandera-nf', - keywords: ['Bandera'], + name: 'isla_norfolk', + keywords: ['bandera', 'bandera-nf'], }, '🇳🇬': { - name: 'bandera-ng', - keywords: ['Bandera'], + name: 'nigeria', + keywords: ['bandera', 'bandera-ng'], }, '🇳🇮': { - name: 'bandera-ni', - keywords: ['Bandera'], + name: 'nicaragua', + keywords: ['bandera', 'bandera-ni'], }, '🇳🇱': { - name: 'bandera-nl', - keywords: ['Bandera'], + name: 'países_bajos', + keywords: ['bandera', 'bandera-nl'], }, '🇳🇴': { - name: 'bandera-no', - keywords: ['Bandera'], + name: 'noruega', + keywords: ['bandera', 'bandera-no'], }, '🇳🇵': { - name: 'bandera-np', - keywords: ['Bandera'], + name: 'nepal', + keywords: ['bandera', 'bandera-np'], }, '🇳🇷': { - name: 'bandera-nr', - keywords: ['Bandera'], + name: 'nauru', + keywords: ['bandera', 'bandera-nr'], }, '🇳🇺': { - name: 'bandera-nu', - keywords: ['Bandera'], + name: 'niue', + keywords: ['bandera', 'bandera-nu'], }, '🇳🇿': { - name: 'bandera-nz', - keywords: ['Bandera'], + name: 'nueva_zealand', + keywords: ['bandera', 'bandera-nz'], }, '🇴🇲': { - name: 'bandera-om', - keywords: ['Bandera'], + name: 'omán', + keywords: ['bandera', 'bandera-om'], }, '🇵🇦': { - name: 'bandera-pa', - keywords: ['Bandera'], + name: 'panamá', + keywords: ['bandera', 'bandera-pa'], }, '🇵🇪': { - name: 'bandera-pe', - keywords: ['Bandera'], + name: 'perú', + keywords: ['bandera', 'bandera-pe'], }, '🇵🇫': { - name: 'bandera-pf', - keywords: ['Bandera'], + name: 'polinesia_francesa', + keywords: ['bandera', 'bandera-pf'], }, '🇵🇬': { - name: 'bandera-pg', - keywords: ['Bandera'], + name: 'papúa_nueva_guinea', + keywords: ['bandera', 'bandera-pg'], }, '🇵🇭': { - name: 'bandera-ph', - keywords: ['Bandera'], + name: 'filipinas', + keywords: ['bandera', 'bandera-ph'], }, '🇵🇰': { - name: 'bandera-pk', - keywords: ['Bandera'], + name: 'pakistán', + keywords: ['bandera', 'bandera-pk'], }, '🇵🇱': { - name: 'bandera-pl', - keywords: ['Bandera'], + name: 'polonia', + keywords: ['bandera', 'bandera-pl'], }, '🇵🇲': { - name: 'bandera-pm', - keywords: ['Bandera'], + name: 'san_pedro_y_miquelón', + keywords: ['bandera', 'bandera-pm'], }, '🇵🇳': { - name: 'bandera-pn', - keywords: ['Bandera'], + name: 'islas_pitcairn', + keywords: ['bandera', 'bandera-pn'], }, '🇵🇷': { - name: 'bandera-pr', - keywords: ['Bandera'], + name: 'puerto_rico', + keywords: ['bandera', 'bandera-pr'], }, '🇵🇸': { - name: 'bandera-ps', - keywords: ['Bandera'], + name: 'palestina', + keywords: ['bandera', 'bandera-ps'], }, '🇵🇹': { - name: 'bandera-pt', - keywords: ['Bandera'], + name: 'portugal', + keywords: ['bandera', 'bandera-pt'], }, '🇵🇼': { - name: 'bandera-pw', - keywords: ['Bandera'], + name: 'palau', + keywords: ['bandera', 'bandera-pw'], }, '🇵🇾': { - name: 'bandera-py', - keywords: ['Bandera'], + name: 'paraguay', + keywords: ['bandera', 'bandera-py'], }, '🇶🇦': { - name: 'bandera-qa', - keywords: ['Bandera'], + name: 'qatar', + keywords: ['bandera', 'bandera-qa'], }, '🇷🇪': { - name: 'bandera-re', - keywords: ['Bandera'], + name: 'reunión', + keywords: ['bandera', 'bandera-re'], }, '🇷🇴': { - name: 'bandera-ro', - keywords: ['Bandera'], + name: 'rumanía', + keywords: ['bandera', 'bandera-ro'], }, '🇷🇸': { - name: 'bandera-rs', - keywords: ['Bandera'], + name: 'serbia', + keywords: ['bandera', 'bandera-rs'], }, '🇷🇺': { - name: 'ru', - keywords: ['Bandera'], + name: 'rusia', + keywords: ['bandera', 'bandera-ru'], }, '🇷🇼': { - name: 'bandera-rw', - keywords: ['Bandera'], + name: 'ruanda', + keywords: ['bandera', 'bandera-rw'], }, '🇸🇦': { - name: 'bandera-sa', - keywords: ['Bandera'], + name: 'arabia_saudita', + keywords: ['bandera', 'bandera-sa'], }, '🇸🇧': { - name: 'bandera-sb', - keywords: ['Bandera'], + name: 'islas_salomón', + keywords: ['bandera', 'bandera-sb'], }, '🇸🇨': { - name: 'bandera-sc', - keywords: ['Bandera'], + name: 'seychelles', + keywords: ['bandera', 'bandera-sc'], }, '🇸🇩': { - name: 'bandera-sd', - keywords: ['Bandera'], + name: 'sudán', + keywords: ['bandera', 'bandera-sd'], }, '🇸🇪': { - name: 'bandera-se', - keywords: ['Bandera'], + name: 'suecia', + keywords: ['bandera', 'bandera-se'], }, '🇸🇬': { - name: 'bandera-sg', - keywords: ['Bandera'], + name: 'singapur', + keywords: ['bandera', 'bandera-sg'], }, '🇸🇭': { - name: 'bandera-sh', - keywords: ['Bandera'], + name: 'santa_elena', + keywords: ['bandera', 'bandera-sh'], }, '🇸🇮': { - name: 'bandera-si', - keywords: ['Bandera'], + name: 'eslovenia', + keywords: ['bandera', 'bandera-si'], }, '🇸🇯': { - name: 'bandera-sj', - keywords: ['Bandera'], + name: 'svalbard_y_jan_mayen', + keywords: ['bandera', 'bandera-sj'], }, '🇸🇰': { - name: 'bandera-sk', - keywords: ['Bandera'], + name: 'eslovaquia', + keywords: ['bandera', 'bandera-sk'], }, '🇸🇱': { - name: 'bandera-sl', - keywords: ['Bandera'], + name: 'sierra_leona', + keywords: ['bandera', 'bandera-sl'], }, '🇸🇲': { - name: 'bandera-sm', - keywords: ['Bandera'], + name: 'san_marino', + keywords: ['bandera', 'bandera-sm'], }, '🇸🇳': { - name: 'bandera-sn', - keywords: ['Bandera'], + name: 'senegal', + keywords: ['bandera', 'bandera-sn'], }, '🇸🇴': { - name: 'bandera-so', - keywords: ['Bandera'], + name: 'somalia', + keywords: ['bandera', 'bandera-so'], }, '🇸🇷': { - name: 'bandera-sr', - keywords: ['Bandera'], + name: 'surinám', + keywords: ['bandera', 'bandera-sr'], }, '🇸🇸': { - name: 'bandera-ss', - keywords: ['Bandera'], + name: 'república_de_sudán_del_sur', + keywords: ['bandera', 'bandera-ss'], }, '🇸🇹': { - name: 'bandera-st', - keywords: ['Bandera'], + name: 'santo_tomé_y_príncipe', + keywords: ['bandera', 'bandera-st'], }, '🇸🇻': { - name: 'bandera-sv', - keywords: ['Bandera'], + name: 'el_salvador', + keywords: ['bandera', 'bandera-sv'], }, '🇸🇽': { - name: 'bandera-sx', - keywords: ['Bandera'], + name: 'sint_maarten', + keywords: ['bandera', 'bandera-sx'], }, '🇸🇾': { - name: 'bandera-sy', - keywords: ['Bandera'], + name: 'siria', + keywords: ['bandera', 'bandera-sy'], }, '🇸🇿': { - name: 'bandera-sz', - keywords: ['Bandera'], + name: 'swazilandia', + keywords: ['bandera', 'bandera-sz'], }, '🇹🇦': { - name: 'bandera-ta', - keywords: ['Bandera'], + name: 'tristán_de_acuña', + keywords: ['bandera', 'bandera-ta'], }, '🇹🇨': { - name: 'bandera-tc', - keywords: ['Bandera'], + name: 'islas_turcas_y_caicos', + keywords: ['bandera', 'bandera-tc'], }, '🇹🇩': { - name: 'bandera-td', - keywords: ['Bandera'], + name: 'chad', + keywords: ['bandera', 'bandera-td'], }, '🇹🇫': { - name: 'bandera-tf', - keywords: ['Bandera'], + name: 'territorios_australes_y_antárticas_franceses', + keywords: ['bandera', 'bandera-tf'], }, '🇹🇬': { - name: 'bandera-tg', - keywords: ['Bandera'], + name: 'togo', + keywords: ['bandera', 'bandera-tg'], }, '🇹🇭': { - name: 'bandera-th', - keywords: ['Bandera'], + name: 'tailandia', + keywords: ['bandera', 'bandera-th'], }, '🇹🇯': { - name: 'bandera-tj', - keywords: ['Bandera'], + name: 'tayikistán', + keywords: ['bandera', 'bandera-tj'], }, '🇹🇰': { - name: 'bandera-tk', - keywords: ['Bandera'], + name: 'tokelau', + keywords: ['bandera', 'bandera-tk'], }, '🇹🇱': { - name: 'bandera-tl', - keywords: ['Bandera'], + name: 'timor_oriental', + keywords: ['bandera', 'bandera-tl'], }, '🇹🇲': { - name: 'bandera-tm', - keywords: ['Bandera'], + name: 'turkmenistán', + keywords: ['bandera', 'bandera-tm'], }, '🇹🇳': { - name: 'bandera-tn', - keywords: ['Bandera'], + name: 'tunez', + keywords: ['bandera', 'bandera-tn'], }, '🇹🇴': { - name: 'bandera-to', - keywords: ['Bandera'], + name: 'tonga', + keywords: ['bandera', 'bandera-to'], }, '🇹🇷': { - name: 'bandera-tr', - keywords: ['Bandera'], + name: 'turquía', + keywords: ['bandera', 'bandera-tr'], }, '🇹🇹': { - name: 'bandera-tt', - keywords: ['Bandera'], + name: 'trinidad_y_tobago', + keywords: ['bandera', 'bandera-tt'], }, '🇹🇻': { - name: 'bandera-tv', - keywords: ['Bandera'], + name: 'tuvalu', + keywords: ['bandera', 'bandera-tv'], }, '🇹🇼': { - name: 'bandera-tw', - keywords: ['Bandera'], + name: 'taiwán', + keywords: ['bandera', 'bandera-tw'], }, '🇹🇿': { - name: 'bandera-tz', - keywords: ['Bandera'], + name: 'tanzania', + keywords: ['bandera', 'bandera-tz'], }, '🇺🇦': { - name: 'bandera-ua', - keywords: ['Bandera'], + name: 'ucrania', + keywords: ['bandera', 'bandera-ua'], }, '🇺🇬': { - name: 'bandera-ug', - keywords: ['Bandera'], + name: 'uganda', + keywords: ['bandera', 'bandera-ug'], }, '🇺🇲': { - name: 'bandera-um', - keywords: ['Bandera'], + name: 'islas_ultramarinas_menores_de_estados_unidos', + keywords: ['bandera', 'bandera-um'], }, '🇺🇳': { name: 'bandera-onu', - keywords: ['Bandera'], + keywords: ['Bandera', 'bandera-onu'], }, '🇺🇸': { - name: 'us', - keywords: ['Bandera'], + name: 'estados_unidos_de_américa', + keywords: ['bandera', 'bandera-us'], }, '🇺🇾': { - name: 'bandera-uy', - keywords: ['Bandera'], + name: 'uruguay', + keywords: ['bandera', 'bandera-uy'], }, '🇺🇿': { - name: 'bandera-uz', - keywords: ['Bandera'], + name: 'uzbekistan', + keywords: ['bandera', 'bandera-uz'], }, '🇻🇦': { - name: 'bandera-va', - keywords: ['Bandera'], + name: 'ciudad_del_vaticano', + keywords: ['bandera', 'bandera-va'], }, '🇻🇨': { - name: 'bandera-vc', - keywords: ['Bandera'], + name: 'san_vicente_y_las_granadinas', + keywords: ['bandera', 'bandera-vc'], }, '🇻🇪': { - name: 'bandera-ve', - keywords: ['Bandera'], + name: 'venezuela', + keywords: ['bandera', 'bandera-ve'], }, '🇻🇬': { - name: 'bandera-vg', - keywords: ['Bandera'], + name: 'islas_vírgenes_británicas', + keywords: ['bandera', 'bandera-vg'], }, '🇻🇮': { - name: 'bandera-vi', - keywords: ['Bandera'], + name: 'islas_vírgenes_de_los_estados_unidos', + keywords: ['bandera', 'bandera-vi'], }, '🇻🇳': { - name: 'bandera-vn', - keywords: ['Bandera'], + name: 'vietnam', + keywords: ['bandera', 'bandera-vn'], }, '🇻🇺': { - name: 'bandera-vu', - keywords: ['Bandera'], + name: 'vanuatu', + keywords: ['bandera', 'bandera-vu'], }, '🇼🇫': { - name: 'bandera-wf', - keywords: ['Bandera'], + name: 'wallis_y_futuna', + keywords: ['bandera', 'bandera-wf'], }, '🇼🇸': { - name: 'bandera-ws', - keywords: ['Bandera'], + name: 'samoa', + keywords: ['bandera', 'bandera-ws'], }, '🇽🇰': { - name: 'bandera-xk', - keywords: ['Bandera'], + name: 'kosovo', + keywords: ['bandera', 'bandera-xk'], }, '🇾🇪': { - name: 'bandera-ye', - keywords: ['Bandera'], + name: 'yemen', + keywords: ['bandera', 'bandera-ye'], }, '🇾🇹': { - name: 'bandera-yt', - keywords: ['Bandera'], + name: 'mayotte', + keywords: ['bandera', 'bandera-yt'], }, '🇿🇦': { - name: 'bandera-za', - keywords: ['Bandera'], + name: 'sudáfrica', + keywords: ['bandera', 'bandera-za'], }, '🇿🇲': { - name: 'bandera-zm', - keywords: ['Bandera'], + name: 'zambia', + keywords: ['bandera', 'bandera-zm'], }, '🇿🇼': { - name: 'bandera-zw', - keywords: ['Bandera'], + name: 'zimbabue', + keywords: ['bandera', 'bandera-zw'], }, '🏴󠁧󠁢󠁥󠁮󠁧󠁿': { name: 'bandera-inglaterra', From ad262c4db86e5c4208fe90ce3fa19316930c7662 Mon Sep 17 00:00:00 2001 From: Jakub Kosmydel <104823336+kosmydel@users.noreply.github.com> Date: Tue, 5 Sep 2023 09:35:04 +0200 Subject: [PATCH 02/98] manual changes in flags --- assets/emojis/es.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/emojis/es.js b/assets/emojis/es.js index 515f5d8f82ed..fda12f5f127c 100644 --- a/assets/emojis/es.js +++ b/assets/emojis/es.js @@ -7236,16 +7236,16 @@ const esEmojis = { keywords: ['bandera', 'bandera-zw'], }, '🏴󠁧󠁢󠁥󠁮󠁧󠁿': { - name: 'bandera-inglaterra', - keywords: ['Bandera'], + name: 'inglaterra', + keywords: ['bandera', 'bandera-inglaterra'], }, '🏴󠁧󠁢󠁳󠁣󠁴󠁿': { - name: 'bandera-escocia', - keywords: ['Bandera'], + name: 'escocia', + keywords: ['bandera', 'bandera-escocia'], }, '🏴󠁧󠁢󠁷󠁬󠁳󠁿': { - name: 'bandera-gales', - keywords: ['Bandera'], + name: 'gales', + keywords: ['bandera', 'bandera-gales'], }, }; From c2de2e70e64a05bb98a361581b85b6fd04bf8f41 Mon Sep 17 00:00:00 2001 From: Hans Date: Thu, 31 Aug 2023 07:14:32 +0700 Subject: [PATCH 03/98] fix Chat - Notification is NOT received in the main device after Control policy was created --- src/libs/Notification/LocalNotification/BrowserNotifications.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Notification/LocalNotification/BrowserNotifications.js b/src/libs/Notification/LocalNotification/BrowserNotifications.js index e55c0430fe17..a40850b53f54 100644 --- a/src/libs/Notification/LocalNotification/BrowserNotifications.js +++ b/src/libs/Notification/LocalNotification/BrowserNotifications.js @@ -111,7 +111,7 @@ export default { const plainTextMessage = (_.find(message, (f) => f.type === 'COMMENT') || {}).text; if (isChatRoom) { - const roomName = _.get(report, 'displayName', ''); + const roomName = _.get(report, 'reportName', ''); title = roomName; body = `${plainTextPerson}: ${plainTextMessage}`; } else { From ad42f5ac57fc0b96b9aacd36504c1aa377e4cd04 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 20 Sep 2023 11:43:39 +0200 Subject: [PATCH 04/98] re-test From d07017bbcf5de6c5933a2d91dc970840c0161bc7 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 20 Sep 2023 12:54:51 +0200 Subject: [PATCH 05/98] connect report of participants of MoneyRequestCategoryPage --- src/pages/iou/MoneyRequestCategoryPage.js | 26 ++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/pages/iou/MoneyRequestCategoryPage.js b/src/pages/iou/MoneyRequestCategoryPage.js index 80b88a762609..ac4cae65229c 100644 --- a/src/pages/iou/MoneyRequestCategoryPage.js +++ b/src/pages/iou/MoneyRequestCategoryPage.js @@ -4,6 +4,7 @@ import lodashGet from 'lodash/get'; import {withOnyx} from 'react-native-onyx'; import ROUTES from '../../ROUTES'; import Navigation from '../../libs/Navigation/Navigation'; +import compose from '../../libs/compose'; import useLocalize from '../../hooks/useLocalize'; import ScreenWrapper from '../../components/ScreenWrapper'; import HeaderWithBackButton from '../../components/HeaderWithBackButton'; @@ -65,8 +66,23 @@ MoneyRequestCategoryPage.displayName = 'MoneyRequestCategoryPage'; MoneyRequestCategoryPage.propTypes = propTypes; MoneyRequestCategoryPage.defaultProps = defaultProps; -export default withOnyx({ - report: { - key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${lodashGet(route, 'params.reportID', '')}`, - }, -})(MoneyRequestCategoryPage); +export default compose( + withOnyx({ + iou: { + key: ONYXKEYS.IOU, + }, + }), + withOnyx({ + report: { + key: ({route, iou}) => { + let reportID = lodashGet(route, 'params.reportID', ''); + if (!reportID) { + // When the money request creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. + // Get the report id from the participants list on the IOU object stored in Onyx. + reportID = lodashGet(iou, 'participants.0.reportID', ''); + } + return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; + }, + }, + }), +)(MoneyRequestCategoryPage); From 16a1bbaa488c1030bc7437564409e526e11d1e42 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 20 Sep 2023 16:01:45 +0200 Subject: [PATCH 06/98] attach category to split bill request --- src/libs/actions/IOU.js | 28 ++++++++++++++----- .../iou/steps/MoneyRequestConfirmPage.js | 3 ++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 9e8dadbd53b7..9f2c71bf37f1 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -669,11 +669,12 @@ function requestMoney(report, amount, currency, created, merchant, payeeEmail, p * @param {Number} amount - always in the smallest unit of the currency * @param {String} comment * @param {String} currency + * @param {String} category * @param {String} existingSplitChatReportID - the report ID where the split bill happens, could be a group chat or a workspace chat * * @return {Object} */ -function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, existingSplitChatReportID = '') { +function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, existingSplitChatReportID = '') { const currentUserEmailForIOUSplit = OptionsListUtils.addSMSDomainIfPhoneNumber(currentUserLogin); const participantAccountIDs = _.map(participants, (participant) => Number(participant.accountID)); const existingSplitChatReport = @@ -697,6 +698,10 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco '', '', `${Localize.translateLocal('iou.splitBill')} ${Localize.translateLocal('common.with')} ${formattedParticipants} [${DateUtils.getDBTime().slice(0, 10)}]`, + undefined, + undefined, + undefined, + category, ); // Note: The created action must be optimistically generated before the IOU action so there's no chance that the created action appears after the IOU action in the chat @@ -824,8 +829,8 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco const hasMultipleParticipants = participants.length > 1; _.each(participants, (participant) => { // In case the participant is a worskapce, email & accountID should remain undefined and won't be used in the rest of this code - const email = isOwnPolicyExpenseChat ? '' : OptionsListUtils.addSMSDomainIfPhoneNumber(participant.login).toLowerCase(); - const accountID = isOwnPolicyExpenseChat ? 0 : Number(participant.accountID); + const email = isOwnPolicyExpenseChat ? '' : OptionsListUtils.addSMSDomainIfPhoneNumber(participant.login || '').toLowerCase(); + const accountID = isOwnPolicyExpenseChat ? 0 : Number(participant.accountID) || 0; if (email === currentUserEmailForIOUSplit) { return; } @@ -877,6 +882,11 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco '', CONST.IOU.MONEY_REQUEST_TYPE.SPLIT, splitTransaction.transactionID, + undefined, + undefined, + undefined, + undefined, + category, ); // STEP 4: Build optimistic reportActions. We need: @@ -976,10 +986,11 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco * @param {Number} amount - always in smallest currency unit * @param {String} comment * @param {String} currency + * @param {String} category * @param {String} existingSplitChatReportID - Either a group DM or a workspace chat */ -function splitBill(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, existingSplitChatReportID = '') { - const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, existingSplitChatReportID); +function splitBill(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, existingSplitChatReportID = '') { + const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, existingSplitChatReportID); API.write( 'SplitBill', @@ -989,6 +1000,7 @@ function splitBill(participants, currentUserLogin, currentUserAccountID, amount, splits: JSON.stringify(splits), currency, comment, + category, transactionID: splitData.transactionID, reportActionID: splitData.reportActionID, createdReportActionID: splitData.createdReportActionID, @@ -1009,9 +1021,10 @@ function splitBill(participants, currentUserLogin, currentUserAccountID, amount, * @param {Number} amount - always in smallest currency unit * @param {String} comment * @param {String} currency + * @param {String} category */ -function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccountID, amount, comment, currency) { - const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency); +function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category) { + const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category); API.write( 'SplitBillAndOpenReport', @@ -1021,6 +1034,7 @@ function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccou splits: JSON.stringify(splits), currency, comment, + category, transactionID: splitData.transactionID, reportActionID: splitData.reportActionID, createdReportActionID: splitData.createdReportActionID, diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 224f661915d8..e22254ff19d0 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -192,6 +192,7 @@ function MoneyRequestConfirmPage(props) { props.iou.amount, trimmedComment, props.iou.currency, + props.iou.category, reportID.current, ); return; @@ -206,6 +207,7 @@ function MoneyRequestConfirmPage(props) { props.iou.amount, trimmedComment, props.iou.currency, + props.iou.category, ); return; } @@ -230,6 +232,7 @@ function MoneyRequestConfirmPage(props) { props.currentUserPersonalDetails.login, props.currentUserPersonalDetails.accountID, props.iou.currency, + props.iou.category, props.iou.receiptPath, props.iou.receiptSource, isDistanceRequest, From 576ad9391f396b24523a7a664ff1ac2d8e3239aa Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 21 Sep 2023 14:54:47 +0200 Subject: [PATCH 07/98] fix crash when a participant a workspace --- src/libs/actions/IOU.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index dbbebce3a5cb..75049004063f 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -886,9 +886,11 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco const hasMultipleParticipants = participants.length > 1; _.each(participants, (participant) => { + const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(participant); + // In case the participant is a worskapce, email & accountID should remain undefined and won't be used in the rest of this code - const email = isOwnPolicyExpenseChat ? '' : OptionsListUtils.addSMSDomainIfPhoneNumber(participant.login || '').toLowerCase(); - const accountID = isOwnPolicyExpenseChat ? 0 : Number(participant.accountID) || 0; + const email = isOwnPolicyExpenseChat || isPolicyExpenseChat ? '' : OptionsListUtils.addSMSDomainIfPhoneNumber(participant.login).toLowerCase(); + const accountID = isOwnPolicyExpenseChat || isPolicyExpenseChat ? 0 : Number(participant.accountID); if (email === currentUserEmailForIOUSplit) { return; } @@ -1050,7 +1052,6 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco */ function splitBill(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, existingSplitChatReportID = '') { const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, category, existingSplitChatReportID); - API.write( 'SplitBill', { From f4f86d8538a055ce6f9c4e30fe9f89be0357c854 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 21 Sep 2023 15:18:01 +0200 Subject: [PATCH 08/98] fix policy and report props of MoneyRequestConfirmationList --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index f9d80e784e22..6b90a4bc5f37 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -322,14 +322,14 @@ function MoneyRequestConfirmPage(props) { receiptPath={props.iou.receiptPath} receiptSource={props.iou.receiptSource} iouType={iouType.current} - reportID={reportID.current} + reportID={reportID.current || lodashGet(props.iou, 'participants.0.reportID', '')} // The participants can only be modified when the action is initiated from directly within a group chat and not the floating-action-button. // This is because when there is a group of people, say they are on a trip, and you have some shared expenses with some of the people, // but not all of them (maybe someone skipped out on dinner). Then it's nice to be able to select/deselect people from the group chat bill // split rather than forcing the user to create a new group, just for that expense. The reportID is empty, when the action was initiated from // the floating-action-button (since it is something that exists outside the context of a report). canModifyParticipants={!_.isEmpty(reportID.current)} - policyID={props.report.policyID} + policyID={props.policy.id} bankAccountRoute={ReportUtils.getBankAccountRoute(props.report)} iouMerchant={props.iou.merchant} iouCreated={props.iou.created} From e7ba3fc0716f3c11f5ea166b0b969f6ad70eafd2 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 21 Sep 2023 15:20:42 +0200 Subject: [PATCH 09/98] fix props --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 6b90a4bc5f37..c43635d484d3 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -329,7 +329,7 @@ function MoneyRequestConfirmPage(props) { // split rather than forcing the user to create a new group, just for that expense. The reportID is empty, when the action was initiated from // the floating-action-button (since it is something that exists outside the context of a report). canModifyParticipants={!_.isEmpty(reportID.current)} - policyID={props.policy.id} + policyID={props.report.policyID} bankAccountRoute={ReportUtils.getBankAccountRoute(props.report)} iouMerchant={props.iou.merchant} iouCreated={props.iou.created} From aa8f4f6f409a37fda24c48c2a5f093f656d50cab Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 21 Sep 2023 15:46:12 +0200 Subject: [PATCH 10/98] fix adding recently categories --- src/libs/actions/IOU.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 75049004063f..6b3c82eb21fb 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -465,13 +465,16 @@ function getMoneyRequestInformation( billable, ); - const uniquePolicyRecentlyUsedCategories = allRecentlyUsedCategories - ? _.filter( - allRecentlyUsedCategories[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${iouReport.policyID}`], - (recentlyUsedPolicyCategory) => recentlyUsedPolicyCategory !== category, - ) - : []; - const optimisticPolicyRecentlyUsedCategories = [category, ...uniquePolicyRecentlyUsedCategories]; + let optimisticPolicyRecentlyUsedCategories; + if (category) { + const uniquePolicyRecentlyUsedCategories = allRecentlyUsedCategories + ? _.filter( + allRecentlyUsedCategories[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${iouReport.policyID}`], + (recentlyUsedPolicyCategory) => recentlyUsedPolicyCategory !== category, + ) + : []; + optimisticPolicyRecentlyUsedCategories = [category, ...uniquePolicyRecentlyUsedCategories]; + } const optimisticPolicyRecentlyUsedTags = {}; const recentlyUsedPolicyTags = allRecentlyUsedTags[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${iouReport.policyID}`]; From 495894eae7a3e5aa89b3c782ed8e686e91e97291 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 21 Sep 2023 15:54:12 +0200 Subject: [PATCH 11/98] add recently categories for split bills optimistic --- src/libs/actions/IOU.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 6b3c82eb21fb..f793d7e776c4 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -990,6 +990,17 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco oneOnOneReportPreviewAction = ReportUtils.buildOptimisticReportPreview(oneOnOneChatReport, oneOnOneIOUReport); } + let optimisticPolicyRecentlyUsedCategories; + if (category && isPolicyExpenseChat) { + const uniquePolicyRecentlyUsedCategories = allRecentlyUsedCategories + ? _.filter( + allRecentlyUsedCategories[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${participant.policyID}`], + (recentlyUsedPolicyCategory) => recentlyUsedPolicyCategory !== category, + ) + : []; + optimisticPolicyRecentlyUsedCategories = [category, ...uniquePolicyRecentlyUsedCategories]; + } + // STEP 5: Build Onyx Data const [oneOnOneOptimisticData, oneOnOneSuccessData, oneOnOneFailureData] = buildOnyxDataForMoneyRequest( oneOnOneChatReport, @@ -1000,7 +1011,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco oneOnOneIOUAction, oneOnOnePersonalDetailListAction, oneOnOneReportPreviewAction, - [], + optimisticPolicyRecentlyUsedCategories, {}, isNewOneOnOneChatReport, shouldCreateNewOneOnOneIOUReport, From cd5a6c2687e321ec1aa6436ad56baa509facd7ab Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 21 Sep 2023 19:13:35 +0200 Subject: [PATCH 12/98] use one withOnyx --- src/pages/iou/MoneyRequestCategoryPage.js | 35 ++++++++++------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/src/pages/iou/MoneyRequestCategoryPage.js b/src/pages/iou/MoneyRequestCategoryPage.js index 246e94a6e261..5e94ec498b01 100644 --- a/src/pages/iou/MoneyRequestCategoryPage.js +++ b/src/pages/iou/MoneyRequestCategoryPage.js @@ -4,7 +4,6 @@ import lodashGet from 'lodash/get'; import {withOnyx} from 'react-native-onyx'; import ROUTES from '../../ROUTES'; import Navigation from '../../libs/Navigation/Navigation'; -import compose from '../../libs/compose'; import useLocalize from '../../hooks/useLocalize'; import ScreenWrapper from '../../components/ScreenWrapper'; import HeaderWithBackButton from '../../components/HeaderWithBackButton'; @@ -83,23 +82,19 @@ MoneyRequestCategoryPage.displayName = 'MoneyRequestCategoryPage'; MoneyRequestCategoryPage.propTypes = propTypes; MoneyRequestCategoryPage.defaultProps = defaultProps; -export default compose( - withOnyx({ - iou: { - key: ONYXKEYS.IOU, +export default withOnyx({ + iou: { + key: ONYXKEYS.IOU, + }, + report: { + key: ({route, iou}) => { + let reportID = lodashGet(route, 'params.reportID', ''); + if (!reportID) { + // When the money request creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. + // Get the report id from the participants list on the IOU object stored in Onyx. + reportID = lodashGet(iou, 'participants.0.reportID', ''); + } + return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; }, - }), - withOnyx({ - report: { - key: ({route, iou}) => { - let reportID = lodashGet(route, 'params.reportID', ''); - if (!reportID) { - // When the money request creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. - // Get the report id from the participants list on the IOU object stored in Onyx. - reportID = lodashGet(iou, 'participants.0.reportID', ''); - } - return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; - }, - }, - }), -)(MoneyRequestCategoryPage); + }, +})(MoneyRequestCategoryPage); From 57b61e5645a59f605419dffaab8172c0bd13bd4a Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 22 Sep 2023 14:05:26 +0200 Subject: [PATCH 13/98] add comments --- src/libs/actions/IOU.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 7183baebdd55..818f4ab9633b 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -889,9 +889,10 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco const hasMultipleParticipants = participants.length > 1; _.each(participants, (participant) => { + // In a case when a participant is a workspace, even when a current user is not an owner of the workspace const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(participant); - // In case the participant is a worskapce, email & accountID should remain undefined and won't be used in the rest of this code + // In case the participant is a workspace, email & accountID should remain undefined and won't be used in the rest of this code const email = isOwnPolicyExpenseChat || isPolicyExpenseChat ? '' : OptionsListUtils.addSMSDomainIfPhoneNumber(participant.login).toLowerCase(); const accountID = isOwnPolicyExpenseChat || isPolicyExpenseChat ? 0 : Number(participant.accountID); if (email === currentUserEmailForIOUSplit) { @@ -990,6 +991,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco oneOnOneReportPreviewAction = ReportUtils.buildOptimisticReportPreview(oneOnOneChatReport, oneOnOneIOUReport); } + // Add category to optimistic policy recently used categories when a participant is a workspace let optimisticPolicyRecentlyUsedCategories; if (category && isPolicyExpenseChat) { const uniquePolicyRecentlyUsedCategories = allRecentlyUsedCategories From a036c4da73ba6cbf9da4d9ee40a2ebdee479edf0 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 22 Sep 2023 15:11:11 +0200 Subject: [PATCH 14/98] move isPolicyExpenseChat to parent --- src/components/MoneyRequestConfirmationList.js | 10 +++++----- src/pages/iou/steps/MoneyRequestConfirmPage.js | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 13471407914f..cdcb875f163f 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -137,6 +137,9 @@ const propTypes = { /** Whether the money request is a distance request */ isDistanceRequest: PropTypes.bool, + /** A flag for verifying that the current report is a workspace */ + isPolicyExpenseChat: PropTypes.bool.isRequired, + /* Onyx Props */ /** Collection of categories attached to a policy */ policyCategories: PropTypes.objectOf(categoryPropTypes), @@ -195,11 +198,8 @@ function MoneyRequestConfirmationList(props) { const distance = lodashGet(transaction, 'routes.route0.distance', 0); const shouldCalculateDistanceAmount = props.isDistanceRequest && props.iouAmount === 0; - // A flag for verifying that the current report is a sub-report of a workspace chat - const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(ReportUtils.getReport(props.reportID))), [props.reportID]); - // A flag for showing the categories field - const shouldShowCategories = isPolicyExpenseChat && Permissions.canUseCategories(props.betas) && OptionsListUtils.hasEnabledOptions(_.values(props.policyCategories)); + const shouldShowCategories = props.isPolicyExpenseChat && Permissions.canUseCategories(props.betas) && OptionsListUtils.hasEnabledOptions(_.values(props.policyCategories)); // Fetches the first tag list of the policy const tagListKey = _.first(_.keys(props.policyTags)); @@ -207,7 +207,7 @@ function MoneyRequestConfirmationList(props) { const tagListName = lodashGet(props.policyTags, [tagListKey, 'name'], ''); const canUseTags = Permissions.canUseTags(props.betas); // A flag for showing the tags field - const shouldShowTags = isPolicyExpenseChat && canUseTags && _.any(tagList, (tag) => tag.enabled); + const shouldShowTags = props.isPolicyExpenseChat && canUseTags && _.any(tagList, (tag) => tag.enabled); // A flag for showing the billable field const shouldShowBillable = canUseTags && !lodashGet(props.policy, 'disabledFields.defaultBillable', true); diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 3b9f7dcebcfa..5916e0662c99 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -74,6 +74,7 @@ function MoneyRequestConfirmPage(props) { }), [props.iou.participants, props.personalDetails], ); + const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(props.report)), [props.report]); useEffect(() => { const policyExpenseChat = _.find(participants, (participant) => participant.isPolicyExpenseChat); @@ -325,7 +326,8 @@ function MoneyRequestConfirmPage(props) { receiptPath={props.iou.receiptPath} receiptSource={props.iou.receiptSource} iouType={iouType.current} - reportID={reportID.current || lodashGet(props.iou, 'participants.0.reportID', '')} + reportID={reportID.current} + isPolicyExpenseChat={isPolicyExpenseChat} // The participants can only be modified when the action is initiated from directly within a group chat and not the floating-action-button. // This is because when there is a group of people, say they are on a trip, and you have some shared expenses with some of the people, // but not all of them (maybe someone skipped out on dinner). Then it's nice to be able to select/deselect people from the group chat bill From ddcf5d6fa946017467d8c454bd4fed602ce093ef Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 22 Sep 2023 15:11:22 +0200 Subject: [PATCH 15/98] hack onyx forwarding --- src/pages/iou/MoneyRequestCategoryPage.js | 38 ++++++++++++++--------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/pages/iou/MoneyRequestCategoryPage.js b/src/pages/iou/MoneyRequestCategoryPage.js index 36fa5624cc58..65e514f8582e 100644 --- a/src/pages/iou/MoneyRequestCategoryPage.js +++ b/src/pages/iou/MoneyRequestCategoryPage.js @@ -2,6 +2,7 @@ import React from 'react'; 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'; @@ -83,19 +84,26 @@ MoneyRequestCategoryPage.displayName = 'MoneyRequestCategoryPage'; MoneyRequestCategoryPage.propTypes = propTypes; MoneyRequestCategoryPage.defaultProps = defaultProps; -export default withOnyx({ - iou: { - key: ONYXKEYS.IOU, - }, - report: { - key: ({route, iou}) => { - let reportID = lodashGet(route, 'params.reportID', ''); - if (!reportID) { - // When the money request creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. - // Get the report id from the participants list on the IOU object stored in Onyx. - reportID = lodashGet(iou, 'participants.0.reportID', ''); - } - return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; +export default compose( + withOnyx({ + iou: { + key: ONYXKEYS.IOU, }, - }, -})(MoneyRequestCategoryPage); + }), + // This is a temporary hack to forward forward iou value to next getter. + // There is a problem that with one withOnyx it does not forward value from first to second. + // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file + withOnyx({ + report: { + key: ({route, iou}) => { + let reportID = lodashGet(route, 'params.reportID', ''); + if (!reportID) { + // When the money request creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. + // Get the report id from the participants list on the IOU object stored in Onyx. + reportID = lodashGet(iou, 'participants.0.reportID', ''); + } + return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; + }, + }, + }), +)(MoneyRequestCategoryPage); From 17c2a738bd2ff3aa29a03059d3c55fa39f241224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Fri, 22 Sep 2023 15:51:28 +0200 Subject: [PATCH 16/98] migrate NetworkConnection to TypeScript --- ...workConnection.js => NetworkConnection.ts} | 41 ++++++++----------- src/libs/Throttle.ts | 12 ++++++ 2 files changed, 30 insertions(+), 23 deletions(-) rename src/libs/{NetworkConnection.js => NetworkConnection.ts} (85%) create mode 100644 src/libs/Throttle.ts diff --git a/src/libs/NetworkConnection.js b/src/libs/NetworkConnection.ts similarity index 85% rename from src/libs/NetworkConnection.js rename to src/libs/NetworkConnection.ts index 9ca09c9154bc..743b55674b8a 100644 --- a/src/libs/NetworkConnection.js +++ b/src/libs/NetworkConnection.ts @@ -1,4 +1,3 @@ -import _ from 'underscore'; import Onyx from 'react-native-onyx'; import NetInfo from '@react-native-community/netinfo'; import AppStateMonitor from './AppStateMonitor'; @@ -7,33 +6,31 @@ import * as NetworkActions from './actions/Network'; import CONFIG from '../CONFIG'; import CONST from '../CONST'; import ONYXKEYS from '../ONYXKEYS'; +import throttle from './Throttle'; let isOffline = false; let hasPendingNetworkCheck = false; // Holds all of the callbacks that need to be triggered when the network reconnects let callbackID = 0; -const reconnectionCallbacks = {}; +const reconnectionCallbacks: Record Promise> = {}; /** * Loop over all reconnection callbacks and fire each one */ -const triggerReconnectionCallbacks = _.throttle( - (reason) => { - Log.info(`[NetworkConnection] Firing reconnection callbacks because ${reason}`); - _.each(reconnectionCallbacks, (callback) => callback()); - }, - 5000, - {trailing: false}, -); +const triggerReconnectionCallbacks = throttle((reason) => { + alert('X'); + Log.info(`[NetworkConnection] Firing reconnection callbacks because ${reason?.toString()}`); + Object.values(reconnectionCallbacks).forEach((callback) => { + callback(); + }); +}, 5000); /** * Called when the offline status of the app changes and if the network is "reconnecting" (going from offline to online) * then all of the reconnection callbacks are triggered - * - * @param {Boolean} isCurrentlyOffline */ -function setOfflineStatus(isCurrentlyOffline) { +function setOfflineStatus(isCurrentlyOffline: boolean): void { NetworkActions.setIsOffline(isCurrentlyOffline); // When reconnecting, ie, going from offline to online, all the reconnection callbacks @@ -72,7 +69,7 @@ Onyx.connect({ * internet connectivity or not. This is more reliable than the Pusher * `disconnected` event which takes about 10-15 seconds to emit. */ -function subscribeToNetInfo() { +function subscribeToNetInfo(): void { // Note: We are disabling the configuration for NetInfo when using the local web API since requests can get stuck in a 'Pending' state and are not reliable indicators for "offline". // If you need to test the "recheck" feature then switch to the production API proxy server. if (!CONFIG.IS_USING_LOCAL_WEB) { @@ -101,7 +98,7 @@ function subscribeToNetInfo() { // Subscribe to the state change event via NetInfo so we can update // whether a user has internet connectivity or not. NetInfo.addEventListener((state) => { - Log.info('[NetworkConnection] NetInfo state change', false, state); + Log.info('[NetworkConnection] NetInfo state change', false, {...state}); if (shouldForceOffline) { Log.info('[NetworkConnection] Not setting offline status because shouldForceOffline = true'); return; @@ -110,7 +107,7 @@ function subscribeToNetInfo() { }); } -function listenForReconnect() { +function listenForReconnect(): void { Log.info('[NetworkConnection] listenForReconnect called'); AppStateMonitor.addBecameActiveListener(() => { @@ -120,11 +117,9 @@ function listenForReconnect() { /** * Register callback to fire when we reconnect - * - * @param {Function} callback - must return a Promise - * @returns {Function} unsubscribe method + * @returns unsubscribe method */ -function onReconnect(callback) { +function onReconnect(callback: () => Promise): () => void { const currentID = callbackID; callbackID++; reconnectionCallbacks[currentID] = callback; @@ -134,14 +129,14 @@ function onReconnect(callback) { /** * Delete all queued reconnection callbacks */ -function clearReconnectionCallbacks() { - _.each(_.keys(reconnectionCallbacks), (key) => delete reconnectionCallbacks[key]); +function clearReconnectionCallbacks(): void { + Object.keys(reconnectionCallbacks).forEach((key) => delete reconnectionCallbacks[key]); } /** * Refresh NetInfo state. */ -function recheckNetworkConnection() { +function recheckNetworkConnection(): void { if (hasPendingNetworkCheck) { return; } diff --git a/src/libs/Throttle.ts b/src/libs/Throttle.ts new file mode 100644 index 000000000000..1a271b479d62 --- /dev/null +++ b/src/libs/Throttle.ts @@ -0,0 +1,12 @@ +function throttle(func: (...args: unknown[]) => void, timeFrame: number): (...args: unknown[]) => void { + let lastTime = 0; + return function (...args) { + const now = new Date().getTime(); + if (now - lastTime >= timeFrame) { + func(...args); + lastTime = now; + } + }; +} + +export default throttle; From 36b69512bfede11cda937f098d35e9bc87640665 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 22 Sep 2023 16:02:08 +0200 Subject: [PATCH 17/98] fix props types --- src/components/MoneyRequestConfirmationList.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index cdcb875f163f..c04c6be55218 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -138,7 +138,7 @@ const propTypes = { isDistanceRequest: PropTypes.bool, /** A flag for verifying that the current report is a workspace */ - isPolicyExpenseChat: PropTypes.bool.isRequired, + isPolicyExpenseChat: PropTypes.bool, /* Onyx Props */ /** Collection of categories attached to a policy */ @@ -181,6 +181,7 @@ const defaultProps = { transaction: {}, mileageRate: {unit: CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES, rate: 0, currency: 'USD'}, isDistanceRequest: false, + isPolicyExpenseChat: false, }; function MoneyRequestConfirmationList(props) { From 19c4b5e6713da2adb8b6f6b400b001a3d88b6a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Fri, 22 Sep 2023 16:03:08 +0200 Subject: [PATCH 18/98] remove alert --- src/libs/NetworkConnection.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/NetworkConnection.ts b/src/libs/NetworkConnection.ts index 743b55674b8a..dea438dea7d0 100644 --- a/src/libs/NetworkConnection.ts +++ b/src/libs/NetworkConnection.ts @@ -19,7 +19,6 @@ const reconnectionCallbacks: Record Promise> = {}; * Loop over all reconnection callbacks and fire each one */ const triggerReconnectionCallbacks = throttle((reason) => { - alert('X'); Log.info(`[NetworkConnection] Firing reconnection callbacks because ${reason?.toString()}`); Object.values(reconnectionCallbacks).forEach((callback) => { callback(); From 0bcda516755ab261aa5de9aa1e72216ed0d15c78 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Tue, 26 Sep 2023 15:13:39 +0200 Subject: [PATCH 19/98] unify a fix to get report id on confirm page --- src/pages/iou/MoneyRequestCategoryPage.js | 4 +--- src/pages/iou/MoneyRequestTagPage.js | 17 +++++++++++--- .../iou/steps/MoneyRequestConfirmPage.js | 2 +- .../MoneyRequestParticipantsPage.js | 23 ++++--------------- .../MoneyRequestParticipantsSelector.js | 2 +- 5 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/pages/iou/MoneyRequestCategoryPage.js b/src/pages/iou/MoneyRequestCategoryPage.js index c18a8f1f50df..6a630c2ec705 100644 --- a/src/pages/iou/MoneyRequestCategoryPage.js +++ b/src/pages/iou/MoneyRequestCategoryPage.js @@ -90,15 +90,13 @@ export default compose( key: ONYXKEYS.IOU, }, }), - // This is a temporary hack to forward forward iou value to next getter. - // There is a problem that with one withOnyx it does not forward value from first to second. // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file withOnyx({ report: { key: ({route, iou}) => { let reportID = lodashGet(route, 'params.reportID', ''); if (!reportID) { - // When the money request creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. + // When the money request or split bill creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. // Get the report id from the participants list on the IOU object stored in Onyx. reportID = lodashGet(iou, 'participants.0.reportID', ''); } diff --git a/src/pages/iou/MoneyRequestTagPage.js b/src/pages/iou/MoneyRequestTagPage.js index 43c0cd9d1480..44adf34385c5 100644 --- a/src/pages/iou/MoneyRequestTagPage.js +++ b/src/pages/iou/MoneyRequestTagPage.js @@ -98,14 +98,25 @@ MoneyRequestTagPage.defaultProps = defaultProps; export default compose( withOnyx({ - report: { - key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${lodashGet(route, 'params.reportID')}`, - }, iou: { key: ONYXKEYS.IOU, }, }), // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file + withOnyx({ + report: { + key: ({route, iou}) => { + let reportID = lodashGet(route, 'params.reportID', ''); + if (!reportID) { + // When the money request or split bill creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. + // Get the report id from the participants list on the IOU object stored in Onyx. + reportID = lodashGet(iou, 'participants.0.reportID', ''); + } + return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; + }, + }, + }), + // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file withOnyx({ policyTags: { key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${report ? report.policyID : '0'}`, diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index ee1e346a425b..41fd36c8d8f9 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -381,7 +381,7 @@ export default compose( key: ({route, iou}) => { let reportID = lodashGet(route, 'params.reportID', ''); if (!reportID) { - // When the money request creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. + // When the money request or split bill creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. // Get the report id from the participants list on the IOU object stored in Onyx. reportID = lodashGet(iou, 'participants.0.reportID', ''); } diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index 8d745903eb40..89c18efc4e76 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -45,7 +45,6 @@ const defaultProps = { function MoneyRequestParticipantsPage({iou, selectedTab, route}) { const {translate} = useLocalize(); const prevMoneyRequestId = useRef(iou.id); - const isNewReportIDSelectedLocally = useRef(false); const optionsSelectorRef = useRef(); const iouType = useRef(lodashGet(route, 'params.iouType', '')); const reportID = useRef(lodashGet(route, 'params.reportID', '')); @@ -63,19 +62,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { setHeaderTitle(_.isEmpty(iou.participants) ? translate('tabSelector.manual') : translate('iou.split')); }, [iou.participants, isDistanceRequest, translate]); - const navigateToRequestStep = (moneyRequestType, option) => { - if (option.reportID) { - isNewReportIDSelectedLocally.current = true; - IOU.setMoneyRequestId(`${moneyRequestType}${option.reportID}`); - Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(moneyRequestType, option.reportID)); - return; - } - - IOU.setMoneyRequestId(moneyRequestType); - Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(moneyRequestType, reportID.current)); - }; - - const navigateToSplitStep = (moneyRequestType) => { + const navigateToConfirmationStep = (moneyRequestType) => { IOU.setMoneyRequestId(moneyRequestType); Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(moneyRequestType, reportID.current)); }; @@ -88,7 +75,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { // ID in Onyx could change by initiating a new request in a separate browser tab or completing a request if (prevMoneyRequestId.current !== iou.id) { // The ID is cleared on completing a request. In that case, we will do nothing - if (iou.id && !isDistanceRequest && !isSplitRequest && !isNewReportIDSelectedLocally.current) { + if (iou.id && !isDistanceRequest && !isSplitRequest) { navigateBack(true); } return; @@ -96,7 +83,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { // Reset the money request Onyx if the ID in Onyx does not match the ID from params const moneyRequestId = `${iouType.current}${reportID.current}`; - const shouldReset = iou.id !== moneyRequestId && !isNewReportIDSelectedLocally.current; + const shouldReset = iou.id !== moneyRequestId; if (shouldReset) { IOU.resetMoneyRequestInfo(moneyRequestId); } @@ -126,8 +113,8 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { ref={(el) => (optionsSelectorRef.current = el)} participants={iou.participants} onAddParticipants={IOU.setMoneyRequestParticipants} - navigateToRequest={(option) => navigateToRequestStep(CONST.IOU.MONEY_REQUEST_TYPE.REQUEST, option)} - navigateToSplit={() => navigateToSplitStep(CONST.IOU.MONEY_REQUEST_TYPE.SPLIT)} + navigateToRequest={() => navigateToConfirmationStep(CONST.IOU.MONEY_REQUEST_TYPE.REQUEST)} + navigateToSplit={() => navigateToConfirmationStep(CONST.IOU.MONEY_REQUEST_TYPE.SPLIT)} safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle} iouType={iouType.current} isDistanceRequest={isDistanceRequest} diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js index 170ee042bffa..a8da1b4ec9ed 100755 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js @@ -161,7 +161,7 @@ function MoneyRequestParticipantsSelector({ onAddParticipants([ {accountID: option.accountID, login: option.login, isPolicyExpenseChat: option.isPolicyExpenseChat, reportID: option.reportID, selected: true, searchText: option.searchText}, ]); - navigateToRequest(option); + navigateToRequest(); }; /** From 8ea4f6fea9ef17b80e2fb66b03e653da6e72e4b8 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 27 Sep 2023 15:29:48 +0700 Subject: [PATCH 20/98] fix: 28241 --- src/components/PopoverWithoutOverlay/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/PopoverWithoutOverlay/index.js b/src/components/PopoverWithoutOverlay/index.js index 778f65349969..5922aa6fd6ab 100644 --- a/src/components/PopoverWithoutOverlay/index.js +++ b/src/components/PopoverWithoutOverlay/index.js @@ -8,6 +8,7 @@ import styles from '../../styles/styles'; import * as StyleUtils from '../../styles/StyleUtils'; import getModalStyles from '../../styles/getModalStyles'; import withWindowDimensions from '../withWindowDimensions'; +import usePrevious from '../../hooks/usePrevious'; function Popover(props) { const ref = React.useRef(null); @@ -24,6 +25,7 @@ function Popover(props) { props.outerStyle, ); + const prevIsVisible = usePrevious(props.isVisible); React.useEffect(() => { if (props.isVisible) { props.onModalShow(); @@ -38,11 +40,15 @@ function Popover(props) { Modal.onModalDidClose(); } Modal.willAlertModalBecomeVisible(props.isVisible); + + if (prevIsVisible === props.isVisible) { + return; + } Modal.setCloseModal(props.isVisible ? () => props.onClose(props.anchorRef) : null); // We want this effect to run strictly ONLY when isVisible prop changes // eslint-disable-next-line react-hooks/exhaustive-deps - }, [props.isVisible]); + }, [props.isVisible, prevIsVisible]); if (!props.isVisible) { return null; From 3103995b540ee82fbbec9188af8cad4f2ab3bc1b Mon Sep 17 00:00:00 2001 From: Nicole Mendonca Date: Wed, 27 Sep 2023 16:12:05 -0400 Subject: [PATCH 21/98] Update Plan-Types.md https://github.com/Expensify/Expensify/issues/311411 --- .../getting-started/Plan-Types.md | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/articles/expensify-classic/getting-started/Plan-Types.md b/docs/articles/expensify-classic/getting-started/Plan-Types.md index f0323947ee12..c18b3902f383 100644 --- a/docs/articles/expensify-classic/getting-started/Plan-Types.md +++ b/docs/articles/expensify-classic/getting-started/Plan-Types.md @@ -2,4 +2,31 @@ title: Plan-Types description: Plan-Types --- -## Resource Coming Soon! +# Overview +You can access comprehensive information about Expensify's plans and pricing by visiting www.expensify.com/pricing. Below, we provide an overview of each plan type to assist you in selecting the one that best suits your business or personal requirements. + +## Free Plan +The Free plan is suited for small businesses, offering a dedicated workspace for efficiently handling Expensify card management, expense reimbursement, invoicing, and bill payment. This plan includes unlimited receipt scanning for all users within the company and the potential to earn up to 1% cashback on card spending exceeding $25,000 per month (across all cards). + +## Collect Workspace Plan +The Collect Workspace Plan is designed with small companies in mind, providing essential features like a single layer of expense approvals, reimbursement capabilities, corporate card management, and basic integration options such as QuickBooks Online, QuickBooks Desktop, and Xero. This plan is ideal for those who require simple expense management functions. + +## Control Workspace Plan +Our most popular option, the Control Workspace plan, offers a heightened level of control and Workspace customization. With a Control Workspace, you gain access to multi-level approval workflows, comprehensive corporate card management, advanced accounting integration, tax tracking capabilities, and advanced expense rules that facilitate the enforcement of your internal expense policy. This plan provides a robust set of features for effective expense management. + +## Individual Track Plan +The Track plan is tailored for solo Expensify users who don't require expense submission to others. Individuals or sole proprietors can choose the Track plan to customize their Individual Workspace to align with their personal expense tracking requirements. + +## Individual Submit Plan +The Submit plan is designed for individuals who need to keep track of their expenses and share them with someone else, such as their boss, accountant, or even a housemate. It's specifically tailored for single users who want to both track and submit their expenses efficiently. + +# FAQ + +## How can I change Individual plans? +You have the flexibility to switch between a Track and Submit plan, or vice versa, at any time by navigating to **Settings > Workspaces > Individual > *Workspace Name* > Plan**. This allows you to adapt your expense management approach as needed. + +## How can I upgrade Group plans? +You can easily upgrade from a Collect to a Control plan at any time by going to **Settings > Workspaces > Group > *Workspace Name* > Plan**. However, it's important to note that if you have an active Annual Subscription, downgrading from Control to Collect is not possible until your current commitment period expires. + +## How does pricing work if I have two types of Group Workspace plans? +If you have a Control and Collect Workspace, you will be charged at the Control Workspace rate. From d5f884cdb2d672ea1a9d170114707dbeb37ae614 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 28 Sep 2023 15:49:16 +0700 Subject: [PATCH 22/98] Safely catch translation key when it's wrong or missing --- src/CONST.ts | 2 ++ src/libs/Localize/index.js | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index dbe47c6ed1a7..1dcedbc58488 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -906,6 +906,7 @@ const CONST = { RECEIPTS: 'receipts@expensify.com', STUDENT_AMBASSADOR: 'studentambassadors@expensify.com', SVFG: 'svfg@expensify.com', + EXPENSIFY_EMAIL_DOMAIN: '@expensify', }, ACCOUNT_ID: { @@ -2677,6 +2678,7 @@ const CONST = { HIDDEN_MARGIN_VERTICAL: 0, HIDDEN_BORDER_BOTTOM_WIDTH: 0, }, + MISSING_TRANSLATION: 'MISSING TRANSLATION', } as const; export default CONST; diff --git a/src/libs/Localize/index.js b/src/libs/Localize/index.js index db371301f43f..e017e63ee419 100644 --- a/src/libs/Localize/index.js +++ b/src/libs/Localize/index.js @@ -2,12 +2,26 @@ import _ from 'underscore'; import lodashGet from 'lodash/get'; import Str from 'expensify-common/lib/str'; import * as RNLocalize from 'react-native-localize'; +import Onyx from 'react-native-onyx'; import Log from '../Log'; import Config from '../../CONFIG'; import translations from '../../languages/translations'; import CONST from '../../CONST'; import LocaleListener from './LocaleListener'; import BaseLocaleListener from './LocaleListener/BaseLocaleListener'; +import ONYXKEYS from '../../ONYXKEYS'; + +let userEmail; +Onyx.connect({ + key: ONYXKEYS.SESSION, + waitForCollectionCallback: true, + callback: (val) => { + if (!val) { + return; + } + userEmail = val.email; + }, +}); // Listener when an update in Onyx happens so we use the updated locale when translating/localizing items. LocaleListener.connect(); @@ -72,9 +86,12 @@ function translate(desiredLanguage = CONST.LOCALES.DEFAULT, phraseKey, phrasePar // Phrase is not found in default language, on production log an alert to server // on development throw an error - if (Config.IS_IN_PRODUCTION) { + if (Config.IS_IN_PRODUCTION || Config.IS_IN_STAGING) { const phraseString = _.isArray(phraseKey) ? phraseKey.join('.') : phraseKey; Log.alert(`${phraseString} was not found in the en locale`); + if (_.contains(userEmail, CONST.EMAIL.EXPENSIFY_EMAIL_DOMAIN)) { + return CONST.MISSING_TRANSLATION; + } return phraseString; } throw new Error(`${phraseKey} was not found in the default language`); From 8e27b0c37489590473b36530d654e28563bc233c Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 28 Sep 2023 16:05:36 +0700 Subject: [PATCH 23/98] update comment --- src/libs/Localize/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Localize/index.js b/src/libs/Localize/index.js index e017e63ee419..74ca2e22faa7 100644 --- a/src/libs/Localize/index.js +++ b/src/libs/Localize/index.js @@ -84,7 +84,7 @@ function translate(desiredLanguage = CONST.LOCALES.DEFAULT, phraseKey, phrasePar return Str.result(translatedPhrase, phraseParameters); } - // Phrase is not found in default language, on production log an alert to server + // Phrase is not found in default language, on production and staging log an alert to server // on development throw an error if (Config.IS_IN_PRODUCTION || Config.IS_IN_STAGING) { const phraseString = _.isArray(phraseKey) ? phraseKey.join('.') : phraseKey; From 6b581a9c5be6b525e40cf50ea1b2887309f8edc0 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 28 Sep 2023 13:23:45 +0200 Subject: [PATCH 24/98] clarify comment --- src/components/MoneyRequestConfirmationList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 521eb676491b..621a8e3d1b87 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -138,7 +138,7 @@ const propTypes = { /** Whether the money request is a distance request */ isDistanceRequest: PropTypes.bool, - /** A flag for verifying that the current report is a workspace */ + /** A flag for verifying that the current report is a sub-report of a workspace chat */ isPolicyExpenseChat: PropTypes.bool, /* Onyx Props */ From d21274f8221b7c18df2703f18cb49520f5ea35e8 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 28 Sep 2023 14:58:57 +0200 Subject: [PATCH 25/98] unify iou report id getter --- src/libs/actions/IOU.js | 12 ++++++++++++ src/pages/iou/MoneyRequestCategoryPage.js | 4 +--- src/pages/iou/MoneyRequestTagPage.js | 4 +--- src/pages/iou/steps/MoneyRequestConfirmPage.js | 4 +--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index e34774ef5328..d1e566fb2852 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -2333,6 +2333,17 @@ function navigateToNextPage(iou, iouType, report, path = '') { Navigation.navigate(ROUTES.MONEY_REQUEST_PARTICIPANTS.getRoute(iouType)); } +/** + * When the money request or split bill creation flow is initialized via FAB, the reportID is not passed as a navigation + * parameter. + * Gets a report id from the first participant of the IOU object stored in Onyx. + * @param {Object} iou + * @returns {String} + */ +function getIOUReportID(iou) { + return lodashGet(iou, 'participants.0.reportID', ''); +} + export { createDistanceRequest, editMoneyRequest, @@ -2363,4 +2374,5 @@ export { navigateToNextPage, updateDistanceRequest, replaceReceipt, + getIOUReportID, }; diff --git a/src/pages/iou/MoneyRequestCategoryPage.js b/src/pages/iou/MoneyRequestCategoryPage.js index 6a630c2ec705..3ef0ce6aaee1 100644 --- a/src/pages/iou/MoneyRequestCategoryPage.js +++ b/src/pages/iou/MoneyRequestCategoryPage.js @@ -96,9 +96,7 @@ export default compose( key: ({route, iou}) => { let reportID = lodashGet(route, 'params.reportID', ''); if (!reportID) { - // When the money request or split bill creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. - // Get the report id from the participants list on the IOU object stored in Onyx. - reportID = lodashGet(iou, 'participants.0.reportID', ''); + reportID = IOU.getIOUReportID(iou); } return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; }, diff --git a/src/pages/iou/MoneyRequestTagPage.js b/src/pages/iou/MoneyRequestTagPage.js index 44adf34385c5..a8ca82eed302 100644 --- a/src/pages/iou/MoneyRequestTagPage.js +++ b/src/pages/iou/MoneyRequestTagPage.js @@ -108,9 +108,7 @@ export default compose( key: ({route, iou}) => { let reportID = lodashGet(route, 'params.reportID', ''); if (!reportID) { - // When the money request or split bill creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. - // Get the report id from the participants list on the IOU object stored in Onyx. - reportID = lodashGet(iou, 'participants.0.reportID', ''); + reportID = IOU.getIOUReportID(iou); } return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; }, diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 24227c1f39ae..e199b818cfcb 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -382,9 +382,7 @@ export default compose( key: ({route, iou}) => { let reportID = lodashGet(route, 'params.reportID', ''); if (!reportID) { - // When the money request or split bill creation flow is initialized on Global Create, the reportID is not passed as a navigation parameter. - // Get the report id from the participants list on the IOU object stored in Onyx. - reportID = lodashGet(iou, 'participants.0.reportID', ''); + reportID = IOU.getIOUReportID(iou); } return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; }, From 5a5dc17214349f701e88515fece8c4ad3e90050b Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 28 Sep 2023 15:15:58 +0200 Subject: [PATCH 26/98] unify adding a category to recently used --- src/libs/PolicyUtils.js | 15 +++++++++++++++ src/libs/actions/IOU.js | 23 +++++++++-------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/libs/PolicyUtils.js b/src/libs/PolicyUtils.js index 347a825f59cc..ef8506791a21 100644 --- a/src/libs/PolicyUtils.js +++ b/src/libs/PolicyUtils.js @@ -261,6 +261,20 @@ function isPendingDeletePolicy(policy) { return policy.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; } +/** + * Creates a new array based on a previous instance of "policyRecentlyUsedCategories", + * where a new category is a first one. + * + * @param {Array} recentlyUsedPolicyCategories + * @param {String} category + * @returns {Array} + */ +function addCategoryToRecentlyUsed(recentlyUsedPolicyCategories, category) { + const uniquePolicyRecentlyUsedCategories = _.filter(recentlyUsedPolicyCategories, (recentlyUsedPolicyCategory) => recentlyUsedPolicyCategory !== category); + + return [category, ...uniquePolicyRecentlyUsedCategories]; +} + export { getActivePolicies, hasPolicyMemberError, @@ -280,4 +294,5 @@ export { getTagListName, getTagList, isPendingDeletePolicy, + addCategoryToRecentlyUsed, }; diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index d1e566fb2852..27cfc21daaf6 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -22,6 +22,7 @@ import * as Report from './Report'; import * as NumberUtils from '../NumberUtils'; import ReceiptGeneric from '../../../assets/images/receipt-generic.png'; import * as LocalePhoneNumber from '../LocalePhoneNumber'; +import * as PolicyUtils from '../PolicyUtils'; let allReports; Onyx.connect({ @@ -483,13 +484,10 @@ function getMoneyRequestInformation( let optimisticPolicyRecentlyUsedCategories; if (category) { - const uniquePolicyRecentlyUsedCategories = allRecentlyUsedCategories - ? _.filter( - allRecentlyUsedCategories[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${iouReport.policyID}`], - (recentlyUsedPolicyCategory) => recentlyUsedPolicyCategory !== category, - ) - : []; - optimisticPolicyRecentlyUsedCategories = [category, ...uniquePolicyRecentlyUsedCategories]; + optimisticPolicyRecentlyUsedCategories = PolicyUtils.addCategoryToRecentlyUsed( + allRecentlyUsedCategories[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${iouReport.policyID}`] || [], + category, + ); } const optimisticPolicyRecentlyUsedTags = {}; @@ -1150,13 +1148,10 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco // Add category to optimistic policy recently used categories when a participant is a workspace let optimisticPolicyRecentlyUsedCategories; if (category && isPolicyExpenseChat) { - const uniquePolicyRecentlyUsedCategories = allRecentlyUsedCategories - ? _.filter( - allRecentlyUsedCategories[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${participant.policyID}`], - (recentlyUsedPolicyCategory) => recentlyUsedPolicyCategory !== category, - ) - : []; - optimisticPolicyRecentlyUsedCategories = [category, ...uniquePolicyRecentlyUsedCategories]; + optimisticPolicyRecentlyUsedCategories = PolicyUtils.addCategoryToRecentlyUsed( + allRecentlyUsedCategories[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${participant.policyID}`] || [], + category, + ); } // STEP 5: Build Onyx Data From 43144a92d07b5d9ad50917f36ffaa3ce349b4f0b Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 29 Sep 2023 14:47:28 +0200 Subject: [PATCH 27/98] revert a fix --- src/libs/actions/IOU.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 27cfc21daaf6..1254cb0e6cb2 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -482,13 +482,10 @@ function getMoneyRequestInformation( billable, ); - let optimisticPolicyRecentlyUsedCategories; - if (category) { - optimisticPolicyRecentlyUsedCategories = PolicyUtils.addCategoryToRecentlyUsed( - allRecentlyUsedCategories[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${iouReport.policyID}`] || [], - category, - ); - } + const optimisticPolicyRecentlyUsedCategories = PolicyUtils.addCategoryToRecentlyUsed( + allRecentlyUsedCategories[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${iouReport.policyID}`] || [], + category, + ); const optimisticPolicyRecentlyUsedTags = {}; const recentlyUsedPolicyTags = allRecentlyUsedTags[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${iouReport.policyID}`]; From 31e4209f250d0ca7069f92e893268f0b45e9bb2a Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 29 Sep 2023 14:53:04 +0200 Subject: [PATCH 28/98] extend getIOUReportID --- src/libs/actions/IOU.js | 25 +++++++++++++++++-- src/pages/iou/MoneyRequestCategoryPage.js | 6 ++--- src/pages/iou/MoneyRequestTagPage.js | 6 ++--- .../iou/steps/MoneyRequestConfirmPage.js | 6 ++--- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 1254cb0e6cb2..23f124e61736 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -2325,15 +2325,36 @@ function navigateToNextPage(iou, iouType, report, path = '') { Navigation.navigate(ROUTES.MONEY_REQUEST_PARTICIPANTS.getRoute(iouType)); } +// route: PropTypes.shape({ +// /** Route specific parameters used on this screen via route :iouType/new/category/: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, + /** * When the money request or split bill creation flow is initialized via FAB, the reportID is not passed as a navigation * parameter. * Gets a report id from the first participant of the IOU object stored in Onyx. * @param {Object} iou + * @param {Array} iou.participants + * @param {Object} route + * @param {Object} route.params + * @param {String} [route.params.reportID] * @returns {String} */ -function getIOUReportID(iou) { - return lodashGet(iou, 'participants.0.reportID', ''); +function getIOUReportID(iou, route) { + let reportID = lodashGet(route, 'params.reportID', ''); + + if (!reportID) { + reportID = lodashGet(iou, 'participants.0.reportID', ''); + } + + return reportID; } export { diff --git a/src/pages/iou/MoneyRequestCategoryPage.js b/src/pages/iou/MoneyRequestCategoryPage.js index 3ef0ce6aaee1..5055c9f90f8a 100644 --- a/src/pages/iou/MoneyRequestCategoryPage.js +++ b/src/pages/iou/MoneyRequestCategoryPage.js @@ -94,10 +94,8 @@ export default compose( withOnyx({ report: { key: ({route, iou}) => { - let reportID = lodashGet(route, 'params.reportID', ''); - if (!reportID) { - reportID = IOU.getIOUReportID(iou); - } + const reportID = IOU.getIOUReportID(iou, route); + return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; }, }, diff --git a/src/pages/iou/MoneyRequestTagPage.js b/src/pages/iou/MoneyRequestTagPage.js index a8ca82eed302..2fc37d2c4271 100644 --- a/src/pages/iou/MoneyRequestTagPage.js +++ b/src/pages/iou/MoneyRequestTagPage.js @@ -106,10 +106,8 @@ export default compose( withOnyx({ report: { key: ({route, iou}) => { - let reportID = lodashGet(route, 'params.reportID', ''); - if (!reportID) { - reportID = IOU.getIOUReportID(iou); - } + const reportID = IOU.getIOUReportID(iou, route); + return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; }, }, diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index e199b818cfcb..429f62ab280d 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -380,10 +380,8 @@ export default compose( withOnyx({ report: { key: ({route, iou}) => { - let reportID = lodashGet(route, 'params.reportID', ''); - if (!reportID) { - reportID = IOU.getIOUReportID(iou); - } + const reportID = IOU.getIOUReportID(iou, route); + return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; }, }, From 610b1aef9f1c926fcb719b57b7727f50ed0dd2d3 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Fri, 29 Sep 2023 20:48:44 +0700 Subject: [PATCH 29/98] fix lint --- src/components/PopoverWithoutOverlay/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/PopoverWithoutOverlay/index.js b/src/components/PopoverWithoutOverlay/index.js index 5922aa6fd6ab..783d3cc2bc35 100644 --- a/src/components/PopoverWithoutOverlay/index.js +++ b/src/components/PopoverWithoutOverlay/index.js @@ -40,7 +40,6 @@ function Popover(props) { Modal.onModalDidClose(); } Modal.willAlertModalBecomeVisible(props.isVisible); - if (prevIsVisible === props.isVisible) { return; } From 3563a7c2526e0e18b63517c6ca78dbc4ea33a46c Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 29 Sep 2023 16:36:26 +0200 Subject: [PATCH 30/98] fix unit-tests --- tests/actions/IOUTest.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index 3df3b137bab3..25ae453a865e 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -57,7 +57,10 @@ describe('actions/IOU', () => { let iouAction; let transactionID; fetch.pause(); - IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', merchant, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); + Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {}).then(() => + IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', merchant, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment), + ); + return waitForBatchedUpdates() .then( () => @@ -221,6 +224,7 @@ describe('actions/IOU', () => { [createdAction.reportActionID]: createdAction, }), ) + .then(() => Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {})) .then(() => { IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return waitForBatchedUpdates(); @@ -413,6 +417,7 @@ describe('actions/IOU', () => { }), ) .then(() => Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${existingTransaction.transactionID}`, existingTransaction)) + .then(() => Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {})) .then(() => { IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return waitForBatchedUpdates(); @@ -547,7 +552,10 @@ describe('actions/IOU', () => { let iouAction; let transactionID; fetch.pause(); - IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); + Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {}).then(() => + IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment), + ); + return ( waitForBatchedUpdates() .then( @@ -901,6 +909,7 @@ describe('actions/IOU', () => { }), ) .then(() => Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${julesExistingTransaction.transactionID}`, julesExistingTransaction)) + .then(() => Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {})) .then(() => { // When we split a bill offline fetch.pause(); From c6d978669ab6949f09cb591ac03df8df804f0020 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 29 Sep 2023 18:19:41 +0200 Subject: [PATCH 31/98] simplify condition --- src/libs/actions/IOU.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 23f124e61736..d92cf866b27a 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -2348,13 +2348,7 @@ function navigateToNextPage(iou, iouType, report, path = '') { * @returns {String} */ function getIOUReportID(iou, route) { - let reportID = lodashGet(route, 'params.reportID', ''); - - if (!reportID) { - reportID = lodashGet(iou, 'participants.0.reportID', ''); - } - - return reportID; + return lodashGet(route, 'params.reportID') || lodashGet(iou, 'participants.0.reportID', ''); } export { From 2a061f0f0ae391b56bc7806908dffe6d7a7b5776 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 29 Sep 2023 18:21:14 +0200 Subject: [PATCH 32/98] Revert "fix unit-tests" This reverts commit 3563a7c2526e0e18b63517c6ca78dbc4ea33a46c. --- tests/actions/IOUTest.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index 25ae453a865e..3df3b137bab3 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -57,10 +57,7 @@ describe('actions/IOU', () => { let iouAction; let transactionID; fetch.pause(); - Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {}).then(() => - IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', merchant, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment), - ); - + IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', merchant, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return waitForBatchedUpdates() .then( () => @@ -224,7 +221,6 @@ describe('actions/IOU', () => { [createdAction.reportActionID]: createdAction, }), ) - .then(() => Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {})) .then(() => { IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return waitForBatchedUpdates(); @@ -417,7 +413,6 @@ describe('actions/IOU', () => { }), ) .then(() => Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${existingTransaction.transactionID}`, existingTransaction)) - .then(() => Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {})) .then(() => { IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return waitForBatchedUpdates(); @@ -552,10 +547,7 @@ describe('actions/IOU', () => { let iouAction; let transactionID; fetch.pause(); - Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {}).then(() => - IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment), - ); - + IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return ( waitForBatchedUpdates() .then( @@ -909,7 +901,6 @@ describe('actions/IOU', () => { }), ) .then(() => Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${julesExistingTransaction.transactionID}`, julesExistingTransaction)) - .then(() => Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {})) .then(() => { // When we split a bill offline fetch.pause(); From 56cfc89f20bdea91c7de258421bf07ef4ece17f9 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 2 Oct 2023 14:37:25 +0200 Subject: [PATCH 33/98] implement buildOptimisticPolicyRecentlyUsedCategories --- src/libs/actions/IOU.js | 29 ++++++----------------------- src/libs/actions/Policy.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 24c192e807ff..5b12b2f018d7 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -22,7 +22,7 @@ import * as Report from './Report'; import * as NumberUtils from '../NumberUtils'; import ReceiptGeneric from '../../../assets/images/receipt-generic.png'; import * as LocalePhoneNumber from '../LocalePhoneNumber'; -import * as PolicyUtils from '../PolicyUtils'; +import * as Policy from './Policy'; let allReports; Onyx.connect({ @@ -45,13 +45,6 @@ Onyx.connect({ }, }); -let allRecentlyUsedCategories = {}; -Onyx.connect({ - key: ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, - waitForCollectionCallback: true, - callback: (val) => (allRecentlyUsedCategories = val), -}); - let allRecentlyUsedTags = {}; Onyx.connect({ key: ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS, @@ -176,11 +169,7 @@ function buildOnyxDataForMoneyRequest( ]; if (!_.isEmpty(optimisticRecentlyUsedCategories)) { - optimisticData.push({ - onyxMethod: Onyx.METHOD.SET, - key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${iouReport.policyID}`, - value: optimisticRecentlyUsedCategories, - }); + optimisticData.push(optimisticRecentlyUsedCategories); } if (!_.isEmpty(optimisticPolicyRecentlyUsedTags)) { @@ -464,10 +453,7 @@ function getMoneyRequestInformation( billable, ); - const optimisticPolicyRecentlyUsedCategories = PolicyUtils.addCategoryToRecentlyUsed( - allRecentlyUsedCategories[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${iouReport.policyID}`] || [], - category, - ); + const optimisticPolicyRecentlyUsedCategories = Policy.buildOptimisticPolicyRecentlyUsedCategories(iouReport.policyID, category); const optimisticPolicyRecentlyUsedTags = {}; const recentlyUsedPolicyTags = allRecentlyUsedTags[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${iouReport.policyID}`]; @@ -1125,12 +1111,9 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco } // Add category to optimistic policy recently used categories when a participant is a workspace - let optimisticPolicyRecentlyUsedCategories; - if (category && isPolicyExpenseChat) { - optimisticPolicyRecentlyUsedCategories = PolicyUtils.addCategoryToRecentlyUsed( - allRecentlyUsedCategories[`${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${participant.policyID}`] || [], - category, - ); + let optimisticPolicyRecentlyUsedCategories = {}; + if (isPolicyExpenseChat) { + optimisticPolicyRecentlyUsedCategories = Policy.buildOptimisticPolicyRecentlyUsedCategories(participant.policyID, category); } // STEP 5: Build Onyx Data diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index fcce909c5582..b8f94ba37149 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -12,6 +12,7 @@ import * as OptionsListUtils from '../OptionsListUtils'; import * as ErrorUtils from '../ErrorUtils'; import * as ReportUtils from '../ReportUtils'; import * as PersonalDetailsUtils from '../PersonalDetailsUtils'; +import * as PolicyUtils from '../PolicyUtils'; import Log from '../Log'; const allPolicies = {}; @@ -65,6 +66,13 @@ Onyx.connect({ callback: (val) => (allPersonalDetails = val), }); +let allRecentlyUsedCategories = {}; +Onyx.connect({ + key: ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, + waitForCollectionCallback: true, + callback: (val) => (allRecentlyUsedCategories = val), +}); + /** * Stores in Onyx the policy ID of the last workspace that was accessed by the user * @param {String|null} policyID @@ -1168,6 +1176,25 @@ function clearErrors(policyID) { hideWorkspaceAlertMessage(policyID); } +/** + * @param {String} policyID + * @param {String} category + * @returns {Object} + */ +function buildOptimisticPolicyRecentlyUsedCategories(policyID, category) { + if (!policyID || !category) { + return {}; + } + + const policyRecentlyUsedCategories = lodashGet(allRecentlyUsedCategories, `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${policyID}`, []); + + return { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${policyID}`, + value: PolicyUtils.addCategoryToRecentlyUsed(policyRecentlyUsedCategories, category), + }; +} + export { removeMembers, addMembersToWorkspace, @@ -1197,4 +1224,5 @@ export { setWorkspaceInviteMembersDraft, clearErrors, openDraftWorkspaceRequest, + buildOptimisticPolicyRecentlyUsedCategories, }; From 87154dc61ab2c4599ed96ca11198fd0d807ef144 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 2 Oct 2023 17:11:44 +0200 Subject: [PATCH 34/98] remove extra helper --- src/libs/PolicyUtils.js | 15 --------------- src/libs/actions/Policy.js | 4 ++-- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/libs/PolicyUtils.js b/src/libs/PolicyUtils.js index ef8506791a21..347a825f59cc 100644 --- a/src/libs/PolicyUtils.js +++ b/src/libs/PolicyUtils.js @@ -261,20 +261,6 @@ function isPendingDeletePolicy(policy) { return policy.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; } -/** - * Creates a new array based on a previous instance of "policyRecentlyUsedCategories", - * where a new category is a first one. - * - * @param {Array} recentlyUsedPolicyCategories - * @param {String} category - * @returns {Array} - */ -function addCategoryToRecentlyUsed(recentlyUsedPolicyCategories, category) { - const uniquePolicyRecentlyUsedCategories = _.filter(recentlyUsedPolicyCategories, (recentlyUsedPolicyCategory) => recentlyUsedPolicyCategory !== category); - - return [category, ...uniquePolicyRecentlyUsedCategories]; -} - export { getActivePolicies, hasPolicyMemberError, @@ -294,5 +280,4 @@ export { getTagListName, getTagList, isPendingDeletePolicy, - addCategoryToRecentlyUsed, }; diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index b8f94ba37149..819b3163c492 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -12,7 +12,6 @@ import * as OptionsListUtils from '../OptionsListUtils'; import * as ErrorUtils from '../ErrorUtils'; import * as ReportUtils from '../ReportUtils'; import * as PersonalDetailsUtils from '../PersonalDetailsUtils'; -import * as PolicyUtils from '../PolicyUtils'; import Log from '../Log'; const allPolicies = {}; @@ -1187,11 +1186,12 @@ function buildOptimisticPolicyRecentlyUsedCategories(policyID, category) { } const policyRecentlyUsedCategories = lodashGet(allRecentlyUsedCategories, `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${policyID}`, []); + const uniquePolicyRecentlyUsedCategories = _.filter(policyRecentlyUsedCategories, (recentlyUsedPolicyCategory) => recentlyUsedPolicyCategory !== category); return { onyxMethod: Onyx.METHOD.SET, key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${policyID}`, - value: PolicyUtils.addCategoryToRecentlyUsed(policyRecentlyUsedCategories, category), + value: [category, ...uniquePolicyRecentlyUsedCategories], }; } From ddee576cd82f59be95346e5c22138aa2b54b213c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Mon, 2 Oct 2023 17:46:06 +0200 Subject: [PATCH 35/98] add properly typed throttle function --- src/libs/NetworkConnection.ts | 3 ++- src/libs/Throttle.ts | 40 ++++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/libs/NetworkConnection.ts b/src/libs/NetworkConnection.ts index dea438dea7d0..2ba9f9dd1604 100644 --- a/src/libs/NetworkConnection.ts +++ b/src/libs/NetworkConnection.ts @@ -18,7 +18,8 @@ const reconnectionCallbacks: Record Promise> = {}; /** * Loop over all reconnection callbacks and fire each one */ -const triggerReconnectionCallbacks = throttle((reason) => { +const [triggerReconnectionCallbacks] = throttle((reason: string) => { + alert(reason); Log.info(`[NetworkConnection] Firing reconnection callbacks because ${reason?.toString()}`); Object.values(reconnectionCallbacks).forEach((callback) => { callback(); diff --git a/src/libs/Throttle.ts b/src/libs/Throttle.ts index 1a271b479d62..f5e685f9bb64 100644 --- a/src/libs/Throttle.ts +++ b/src/libs/Throttle.ts @@ -1,12 +1,32 @@ -function throttle(func: (...args: unknown[]) => void, timeFrame: number): (...args: unknown[]) => void { - let lastTime = 0; - return function (...args) { - const now = new Date().getTime(); - if (now - lastTime >= timeFrame) { - func(...args); - lastTime = now; - } - }; -} +const throttle = (fn: (...args: A) => R, delay: number): [(...args: A) => R | undefined, () => void] => { + let wait = false; + let timeout: undefined | number; + let cancelled = false; + + return [ + (...args: A) => { + if (cancelled) { + return undefined; + } + if (wait) { + return undefined; + } + + const val = fn(...args); + + wait = true; + + timeout = window.setTimeout(() => { + wait = false; + }, delay); + + return val; + }, + () => { + cancelled = true; + clearTimeout(timeout); + }, + ]; +}; export default throttle; From acdbbd9c1dacbb6c5897d253ab97a83edfa29975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Mon, 2 Oct 2023 17:53:35 +0200 Subject: [PATCH 36/98] remove test code --- src/libs/NetworkConnection.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/NetworkConnection.ts b/src/libs/NetworkConnection.ts index 2ba9f9dd1604..46067b29d4f7 100644 --- a/src/libs/NetworkConnection.ts +++ b/src/libs/NetworkConnection.ts @@ -19,7 +19,6 @@ const reconnectionCallbacks: Record Promise> = {}; * Loop over all reconnection callbacks and fire each one */ const [triggerReconnectionCallbacks] = throttle((reason: string) => { - alert(reason); Log.info(`[NetworkConnection] Firing reconnection callbacks because ${reason?.toString()}`); Object.values(reconnectionCallbacks).forEach((callback) => { callback(); From 259d4bce633c044223ca856127799bb4790b04f9 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 2 Oct 2023 17:54:44 +0200 Subject: [PATCH 37/98] show category on a split bill --- src/components/MoneyRequestConfirmationList.js | 3 ++- src/pages/iou/SplitBillDetailsPage.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index c36ae3a85f0f..39e79d594f1d 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -197,7 +197,8 @@ function MoneyRequestConfirmationList(props) { const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(ReportUtils.getReport(props.reportID))), [props.reportID]); // A flag for showing the categories field - const shouldShowCategories = isPolicyExpenseChat && Permissions.canUseCategories(props.betas) && OptionsListUtils.hasEnabledOptions(_.values(props.policyCategories)); + const shouldShowCategories = + isPolicyExpenseChat && Permissions.canUseCategories(props.betas) && (props.iouCategory || OptionsListUtils.hasEnabledOptions(_.values(props.policyCategories))); // Fetches the first tag list of the policy const policyTag = PolicyUtils.getTag(props.policyTags); diff --git a/src/pages/iou/SplitBillDetailsPage.js b/src/pages/iou/SplitBillDetailsPage.js index 23da92bcc9e7..6f7e37883c85 100644 --- a/src/pages/iou/SplitBillDetailsPage.js +++ b/src/pages/iou/SplitBillDetailsPage.js @@ -1,5 +1,6 @@ import React from 'react'; import _ from 'underscore'; +import lodashGet from 'lodash/get'; import {View} from 'react-native'; import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; @@ -69,7 +70,7 @@ function SplitBillDetailsPage(props) { } const payeePersonalDetails = props.personalDetails[reportAction.actorAccountID]; const participantsExcludingPayee = _.filter(participants, (participant) => participant.accountID !== reportAction.actorAccountID); - const {amount: splitAmount, currency: splitCurrency, comment: splitComment} = ReportUtils.getTransactionDetails(transaction); + const {amount: splitAmount, currency: splitCurrency, comment: splitComment, category: splitCategory} = ReportUtils.getTransactionDetails(transaction); return ( @@ -87,9 +88,11 @@ function SplitBillDetailsPage(props) { iouAmount={splitAmount} iouComment={splitComment} iouCurrencyCode={splitCurrency} + iouCategory={splitCategory} iouType={CONST.IOU.MONEY_REQUEST_TYPE.SPLIT} isReadOnly shouldShowFooter={false} + reportID={lodashGet(props.report, 'reportID', '')} /> )} From 864154caa1deb7c384f44f09eea25356a5e8f4a2 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 2 Oct 2023 18:07:42 +0200 Subject: [PATCH 38/98] unify --- src/libs/actions/IOU.js | 12 ++++++++---- src/libs/actions/Policy.js | 8 ++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 5b12b2f018d7..26ff5f7b7773 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -117,7 +117,7 @@ function buildOnyxDataForMoneyRequest( iouAction, optimisticPersonalDetailListAction, reportPreviewAction, - optimisticRecentlyUsedCategories, + optimisticPolicyRecentlyUsedCategories, optimisticPolicyRecentlyUsedTags, isNewChatReport, isNewIOUReport, @@ -168,8 +168,12 @@ function buildOnyxDataForMoneyRequest( }, ]; - if (!_.isEmpty(optimisticRecentlyUsedCategories)) { - optimisticData.push(optimisticRecentlyUsedCategories); + if (!_.isEmpty(optimisticPolicyRecentlyUsedCategories)) { + optimisticData.push({ + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${iouReport.policyID}`, + value: optimisticPolicyRecentlyUsedCategories, + }); } if (!_.isEmpty(optimisticPolicyRecentlyUsedTags)) { @@ -1111,7 +1115,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco } // Add category to optimistic policy recently used categories when a participant is a workspace - let optimisticPolicyRecentlyUsedCategories = {}; + let optimisticPolicyRecentlyUsedCategories = []; if (isPolicyExpenseChat) { optimisticPolicyRecentlyUsedCategories = Policy.buildOptimisticPolicyRecentlyUsedCategories(participant.policyID, category); } diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 819b3163c492..f4ad81e9d62c 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -1182,17 +1182,13 @@ function clearErrors(policyID) { */ function buildOptimisticPolicyRecentlyUsedCategories(policyID, category) { if (!policyID || !category) { - return {}; + return []; } const policyRecentlyUsedCategories = lodashGet(allRecentlyUsedCategories, `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${policyID}`, []); const uniquePolicyRecentlyUsedCategories = _.filter(policyRecentlyUsedCategories, (recentlyUsedPolicyCategory) => recentlyUsedPolicyCategory !== category); - return { - onyxMethod: Onyx.METHOD.SET, - key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES}${policyID}`, - value: [category, ...uniquePolicyRecentlyUsedCategories], - }; + return [category, ...uniquePolicyRecentlyUsedCategories]; } export { From 8038e29e58d62378018e38223b7c953d9a92c053 Mon Sep 17 00:00:00 2001 From: Nicole Mendonca Date: Mon, 2 Oct 2023 19:49:51 -0400 Subject: [PATCH 39/98] Update Plan-Types.md updating description as per SEO --- docs/articles/expensify-classic/getting-started/Plan-Types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/articles/expensify-classic/getting-started/Plan-Types.md b/docs/articles/expensify-classic/getting-started/Plan-Types.md index c18b3902f383..87addc0db91d 100644 --- a/docs/articles/expensify-classic/getting-started/Plan-Types.md +++ b/docs/articles/expensify-classic/getting-started/Plan-Types.md @@ -1,6 +1,6 @@ --- title: Plan-Types -description: Plan-Types +description: Learn which Expensify plan is the best fit for you --- # Overview You can access comprehensive information about Expensify's plans and pricing by visiting www.expensify.com/pricing. Below, we provide an overview of each plan type to assist you in selecting the one that best suits your business or personal requirements. From 687730d6ef740ffcd9a40ad3f3a65ce8af64db90 Mon Sep 17 00:00:00 2001 From: Rachael Hopkins <32854888+RachCHopkins@users.noreply.github.com> Date: Tue, 3 Oct 2023 16:13:51 +1300 Subject: [PATCH 40/98] Update QuickBooks-Desktop.md --- .../QuickBooks-Desktop.md | 145 +++++++++++++++++- 1 file changed, 142 insertions(+), 3 deletions(-) diff --git a/docs/articles/expensify-classic/integrations/accounting-integrations/QuickBooks-Desktop.md b/docs/articles/expensify-classic/integrations/accounting-integrations/QuickBooks-Desktop.md index 3ee1c8656b4b..d8c7c145a670 100644 --- a/docs/articles/expensify-classic/integrations/accounting-integrations/QuickBooks-Desktop.md +++ b/docs/articles/expensify-classic/integrations/accounting-integrations/QuickBooks-Desktop.md @@ -1,5 +1,144 @@ --- -title: Coming Soon -description: Coming Soon +title: QuickBooks Desktop +description: How to connect Expensify to QuickBooks Desktop and troubleshoot issues. --- -## Resource Coming Soon! +# Overview +QuickBooks Desktop is an accounting package developed by Intuit. It is designed for small and medium-sized businesses to help them manage their financial and accounting tasks. You can connect Expensify to QuickBooks Desktop to make expense management seamless. +To connect Expensify with QuickBooks Desktop, using Right Networks as your hosting platform is best. Right Networks is a cloud-based service we recommend for this integration. If you need a Right Networks account, complete [this form](https://info.rightnetworks.com/partner-expensify) and contact a Sales Consultant to start the process. + +# How to connect to QuickBooks Desktop +Before you link your Expensify policy with QuickBooks Desktop, ensure you log in as an Admin in QuickBooks. Also, check that the company file you want to connect to is the only one open. + +## Set up submitters in QuickBooks Desktop +For a seamless integration, here are the steps to follow: +* Make sure all report submitters are set up as Vendors in QuickBooks Desktop and their Expensify email is in the "Main Email" field of their Vendor record. You can do this in the vendor section of QuickBooks. +* If you want to export reports to your users' employee records instead of vendor records, select Check or Journal Entry as your reimbursable export option. +* To set up Expensify users as employees, activate QuickBooks Desktop Payroll. This module is necessary to access the Employee Profile tab, where you can enter the submitter's email addresses. + +## Enable/install the Expensify Sync Manager +Navigate to **Settings** > **Policies** > **Group** > _[Policy Name]_ > **Connections**, select the Connect to QuickBooks Desktop radio button and click Connect to QuickBooks. + +**Enable the Expensify Sync Manager in Right Networks (recommended)** +*Please note: Single-user mode in QuickBooks Desktop is required.* +If you don't yet have an account with Right Networks, you must first contact Right Networks [here](https://info.rightnetworks.com/partner-expensify). You can enable the Expensify Sync Manager yourself from your Right Networks portal's **My Account** section or contact Right Networks for assistance. + +**OR, install the Expensify Sync Manager on Your Third-Party Remote Desktop.** +To download the Sync Manager to your desktop, you must contact your third-party remote desktop provider and request permission. They might have security restrictions, so it's best to communicate with them directly to avoid potential problems with the Sync Manager. Remember that the Sync Manager program file should be stored in the same location (i.e., the same drive) as your QuickBooks Desktop program. + +## Complete the connection +1. Open QuickBooks and access your desired Company File using the QuickBooks Admin credentials. Admin credentials are necessary for creating the connection due to permission requirements, but you won't need to stay logged in as an admin for syncing or exporting. +2. Navigate to your Expensify policy settings by going to **Settings** > **Policies** > **Group** > _[Policy Name]_ > **Connections**. Copy the Token by selecting the copy icon. +3. While QuickBooks is still running, launch the Expensify Sync Manager. Paste your Token into the Sync Manager and click **Save**. +4. Once the Sync Manager status displays **Connected**, return to Expensify and click the *Continue* button. + +## Allow access +1. Return to QuickBooks, and you'll encounter an **Application Certificate** screen. On the first page of the Certificate screen, click **Yes, always; allow access even if QuickBooks is not running** and then click **Continue**. +2. On the second page of the Certificate screen, choose the Admin user from the dropdown menu, and then click *Done* to complete this step. Note that selecting Admin here does not require you to be logged in as an admin to use this connection; it's simply selecting the appropriate permissions. +3. Head back to Expensify and patiently wait for the sync process to finish, then move on to the configuration. + +# How to configure export settings for QuickBooks Desktop +To Configure Settings, go to **Settings** > **Policies** > **Group** > _[Policy Name]_ > **Connections** and click **Configure**. + +## Preferred Exporter +This person is used in QuickBooks Desktop as the export user. They will also receive notifications for errors. + +## Date +Choose either the report's submitted date, the report's exported date, or the date of the last expense on the report when exporting reports to QuickBooks Desktop. + +## Use unique reference numbers +Enable this to allow use of a unique reference number for each transaction. Disable this to use the same Report ID for all expenses from a certain report. + +## Reimbursable expenses +* **Vendor Bill (recommended):** A single itemized vendor bill for each Expensify report. An A/P account is required to export to a vendor bill. +* **Check:** A single itemized check for each Expensify report. +* **Journal Entry:** A single itemized journal entry for each Expensify report. + +## Non-reimbursable expenses +**Credit Card Expenses:** +* Each expense will appear as a separate credit card transaction. +* The posting date will match your credit card statement. +* To display the merchant name in the payee field in QuickBooks Desktop, ensure that a matching Vendor exists in QuickBooks. Expensify searches for an exact match during export. If no match is found, the payee is mapped to a **Credit Card Misc.** Vendor created by Expensify. +* If you're centrally managing company cards through Domain Control, you can export expenses from each card to a specific QuickBooks account (detailed instructions available). + +**Debit Card Expenses:** +* Expenses export as individual itemized checks for each Expensify report. +* The check is written to the "vendor," which is the person who created or submitted the report in Expensify. + +**Vendor Bill:** +* Each Expensify report results in a single itemized vendor bill. +* The bill is associated with the "vendor," which is the individual responsible for creating or submitting the report in Expensify. + +# How to configure coding for QuickBooks Desktop +## Categories +Expensify's integration with QuickBooks brings in your Chart of Accounts as Categories in Expensify automatically. Here's how to manage them: +1. After connecting, go to **Settings** > **Policies** > **Group** > _[Policy Name]_ > **Categories** to view the accounts imported from QuickBooks Desktop. +2. You can use the enable/disable button to choose which Categories your employees can access. Additionally, you can set specific rules for each Category via the blue settings cog. +3. Expensify offers Auto-Categorization to automatically assign expenses to the appropriate expense categories. +4. If needed, you can edit the names of the imported Categories to simplify expense coding for your employees. Keep in mind that if you make changes to these accounts in QuickBooks Desktop, the category names in Expensify will update to match them during the next sync. +5. _**Important:**_ Each expense must have a category selected to export to QuickBooks Desktop. The selected category must be one imported from QuickBooks Desktop; you cannot manually create categories within Expensify policy settings. +## Classes +Classes can be imported from QuickBooks as either tags (line-item level) or report fields (header level). + +## Customers/Projects +You can bring in Customers/Projects from QuickBooks into Expensify in two ways: as tags (at the line-item level) or as report fields (at the header level). If you're utilizing Billable Expenses in Expensify, here's what you need to know: +* Customers/Projects must be enabled if you're using Billable Expenses. +* Expenses marked as "Billable" need to be tagged with a Customer/Project to successfully export them to QuickBooks. + +## Items +Items can be imported from QuickBooks as categories alongside your expense accounts. + +# FAQ +## How do I sync my connection? +1: Ensure that both the Expensify Sync Manager and QuickBooks Desktop are running. +2: On the Expensify website, navigate to **Settings** > **Policies** > **Group** > _[Policy Name]_ > **Connections** > **QuickBooks Desktop**, and click **Sync now**. +3: Wait for the syncing process to finish. Typically, this takes about 2-5 minutes, but it might take longer, depending on when you last synced and the size of your QuickBooks company file. The page will refresh automatically once syncing is complete. + +We recommend syncing at least once a week or whenever you make changes in QuickBooks Desktop that could impact how your reports export from Expensify. Changes could include adjustments to your Chart of Accounts, Vendors, Employees, Customers/Jobs, or Items. Remember, both the Sync Manager and QuickBooks Desktop need to be running for syncing or exporting to work. + +## Can I export negative expenses? +Generally, you can export negative expenses to QuickBooks Desktop successfully, regardless of your option. However, please keep in mind that if you have *Check* selected as your export option, the report's total cannot be negative. + +## How does multi-currency work with QuickBooks Desktop? +When using QuickBooks Desktop Multi-Currency, there are some limitations to consider based on your export options: +1. **Vendor Bills and Checks:** The currency of the vendor and the currency of the account must match, but they do not have to be in the home currency. +2. **Credit Card:** If an expense doesn't match an existing vendor in QuickBooks, it exports to the **Credit Card Misc.** vendor created by Expensify. When exporting a report in a currency other than your home currency, the transaction will be created under the vendor's currency with a 1:1 conversion. For example, a transaction in Expensify for $50 CAD will appear in QuickBooks as $50 USD. +3. **Journal Entries:** Multi-currency exports will fail because the account currency must match both the vendor currency and the home currency. + +# Sync and export errors +## Error: No Vendor Found For Email in QuickBooks +To address this issue, ensure that each submitter's email is saved as the **Main Email** in their Vendor record within QuickBooks Desktop. Here's how to resolve it: +1. Go to your Vendor section in QuickBooks. +2. Verify that the email mentioned in the error matches the **Main Email** field in the respective vendor's record. It's important to note that this comparison is case-sensitive, so ensure that capitalization matches as well. +3. If you prefer to export reports to your users' employee records instead of their vendor records, select either **Check** or **Journal Entry** as your reimbursable export option. If you are setting up Expensify users as employees, activate QuickBooks Desktop Payroll to access the Employee Profile tab where submitter email addresses need to be entered. +4. Once you've added the correct email to the vendor record, save this change, and then sync your policy before attempting to export the report again. + +## Error: Do Not Have Permission to Access Company Data File +To resolve this error, follow these steps: +1. Log into QuickBooks Desktop as an Admin in single-user mode. +2. Go to **Edit** > **Preferences** > **Integrated Applications** > **Company Preferences**. +3. Select the Expensify Sync Manager and click on **Properties**. +4. Ensure that **Allow this application to login automatically** is checked, and then click **OK**. Close all windows within QuickBooks. +5. If you still encounter the error after following the above steps, go to **Edit** > **Preferences** > **Integrated Applications** > **Company Preferences**, and remove the Expensify Sync Manager from the list. +6. Next, attempt to sync your policy again in Expensify. You'll be prompted to re-authorize the connection in QuickBooks. +7. Click **Yes, always; allow access even if QuickBooks is not running.** +8. From the dropdown, select the Admin user, and then click **Continue**. Note that selecting **Admin** here doesn't mean you always have to be logged in as an admin to use the connection; it's just required for setting up the connection. +9. Click **Done** on the pop-up window and return to Expensify, where your policy should complete the syncing process. + +## Error: The Wrong QuickBooks Company is Open. +This error suggests that the wrong company file is open in QuickBooks Desktop. To resolve this issue, follow these steps: +1. First, go through the general troubleshooting steps as outlined. +2. If you can confirm that the incorrect company file is open in QuickBooks, go to QuickBooks and select **File** > **Open or Restore Company** > _[Company Name]_ to open the correct company file. After doing this, try syncing your policy again. +3. If the correct company file is open, but you're still encountering the error, completely close QuickBooks Desktop, reopen the desired company file and then attempt to sync again. +4. If the error persists, log into QuickBooks as an admin in single-user mode. Then, go to **Edit** > **Preferences** > **Integrated Applications** > **Company Preferences** and remove the Expensify Sync Manager from the list. +5. Next, try syncing your policy again in Expensify. You'll be prompted to re-authorize the connection in QuickBooks, allowing you to sync successfully. +6. If the error continues even after trying the steps above, double-check that the token you see in the Sync Manager matches the token in your connection settings. + +## Error: The Expensify Sync Manager Could Not Be Reached. +To resolve this error, follow these steps: +*Note: You must be in single-user mode to sync.* + +1. Ensure that both the Sync Manager and QuickBooks Desktop are running. +2. Confirm that the Sync Manager is installed in the correct location. It should be in the same location as your QuickBooks application. If QuickBooks is on your local desktop, the Sync Manager should be there, too. If QuickBooks is on a remote server, install the Sync Manager there. +Verify that the Sync Manager's status is **Connected**. +3. If the Sync Manager status is already **Connected**, click **Edit** and then *Save* to refresh the connection. Afterwards, try syncing your policy again. +4. If the error persists, double-check that the token you see in the Sync Manager matches the token in your connection settings. From 733d2292ed299492ce90a349c92141ada9dc77cf Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Tue, 3 Oct 2023 17:07:18 +0200 Subject: [PATCH 41/98] clear category on go back --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 429f62ab280d..a508b8b22402 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -117,11 +117,15 @@ function MoneyRequestConfirmPage(props) { const navigateBack = () => { let fallback; + if (reportID.current) { fallback = ROUTES.MONEY_REQUEST.getRoute(iouType.current, reportID.current); } else { fallback = ROUTES.MONEY_REQUEST_PARTICIPANTS.getRoute(iouType.current); } + + IOU.resetMoneyRequestCategory(); + Navigation.goBack(fallback); }; From a2def14424eeed80927b641acbf9c5a7d6b68d3d Mon Sep 17 00:00:00 2001 From: Mark Louis <53453740+marklouisdeshaun@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:29:20 -0600 Subject: [PATCH 42/98] Update Tax-Exempt.md Adding tax exempt resource to the help site --- .../billing-and-subscriptions/Tax-Exempt.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/articles/expensify-classic/billing-and-subscriptions/Tax-Exempt.md b/docs/articles/expensify-classic/billing-and-subscriptions/Tax-Exempt.md index c4948b5b3083..33fbec003a91 100644 --- a/docs/articles/expensify-classic/billing-and-subscriptions/Tax-Exempt.md +++ b/docs/articles/expensify-classic/billing-and-subscriptions/Tax-Exempt.md @@ -1,5 +1,20 @@ --- title: Tax Exempt -description: Tax Exempt +description: Tax-exempt status in Expensify for organizations recognized by the IRS or local tax authorities. --- -## Resource Coming Soon! +# Overview +If your organization is recognized by the IRS or other local tax authorities as tax-exempt, that means you don’t need to pay any tax on your Expensify monthly bill. Please follow these instructions to request tax-exempt status. +# How to request tax-exempt status in Expensify +1. Go to **Settings > Account > Payments**. +1. Click on the option that says **Request Tax-Exempt Status**. +1. After you've requested tax-exempt status, Concierge (our support service) will start a conversation with you. They will ask you to upload a PDF of your tax-exempt documentation. This document should include your VAT number (or "RUT" in Chile). You can use one of the following documents: 501(c), ST-119, or a foreign tax-exempt declaration. +1. Our team will review your document and let you know if we need any more information. +1. Once everything is verified, we'll update your account accordingly. + +Once your account is marked as tax-exempt, the corresponding state tax will no longer be applied to future billing. + +If you need to remove your tax-exempt status, let your Account Manager know or contact Concierge. + +# FAQ +## What happens to my past Expensify bills that incorrectly had tax added to them? +Expensify can provide a refund for the tax you were charged on your previous bills. Please let your Account Manager know or contact Concierge if this is the case. From 485b9c638df1113fbbd999bc932beab061e8691a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Wed, 4 Oct 2023 09:49:14 +0200 Subject: [PATCH 43/98] review changes --- src/libs/NetworkConnection.ts | 24 ++++++++++++++---------- src/libs/Throttle.ts | 32 -------------------------------- 2 files changed, 14 insertions(+), 42 deletions(-) delete mode 100644 src/libs/Throttle.ts diff --git a/src/libs/NetworkConnection.ts b/src/libs/NetworkConnection.ts index 46067b29d4f7..160a3aa3dee1 100644 --- a/src/libs/NetworkConnection.ts +++ b/src/libs/NetworkConnection.ts @@ -2,11 +2,11 @@ import Onyx from 'react-native-onyx'; import NetInfo from '@react-native-community/netinfo'; import AppStateMonitor from './AppStateMonitor'; import Log from './Log'; +import throttle from 'lodash/throttle'; import * as NetworkActions from './actions/Network'; import CONFIG from '../CONFIG'; import CONST from '../CONST'; import ONYXKEYS from '../ONYXKEYS'; -import throttle from './Throttle'; let isOffline = false; let hasPendingNetworkCheck = false; @@ -18,12 +18,16 @@ const reconnectionCallbacks: Record Promise> = {}; /** * Loop over all reconnection callbacks and fire each one */ -const [triggerReconnectionCallbacks] = throttle((reason: string) => { - Log.info(`[NetworkConnection] Firing reconnection callbacks because ${reason?.toString()}`); - Object.values(reconnectionCallbacks).forEach((callback) => { - callback(); - }); -}, 5000); +const triggerReconnectionCallbacks = throttle( + (reason) => { + Log.info(`[NetworkConnection] Firing reconnection callbacks because ${reason}`); + Object.values(reconnectionCallbacks).forEach((callback) => { + callback(); + }); + }, + 5000, + {trailing: false}, +); /** * Called when the offline status of the app changes and if the network is "reconnecting" (going from offline to online) @@ -106,7 +110,7 @@ function subscribeToNetInfo(): void { }); } -function listenForReconnect(): void { +function listenForReconnect() { Log.info('[NetworkConnection] listenForReconnect called'); AppStateMonitor.addBecameActiveListener(() => { @@ -128,14 +132,14 @@ function onReconnect(callback: () => Promise): () => void { /** * Delete all queued reconnection callbacks */ -function clearReconnectionCallbacks(): void { +function clearReconnectionCallbacks() { Object.keys(reconnectionCallbacks).forEach((key) => delete reconnectionCallbacks[key]); } /** * Refresh NetInfo state. */ -function recheckNetworkConnection(): void { +function recheckNetworkConnection() { if (hasPendingNetworkCheck) { return; } diff --git a/src/libs/Throttle.ts b/src/libs/Throttle.ts deleted file mode 100644 index f5e685f9bb64..000000000000 --- a/src/libs/Throttle.ts +++ /dev/null @@ -1,32 +0,0 @@ -const throttle = (fn: (...args: A) => R, delay: number): [(...args: A) => R | undefined, () => void] => { - let wait = false; - let timeout: undefined | number; - let cancelled = false; - - return [ - (...args: A) => { - if (cancelled) { - return undefined; - } - if (wait) { - return undefined; - } - - const val = fn(...args); - - wait = true; - - timeout = window.setTimeout(() => { - wait = false; - }, delay); - - return val; - }, - () => { - cancelled = true; - clearTimeout(timeout); - }, - ]; -}; - -export default throttle; From d899d973dbe3a4d62080fb60b584241030aa73ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Wed, 4 Oct 2023 11:29:37 +0200 Subject: [PATCH 44/98] fix eslint error --- src/libs/NetworkConnection.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/NetworkConnection.ts b/src/libs/NetworkConnection.ts index 160a3aa3dee1..663a9c1b37d5 100644 --- a/src/libs/NetworkConnection.ts +++ b/src/libs/NetworkConnection.ts @@ -1,8 +1,8 @@ import Onyx from 'react-native-onyx'; import NetInfo from '@react-native-community/netinfo'; +import throttle from 'lodash/throttle'; import AppStateMonitor from './AppStateMonitor'; import Log from './Log'; -import throttle from 'lodash/throttle'; import * as NetworkActions from './actions/Network'; import CONFIG from '../CONFIG'; import CONST from '../CONST'; From 0bbe1594661356a6eabc2421dd83dbe673970f1b Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 4 Oct 2023 17:42:11 +0700 Subject: [PATCH 45/98] fix condition --- src/libs/Localize/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Localize/index.js b/src/libs/Localize/index.js index 74ca2e22faa7..d86617e4d7a0 100644 --- a/src/libs/Localize/index.js +++ b/src/libs/Localize/index.js @@ -89,7 +89,7 @@ function translate(desiredLanguage = CONST.LOCALES.DEFAULT, phraseKey, phrasePar if (Config.IS_IN_PRODUCTION || Config.IS_IN_STAGING) { const phraseString = _.isArray(phraseKey) ? phraseKey.join('.') : phraseKey; Log.alert(`${phraseString} was not found in the en locale`); - if (_.contains(userEmail, CONST.EMAIL.EXPENSIFY_EMAIL_DOMAIN)) { + if (userEmail.includes(CONST.EMAIL.EXPENSIFY_EMAIL_DOMAIN)) { return CONST.MISSING_TRANSLATION; } return phraseString; From df19f0397c1dad0a5599357098f2b0b4f6b3ae67 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 4 Oct 2023 12:56:45 +0200 Subject: [PATCH 46/98] clear values on start confirm --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index a508b8b22402..907869c0e3a4 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -78,6 +78,11 @@ function MoneyRequestConfirmPage(props) { const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(props.report)), [props.report]); const isManualRequestDM = props.selectedTab === CONST.TAB.MANUAL && iouType.current === CONST.IOU.MONEY_REQUEST_TYPE.REQUEST; + useEffect(() => { + IOU.resetMoneyRequestCategory(); + IOU.resetMoneyRequestTag(); + }, []); + useEffect(() => { const policyExpenseChat = _.find(participants, (participant) => participant.isPolicyExpenseChat); if (policyExpenseChat) { @@ -117,15 +122,11 @@ function MoneyRequestConfirmPage(props) { const navigateBack = () => { let fallback; - if (reportID.current) { fallback = ROUTES.MONEY_REQUEST.getRoute(iouType.current, reportID.current); } else { fallback = ROUTES.MONEY_REQUEST_PARTICIPANTS.getRoute(iouType.current); } - - IOU.resetMoneyRequestCategory(); - Navigation.goBack(fallback); }; From 660823422a8b9dd7cfd898fe0abb4f422605075d Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 4 Oct 2023 18:01:30 +0700 Subject: [PATCH 47/98] fix test --- src/libs/Localize/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Localize/index.js b/src/libs/Localize/index.js index d86617e4d7a0..18ce57f9f67e 100644 --- a/src/libs/Localize/index.js +++ b/src/libs/Localize/index.js @@ -11,7 +11,7 @@ import LocaleListener from './LocaleListener'; import BaseLocaleListener from './LocaleListener/BaseLocaleListener'; import ONYXKEYS from '../../ONYXKEYS'; -let userEmail; +let userEmail = ''; Onyx.connect({ key: ONYXKEYS.SESSION, waitForCollectionCallback: true, From d4c8acdbac381e4e630c1c2604d001773dbc5619 Mon Sep 17 00:00:00 2001 From: someone-here Date: Thu, 5 Oct 2023 00:07:11 +0530 Subject: [PATCH 48/98] Disable SelectCircle in split bill --- src/components/OptionRow.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/OptionRow.js b/src/components/OptionRow.js index 70415ab03a13..47ab4fe45db1 100644 --- a/src/components/OptionRow.js +++ b/src/components/OptionRow.js @@ -282,6 +282,7 @@ class OptionRow extends Component { ) : ( this.props.onSelectedStatePressed(this.props.option)} + disabled={this.state.isDisabled} accessibilityRole={CONST.ACCESSIBILITY_ROLE.CHECKBOX} accessibilityLabel={CONST.ACCESSIBILITY_ROLE.CHECKBOX} > From 7defd51ff27e0c7a4cc873fb97554c4d28cb744d Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 5 Oct 2023 11:28:30 +0100 Subject: [PATCH 49/98] add dedicated screenshot/video section to standard issue template --- .github/ISSUE_TEMPLATE/Standard.md | 56 ++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/Standard.md b/.github/ISSUE_TEMPLATE/Standard.md index 39d1c38fa56f..25493866c0e6 100644 --- a/.github/ISSUE_TEMPLATE/Standard.md +++ b/.github/ISSUE_TEMPLATE/Standard.md @@ -24,12 +24,12 @@ Can the user still use Expensify without this being fixed? Have you informed the Check off any platforms that are affected by this issue ---> Which of our officially supported platforms is this issue occurring on? -- [ ] Android / native -- [ ] Android / Chrome -- [ ] iOS / native -- [ ] iOS / Safari -- [ ] MacOS / Chrome / Safari -- [ ] MacOS / Desktop +- [ ] Android: Native +- [ ] Android: Chrome +- [ ] iOS: Native +- [ ] iOS: Safari +- [ ] MacOS: Chrome / Safari +- [ ] MacOS: Desktop **Version Number:** **Reproducible in staging?:** @@ -37,9 +37,51 @@ Which of our officially supported platforms is this issue occurring on? **If this was caught during regression testing, add the test name, ID and link from TestRail:** **Email or phone of affected tester (no customers):** **Logs:** https://stackoverflow.com/c/expensify/questions/4856 -**Notes/Photos/Videos:** Any additional supporting documentation **Expensify/Expensify Issue URL:** **Issue reported by:** **Slack conversation:** +## Screenshots/Videos +
+Android: Native + + + +
+ +
+Android: Chrome + + + +
+ +
+iOS: Native + + + +
+ +
+iOS: Safari + + + +
+ +
+MacOS: Chrome / Safari + + + +
+ +
+MacOS: Desktop + + + +
+ [View all open jobs on GitHub](https://github.com/Expensify/App/issues?q=is%3Aopen+is%3Aissue+label%3A%22Help+Wanted%22) From e4b957f8ba788e46874e3276a26fb97d42ebef35 Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 5 Oct 2023 11:30:24 +0100 Subject: [PATCH 50/98] move details to top of issue for better visibility --- .github/ISSUE_TEMPLATE/Standard.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/Standard.md b/.github/ISSUE_TEMPLATE/Standard.md index 25493866c0e6..964e27729984 100644 --- a/.github/ISSUE_TEMPLATE/Standard.md +++ b/.github/ISSUE_TEMPLATE/Standard.md @@ -7,6 +7,16 @@ labels: Bug, Daily If you haven’t already, check out our [contributing guidelines](https://github.com/Expensify/ReactNativeChat/blob/main/contributingGuides/CONTRIBUTING.md) for onboarding and email contributors@expensify.com to request to join our Slack channel! ___ +**Version Number:** +**Reproducible in staging?:** +**Reproducible in production?:** +**If this was caught during regression testing, add the test name, ID and link from TestRail:** +**Email or phone of affected tester (no customers):** +**Logs:** https://stackoverflow.com/c/expensify/questions/4856 +**Expensify/Expensify Issue URL:** +**Issue reported by:** +**Slack conversation:** + ## Action Performed: Break down in numbered steps @@ -31,16 +41,6 @@ Which of our officially supported platforms is this issue occurring on? - [ ] MacOS: Chrome / Safari - [ ] MacOS: Desktop -**Version Number:** -**Reproducible in staging?:** -**Reproducible in production?:** -**If this was caught during regression testing, add the test name, ID and link from TestRail:** -**Email or phone of affected tester (no customers):** -**Logs:** https://stackoverflow.com/c/expensify/questions/4856 -**Expensify/Expensify Issue URL:** -**Issue reported by:** -**Slack conversation:** - ## Screenshots/Videos
Android: Native From dd05a2531fc290dcaa370df0aca990810a0a4da7 Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 5 Oct 2023 11:34:43 +0100 Subject: [PATCH 51/98] align the pull request device list with the standard issue template --- .github/PULL_REQUEST_TEMPLATE.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 800888580518..2dff4583f219 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -70,12 +70,12 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c - [ ] I tested this PR with a [High Traffic account](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#high-traffic-accounts) against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability). - [ ] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms) - [ ] I ran the tests on **all platforms** & verified they passed on: - - [ ] Android / native - - [ ] Android / Chrome - - [ ] iOS / native - - [ ] iOS / Safari - - [ ] MacOS / Chrome / Safari - - [ ] MacOS / Desktop + - [ ] Android: Native + - [ ] Android: Chrome + - [ ] iOS: Native + - [ ] iOS: Safari + - [ ] MacOS: Chrome / Safari + - [ ] MacOS: Desktop - [ ] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed) - [ ] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code)) - [ ] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`) @@ -120,42 +120,42 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c ### Screenshots/Videos
-Web +Android: Native
-Mobile Web - Chrome +Android: Chrome
-Mobile Web - Safari +iOS: Native
-Desktop +iOS: Safari
-iOS +MacOS: Chrome / Safari
-Android +MacOS: Desktop From 0e2d417f688f8fddc7aaf4f841f3b711a03c102a Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 5 Oct 2023 11:36:14 +0100 Subject: [PATCH 52/98] reintroduce mWeb for clarity --- .github/ISSUE_TEMPLATE/Standard.md | 8 ++++---- .github/PULL_REQUEST_TEMPLATE.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/Standard.md b/.github/ISSUE_TEMPLATE/Standard.md index 964e27729984..5e0e3633f3bc 100644 --- a/.github/ISSUE_TEMPLATE/Standard.md +++ b/.github/ISSUE_TEMPLATE/Standard.md @@ -35,9 +35,9 @@ Check off any platforms that are affected by this issue ---> Which of our officially supported platforms is this issue occurring on? - [ ] Android: Native -- [ ] Android: Chrome +- [ ] Android: mWeb Chrome - [ ] iOS: Native -- [ ] iOS: Safari +- [ ] iOS: mWeb Safari - [ ] MacOS: Chrome / Safari - [ ] MacOS: Desktop @@ -50,7 +50,7 @@ Which of our officially supported platforms is this issue occurring on?
-Android: Chrome +Android: mWeb Chrome @@ -64,7 +64,7 @@ Which of our officially supported platforms is this issue occurring on?
-iOS: Safari +iOS: mWeb Safari diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 2dff4583f219..0396a7543b50 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -71,9 +71,9 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c - [ ] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms) - [ ] I ran the tests on **all platforms** & verified they passed on: - [ ] Android: Native - - [ ] Android: Chrome + - [ ] Android: mWeb Chrome - [ ] iOS: Native - - [ ] iOS: Safari + - [ ] iOS: mWeb Safari - [ ] MacOS: Chrome / Safari - [ ] MacOS: Desktop - [ ] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed) @@ -127,7 +127,7 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c
-Android: Chrome +Android: mWeb Chrome @@ -141,7 +141,7 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c
-iOS: Safari +iOS: mWeb Safari From 667fe65b6f65b25857a4fc0144d69631c7ff05ed Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Thu, 5 Oct 2023 11:40:19 +0100 Subject: [PATCH 53/98] align device naming across all issue templates --- .github/ISSUE_TEMPLATE/Accessibility.md | 12 ++++++------ .github/ISSUE_TEMPLATE/Performance.md | 12 ++++++------ contributingGuides/REVIEWER_CHECKLIST.md | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/Accessibility.md b/.github/ISSUE_TEMPLATE/Accessibility.md index 1323e2c17e78..97fc17d28a94 100644 --- a/.github/ISSUE_TEMPLATE/Accessibility.md +++ b/.github/ISSUE_TEMPLATE/Accessibility.md @@ -35,12 +35,12 @@ What can we do to fix the issue? Check off any platforms that are affected by this issue ---> Which of our officially supported platforms is this issue occurring on? Please only tick the box if you have provided a screen-recording in the thread for each platform: -- [ ] Android / native -- [ ] Android / Chrome -- [ ] iOS / native -- [ ] iOS / Safari -- [ ] MacOS / Chrome / Safari -- [ ] MacOS / Desktop +- [ ] Android: Native +- [ ] Android: mWeb Chrome +- [ ] iOS: Native +- [ ] iOS: mWeb Safari +- [ ] MacOS: Chrome / Safari +- [ ] MacOS: Desktop **Version Number:** **Reproducible in staging?:** diff --git a/.github/ISSUE_TEMPLATE/Performance.md b/.github/ISSUE_TEMPLATE/Performance.md index 67b2e6971874..bbb729e8af31 100644 --- a/.github/ISSUE_TEMPLATE/Performance.md +++ b/.github/ISSUE_TEMPLATE/Performance.md @@ -28,12 +28,12 @@ Note: These should be the same as the benchmarks collected before any changes. Check off any platforms that are affected by this issue ---> Which of our officially supported platforms is this issue occurring on? -- [ ] Android / native -- [ ] Android / Chrome -- [ ] iOS / native -- [ ] iOS / Safari -- [ ] MacOS / Chrome / Safari -- [ ] MacOS / Desktop +- [ ] Android: Native +- [ ] Android: mWeb Chrome +- [ ] iOS: Native +- [ ] iOS: mWeb Safari +- [ ] MacOS: Chrome / Safari +- [ ] MacOS: Desktop **Version Number:** **Reproducible in staging?:** diff --git a/contributingGuides/REVIEWER_CHECKLIST.md b/contributingGuides/REVIEWER_CHECKLIST.md index 6a5dffc8b073..d52d80a818bb 100644 --- a/contributingGuides/REVIEWER_CHECKLIST.md +++ b/contributingGuides/REVIEWER_CHECKLIST.md @@ -10,12 +10,12 @@ - [ ] I checked that screenshots or videos are included for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms) - [ ] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms) - [ ] I verified tests pass on **all platforms** & I tested again on: - - [ ] Android / native - - [ ] Android / Chrome - - [ ] iOS / native - - [ ] iOS / Safari - - [ ] MacOS / Chrome / Safari - - [ ] MacOS / Desktop + - [ ] Android: Native + - [ ] Android: mWeb Chrome + - [ ] iOS: Native + - [ ] iOS: mWeb Safari + - [ ] MacOS: Chrome / Safari + - [ ] MacOS: Desktop - [ ] If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack - [ ] I verified proper code patterns were followed (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code)) - [ ] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`). From ece54e4b92f02b1eeadfa7742177906d9d50266f Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 5 Oct 2023 13:21:28 +0200 Subject: [PATCH 54/98] add AUTO_REPORTING_FREQUENCIES --- src/CONST.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/CONST.ts b/src/CONST.ts index e98a42c973cf..e60d1d26f064 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1147,6 +1147,14 @@ const CONST = { AUDITOR: 'auditor', USER: 'user', }, + AUTO_REPORTING_FREQUENCIES: { + IMMEDIATE: 'immediate', + WEEKLY: 'weekly', + SEMI_MONTHLY: 'semimonthly', + MONTHLY: 'monthly', + TRIP: 'trip', + MANUAL: 'manual', + }, ROOM_PREFIX: '#', CUSTOM_UNIT_RATE_BASE_OFFSET: 100, OWNER_EMAIL_FAKE: '_FAKE_', From 86a32be9ce65821bed330c46537391cc970ba41a Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 5 Oct 2023 13:22:06 +0200 Subject: [PATCH 55/98] add SUBMITTED --- src/CONST.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CONST.ts b/src/CONST.ts index e60d1d26f064..f5f6b4345c93 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -476,6 +476,7 @@ const CONST = { ACTIONS: { LIMIT: 50, TYPE: { + SUBMITTED: 'SUBMITTED', APPROVED: 'APPROVED', ADDCOMMENT: 'ADDCOMMENT', CLOSED: 'CLOSED', From c4e008d14125e38e917f4107d6ac1802620c2e75 Mon Sep 17 00:00:00 2001 From: Maciej Dobosz Date: Thu, 5 Oct 2023 16:18:25 +0200 Subject: [PATCH 56/98] Migrate to Typescript --- ...useThrottledButtonState.js => useThrottledButtonState.ts} | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) rename src/hooks/{useThrottledButtonState.js => useThrottledButtonState.ts} (84%) diff --git a/src/hooks/useThrottledButtonState.js b/src/hooks/useThrottledButtonState.ts similarity index 84% rename from src/hooks/useThrottledButtonState.js rename to src/hooks/useThrottledButtonState.ts index fbf5a15e916f..12f9926799d9 100644 --- a/src/hooks/useThrottledButtonState.js +++ b/src/hooks/useThrottledButtonState.ts @@ -1,9 +1,6 @@ import {useEffect, useState} from 'react'; -/** - * @returns {Array} - */ -export default function useThrottledButtonState() { +export default function useThrottledButtonState(): [boolean, () => void] { const [isButtonActive, setIsButtonActive] = useState(true); useEffect(() => { From 68afc352640e7b3c9185bc1c0b97326b1170f318 Mon Sep 17 00:00:00 2001 From: Maciej Dobosz Date: Thu, 5 Oct 2023 16:34:41 +0200 Subject: [PATCH 57/98] Extract returned value to type --- src/hooks/useThrottledButtonState.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hooks/useThrottledButtonState.ts b/src/hooks/useThrottledButtonState.ts index 12f9926799d9..c6322d063724 100644 --- a/src/hooks/useThrottledButtonState.ts +++ b/src/hooks/useThrottledButtonState.ts @@ -1,6 +1,8 @@ import {useEffect, useState} from 'react'; -export default function useThrottledButtonState(): [boolean, () => void] { +type ThrottledButtonState = [boolean, () => void]; + +export default function useThrottledButtonState(): ThrottledButtonState { const [isButtonActive, setIsButtonActive] = useState(true); useEffect(() => { From da7d34066d70a07b1111b3eb1ea9d0bc838bd681 Mon Sep 17 00:00:00 2001 From: Artem Makushov Date: Thu, 5 Oct 2023 20:41:58 +0200 Subject: [PATCH 58/98] add submit action --- src/CONST.ts | 1 + src/libs/ReportUtils.js | 42 +++++++++++++++++++++++++++++++ src/libs/actions/IOU.js | 55 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) diff --git a/src/CONST.ts b/src/CONST.ts index 9a4e1faf170e..74cc9de8c444 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -480,6 +480,7 @@ const CONST = { ADDCOMMENT: 'ADDCOMMENT', CLOSED: 'CLOSED', CREATED: 'CREATED', + SUBMITTED: 'SUBMITTED', TASKEDITED: 'TASKEDITED', TASKCANCELLED: 'TASKCANCELLED', IOU: 'IOU', diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 7efdd7d96ca9..dc73ae0243f9 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2202,6 +2202,9 @@ function getIOUReportActionMessage(iouReportID, type, total, comment, currency, case CONST.REPORT.ACTIONS.TYPE.APPROVED: iouMessage = `approved ${amount}`; break; + case CONST.REPORT.ACTIONS.TYPE.SUBMITTED: + iouMessage = `submitted ${amount}`; + break; case CONST.IOU.REPORT_ACTION_TYPE.CREATE: iouMessage = `requested ${amount}${comment && ` for ${comment}`}`; break; @@ -2359,6 +2362,44 @@ function buildOptimisticApprovedReportAction(amount, currency, expenseReportID) }; } +/** + * Builds an optimistic SUBMITTED report action with a randomly generated reportActionID. + * + * @param {Number} amount + * @param {String} currency + * @param {Number} expenseReportID + * + * @returns {Object} + */ +function buildOptimisticSubmittedReportAction(amount, currency, expenseReportID) { + const originalMessage = { + amount, + currency, + expenseReportID, + }; + + return { + actionName: CONST.REPORT.ACTIONS.TYPE.SUBMITTED, + actorAccountID: currentUserAccountID, + automatic: false, + avatar: lodashGet(currentUserPersonalDetails, 'avatar', UserUtils.getDefaultAvatar(currentUserAccountID)), + isAttachment: false, + originalMessage, + message: getIOUReportActionMessage(expenseReportID, CONST.REPORT.ACTIONS.TYPE.SUBMITTED, Math.abs(amount), '', currency), + person: [ + { + style: 'strong', + text: lodashGet(currentUserPersonalDetails, 'displayName', currentUserEmail), + type: 'TEXT', + }, + ], + reportActionID: NumberUtils.rand64(), + shouldShow: true, + created: DateUtils.getDBTime(), + pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, + }; +} + /** * Builds an optimistic report preview action with a randomly generated reportActionID. * @@ -3831,6 +3872,7 @@ export { buildOptimisticEditedTaskReportAction, buildOptimisticIOUReport, buildOptimisticApprovedReportAction, + buildOptimisticSubmittedReportAction, buildOptimisticExpenseReport, buildOptimisticIOUReportAction, buildOptimisticReportPreview, diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index b6f193ceeef4..6e19b1824db7 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -2096,6 +2096,60 @@ function approveMoneyRequest(expenseReport) { API.write('ApproveMoneyRequest', {reportID: expenseReport.reportID, approvedReportActionID: optimisticApprovedReportAction.reportActionID}, {optimisticData, successData, failureData}); } +function submitReport(expenseReport) { + const optimisticSubmittedReportAction = ReportUtils.buildOptimisticSubmittedReportAction(expenseReport.total, expenseReport.currency, expenseReport.reportID); + + const optimisticReportActionsData = { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`, + value: { + [optimisticSubmittedReportAction.reportActionID]: { + ...optimisticSubmittedReportAction, + pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, + }, + }, + }; + const optimisticIOUReportData = { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, + value: { + ...expenseReport, + lastMessageText: optimisticSubmittedReportAction.message[0].text, + lastMessageHtml: optimisticSubmittedReportAction.message[0].html, + state: CONST.REPORT.STATE.SUBMITTED, + stateNum: CONST.REPORT.STATE_NUM.SUBMITTED, + statusNum: CONST.REPORT.STATUS.SUBMITTED, + }, + }; + const optimisticData = [optimisticIOUReportData, optimisticReportActionsData]; + + const successData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`, + value: { + [optimisticSubmittedReportAction.reportActionID]: { + pendingAction: null, + }, + }, + }, + ]; + + const failureData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`, + value: { + [expenseReport.reportActionID]: { + errors: ErrorUtils.getMicroSecondOnyxError('iou.error.other'), + }, + }, + }, + ]; + + API.write('ApproveMoneyRequest', {reportID: expenseReport.reportID, approvedReportActionID: optimisticApprovedReportAction.reportActionID}, {optimisticData, successData, failureData}); +} + /** * @param {String} paymentType * @param {Object} chatReport @@ -2311,6 +2365,7 @@ export { requestMoney, sendMoneyElsewhere, approveMoneyRequest, + submitReport, payMoneyRequest, sendMoneyWithWallet, startMoneyRequest, From 9ca8e1e47aee821a056e6dbb203a4c407c008401 Mon Sep 17 00:00:00 2001 From: Artem Makushov Date: Thu, 5 Oct 2023 20:54:29 +0200 Subject: [PATCH 59/98] lint fix --- src/libs/actions/IOU.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 6e19b1824db7..9046b94bb8e7 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -2147,7 +2147,7 @@ function submitReport(expenseReport) { }, ]; - API.write('ApproveMoneyRequest', {reportID: expenseReport.reportID, approvedReportActionID: optimisticApprovedReportAction.reportActionID}, {optimisticData, successData, failureData}); + API.write('SubmitReport', {reportID: expenseReport.reportID, submittedReportActionID: optimisticSubmittedReportAction.reportActionID}, {optimisticData, successData, failureData}); } /** From cdc45d7b2ff5bdb7b7c43a2ece692de0f18fb60d Mon Sep 17 00:00:00 2001 From: mkhutornyi Date: Thu, 5 Oct 2023 20:17:24 +0100 Subject: [PATCH 60/98] prevent focusing on composer while popover is open --- src/components/BaseMiniContextMenuItem.js | 6 ++++++ src/components/LHNOptionsList/OptionRowLHN.js | 5 +++-- src/components/Reactions/AddReactionBubble.js | 11 +++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/BaseMiniContextMenuItem.js b/src/components/BaseMiniContextMenuItem.js index 0e9085b54c17..c5c0892324c3 100644 --- a/src/components/BaseMiniContextMenuItem.js +++ b/src/components/BaseMiniContextMenuItem.js @@ -61,6 +61,12 @@ function BaseMiniContextMenuItem(props) { return; } + // Allow text input blur on right click + if (!e || e.button === 2) { + return; + } + + // Prevent text input blur on left click e.preventDefault(); }} accessibilityLabel={props.tooltipText} diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index fb6fd59870a0..a5ad8a6b707d 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -171,11 +171,12 @@ function OptionRowLHN(props) { props.onSelectRow(optionItem, popoverAnchor); }} onMouseDown={(e) => { - if (!e) { + // Allow composer blur on right click + if (!e || e.button === 2) { return; } - // Prevent losing Composer focus + // Prevent composer blur on left click e.preventDefault(); }} onSecondaryInteraction={(e) => showPopover(e)} diff --git a/src/components/Reactions/AddReactionBubble.js b/src/components/Reactions/AddReactionBubble.js index 0315c63aabf1..656188559334 100644 --- a/src/components/Reactions/AddReactionBubble.js +++ b/src/components/Reactions/AddReactionBubble.js @@ -88,8 +88,15 @@ function AddReactionBubble(props) { ref={ref} style={({hovered, pressed}) => [styles.emojiReactionBubble, styles.userSelectNone, StyleUtils.getEmojiReactionBubbleStyle(hovered || pressed, false, props.isContextMenu)]} onPress={Session.checkIfActionIsAllowed(onPress)} - // Prevent text input blur when Add reaction is clicked - onMouseDown={(e) => e.preventDefault()} + onMouseDown={(e) => { + // Allow text input blur when Add reaction is right clicked + if (!e || e.button === 2) { + return; + } + + // Prevent text input blur when Add reaction is left clicked + e.preventDefault(); + }} accessibilityLabel={props.translate('emojiReactions.addReactionTooltip')} accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON} // disable dimming From 798132ffe0158fb513a355104950e42a3be995e3 Mon Sep 17 00:00:00 2001 From: Nicole Mendonca Date: Thu, 5 Oct 2023 16:39:42 -0400 Subject: [PATCH 61/98] Update docs/articles/expensify-classic/getting-started/Plan-Types.md Co-authored-by: Rushat Gabhane --- docs/articles/expensify-classic/getting-started/Plan-Types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/articles/expensify-classic/getting-started/Plan-Types.md b/docs/articles/expensify-classic/getting-started/Plan-Types.md index 87addc0db91d..90c632ffa5cc 100644 --- a/docs/articles/expensify-classic/getting-started/Plan-Types.md +++ b/docs/articles/expensify-classic/getting-started/Plan-Types.md @@ -1,5 +1,5 @@ --- -title: Plan-Types +title: Plan Types description: Learn which Expensify plan is the best fit for you --- # Overview From f05000d4c7d69725822cf15675a9d16f8e05985e Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Fri, 6 Oct 2023 15:59:50 +0900 Subject: [PATCH 62/98] feat: add new comp for iframe --- src/components/IFrame.js | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/components/IFrame.js diff --git a/src/components/IFrame.js b/src/components/IFrame.js new file mode 100644 index 000000000000..04a6c8d43075 --- /dev/null +++ b/src/components/IFrame.js @@ -0,0 +1,62 @@ +import React, {useEffect} from 'react'; + +function getNewDotURL(url) { + const urlObj = new URL(url); + const paramString = urlObj.searchParams.get('param') ?? ''; + const pathname = urlObj.pathname.slice(1); + + let params; + try { + params = JSON.parse(paramString); + } catch { + params = {}; + } + + if (pathname === 'inbox') { + return 'home'; + } + + if (pathname === 'expenses') { + return `${params.viewMode === 'charts' ? 'insights' : 'expenses'}/${paramString}`; + } + + if (pathname === 'admin_policies') { + const {section} = params; + return section === 'individual' ? 'individual_workspaces' : 'group_workspaces'; + } + + if (pathname === 'policy') { + const workspaceID = params.policyID || ''; + const section = urlObj.hash.slice(1) || 'overview'; + + return `workspace/${workspaceID}/${section}`; + } + + if (pathname === 'settings') { + const {section} = params; + return `settings/${section}`; + } + + if (pathname.includes('domain')) { + return pathname; + } + + return pathname; +} + +export default function ReportScreen() { + useEffect(() => { + window.addEventListener('message', (event) => { + const url = event.data; + const newDotURL = getNewDotURL(url); + }); + }, []); + + return ( +