/
chat2-gen.tsx
2352 lines (2347 loc) · 86.4 KB
/
chat2-gen.tsx
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
594
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
// NOTE: This file is GENERATED from json files in actions/json. Run 'yarn build-actions' to regenerate
import * as RPCTypes from '../constants/types/rpc-gen'
import * as RPCChatTypes from '../constants/types/rpc-chat-gen'
import * as Types from '../constants/types/chat2'
import * as TeamsTypes from '../constants/types/teams'
import HiddenString from '../util/hidden-string'
import {RetentionPolicy} from '../constants/types/retention-policy'
import {AmpTracker} from '../chat/audio/amptracker'
// Constants
export const resetStore = 'common:resetStore' // not a part of chat2 but is handled by every reducer. NEVER dispatch this
export const typePrefix = 'chat2:'
export const addAttachmentViewMessage = 'chat2:addAttachmentViewMessage'
export const addBotMember = 'chat2:addBotMember'
export const addUsersToChannel = 'chat2:addUsersToChannel'
export const attachmentDownload = 'chat2:attachmentDownload'
export const attachmentDownloaded = 'chat2:attachmentDownloaded'
export const attachmentFullscreenNext = 'chat2:attachmentFullscreenNext'
export const attachmentFullscreenSelection = 'chat2:attachmentFullscreenSelection'
export const attachmentLoading = 'chat2:attachmentLoading'
export const attachmentMobileSave = 'chat2:attachmentMobileSave'
export const attachmentMobileSaved = 'chat2:attachmentMobileSaved'
export const attachmentPasted = 'chat2:attachmentPasted'
export const attachmentPreviewSelect = 'chat2:attachmentPreviewSelect'
export const attachmentUploaded = 'chat2:attachmentUploaded'
export const attachmentUploading = 'chat2:attachmentUploading'
export const attachmentsUpload = 'chat2:attachmentsUpload'
export const attemptAudioRecording = 'chat2:attemptAudioRecording'
export const badgesUpdated = 'chat2:badgesUpdated'
export const blockConversation = 'chat2:blockConversation'
export const changeFocus = 'chat2:changeFocus'
export const clearAttachmentView = 'chat2:clearAttachmentView'
export const clearCommandStatusInfo = 'chat2:clearCommandStatusInfo'
export const clearMessages = 'chat2:clearMessages'
export const clearMetas = 'chat2:clearMetas'
export const clearPaymentConfirmInfo = 'chat2:clearPaymentConfirmInfo'
export const confirmScreenResponse = 'chat2:confirmScreenResponse'
export const conversationErrored = 'chat2:conversationErrored'
export const createConversation = 'chat2:createConversation'
export const deselectConversation = 'chat2:deselectConversation'
export const desktopNotification = 'chat2:desktopNotification'
export const dismissBlockButtons = 'chat2:dismissBlockButtons'
export const dismissBottomBanner = 'chat2:dismissBottomBanner'
export const editBotSettings = 'chat2:editBotSettings'
export const enableAudioRecording = 'chat2:enableAudioRecording'
export const giphyGotSearchResult = 'chat2:giphyGotSearchResult'
export const giphySend = 'chat2:giphySend'
export const giphyToggleWindow = 'chat2:giphyToggleWindow'
export const handleSeeingWallets = 'chat2:handleSeeingWallets'
export const hideConversation = 'chat2:hideConversation'
export const ignorePinnedMessage = 'chat2:ignorePinnedMessage'
export const inboxRefresh = 'chat2:inboxRefresh'
export const inboxSearch = 'chat2:inboxSearch'
export const inboxSearchMoveSelectedIndex = 'chat2:inboxSearchMoveSelectedIndex'
export const inboxSearchNameResults = 'chat2:inboxSearchNameResults'
export const inboxSearchSelect = 'chat2:inboxSearchSelect'
export const inboxSearchSetIndexPercent = 'chat2:inboxSearchSetIndexPercent'
export const inboxSearchSetTextStatus = 'chat2:inboxSearchSetTextStatus'
export const inboxSearchStarted = 'chat2:inboxSearchStarted'
export const inboxSearchTextResult = 'chat2:inboxSearchTextResult'
export const joinConversation = 'chat2:joinConversation'
export const jumpToRecent = 'chat2:jumpToRecent'
export const leaveConversation = 'chat2:leaveConversation'
export const loadAttachmentView = 'chat2:loadAttachmentView'
export const loadMessagesCentered = 'chat2:loadMessagesCentered'
export const loadMoreSmalls = 'chat2:loadMoreSmalls'
export const loadNewerMessagesDueToScroll = 'chat2:loadNewerMessagesDueToScroll'
export const loadNextBotPage = 'chat2:loadNextBotPage'
export const loadOlderMessagesDueToScroll = 'chat2:loadOlderMessagesDueToScroll'
export const lockAudioRecording = 'chat2:lockAudioRecording'
export const markConversationsStale = 'chat2:markConversationsStale'
export const markInitiallyLoadedThreadAsRead = 'chat2:markInitiallyLoadedThreadAsRead'
export const messageAttachmentNativeSave = 'chat2:messageAttachmentNativeSave'
export const messageAttachmentNativeShare = 'chat2:messageAttachmentNativeShare'
export const messageAttachmentUploaded = 'chat2:messageAttachmentUploaded'
export const messageDelete = 'chat2:messageDelete'
export const messageDeleteHistory = 'chat2:messageDeleteHistory'
export const messageEdit = 'chat2:messageEdit'
export const messageErrored = 'chat2:messageErrored'
export const messageReplyPrivately = 'chat2:messageReplyPrivately'
export const messageRetry = 'chat2:messageRetry'
export const messageSend = 'chat2:messageSend'
export const messageSendByUsernames = 'chat2:messageSendByUsernames'
export const messageSetEditing = 'chat2:messageSetEditing'
export const messageSetQuoting = 'chat2:messageSetQuoting'
export const messageWasEdited = 'chat2:messageWasEdited'
export const messagesAdd = 'chat2:messagesAdd'
export const messagesExploded = 'chat2:messagesExploded'
export const messagesWereDeleted = 'chat2:messagesWereDeleted'
export const metaDelete = 'chat2:metaDelete'
export const metaHandleQueue = 'chat2:metaHandleQueue'
export const metaNeedsUpdating = 'chat2:metaNeedsUpdating'
export const metaReceivedError = 'chat2:metaReceivedError'
export const metaRequestTrusted = 'chat2:metaRequestTrusted'
export const metaRequestingTrusted = 'chat2:metaRequestingTrusted'
export const metasReceived = 'chat2:metasReceived'
export const muteConversation = 'chat2:muteConversation'
export const navigateToInbox = 'chat2:navigateToInbox'
export const navigateToThread = 'chat2:navigateToThread'
export const notificationSettingsUpdated = 'chat2:notificationSettingsUpdated'
export const openChatFromWidget = 'chat2:openChatFromWidget'
export const openFolder = 'chat2:openFolder'
export const paymentInfoReceived = 'chat2:paymentInfoReceived'
export const pendingMessageWasEdited = 'chat2:pendingMessageWasEdited'
export const pinMessage = 'chat2:pinMessage'
export const prepareFulfillRequestForm = 'chat2:prepareFulfillRequestForm'
export const previewConversation = 'chat2:previewConversation'
export const refreshBotPublicCommands = 'chat2:refreshBotPublicCommands'
export const refreshBotSettings = 'chat2:refreshBotSettings'
export const removeBotMember = 'chat2:removeBotMember'
export const replyJump = 'chat2:replyJump'
export const requestInfoReceived = 'chat2:requestInfoReceived'
export const resetChatWithoutThem = 'chat2:resetChatWithoutThem'
export const resetLetThemIn = 'chat2:resetLetThemIn'
export const resetSmalls = 'chat2:resetSmalls'
export const resolveMaybeMention = 'chat2:resolveMaybeMention'
export const saveMinWriterRole = 'chat2:saveMinWriterRole'
export const selectConversation = 'chat2:selectConversation'
export const sendAudioRecording = 'chat2:sendAudioRecording'
export const sendTyping = 'chat2:sendTyping'
export const setAttachmentViewStatus = 'chat2:setAttachmentViewStatus'
export const setAudioRecordingPostInfo = 'chat2:setAudioRecordingPostInfo'
export const setBotPublicCommands = 'chat2:setBotPublicCommands'
export const setBotSettings = 'chat2:setBotSettings'
export const setChannelSearchText = 'chat2:setChannelSearchText'
export const setCommandMarkdown = 'chat2:setCommandMarkdown'
export const setCommandStatusInfo = 'chat2:setCommandStatusInfo'
export const setContainsLastMessage = 'chat2:setContainsLastMessage'
export const setConvExplodingMode = 'chat2:setConvExplodingMode'
export const setConvRetentionPolicy = 'chat2:setConvRetentionPolicy'
export const setConversationOffline = 'chat2:setConversationOffline'
export const setExplodingModeLock = 'chat2:setExplodingModeLock'
export const setInboxNumSmallRows = 'chat2:setInboxNumSmallRows'
export const setInboxShowIsNew = 'chat2:setInboxShowIsNew'
export const setLoadedBotPage = 'chat2:setLoadedBotPage'
export const setMaybeMentionInfo = 'chat2:setMaybeMentionInfo'
export const setMinWriterRole = 'chat2:setMinWriterRole'
export const setPaymentConfirmInfo = 'chat2:setPaymentConfirmInfo'
export const setPrependText = 'chat2:setPrependText'
export const setThreadLoadStatus = 'chat2:setThreadLoadStatus'
export const setThreadSearchQuery = 'chat2:setThreadSearchQuery'
export const setThreadSearchStatus = 'chat2:setThreadSearchStatus'
export const setUnsentText = 'chat2:setUnsentText'
export const setWalletsOld = 'chat2:setWalletsOld'
export const staticConfigLoaded = 'chat2:staticConfigLoaded'
export const stopAudioRecording = 'chat2:stopAudioRecording'
export const tabSelected = 'chat2:tabSelected'
export const threadSearch = 'chat2:threadSearch'
export const threadSearchResults = 'chat2:threadSearchResults'
export const toggleGiphyPrefill = 'chat2:toggleGiphyPrefill'
export const toggleInboxSearch = 'chat2:toggleInboxSearch'
export const toggleInfoPanel = 'chat2:toggleInfoPanel'
export const toggleLocalReaction = 'chat2:toggleLocalReaction'
export const toggleMessageCollapse = 'chat2:toggleMessageCollapse'
export const toggleMessageReaction = 'chat2:toggleMessageReaction'
export const toggleReplyToMessage = 'chat2:toggleReplyToMessage'
export const toggleSmallTeamsExpanded = 'chat2:toggleSmallTeamsExpanded'
export const toggleThreadSearch = 'chat2:toggleThreadSearch'
export const unfurlRemove = 'chat2:unfurlRemove'
export const unfurlResolvePrompt = 'chat2:unfurlResolvePrompt'
export const unfurlTogglePrompt = 'chat2:unfurlTogglePrompt'
export const unhideConversation = 'chat2:unhideConversation'
export const unpinMessage = 'chat2:unpinMessage'
export const unsentTextChanged = 'chat2:unsentTextChanged'
export const updateBlockButtons = 'chat2:updateBlockButtons'
export const updateCoinFlipStatus = 'chat2:updateCoinFlipStatus'
export const updateConvExplodingModes = 'chat2:updateConvExplodingModes'
export const updateConvRetentionPolicy = 'chat2:updateConvRetentionPolicy'
export const updateLastCoord = 'chat2:updateLastCoord'
export const updateMessages = 'chat2:updateMessages'
export const updateMoreToLoad = 'chat2:updateMoreToLoad'
export const updateNotificationSettings = 'chat2:updateNotificationSettings'
export const updateReactions = 'chat2:updateReactions'
export const updateTeamRetentionPolicy = 'chat2:updateTeamRetentionPolicy'
export const updateUnreadline = 'chat2:updateUnreadline'
export const updateUserReacjis = 'chat2:updateUserReacjis'
// Payload Types
type _AddAttachmentViewMessagePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly viewType: RPCChatTypes.GalleryItemTyp
readonly message: Types.Message
}
type _AddBotMemberPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly allowCommands: boolean
readonly allowMentions: boolean
readonly username: string
}
type _AddUsersToChannelPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly usernames: Array<string>
}
type _AttachmentDownloadPayload = {readonly message: Types.Message}
type _AttachmentDownloadedPayload = {
readonly message: Types.Message
readonly error?: string
readonly path?: string
}
type _AttachmentFullscreenNextPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: Types.MessageID
readonly backInTime: boolean
}
type _AttachmentFullscreenSelectionPayload = {readonly autoPlay: boolean; readonly message: Types.Message}
type _AttachmentLoadingPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly message: Types.Message
readonly ratio: number
readonly isPreview: boolean
}
type _AttachmentMobileSavePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly ordinal: Types.Ordinal
}
type _AttachmentMobileSavedPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly ordinal: Types.Ordinal
}
type _AttachmentPastedPayload = {readonly conversationIDKey: Types.ConversationIDKey; readonly data: Buffer}
type _AttachmentPreviewSelectPayload = {readonly message: Types.MessageAttachment}
type _AttachmentUploadedPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly ordinal: Types.Ordinal
}
type _AttachmentUploadingPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly outboxID: Types.OutboxID
readonly ratio: number
}
type _AttachmentsUploadPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly paths: Array<Types.PathAndOutboxID>
readonly titles: Array<string>
}
type _AttemptAudioRecordingPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly meteringCb: (amp: number) => void
}
type _BadgesUpdatedPayload = {readonly conversations: Array<RPCTypes.BadgeConversationInfo>}
type _BlockConversationPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly reportUser: boolean
}
type _ChangeFocusPayload = {readonly nextFocus: Types.Focus}
type _ClearAttachmentViewPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _ClearCommandStatusInfoPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _ClearMessagesPayload = void
type _ClearMetasPayload = void
type _ClearPaymentConfirmInfoPayload = void
type _ConfirmScreenResponsePayload = {readonly accept: boolean}
type _ConversationErroredPayload = {readonly message: string}
type _CreateConversationPayload = {readonly participants: Array<string>}
type _DeselectConversationPayload = {readonly ifConversationIDKey: Types.ConversationIDKey}
type _DesktopNotificationPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly author: string
readonly body: string
}
type _DismissBlockButtonsPayload = {readonly teamID: RPCTypes.TeamID}
type _DismissBottomBannerPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _EditBotSettingsPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly username: string
readonly allowCommands: boolean
readonly allowMentions: boolean
}
type _EnableAudioRecordingPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly meteringCb: (amp: number) => void
}
type _GiphyGotSearchResultPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly results: RPCChatTypes.GiphySearchResults
}
type _GiphySendPayload = {readonly conversationIDKey: Types.ConversationIDKey; readonly url: HiddenString}
type _GiphyToggleWindowPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly show: boolean
readonly clearInput: boolean
}
type _HandleSeeingWalletsPayload = void
type _HideConversationPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _IgnorePinnedMessagePayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _InboxRefreshPayload = {
readonly reason:
| 'bootstrap'
| 'componentNeverLoaded'
| 'inboxStale'
| 'inboxSyncedClear'
| 'inboxSyncedUnknown'
| 'joinedAConversation'
| 'leftAConversation'
| 'teamTypeChanged'
| 'maybeKickedFromTeam'
| 'widgetRefresh'
}
type _InboxSearchMoveSelectedIndexPayload = {readonly increment: boolean}
type _InboxSearchNameResultsPayload = {
readonly results: Array<Types.InboxSearchConvHit>
readonly unread: boolean
}
type _InboxSearchPayload = {readonly query: HiddenString}
type _InboxSearchSelectPayload = {
readonly conversationIDKey?: Types.ConversationIDKey
readonly query?: HiddenString
readonly selectedIndex?: number
}
type _InboxSearchSetIndexPercentPayload = {readonly percent: number}
type _InboxSearchSetTextStatusPayload = {readonly status: Types.InboxSearchStatus}
type _InboxSearchStartedPayload = void
type _InboxSearchTextResultPayload = {readonly result: Types.InboxSearchTextHit}
type _JoinConversationPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _JumpToRecentPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _LeaveConversationPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly dontNavigateToInbox?: boolean
}
type _LoadAttachmentViewPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly viewType: RPCChatTypes.GalleryItemTyp
readonly fromMsgID?: Types.MessageID
}
type _LoadMessagesCenteredPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: Types.MessageID
readonly highlightMode: Types.CenterOrdinalHighlightMode
}
type _LoadMoreSmallsPayload = void
type _LoadNewerMessagesDueToScrollPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _LoadNextBotPagePayload = {readonly pageSize: number}
type _LoadOlderMessagesDueToScrollPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _LockAudioRecordingPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _MarkConversationsStalePayload = {
readonly conversationIDKeys: Array<Types.ConversationIDKey>
readonly updateType: RPCChatTypes.StaleUpdateType
}
type _MarkInitiallyLoadedThreadAsReadPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _MessageAttachmentNativeSavePayload = {readonly message: Types.Message}
type _MessageAttachmentNativeSharePayload = {readonly message: Types.Message}
type _MessageAttachmentUploadedPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly placeholderID: RPCChatTypes.MessageID
readonly message: Types.MessageAttachment
}
type _MessageDeleteHistoryPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _MessageDeletePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly ordinal: Types.Ordinal
}
type _MessageEditPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly ordinal: Types.Ordinal
readonly text: HiddenString
}
type _MessageErroredPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly reason: string
readonly errorTyp: number | null
readonly outboxID: Types.OutboxID
}
type _MessageReplyPrivatelyPayload = {
readonly sourceConversationIDKey: Types.ConversationIDKey
readonly ordinal: Types.Ordinal
}
type _MessageRetryPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly outboxID: Types.OutboxID
}
type _MessageSendByUsernamesPayload = {
readonly usernames: string
readonly text: HiddenString
readonly waitingKey?: string
}
type _MessageSendPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly text: HiddenString
readonly replyTo?: Types.MessageID
readonly waitingKey?: string
}
type _MessageSetEditingPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly ordinal: Types.Ordinal | null
readonly editLastUser?: string
}
type _MessageSetQuotingPayload = {
readonly sourceConversationIDKey: Types.ConversationIDKey
readonly targetConversationIDKey: Types.ConversationIDKey
readonly ordinal: Types.Ordinal
}
type _MessageWasEditedPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: RPCChatTypes.MessageID
readonly text: HiddenString
readonly mentionsAt: Set<string>
readonly mentionsChannel: 'none' | 'all' | 'here'
readonly mentionsChannelName: Map<string, Types.ConversationIDKey>
}
type _MessagesAddPayload = {
readonly context:
| {type: 'sent'}
| {type: 'incoming'}
| {type: 'threadLoad'; conversationIDKey: Types.ConversationIDKey}
readonly messages: Array<Types.Message>
readonly shouldClearOthers?: boolean
readonly centeredMessageIDs?: Array<{
conversationIDKey: Types.ConversationIDKey
messageID: Types.MessageID
highlightMode: Types.CenterOrdinalHighlightMode
}>
readonly forceContainsLatestCalc?: boolean
}
type _MessagesExplodedPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageIDs: Array<RPCChatTypes.MessageID>
readonly explodedBy?: string
}
type _MessagesWereDeletedPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageIDs?: Array<RPCChatTypes.MessageID>
readonly upToMessageID?: RPCChatTypes.MessageID
readonly deletableMessageTypes?: Set<Types.MessageType>
readonly ordinals?: Array<Types.Ordinal>
}
type _MetaDeletePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly selectSomethingElse: boolean
}
type _MetaHandleQueuePayload = void
type _MetaNeedsUpdatingPayload = {
readonly conversationIDKeys: Array<Types.ConversationIDKey>
readonly reason: string
}
type _MetaReceivedErrorPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly error: RPCChatTypes.InboxUIItemError | null
readonly username: string | null
}
type _MetaRequestTrustedPayload = {
readonly force?: boolean
readonly noWaiting?: boolean
readonly reason:
| 'refreshPreviousSelected'
| 'requestTeamsUnboxing'
| 'inboxSynced'
| 'setConvRetention'
| 'subTeamRename'
| 'tlfFinalize'
| 'threadStale'
| 'membersUpdate'
| 'scroll'
| 'ensureSelectedMeta'
| 'ensureWidgetMetas'
| 'inboxSearchResults'
readonly conversationIDKeys: Array<Types.ConversationIDKey>
}
type _MetaRequestingTrustedPayload = {readonly conversationIDKeys: Array<Types.ConversationIDKey>}
type _MetasReceivedPayload = {
readonly metas: Array<Types.ConversationMeta>
readonly removals?: Array<Types.ConversationIDKey>
readonly fromInboxRefresh?: boolean
readonly initialTrustedLoad?: boolean
}
type _MuteConversationPayload = {readonly conversationIDKey: Types.ConversationIDKey; readonly muted: boolean}
type _NavigateToInboxPayload = void
type _NavigateToThreadPayload = void
type _NotificationSettingsUpdatedPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly settings: RPCChatTypes.ConversationNotificationInfo
}
type _OpenChatFromWidgetPayload = {readonly conversationIDKey?: Types.ConversationIDKey}
type _OpenFolderPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _PaymentInfoReceivedPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: RPCChatTypes.MessageID
readonly paymentInfo: Types.ChatPaymentInfo
}
type _PendingMessageWasEditedPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly ordinal: Types.Ordinal
readonly text: HiddenString
}
type _PinMessagePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: Types.MessageID
}
type _PrepareFulfillRequestFormPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly ordinal: Types.Ordinal
}
type _PreviewConversationPayload = {
readonly participants?: Array<string>
readonly teamname?: string
readonly channelname?: string
readonly conversationIDKey?: Types.ConversationIDKey
readonly reason:
| 'manageView'
| 'messageLink'
| 'resetChatWithoutThem'
| 'tracker'
| 'teamHeader'
| 'files'
| 'teamInvite'
| 'fromAReset'
| 'profile'
| 'teamMember'
| 'teamHeader'
| 'convertAdHoc'
| 'memberView'
| 'newChannel'
| 'transaction'
| 'sentPayment'
| 'requestedPayment'
| 'teamMention'
| 'appLink'
| 'search'
| 'journeyCardPopular'
}
type _RefreshBotPublicCommandsPayload = {readonly username: string}
type _RefreshBotSettingsPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly username: string
}
type _RemoveBotMemberPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly username: string
}
type _ReplyJumpPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: Types.MessageID
}
type _RequestInfoReceivedPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: RPCChatTypes.MessageID
readonly requestInfo: Types.ChatRequestInfo
}
type _ResetChatWithoutThemPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _ResetLetThemInPayload = {readonly conversationIDKey: Types.ConversationIDKey; readonly username: string}
type _ResetSmallsPayload = void
type _ResolveMaybeMentionPayload = {readonly name: string; readonly channel: string}
type _SaveMinWriterRolePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly role: TeamsTypes.TeamRoleType
readonly cannotWrite: boolean
}
type _SelectConversationPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly reason:
| 'focused'
| 'clearSelected'
| 'desktopNotification'
| 'createdMessagePrivately'
| 'extension'
| 'files'
| 'findNewestConversation'
| 'inboxBig'
| 'inboxFilterArrow'
| 'inboxFilterChanged'
| 'inboxSmall'
| 'inboxNewConversation'
| 'inboxSearch'
| 'jumpFromReset'
| 'jumpToReset'
| 'justCreated'
| 'manageView'
| 'previewResolved'
| 'push'
| 'savedLastState'
| 'startFoundExisting'
| 'teamChat'
| 'addedToChannel'
| 'teamMention'
readonly navKey?: string
}
type _SendAudioRecordingPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly fromStaged: boolean
readonly info: Types.AudioRecordingInfo
}
type _SendTypingPayload = {readonly conversationIDKey: Types.ConversationIDKey; readonly typing: boolean}
type _SetAttachmentViewStatusPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly viewType: RPCChatTypes.GalleryItemTyp
readonly status: Types.AttachmentViewStatus
readonly last?: boolean
}
type _SetAudioRecordingPostInfoPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly path: string
readonly outboxID: Buffer
}
type _SetBotPublicCommandsPayload = {readonly username: string; readonly commands: Types.BotPublicCommands}
type _SetBotSettingsPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly username: string
readonly settings: RPCTypes.TeamBotSettings
}
type _SetChannelSearchTextPayload = {readonly text: string}
type _SetCommandMarkdownPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly md: RPCChatTypes.UICommandMarkdown | null
}
type _SetCommandStatusInfoPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly info: Types.CommandStatusInfo
}
type _SetContainsLastMessagePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly contains: boolean
}
type _SetConvExplodingModePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly seconds: number
}
type _SetConvRetentionPolicyPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly policy: RetentionPolicy
}
type _SetConversationOfflinePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly offline: boolean
}
type _SetExplodingModeLockPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly unset?: boolean
}
type _SetInboxNumSmallRowsPayload = {readonly ignoreWrite?: boolean; readonly rows: number}
type _SetInboxShowIsNewPayload = {readonly isNew: boolean}
type _SetLoadedBotPagePayload = {readonly page: number}
type _SetMaybeMentionInfoPayload = {readonly name: string; readonly info: RPCChatTypes.UIMaybeMentionInfo}
type _SetMinWriterRolePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly role: TeamsTypes.TeamRoleType
}
type _SetPaymentConfirmInfoPayload = {
readonly error?: RPCTypes.Status
readonly summary?: RPCChatTypes.UIChatPaymentSummary
}
type _SetPrependTextPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly text: HiddenString | null
}
type _SetThreadLoadStatusPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly status: RPCChatTypes.UIChatThreadStatus
}
type _SetThreadSearchQueryPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly query: HiddenString
}
type _SetThreadSearchStatusPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly status: Types.ThreadSearchStatus
}
type _SetUnsentTextPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly text?: HiddenString
}
type _SetWalletsOldPayload = void
type _StaticConfigLoadedPayload = {readonly staticConfig: Types.StaticConfig}
type _StopAudioRecordingPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly stopType: Types.AudioStopType
readonly amps?: AmpTracker
}
type _TabSelectedPayload = void
type _ThreadSearchPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly query: HiddenString
}
type _ThreadSearchResultsPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messages: Array<Types.Message>
readonly clear: boolean
}
type _ToggleGiphyPrefillPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _ToggleInboxSearchPayload = {readonly enabled: boolean}
type _ToggleInfoPanelPayload = void
type _ToggleLocalReactionPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly emoji: string
readonly targetOrdinal: Types.Ordinal
readonly username: string
}
type _ToggleMessageCollapsePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: Types.MessageID
readonly collapse: boolean
}
type _ToggleMessageReactionPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly emoji: string
readonly ordinal: Types.Ordinal
}
type _ToggleReplyToMessagePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly ordinal?: Types.Ordinal
}
type _ToggleSmallTeamsExpandedPayload = void
type _ToggleThreadSearchPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _UnfurlRemovePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: Types.MessageID
}
type _UnfurlResolvePromptPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: Types.MessageID
readonly domain: string
readonly result: RPCChatTypes.UnfurlPromptResult
}
type _UnfurlTogglePromptPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: Types.MessageID
readonly domain: string
readonly show: boolean
}
type _UnhideConversationPayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _UnpinMessagePayload = {readonly conversationIDKey: Types.ConversationIDKey}
type _UnsentTextChangedPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly text: HiddenString
}
type _UpdateBlockButtonsPayload = {
readonly teamID: RPCTypes.TeamID
readonly adder?: string
readonly show: boolean
}
type _UpdateCoinFlipStatusPayload = {readonly statuses: Array<RPCChatTypes.UICoinFlipStatus>}
type _UpdateConvExplodingModesPayload = {
readonly modes: Array<{conversationIDKey: Types.ConversationIDKey; seconds: number}>
}
type _UpdateConvRetentionPolicyPayload = {readonly meta: Types.ConversationMeta}
type _UpdateLastCoordPayload = {readonly coord: Types.Coordinate}
type _UpdateMessagesPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messages: Array<{messageID: Types.MessageID; message: Types.Message}>
}
type _UpdateMoreToLoadPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly moreToLoad: boolean
}
type _UpdateNotificationSettingsPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly notificationsDesktop: Types.NotificationsType
readonly notificationsMobile: Types.NotificationsType
readonly notificationsGlobalIgnoreMentions: boolean
}
type _UpdateReactionsPayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly updates: Array<{targetMsgID: RPCChatTypes.MessageID; reactions: Types.Reactions}>
}
type _UpdateTeamRetentionPolicyPayload = {readonly metas: Array<Types.ConversationMeta>}
type _UpdateUnreadlinePayload = {
readonly conversationIDKey: Types.ConversationIDKey
readonly messageID: Types.MessageID
}
type _UpdateUserReacjisPayload = {readonly userReacjis: RPCTypes.UserReacjis}
// Action Creators
/**
* Actually start a conversation
*/
export const createCreateConversation = (payload: _CreateConversationPayload): CreateConversationPayload => ({
payload,
type: createConversation,
})
/**
* Add a list of users to a conversation. Creates a SystemBulkAddToConv message.
*/
export const createAddUsersToChannel = (payload: _AddUsersToChannelPayload): AddUsersToChannelPayload => ({
payload,
type: addUsersToChannel,
})
/**
* Add an unfurl prompt to a message
*/
export const createUnfurlTogglePrompt = (payload: _UnfurlTogglePromptPayload): UnfurlTogglePromptPayload => ({
payload,
type: unfurlTogglePrompt,
})
/**
* Add result for attachment view
*/
export const createAddAttachmentViewMessage = (
payload: _AddAttachmentViewMessagePayload
): AddAttachmentViewMessagePayload => ({payload, type: addAttachmentViewMessage})
/**
* Change selected index of inbox search
*/
export const createInboxSearchMoveSelectedIndex = (
payload: _InboxSearchMoveSelectedIndexPayload
): InboxSearchMoveSelectedIndexPayload => ({payload, type: inboxSearchMoveSelectedIndex})
/**
* Clear attachment views
*/
export const createClearAttachmentView = (
payload: _ClearAttachmentViewPayload
): ClearAttachmentViewPayload => ({payload, type: clearAttachmentView})
/**
* Clear command status info
*/
export const createClearCommandStatusInfo = (
payload: _ClearCommandStatusInfoPayload
): ClearCommandStatusInfoPayload => ({payload, type: clearCommandStatusInfo})
/**
* Clear data for payment confirm modal
*/
export const createClearPaymentConfirmInfo = (
payload: _ClearPaymentConfirmInfoPayload
): ClearPaymentConfirmInfoPayload => ({payload, type: clearPaymentConfirmInfo})
/**
* Consume a service notification that a conversation's retention policy has been updated
*/
export const createUpdateConvRetentionPolicy = (
payload: _UpdateConvRetentionPolicyPayload
): UpdateConvRetentionPolicyPayload => ({payload, type: updateConvRetentionPolicy})
/**
* Consume a service notification that a team retention policy was updated
*/
export const createUpdateTeamRetentionPolicy = (
payload: _UpdateTeamRetentionPolicyPayload
): UpdateTeamRetentionPolicyPayload => ({payload, type: updateTeamRetentionPolicy})
/**
* Desktop changed tab to chat
*/
export const createTabSelected = (payload: _TabSelectedPayload): TabSelectedPayload => ({
payload,
type: tabSelected,
})
/**
* Explicitly set whether a thread is loaded to the most recent message
*/
export const createSetContainsLastMessage = (
payload: _SetContainsLastMessagePayload
): SetContainsLastMessagePayload => ({payload, type: setContainsLastMessage})
/**
* Exploding messages expired or were manually detonated.
*/
export const createMessagesExploded = (payload: _MessagesExplodedPayload): MessagesExplodedPayload => ({
payload,
type: messagesExploded,
})
/**
* Giphy search results obtained
*/
export const createGiphyGotSearchResult = (
payload: _GiphyGotSearchResultPayload
): GiphyGotSearchResultPayload => ({payload, type: giphyGotSearchResult})
/**
* Handle an update to our conversation exploding modes.
*/
export const createUpdateConvExplodingModes = (
payload: _UpdateConvExplodingModesPayload
): UpdateConvExplodingModesPayload => ({payload, type: updateConvExplodingModes})
/**
* Ignore pinned message
*/
export const createIgnorePinnedMessage = (
payload: _IgnorePinnedMessagePayload
): IgnorePinnedMessagePayload => ({payload, type: ignorePinnedMessage})
/**
* Inbox search has started
*/
export const createInboxSearchStarted = (payload: _InboxSearchStartedPayload): InboxSearchStartedPayload => ({
payload,
type: inboxSearchStarted,
})
/**
* Inbox search name results received
*/
export const createInboxSearchNameResults = (
payload: _InboxSearchNameResultsPayload
): InboxSearchNameResultsPayload => ({payload, type: inboxSearchNameResults})
/**
* Inbox text result has arrived
*/
export const createInboxSearchTextResult = (
payload: _InboxSearchTextResultPayload
): InboxSearchTextResultPayload => ({payload, type: inboxSearchTextResult})
/**
* Jump to a replied to message
*/
export const createReplyJump = (payload: _ReplyJumpPayload): ReplyJumpPayload => ({payload, type: replyJump})
/**
* Jump to most recent messages in a conversation
*/
export const createJumpToRecent = (payload: _JumpToRecentPayload): JumpToRecentPayload => ({
payload,
type: jumpToRecent,
})
/**
* Load attachment view pane
*/
export const createLoadAttachmentView = (payload: _LoadAttachmentViewPayload): LoadAttachmentViewPayload => ({
payload,
type: loadAttachmentView,
})
/**
* Perform a search in a thread
*/
export const createThreadSearch = (payload: _ThreadSearchPayload): ThreadSearchPayload => ({
payload,
type: threadSearch,
})
/**
* Perform an inbox search
*/
export const createInboxSearch = (payload: _InboxSearchPayload): InboxSearchPayload => ({
payload,
type: inboxSearch,
})
/**
* Pin a message
*/
export const createPinMessage = (payload: _PinMessagePayload): PinMessagePayload => ({
payload,
type: pinMessage,
})
/**
* Prime data to fulfill this message's request and navigate to the send form.
*/
export const createPrepareFulfillRequestForm = (
payload: _PrepareFulfillRequestFormPayload
): PrepareFulfillRequestFormPayload => ({payload, type: prepareFulfillRequestForm})
/**
* Record a new thread search result
*/
export const createThreadSearchResults = (
payload: _ThreadSearchResultsPayload
): ThreadSearchResultsPayload => ({payload, type: threadSearchResults})
/**
* Remove an unfurl
*/
export const createUnfurlRemove = (payload: _UnfurlRemovePayload): UnfurlRemovePayload => ({
payload,
type: unfurlRemove,
})
/**
* Reply to a message publicly
*/
export const createToggleReplyToMessage = (
payload: _ToggleReplyToMessagePayload
): ToggleReplyToMessagePayload => ({payload, type: toggleReplyToMessage})
/**
* Resolve an unknown @ mention
*/
export const createResolveMaybeMention = (
payload: _ResolveMaybeMentionPayload
): ResolveMaybeMentionPayload => ({payload, type: resolveMaybeMention})
/**
* Response to an unfurl prompt
*/
export const createUnfurlResolvePrompt = (
payload: _UnfurlResolvePromptPayload
): UnfurlResolvePromptPayload => ({payload, type: unfurlResolvePrompt})
/**
* Select an inbox search item
*/
export const createInboxSearchSelect = (
payload: _InboxSearchSelectPayload = Object.freeze({})
): InboxSearchSelectPayload => ({payload, type: inboxSearchSelect})
/**
* Set a lock on the exploding mode for a conversation.
*/
export const createSetExplodingModeLock = (
payload: _SetExplodingModeLockPayload
): SetExplodingModeLockPayload => ({payload, type: setExplodingModeLock})
/**
* Set attachment view status
*/
export const createSetAttachmentViewStatus = (
payload: _SetAttachmentViewStatusPayload
): SetAttachmentViewStatusPayload => ({payload, type: setAttachmentViewStatus})
/**
* Set command markdown for a conversation
*/
export const createSetCommandMarkdown = (payload: _SetCommandMarkdownPayload): SetCommandMarkdownPayload => ({
payload,
type: setCommandMarkdown,
})
/**
* Set command status info
*/
export const createSetCommandStatusInfo = (
payload: _SetCommandStatusInfoPayload
): SetCommandStatusInfoPayload => ({payload, type: setCommandStatusInfo})
/**
* Set filter for channel search
*/
export const createSetChannelSearchText = (
payload: _SetChannelSearchTextPayload
): SetChannelSearchTextPayload => ({payload, type: setChannelSearchText})
/**
* Set index percent complete
*/
export const createInboxSearchSetIndexPercent = (
payload: _InboxSearchSetIndexPercentPayload
): InboxSearchSetIndexPercentPayload => ({payload, type: inboxSearchSetIndexPercent})
/**
* Set prepend text for a conversation