-
Notifications
You must be signed in to change notification settings - Fork 3k
/
CONST.ts
executable file
·6378 lines (6085 loc) · 208 KB
/
CONST.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
863
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* eslint-disable @typescript-eslint/naming-convention */
import {add as dateAdd} from 'date-fns';
import {sub as dateSubtract} from 'date-fns/sub';
import Config from 'react-native-config';
import * as KeyCommand from 'react-native-key-command';
import type {ValueOf} from 'type-fest';
import type {Video} from './libs/actions/Report';
import type {MileageRate} from './libs/DistanceRequestUtils';
import BankAccount from './libs/models/BankAccount';
import * as Url from './libs/Url';
import SCREENS from './SCREENS';
import type PlaidBankAccount from './types/onyx/PlaidBankAccount';
// Creating a default array and object this way because objects ({}) and arrays ([]) are not stable types.
// Freezing the array ensures that it cannot be unintentionally modified.
const EMPTY_ARRAY = Object.freeze([]);
const EMPTY_OBJECT = Object.freeze({});
const CLOUDFRONT_DOMAIN = 'cloudfront.net';
const CLOUDFRONT_URL = `https://d2k5nsl2zxldvw.${CLOUDFRONT_DOMAIN}`;
const ACTIVE_EXPENSIFY_URL = Url.addTrailingForwardSlash(Config?.NEW_EXPENSIFY_URL ?? 'https://new.expensify.com');
const USE_EXPENSIFY_URL = 'https://use.expensify.com';
const EXPENSIFY_URL = 'https://www.expensify.com';
const PLATFORM_OS_MACOS = 'Mac OS';
const PLATFORM_IOS = 'iOS';
const ANDROID_PACKAGE_NAME = 'com.expensify.chat';
const CURRENT_YEAR = new Date().getFullYear();
const PULL_REQUEST_NUMBER = Config?.PULL_REQUEST_NUMBER ?? '';
const MAX_DATE = dateAdd(new Date(), {years: 1});
const MIN_DATE = dateSubtract(new Date(), {years: 20});
const EXPENSIFY_POLICY_DOMAIN = 'expensify-policy';
const EXPENSIFY_POLICY_DOMAIN_EXTENSION = '.exfy';
const keyModifierControl = KeyCommand?.constants?.keyModifierControl ?? 'keyModifierControl';
const keyModifierCommand = KeyCommand?.constants?.keyModifierCommand ?? 'keyModifierCommand';
const keyModifierShiftControl = KeyCommand?.constants?.keyModifierShiftControl ?? 'keyModifierShiftControl';
const keyModifierShiftCommand = KeyCommand?.constants?.keyModifierShiftCommand ?? 'keyModifierShiftCommand';
const keyInputEscape = KeyCommand?.constants?.keyInputEscape ?? 'keyInputEscape';
const keyInputEnter = KeyCommand?.constants?.keyInputEnter ?? 'keyInputEnter';
const keyInputUpArrow = KeyCommand?.constants?.keyInputUpArrow ?? 'keyInputUpArrow';
const keyInputDownArrow = KeyCommand?.constants?.keyInputDownArrow ?? 'keyInputDownArrow';
const keyInputLeftArrow = KeyCommand?.constants?.keyInputLeftArrow ?? 'keyInputLeftArrow';
const keyInputRightArrow = KeyCommand?.constants?.keyInputRightArrow ?? 'keyInputRightArrow';
// describes if a shortcut key can cause navigation
const KEYBOARD_SHORTCUT_NAVIGATION_TYPE = 'NAVIGATION_SHORTCUT';
const chatTypes = {
POLICY_ANNOUNCE: 'policyAnnounce',
POLICY_ADMINS: 'policyAdmins',
TRIP_ROOM: 'tripRoom',
GROUP: 'group',
DOMAIN_ALL: 'domainAll',
POLICY_ROOM: 'policyRoom',
POLICY_EXPENSE_CHAT: 'policyExpenseChat',
SELF_DM: 'selfDM',
INVOICE: 'invoice',
SYSTEM: 'system',
} as const;
// Explicit type annotation is required
const cardActiveStates: number[] = [2, 3, 4, 7];
const selectableOnboardingChoices = {
PERSONAL_SPEND: 'newDotPersonalSpend',
MANAGE_TEAM: 'newDotManageTeam',
EMPLOYER: 'newDotEmployer',
CHAT_SPLIT: 'newDotSplitChat',
LOOKING_AROUND: 'newDotLookingAround',
} as const;
const backendOnboardingChoices = {
ADMIN: 'newDotAdmin',
SUBMIT: 'newDotSubmit',
} as const;
const onboardingChoices = {
...selectableOnboardingChoices,
...backendOnboardingChoices,
} as const;
const combinedTrackSubmitOnboardingChoices = {
PERSONAL_SPEND: selectableOnboardingChoices.PERSONAL_SPEND,
EMPLOYER: selectableOnboardingChoices.EMPLOYER,
SUBMIT: backendOnboardingChoices.SUBMIT,
} as const;
const signupQualifiers = {
INDIVIDUAL: 'individual',
VSB: 'vsb',
SMB: 'smb',
} as const;
const selfGuidedTourTask: OnboardingTask = {
type: 'viewTour',
autoCompleted: false,
title: 'Take a 2-minute tour',
description: ({navatticURL}) => `[Take a self-guided product tour](${navatticURL}) and learn about everything Expensify has to offer.`,
};
const onboardingEmployerOrSubmitMessage: OnboardingMessage = {
message: 'Getting paid back is as easy as sending a message. Let’s go over the basics.',
video: {
url: `${CLOUDFRONT_URL}/videos/guided-setup-get-paid-back-v2.mp4`,
thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-get-paid-back.jpg`,
duration: 55,
width: 1280,
height: 960,
},
tasks: [
selfGuidedTourTask,
{
type: 'submitExpense',
autoCompleted: false,
title: 'Submit an expense',
description:
'*Submit an expense* by entering an amount or scanning a receipt.\n'
'\n'
'Here’s how to submit an expense:\n'
'\n'
'1. Click the green * * button.\n'
'2. Choose *Submit expense*.\n'
'3. Enter an amount or scan a receipt.\n'
'4. Add your reimburser to the request.\n'
'\n'
'Then, send your request and wait for that sweet “Cha-ching!” when it’s complete.',
},
{
type: 'addBankAccount',
autoCompleted: false,
title: 'Add personal bank account',
description:
'You’ll need to add your personal bank account to get paid back. Don’t worry, it’s easy!\n'
'\n'
'Here’s how to set up your bank account:\n'
'\n'
'1. Click the settings tab.\n'
'2. Click *Wallet* > *Bank accounts* > * Add bank account*.\n'
'3. Connect your bank account.\n'
'\n'
'Once that’s done, you can request money from anyone and get paid back right into your personal bank account.',
},
],
};
const combinedTrackSubmitOnboardingEmployerOrSubmitMessage: OnboardingMessage = {
...onboardingEmployerOrSubmitMessage,
tasks: [
{
type: 'submitExpense',
autoCompleted: false,
title: 'Submit an expense',
description:
'*Submit an expense* by entering an amount or scanning a receipt.\n'
'\n'
'Here’s how to submit an expense:\n'
'\n'
'1. Click the green * * button.\n'
'2. Choose *Create expense*.\n'
'3. Enter an amount or scan a receipt.\n'
'4. Add your reimburser to the request.\n'
'5. Click *Submit*.\n'
'\n'
'And you’re done! Now wait for that sweet “Cha-ching!” when it’s complete.',
},
{
type: 'addBankAccount',
autoCompleted: false,
title: 'Add personal bank account',
description:
'You’ll need to add your personal bank account to get paid back. Don’t worry, it’s easy!\n'
'\n'
'Here’s how to set up your bank account:\n'
'\n'
'1. Click the settings tab.\n'
'2. Click *Wallet* > *Bank accounts* > * Add bank account*.\n'
'3. Connect your bank account.\n'
'\n'
'Once that’s done, you can request money from anyone and get paid back right into your personal bank account.',
},
],
};
const onboardingPersonalSpendMessage: OnboardingMessage = {
message: 'Here’s how to track your spend in a few clicks.',
video: {
url: `${CLOUDFRONT_URL}/videos/guided-setup-track-personal-v2.mp4`,
thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-track-personal.jpg`,
duration: 55,
width: 1280,
height: 960,
},
tasks: [
{
type: 'trackExpense',
autoCompleted: false,
title: 'Track an expense',
description:
'*Track an expense* in any currency, whether you have a receipt or not.\n'
'\n'
'Here’s how to track an expense:\n'
'\n'
'1. Click the green * * button.\n'
'2. Choose *Track expense*.\n'
'3. Enter an amount or scan a receipt.\n'
'4. Click *Track*.\n'
'\n'
'And you’re done! Yep, it’s that easy.',
},
],
};
const combinedTrackSubmitOnboardingPersonalSpendMessage: OnboardingMessage = {
...onboardingPersonalSpendMessage,
tasks: [
{
type: 'trackExpense',
autoCompleted: false,
title: 'Track an expense',
description:
'*Track an expense* in any currency, whether you have a receipt or not.\n'
'\n'
'Here’s how to track an expense:\n'
'\n'
'1. Click the green * * button.\n'
'2. Choose *Create expense*.\n'
'3. Enter an amount or scan a receipt.\n'
'4. Click "Just track it (don\'t submit it)".\n'
'5. Click *Track*.\n'
'\n'
'And you’re done! Yep, it’s that easy.',
},
],
};
type OnboardingPurpose = ValueOf<typeof onboardingChoices>;
type OnboardingCompanySize = ValueOf<typeof onboardingCompanySize>;
type OnboardingAccounting = ValueOf<typeof CONST.POLICY.CONNECTIONS.NAME> | null;
const onboardingInviteTypes = {
IOU: 'iou',
INVOICE: 'invoice',
CHAT: 'chat',
} as const;
const onboardingCompanySize = {
MICRO: '1-10',
SMALL: '11-50',
MEDIUM_SMALL: '51-100',
MEDIUM: '101-1000',
LARGE: '1001 ',
} as const;
type OnboardingInvite = ValueOf<typeof onboardingInviteTypes>;
type OnboardingTask = {
type: string;
autoCompleted: boolean;
title:
| string
| ((
params: Partial<{
integrationName: string;
}>,
) => string);
description:
| string
| ((
params: Partial<{
adminsRoomLink: string;
workspaceCategoriesLink: string;
workspaceMoreFeaturesLink: string;
workspaceMembersLink: string;
integrationName: string;
workspaceAccountingLink: string;
workspaceSettingsLink: string;
navatticURL: string;
}>,
) => string);
};
type OnboardingMessage = {
/** Text message that will be displayed first */
message: string;
/** Video object to be displayed after initial description message */
video?: Video;
/** List of tasks connected with the message, they will have a checkbox and a separate report for more information */
tasks: OnboardingTask[];
/** Type of task described in a string format */
type?: string;
};
const CONST = {
HEIC_SIGNATURES: [
'6674797068656963', // 'ftypheic' - Indicates standard HEIC file
'6674797068656978', // 'ftypheix' - Indicates a variation of HEIC
'6674797068657631', // 'ftyphevc' - Typically for HEVC encoded media (common in HEIF)
'667479706d696631', // 'ftypmif1' - Multi-Image Format part of HEIF, broader usage
],
RECENT_WAYPOINTS_NUMBER: 20,
DEFAULT_DB_NAME: 'OnyxDB',
DEFAULT_TABLE_NAME: 'keyvaluepairs',
DEFAULT_ONYX_DUMP_FILE_NAME: 'onyx-state.txt',
DEFAULT_POLICY_ROOM_CHAT_TYPES: [chatTypes.POLICY_ADMINS, chatTypes.POLICY_ANNOUNCE, chatTypes.DOMAIN_ALL],
DEFAULT_IMAGE_FILE_NAME: 'image',
DISABLED_MAX_EXPENSE_VALUE: 10000000000,
POLICY_BILLABLE_MODES: {
BILLABLE: 'billable',
NON_BILLABLE: 'nonBillable',
},
// Note: Group and Self-DM excluded as these are not tied to a Workspace
WORKSPACE_ROOM_TYPES: [chatTypes.POLICY_ADMINS, chatTypes.POLICY_ANNOUNCE, chatTypes.DOMAIN_ALL, chatTypes.POLICY_ROOM, chatTypes.POLICY_EXPENSE_CHAT, chatTypes.INVOICE],
ANDROID_PACKAGE_NAME,
WORKSPACE_ENABLE_FEATURE_REDIRECT_DELAY: 100,
ANIMATED_HIGHLIGHT_ENTRY_DELAY: 50,
ANIMATED_HIGHLIGHT_ENTRY_DURATION: 300,
ANIMATED_HIGHLIGHT_START_DELAY: 10,
ANIMATED_HIGHLIGHT_START_DURATION: 300,
ANIMATED_HIGHLIGHT_END_DELAY: 800,
ANIMATED_HIGHLIGHT_END_DURATION: 2000,
ANIMATED_TRANSITION: 300,
ANIMATED_TRANSITION_FROM_VALUE: 100,
ANIMATION_IN_TIMING: 100,
ANIMATION_DIRECTION: {
IN: 'in',
OUT: 'out',
},
POPOVER_ACCOUNT_SWITCHER_POSITION: {
horizontal: 12,
vertical: 80,
},
// Multiplier for gyroscope animation in order to make it a bit more subtle
ANIMATION_GYROSCOPE_VALUE: 0.4,
ANIMATION_PAID_DURATION: 200,
ANIMATION_PAID_CHECKMARK_DELAY: 300,
ANIMATION_PAID_BUTTON_HIDE_DELAY: 1000,
BACKGROUND_IMAGE_TRANSITION_DURATION: 1000,
SCREEN_TRANSITION_END_TIMEOUT: 1000,
ARROW_HIDE_DELAY: 3000,
MAX_IMAGE_CANVAS_AREA: 16777216,
API_ATTACHMENT_VALIDATIONS: {
// 24 megabytes in bytes, this is limit set on servers, do not update without wider internal discussion
MAX_SIZE: 25165824,
// 10 megabytes in bytes, this is limit set on servers for receipt images, do not update without wider internal discussion
RECEIPT_MAX_SIZE: 10485760,
// An arbitrary size, but the same minimum as in the PHP layer
MIN_SIZE: 240,
// Allowed extensions for receipts
ALLOWED_RECEIPT_EXTENSIONS: ['jpg', 'jpeg', 'gif', 'png', 'pdf', 'htm', 'html', 'text', 'rtf', 'doc', 'tif', 'tiff', 'msword', 'zip', 'xml', 'message'],
},
// Allowed extensions for spreadsheets import
ALLOWED_SPREADSHEET_EXTENSIONS: ['xls', 'xlsx', 'csv', 'txt'],
// This is limit set on servers, do not update without wider internal discussion
API_TRANSACTION_CATEGORY_MAX_LENGTH: 255,
AUTO_AUTH_STATE: {
NOT_STARTED: 'not-started',
SIGNING_IN: 'signing-in',
JUST_SIGNED_IN: 'just-signed-in',
FAILED: 'failed',
},
AUTH_TOKEN_TYPES: {
ANONYMOUS: 'anonymousAccount',
SUPPORT: 'support',
},
AVATAR_MAX_ATTACHMENT_SIZE: 6291456,
AVATAR_ALLOWED_EXTENSIONS: ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg'],
// Minimum width and height size in px for a selected image
AVATAR_MIN_WIDTH_PX: 80,
AVATAR_MIN_HEIGHT_PX: 80,
// Maximum width and height size in px for a selected image
AVATAR_MAX_WIDTH_PX: 4096,
AVATAR_MAX_HEIGHT_PX: 4096,
LOGO_MAX_SCALE: 1.5,
MAX_IMAGE_DIMENSION: 2400,
BREADCRUMB_TYPE: {
ROOT: 'root',
STRONG: 'strong',
NORMAL: 'normal',
},
DEFAULT_GROUP_AVATAR_COUNT: 18,
DEFAULT_AVATAR_COUNT: 24,
OLD_DEFAULT_AVATAR_COUNT: 8,
DISPLAY_NAME: {
MAX_LENGTH: 50,
RESERVED_NAMES: ['Expensify', 'Concierge'],
EXPENSIFY_CONCIERGE: 'Expensify Concierge',
},
GPS: {
// It's OK to get a cached location that is up to an hour old because the only accuracy needed is the country the user is in
MAX_AGE: 3600000,
// 15 seconds, don't wait too long because the server can always fall back to using the IP address
TIMEOUT: 15000,
},
LEGAL_NAME: {
MAX_LENGTH: 40,
},
REPORT_DESCRIPTION: {
MAX_LENGTH: 1000,
},
PULL_REQUEST_NUMBER,
// Regex to get link in href prop inside of <a/> component
REGEX_LINK_IN_ANCHOR: /<a\s (?:[^>]*?\s )?href="([^"]*)"/gi,
// Regex to read violation value from string given by backend
VIOLATION_LIMIT_REGEX: /[^0-9] /g,
MERCHANT_NAME_MAX_LENGTH: 255,
MASKED_PAN_PREFIX: 'XXXXXXXXXXXX',
REQUEST_PREVIEW: {
MAX_LENGTH: 83,
},
CALENDAR_PICKER: {
// Numbers were arbitrarily picked.
MIN_YEAR: CURRENT_YEAR - 100,
MAX_YEAR: CURRENT_YEAR 100,
MAX_DATE,
MIN_DATE,
},
DATE_BIRTH: {
MIN_AGE: 0,
MIN_AGE_FOR_PAYMENT: 18,
MAX_AGE: 150,
},
DESKTOP_SHORTCUT_ACCELERATOR: {
PASTE_AND_MATCH_STYLE: 'Option Shift CmdOrCtrl V',
PASTE_AS_PLAIN_TEXT: 'CmdOrCtrl Shift V',
},
// This is used to enable a rotation/transform style to any component.
DIRECTION: {
LEFT: 'left',
RIGHT: 'right',
},
// Sizes needed for report empty state background image handling
EMPTY_STATE_BACKGROUND: {
ASPECT_RATIO: 3.72,
OVERLAP: 60,
SMALL_SCREEN: {
IMAGE_HEIGHT: 300,
},
WIDE_SCREEN: {
IMAGE_HEIGHT: 450,
},
},
NEW_EXPENSIFY_URL: ACTIVE_EXPENSIFY_URL,
APP_DOWNLOAD_LINKS: {
ANDROID: `https://play.google.com/store/apps/details?id=${ANDROID_PACKAGE_NAME}`,
IOS: 'https://apps.apple.com/us/app/expensify-cash/id1530278510',
DESKTOP: `${ACTIVE_EXPENSIFY_URL}NewExpensify.dmg`,
OLD_DOT_ANDROID: 'https://play.google.com/store/apps/details?id=org.me.mobiexpensifyg&hl=en_US&pli=1',
OLD_DOT_IOS: 'https://apps.apple.com/us/app/expensify-expense-tracker/id471713959',
},
COMPANY_WEBSITE_DEFAULT_SCHEME: 'http',
DATE: {
SQL_DATE_TIME: 'YYYY-MM-DD HH:mm:ss',
FNS_FORMAT_STRING: 'yyyy-MM-dd',
FNS_DATE_TIME_FORMAT_STRING: 'yyyy-MM-dd HH:mm:ss',
LOCAL_TIME_FORMAT: 'h:mm a',
YEAR_MONTH_FORMAT: 'yyyyMM',
MONTH_FORMAT: 'MMMM',
WEEKDAY_TIME_FORMAT: 'eeee',
MONTH_DAY_ABBR_FORMAT: 'MMM d',
SHORT_DATE_FORMAT: 'MM-dd',
MONTH_DAY_YEAR_ABBR_FORMAT: 'MMM d, yyyy',
MONTH_DAY_YEAR_FORMAT: 'MMMM d, yyyy',
FNS_TIMEZONE_FORMAT_STRING: "yyyy-MM-dd'T'HH:mm:ssXXX",
FNS_DB_FORMAT_STRING: 'yyyy-MM-dd HH:mm:ss.SSS',
LONG_DATE_FORMAT_WITH_WEEKDAY: 'eeee, MMMM d, yyyy',
UNIX_EPOCH: '1970-01-01 00:00:00.000',
MAX_DATE: '9999-12-31',
MIN_DATE: '0001-01-01',
ORDINAL_DAY_OF_MONTH: 'do',
},
SMS: {
DOMAIN: '@expensify.sms',
},
BANK_ACCOUNT: {
BENEFICIAL_OWNER_INFO_STEP: {
SUBSTEP: {
IS_USER_UBO: 1,
IS_ANYONE_ELSE_UBO: 2,
UBO_DETAILS_FORM: 3,
ARE_THERE_MORE_UBOS: 4,
UBOS_LIST: 5,
},
BENEFICIAL_OWNER_DATA: {
BENEFICIAL_OWNER_KEYS: 'beneficialOwnerKeys',
PREFIX: 'beneficialOwner',
FIRST_NAME: 'firstName',
LAST_NAME: 'lastName',
DOB: 'dob',
SSN_LAST_4: 'ssnLast4',
STREET: 'street',
CITY: 'city',
STATE: 'state',
ZIP_CODE: 'zipCode',
},
},
PLAID: {
ALLOWED_THROTTLED_COUNT: 2,
ERROR: {
TOO_MANY_ATTEMPTS: 'Too many attempts',
},
EVENTS_NAME: {
OPEN: 'OPEN',
EXIT: 'EXIT',
},
},
ERROR: {
MISSING_ROUTING_NUMBER: '402 Missing routingNumber',
MAX_ROUTING_NUMBER: '402 Maximum Size Exceeded routingNumber',
MISSING_INCORPORATION_STATE: '402 Missing incorporationState in additionalData',
MISSING_INCORPORATION_TYPE: '402 Missing incorporationType in additionalData',
},
STEP: {
// In the order they appear in the VBA flow
BANK_ACCOUNT: 'BankAccountStep',
REQUESTOR: 'RequestorStep',
COMPANY: 'CompanyStep',
BENEFICIAL_OWNERS: 'BeneficialOwnersStep',
ACH_CONTRACT: 'ACHContractStep',
VALIDATION: 'ValidationStep',
ENABLE: 'EnableStep',
},
STEP_NAMES: ['1', '2', '3', '4', '5'],
STEPS_HEADER_HEIGHT: 40,
SUBSTEP: {
MANUAL: 'manual',
PLAID: 'plaid',
},
VERIFICATIONS: {
ERROR_MESSAGE: 'verifications.errorMessage',
THROTTLED: 'verifications.throttled',
},
FIELDS_TYPE: {
LOCAL: 'local',
},
ONFIDO_RESPONSE: {
SDK_TOKEN: 'apiResult.sdkToken',
PASS: 'pass',
},
QUESTIONS: {
QUESTION: 'apiResult.questions.question',
DIFFERENTIATOR_QUESTION: 'apiResult.differentiator-question',
},
SETUP_TYPE: {
MANUAL: 'manual',
PLAID: 'plaid',
},
REGEX: {
US_ACCOUNT_NUMBER: /^[0-9]{4,17}$/,
// The back-end is always returning account number with 4 last digits and mask the rest with X
MASKED_US_ACCOUNT_NUMBER: /^[X]{0,13}[0-9]{4}$/,
SWIFT_BIC: /^[A-Za-z0-9]{8,11}$/,
},
VERIFICATION_MAX_ATTEMPTS: 7,
STATE: {
VERIFYING: 'VERIFYING',
VALIDATING: 'VALIDATING',
SETUP: 'SETUP',
PENDING: 'PENDING',
OPEN: 'OPEN',
},
MAX_LENGTH: {
FULL_SSN: 9,
SSN: 4,
ZIP_CODE: 10,
},
TYPE: {
BUSINESS: 'BUSINESS',
PERSONAL: 'PERSONAL',
},
},
NON_USD_BANK_ACCOUNT: {
ALLOWED_FILE_TYPES: ['pdf', 'jpg', 'jpeg', 'png'],
FILE_LIMIT: 10,
TOTAL_FILES_SIZE_LIMIT: 5242880,
STEP: {
COUNTRY: 'CountryStep',
BANK_INFO: 'BankInfoStep',
BUSINESS_INFO: 'BusinessInfoStep',
BENEFICIAL_OWNER_INFO: 'BeneficialOwnerInfoStep',
SIGNER_INFO: 'SignerInfoStep',
AGREEMENTS: 'AgreementsStep',
FINISH: 'FinishStep',
},
BENEFICIAL_OWNER_INFO_STEP: {
SUBSTEP: {
IS_USER_BENEFICIAL_OWNER: 1,
IS_ANYONE_ELSE_BENEFICIAL_OWNER: 2,
BENEFICIAL_OWNER_DETAILS_FORM: 3,
ARE_THERE_MORE_BENEFICIAL_OWNERS: 4,
OWNERSHIP_CHART: 5,
BENEFICIAL_OWNERS_LIST: 6,
},
BENEFICIAL_OWNER_DATA: {
BENEFICIAL_OWNER_KEYS: 'beneficialOwnerKeys',
PREFIX: 'beneficialOwner',
FIRST_NAME: 'firstName',
LAST_NAME: 'lastName',
OWNERSHIP_PERCENTAGE: 'ownershipPercentage',
DOB: 'dob',
SSN_LAST_4: 'ssnLast4',
STREET: 'street',
CITY: 'city',
STATE: 'state',
ZIP_CODE: 'zipCode',
COUNTRY: 'country',
},
CURRENT_USER_KEY: 'currentUser',
},
STEP_NAMES: ['1', '2', '3', '4', '5', '6'],
STEP_HEADER_HEIGHT: 40,
SIGNER_INFO_STEP: {
SUBSTEP: {
IS_DIRECTOR: 1,
ENTER_EMAIL: 2,
SIGNER_DETAILS_FORM: 3,
HANG_TIGHT: 4,
},
},
},
INCORPORATION_TYPES: {
LLC: 'LLC',
CORPORATION: 'Corp',
PARTNERSHIP: 'Partnership',
COOPERATIVE: 'Cooperative',
SOLE_PROPRIETORSHIP: 'Sole Proprietorship',
OTHER: 'Other',
},
BETAS: {
ALL: 'all',
DEFAULT_ROOMS: 'defaultRooms',
DUPE_DETECTION: 'dupeDetection',
P2P_DISTANCE_REQUESTS: 'p2pDistanceRequests',
SPOTNANA_TRAVEL: 'spotnanaTravel',
REPORT_FIELDS_FEATURE: 'reportFieldsFeature',
COMPANY_CARD_FEEDS: 'companyCardFeeds',
DIRECT_FEEDS: 'directFeeds',
NETSUITE_USA_TAX: 'netsuiteUsaTax',
COMBINED_TRACK_SUBMIT: 'combinedTrackSubmit',
CATEGORY_AND_TAG_APPROVERS: 'categoryAndTagApprovers',
PER_DIEM: 'newDotPerDiem',
},
BUTTON_STATES: {
DEFAULT: 'default',
ACTIVE: 'active',
PRESSED: 'pressed',
COMPLETE: 'complete',
DISABLED: 'disabled',
},
BANK_ACCOUNT_TYPES: {
WALLET: 'WALLET',
},
COUNTRY: {
US: 'US',
MX: 'MX',
AU: 'AU',
CA: 'CA',
GB: 'GB',
},
DESKTOP_DEEPLINK_APP_STATE: {
CHECKING: 'checking',
INSTALLED: 'installed',
NOT_INSTALLED: 'not-installed',
},
TAX_RATES: {
CUSTOM_NAME_MAX_LENGTH: 8,
NAME_MAX_LENGTH: 50,
},
PLATFORM: {
IOS: 'ios',
ANDROID: 'android',
WEB: 'web',
DESKTOP: 'desktop',
MOBILEWEB: 'mobileweb',
},
PLATFORM_SPECIFIC_KEYS: {
CTRL: {
DEFAULT: 'control',
[PLATFORM_OS_MACOS]: 'meta',
[PLATFORM_IOS]: 'meta',
},
SHIFT: {
DEFAULT: 'shift',
},
},
KEYBOARD_SHORTCUTS: {
SEARCH: {
descriptionKey: 'search',
shortcutKey: 'K',
modifiers: ['CTRL'],
trigger: {
DEFAULT: {input: 'k', modifierFlags: keyModifierControl},
[PLATFORM_OS_MACOS]: {input: 'k', modifierFlags: keyModifierCommand},
[PLATFORM_IOS]: {input: 'k', modifierFlags: keyModifierCommand},
},
type: KEYBOARD_SHORTCUT_NAVIGATION_TYPE,
},
NEW_CHAT: {
descriptionKey: 'newChat',
shortcutKey: 'K',
modifiers: ['CTRL', 'SHIFT'],
trigger: {
DEFAULT: {input: 'k', modifierFlags: keyModifierShiftControl},
[PLATFORM_OS_MACOS]: {input: 'k', modifierFlags: keyModifierShiftCommand},
[PLATFORM_IOS]: {input: 'k', modifierFlags: keyModifierShiftCommand},
},
type: KEYBOARD_SHORTCUT_NAVIGATION_TYPE,
},
SHORTCUTS: {
descriptionKey: 'openShortcutDialog',
shortcutKey: 'J',
modifiers: ['CTRL'],
trigger: {
DEFAULT: {input: 'j', modifierFlags: keyModifierControl},
[PLATFORM_OS_MACOS]: {input: 'j', modifierFlags: keyModifierCommand},
[PLATFORM_IOS]: {input: 'j', modifierFlags: keyModifierCommand},
},
},
ESCAPE: {
descriptionKey: 'escape',
shortcutKey: 'Escape',
modifiers: [],
trigger: {
DEFAULT: {input: keyInputEscape},
[PLATFORM_OS_MACOS]: {input: keyInputEscape},
[PLATFORM_IOS]: {input: keyInputEscape},
},
},
ENTER: {
descriptionKey: null,
shortcutKey: 'Enter',
modifiers: [],
trigger: {
DEFAULT: {input: keyInputEnter},
[PLATFORM_OS_MACOS]: {input: keyInputEnter},
[PLATFORM_IOS]: {input: keyInputEnter},
},
},
CTRL_ENTER: {
descriptionKey: null,
shortcutKey: 'Enter',
modifiers: ['CTRL'],
trigger: {
DEFAULT: {input: keyInputEnter, modifierFlags: keyModifierControl},
[PLATFORM_OS_MACOS]: {input: keyInputEnter, modifierFlags: keyModifierCommand},
[PLATFORM_IOS]: {input: keyInputEnter, modifierFlags: keyModifierCommand},
},
},
COPY: {
descriptionKey: 'copy',
shortcutKey: 'C',
modifiers: ['CTRL'],
trigger: {
DEFAULT: {input: 'c', modifierFlags: keyModifierControl},
[PLATFORM_OS_MACOS]: {input: 'c', modifierFlags: keyModifierCommand},
[PLATFORM_IOS]: {input: 'c', modifierFlags: keyModifierCommand},
},
},
ARROW_UP: {
descriptionKey: null,
shortcutKey: 'ArrowUp',
modifiers: [],
trigger: {
DEFAULT: {input: keyInputUpArrow},
[PLATFORM_OS_MACOS]: {input: keyInputUpArrow},
[PLATFORM_IOS]: {input: keyInputUpArrow},
},
},
ARROW_DOWN: {
descriptionKey: null,
shortcutKey: 'ArrowDown',
modifiers: [],
trigger: {
DEFAULT: {input: keyInputDownArrow},
[PLATFORM_OS_MACOS]: {input: keyInputDownArrow},
[PLATFORM_IOS]: {input: keyInputDownArrow},
},
},
ARROW_LEFT: {
descriptionKey: null,
shortcutKey: 'ArrowLeft',
modifiers: [],
trigger: {
DEFAULT: {input: keyInputLeftArrow},
[PLATFORM_OS_MACOS]: {input: keyInputLeftArrow},
[PLATFORM_IOS]: {input: keyInputLeftArrow},
},
},
ARROW_RIGHT: {
descriptionKey: null,
shortcutKey: 'ArrowRight',
modifiers: [],
trigger: {
DEFAULT: {input: keyInputRightArrow},
[PLATFORM_OS_MACOS]: {input: keyInputRightArrow},
[PLATFORM_IOS]: {input: keyInputRightArrow},
},
},
TAB: {
descriptionKey: null,
shortcutKey: 'Tab',
modifiers: [],
},
DEBUG: {
descriptionKey: 'openDebug',
shortcutKey: 'D',
modifiers: ['CTRL'],
trigger: {
DEFAULT: {input: 'd', modifierFlags: keyModifierControl},
[PLATFORM_OS_MACOS]: {input: 'd', modifierFlags: keyModifierCommand},
[PLATFORM_IOS]: {input: 'd', modifierFlags: keyModifierCommand},
},
},
},
KEYBOARD_SHORTCUTS_TYPES: {
NAVIGATION_SHORTCUT: KEYBOARD_SHORTCUT_NAVIGATION_TYPE,
},
KEYBOARD_SHORTCUT_KEY_DISPLAY_NAME: {
CONTROL: 'CTRL',
ESCAPE: 'ESC',
META: 'CMD',
SHIFT: 'Shift',
},
CURRENCY: {
USD: 'USD',
AUD: 'AUD',
CAD: 'CAD',
GBP: 'GBP',
NZD: 'NZD',
EUR: 'EUR',
},
get DIRECT_REIMBURSEMENT_CURRENCIES() {
return [this.CURRENCY.USD, this.CURRENCY.AUD, this.CURRENCY.CAD, this.CURRENCY.GBP, this.CURRENCY.EUR];
},
EXAMPLE_PHONE_NUMBER: ' 15005550006',
CONCIERGE_CHAT_NAME: 'Concierge',
CLOUDFRONT_URL,
EMPTY_ARRAY,
EMPTY_OBJECT,
DEFAULT_NUMBER_ID: 0,
USE_EXPENSIFY_URL,
EXPENSIFY_URL,
GOOGLE_MEET_URL_ANDROID: 'https://meet.google.com',
GOOGLE_DOC_IMAGE_LINK_MATCH: 'googleusercontent.com',
IMAGE_BASE64_MATCH: 'base64',
DEEPLINK_BASE_URL: 'new-expensify://',
PDF_VIEWER_URL: '/pdf/web/viewer.html',
CLOUDFRONT_DOMAIN_REGEX: /^https:\/\/\w \.cloudfront\.net/i,
EXPENSIFY_ICON_URL: `${CLOUDFRONT_URL}/images/favicon-2019.png`,
CONCIERGE_ICON_URL_2021: `${CLOUDFRONT_URL}/images/icons/concierge_2021.png`,
CONCIERGE_ICON_URL: `${CLOUDFRONT_URL}/images/icons/concierge_2022.png`,
UPWORK_URL: 'https://github.com/Expensify/App/issues?q=is:open is:issue label:"Help Wanted"',
DEEP_DIVE_EXPENSIFY_CARD: 'https://community.expensify.com/discussion/4848/deep-dive-expensify-card-and-quickbooks-online-auto-reconciliation-how-it-works',
DEEP_DIVE_ERECEIPTS: 'https://community.expensify.com/discussion/5542/deep-dive-what-are-ereceipts/',
DEEP_DIVE_PER_DIEM: 'https://community.expensify.com/discussion/4772/how-to-add-a-single-rate-per-diem',
GITHUB_URL: 'https://github.com/Expensify/App',
TERMS_URL: `${EXPENSIFY_URL}/terms`,
PRIVACY_URL: `${EXPENSIFY_URL}/privacy`,
LICENSES_URL: `${USE_EXPENSIFY_URL}/licenses`,
ACH_TERMS_URL: `${EXPENSIFY_URL}/achterms`,
WALLET_AGREEMENT_URL: `${EXPENSIFY_URL}/expensify-payments-wallet-terms-of-service`,
BANCORP_WALLET_AGREEMENT_URL: `${EXPENSIFY_URL}/bancorp-bank-wallet-terms-of-service`,
HELP_LINK_URL: `${USE_EXPENSIFY_URL}/usa-patriot-act`,
ELECTRONIC_DISCLOSURES_URL: `${USE_EXPENSIFY_URL}/esignagreement`,
GITHUB_RELEASE_URL: 'https://api.github.com/repos/expensify/app/releases/latest',
ADD_SECONDARY_LOGIN_URL: encodeURI('settings?param={"section":"account","openModal":"secondaryLogin"}'),
MANAGE_CARDS_URL: 'domain_companycards',
FEES_URL: `${USE_EXPENSIFY_URL}/fees`,
SAVE_WITH_EXPENSIFY_URL: `${USE_EXPENSIFY_URL}/savings-calculator`,
CFPB_PREPAID_URL: 'https://cfpb.gov/prepaid',
STAGING_NEW_EXPENSIFY_URL: 'https://staging.new.expensify.com',
NEWHELP_URL: 'https://help.expensify.com',
INTERNAL_DEV_EXPENSIFY_URL: 'https://www.expensify.com.dev',
STAGING_EXPENSIFY_URL: 'https://staging.expensify.com',
BANK_ACCOUNT_PERSONAL_DOCUMENTATION_INFO_URL:
'https://community.expensify.com/discussion/6983/faq-why-do-i-need-to-provide-personal-documentation-when-setting-up-updating-my-bank-account',
PERSONAL_DATA_PROTECTION_INFO_URL: 'https://community.expensify.com/discussion/5677/deep-dive-security-how-expensify-protects-your-information',
ONFIDO_FACIAL_SCAN_POLICY_URL: 'https://onfido.com/facial-scan-policy-and-release/',
ONFIDO_PRIVACY_POLICY_URL: 'https://onfido.com/privacy/',
ONFIDO_TERMS_OF_SERVICE_URL: 'https://onfido.com/terms-of-service/',
LIST_OF_RESTRICTED_BUSINESSES: 'https://community.expensify.com/discussion/6191/list-of-restricted-businesses',
TRAVEL_TERMS_URL: `${EXPENSIFY_URL}/travelterms`,
EXPENSIFY_PACKAGE_FOR_SAGE_INTACCT: 'https://www.expensify.com/tools/integrations/downloadPackage',
EXPENSIFY_PACKAGE_FOR_SAGE_INTACCT_FILE_NAME: 'ExpensifyPackageForSageIntacct',
SAGE_INTACCT_INSTRUCTIONS: 'https://help.expensify.com/articles/expensify-classic/integrations/accounting-integrations/Sage-Intacct',
HOW_TO_CONNECT_TO_SAGE_INTACCT: 'https://help.expensify.com/articles/expensify-classic/integrations/accounting-integrations/Sage-Intacct#how-to-connect-to-sage-intacct',
PRICING: `https://www.expensify.com/pricing`,
COMPANY_CARDS_HELP: 'https://help.expensify.com/articles/expensify-classic/connect-credit-cards/company-cards/Commercial-Card-Feeds',
COMPANY_CARDS_STRIPE_HELP: 'https://dashboard.stripe.com/login?redirect=/expenses/settings',
COMPANY_CARDS_CONNECT_CREDIT_CARDS_HELP_URL:
'https://help.expensify.com/articles/expensify-classic/connect-credit-cards/company-cards/Commercial-Card-Feeds#what-is-the-difference-between-commercial-card-feeds-and-your-direct-bank-connections',
CUSTOM_REPORT_NAME_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/spending-insights/Custom-Templates',
CONFIGURE_REIMBURSEMENT_SETTINGS_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/workspaces/Configure-Reimbursement-Settings',
COPILOT_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/copilots-and-delegates/Assign-or-remove-a-Copilot',
DELAYED_SUBMISSION_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/reports/Automatically-submit-employee-reports',
// Use Environment.getEnvironmentURL to get the complete URL with port number
DEV_NEW_EXPENSIFY_URL: 'https://dev.new.expensify.com:',
NAVATTIC: {
ADMIN_TOUR_PRODUCTION: 'https://expensify.navattic.com/kh204a7',
ADMIN_TOUR_STAGING: 'https://expensify.navattic.com/3i300k18',
EMPLOYEE_TOUR_PRODUCTION: 'https://expensify.navattic.com/35609gb',
EMPLOYEE_TOUR_STAGING: 'https://expensify.navattic.com/cf15002s',
},
OLDDOT_URLS: {
ADMIN_POLICIES_URL: 'admin_policies',
ADMIN_DOMAINS_URL: 'admin_domains',
INBOX: 'inbox',
POLICY_CONNECTIONS_URL: (policyID: string) => `policy?param={"policyID":"${policyID}"}#connections`,
},
EXPENSIFY_POLICY_DOMAIN,
EXPENSIFY_POLICY_DOMAIN_EXTENSION,
SIGN_IN_FORM_WIDTH: 300,
REQUEST_CODE_DELAY: 30,
DEEPLINK_PROMPT_DENYLIST: [SCREENS.HOME, SCREENS.SIGN_IN_WITH_APPLE_DESKTOP, SCREENS.SIGN_IN_WITH_GOOGLE_DESKTOP],
SIGN_IN_METHOD: {
APPLE: 'Apple',
GOOGLE: 'Google',
},
OPTION_TYPE: {
REPORT: 'report',
PERSONAL_DETAIL: 'personalDetail',
},
QUICK_ACTIONS: {
REQUEST_MANUAL: 'requestManual',
REQUEST_SCAN: 'requestScan',
REQUEST_DISTANCE: 'requestDistance',
SPLIT_MANUAL: 'splitManual',
SPLIT_SCAN: 'splitScan',
SPLIT_DISTANCE: 'splitDistance',
TRACK_MANUAL: 'trackManual',
TRACK_SCAN: 'trackScan',
TRACK_DISTANCE: 'trackDistance',
ASSIGN_TASK: 'assignTask',
SEND_MONEY: 'sendMoney',
},
RECEIPT: {
ICON_SIZE: 164,
PERMISSION_GRANTED: 'granted',
HAND_ICON_HEIGHT: 152,
HAND_ICON_WIDTH: 200,
SHUTTER_SIZE: 90,
MAX_REPORT_PREVIEW_RECEIPTS: 3,
},
REPORT: {
ROLE: {
ADMIN: 'admin',
MEMBER: 'member',
},
MAX_COUNT_BEFORE_FOCUS_UPDATE: 30,
MIN_INITIAL_REPORT_ACTION_COUNT: 15,
UNREPORTED_REPORTID: '0',
SPLIT_REPORTID: '-2',
ACTIONS: {