chat 1.0.6 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -96
- package/readme.md +1 -201
- package/lib/module/ChatContext/index.js +0 -2
- package/lib/module/ChatContext/index.js.map +0 -1
- package/lib/module/ChatContext/types.js +0 -2
- package/lib/module/ChatContext/types.js.map +0 -1
- package/lib/module/classes/Chat/index.js +0 -2
- package/lib/module/classes/Chat/index.js.map +0 -1
- package/lib/module/classes/Chat/types.js +0 -2
- package/lib/module/classes/Chat/types.js.map +0 -1
- package/lib/module/classes/Inbox/index.js +0 -2
- package/lib/module/classes/Inbox/index.js.map +0 -1
- package/lib/module/classes/Inbox/types.js +0 -2
- package/lib/module/classes/Inbox/types.js.map +0 -1
- package/lib/module/classes/Message/index.js +0 -2
- package/lib/module/classes/Message/index.js.map +0 -1
- package/lib/module/classes/Message/types.js +0 -2
- package/lib/module/classes/Message/types.js.map +0 -1
- package/lib/module/classes/Reaction/index.js +0 -2
- package/lib/module/classes/Reaction/index.js.map +0 -1
- package/lib/module/classes/Reaction/types.js +0 -2
- package/lib/module/classes/Reaction/types.js.map +0 -1
- package/lib/module/classes/Room/index.js +0 -2
- package/lib/module/classes/Room/index.js.map +0 -1
- package/lib/module/classes/Room/types.js +0 -2
- package/lib/module/classes/Room/types.js.map +0 -1
- package/lib/module/classes/index.js +0 -2
- package/lib/module/classes/index.js.map +0 -1
- package/lib/module/components/Avatar/index.js +0 -2
- package/lib/module/components/Avatar/index.js.map +0 -1
- package/lib/module/components/Chat/Bubble/index.js +0 -2
- package/lib/module/components/Chat/Bubble/index.js.map +0 -1
- package/lib/module/components/Chat/Composer/Input/index.js +0 -2
- package/lib/module/components/Chat/Composer/Input/index.js.map +0 -1
- package/lib/module/components/Chat/Composer/Send/index.js +0 -2
- package/lib/module/components/Chat/Composer/Send/index.js.map +0 -1
- package/lib/module/components/Chat/Composer/index.js +0 -2
- package/lib/module/components/Chat/Composer/index.js.map +0 -1
- package/lib/module/components/Chat/Media/Image/index.js +0 -2
- package/lib/module/components/Chat/Media/Image/index.js.map +0 -1
- package/lib/module/components/Chat/Media/index.js +0 -2
- package/lib/module/components/Chat/Media/index.js.map +0 -1
- package/lib/module/components/Chat/Message/Swiper/Action/index.js +0 -2
- package/lib/module/components/Chat/Message/Swiper/Action/index.js.map +0 -1
- package/lib/module/components/Chat/Message/Swiper/index.js +0 -2
- package/lib/module/components/Chat/Message/Swiper/index.js.map +0 -1
- package/lib/module/components/Chat/Message/Touchable/index.js +0 -2
- package/lib/module/components/Chat/Message/Touchable/index.js.map +0 -1
- package/lib/module/components/Chat/Message/index.js +0 -2
- package/lib/module/components/Chat/Message/index.js.map +0 -1
- package/lib/module/components/Chat/SystemMessage/index.js +0 -2
- package/lib/module/components/Chat/SystemMessage/index.js.map +0 -1
- package/lib/module/components/Chat/TypingFooter/index.js +0 -2
- package/lib/module/components/Chat/TypingFooter/index.js.map +0 -1
- package/lib/module/components/Chat/index.js +0 -2
- package/lib/module/components/Chat/index.js.map +0 -1
- package/lib/module/components/Chat/types.js +0 -2
- package/lib/module/components/Chat/types.js.map +0 -1
- package/lib/module/components/Chat-Old/Bubble/index.js +0 -2
- package/lib/module/components/Chat-Old/Bubble/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Composer/Input/index.js +0 -2
- package/lib/module/components/Chat-Old/Composer/Input/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Composer/Send/index.js +0 -2
- package/lib/module/components/Chat-Old/Composer/Send/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Composer/index.js +0 -2
- package/lib/module/components/Chat-Old/Composer/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Message/index.js +0 -2
- package/lib/module/components/Chat-Old/Message/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Swiper/Action/index.js +0 -2
- package/lib/module/components/Chat-Old/Swiper/Action/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Swiper/index.js +0 -2
- package/lib/module/components/Chat-Old/Swiper/index.js.map +0 -1
- package/lib/module/components/Chat-Old/SystemMessage/index.js +0 -2
- package/lib/module/components/Chat-Old/SystemMessage/index.js.map +0 -1
- package/lib/module/components/Chat-Old/index.js +0 -2
- package/lib/module/components/Chat-Old/index.js.map +0 -1
- package/lib/module/components/Chat-Old/types.js +0 -2
- package/lib/module/components/Chat-Old/types.js.map +0 -1
- package/lib/module/components/ChatProvider/index.js +0 -2
- package/lib/module/components/ChatProvider/index.js.map +0 -1
- package/lib/module/components/ChatProvider/types.js +0 -2
- package/lib/module/components/ChatProvider/types.js.map +0 -1
- package/lib/module/components/Inbox/Item/Circle/index.js +0 -2
- package/lib/module/components/Inbox/Item/Circle/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/Circle/types.js +0 -2
- package/lib/module/components/Inbox/Item/Circle/types.js.map +0 -1
- package/lib/module/components/Inbox/Item/Initials/index.js +0 -2
- package/lib/module/components/Inbox/Item/Initials/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/ItemDate/index.js +0 -2
- package/lib/module/components/Inbox/Item/ItemDate/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/Separator/index.js +0 -2
- package/lib/module/components/Inbox/Item/Separator/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/Subtitle/index.js +0 -2
- package/lib/module/components/Inbox/Item/Subtitle/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/Swipeable/index.js +0 -2
- package/lib/module/components/Inbox/Item/Swipeable/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/Title/index.js +0 -2
- package/lib/module/components/Inbox/Item/Title/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/UnreadIndicator/index.js +0 -2
- package/lib/module/components/Inbox/Item/UnreadIndicator/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/index.js +0 -2
- package/lib/module/components/Inbox/Item/index.js.map +0 -1
- package/lib/module/components/Inbox/index.js +0 -2
- package/lib/module/components/Inbox/index.js.map +0 -1
- package/lib/module/components/Inbox/question.md +0 -21
- package/lib/module/components/Inbox/readme.md +0 -21
- package/lib/module/components/Inbox/types.js +0 -2
- package/lib/module/components/Inbox/types.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/Footer/Button/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/Footer/Button/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/Footer/Input/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/Footer/Input/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/Footer/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/Footer/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/Item/Icon/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/Item/Icon/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/Item/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/Item/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Header/index.js +0 -2
- package/lib/module/components/RoomCreator/Header/index.js.map +0 -1
- package/lib/module/components/RoomCreator/index.js +0 -2
- package/lib/module/components/RoomCreator/index.js.map +0 -1
- package/lib/module/components/RoomCreator/types.js +0 -2
- package/lib/module/components/RoomCreator/types.js.map +0 -1
- package/lib/module/components/TypingIndicator/index.js +0 -2
- package/lib/module/components/TypingIndicator/index.js.map +0 -1
- package/lib/module/components/index.js +0 -2
- package/lib/module/components/index.js.map +0 -1
- package/lib/module/helpers/getInitials.js +0 -2
- package/lib/module/helpers/getInitials.js.map +0 -1
- package/lib/module/helpers/sortByAvatar.js +0 -2
- package/lib/module/helpers/sortByAvatar.js.map +0 -1
- package/lib/module/hooks/index.js +0 -2
- package/lib/module/hooks/index.js.map +0 -1
- package/lib/module/hooks/useCreateRoom/index.js +0 -2
- package/lib/module/hooks/useCreateRoom/index.js.map +0 -1
- package/lib/module/hooks/useCreator/index.js +0 -2
- package/lib/module/hooks/useCreator/index.js.map +0 -1
- package/lib/module/hooks/useInbox/index.js +0 -2
- package/lib/module/hooks/useInbox/index.js.map +0 -1
- package/lib/module/hooks/useInbox/types.js +0 -2
- package/lib/module/hooks/useInbox/types.js.map +0 -1
- package/lib/module/hooks/useMessages/index.js +0 -2
- package/lib/module/hooks/useMessages/index.js.map +0 -1
- package/lib/module/hooks/useMessages/types.js +0 -2
- package/lib/module/hooks/useMessages/types.js.map +0 -1
- package/lib/module/hooks/useRoom/index.js +0 -2
- package/lib/module/hooks/useRoom/index.js.map +0 -1
- package/lib/module/hooks/useRoom/types.js +0 -2
- package/lib/module/hooks/useRoom/types.js.map +0 -1
- package/lib/module/hooks/useSend/useSendToGroup/index.js +0 -2
- package/lib/module/hooks/useSend/useSendToGroup/index.js.map +0 -1
- package/lib/module/hooks/useSend/useSendToPeople/index.js +0 -2
- package/lib/module/hooks/useSend/useSendToPeople/index.js.map +0 -1
- package/lib/module/hooks/useTyping/index.js +0 -2
- package/lib/module/hooks/useTyping/index.js.map +0 -1
- package/lib/module/hooks/useTypingOLD/index.js +0 -2
- package/lib/module/hooks/useTypingOLD/index.js.map +0 -1
- package/lib/module/hooks/useTypingOLD/types.js +0 -2
- package/lib/module/hooks/useTypingOLD/types.js.map +0 -1
- package/lib/module/hooks/useViewMessages/index.js +0 -2
- package/lib/module/hooks/useViewMessages/index.js.map +0 -1
- package/lib/module/hooks/useViewMessages/types.js +0 -2
- package/lib/module/hooks/useViewMessages/types.js.map +0 -1
- package/lib/module/hooks/useViewMessagesOld/index.js +0 -2
- package/lib/module/hooks/useViewMessagesOld/index.js.map +0 -1
- package/lib/module/index.js +0 -2
- package/lib/module/index.js.map +0 -1
- package/lib/typescript/ChatContext/index.d.ts +0 -2
- package/lib/typescript/ChatContext/types.d.ts +0 -4
- package/lib/typescript/classes/Chat/index.d.ts +0 -14
- package/lib/typescript/classes/Chat/types.d.ts +0 -21
- package/lib/typescript/classes/Inbox/types.d.ts +0 -2
- package/lib/typescript/classes/Message/index.d.ts +0 -47
- package/lib/typescript/classes/Message/types.d.ts +0 -66
- package/lib/typescript/classes/Reaction/index.d.ts +0 -17
- package/lib/typescript/classes/Reaction/types.d.ts +0 -33
- package/lib/typescript/classes/Room/index.d.ts +0 -42
- package/lib/typescript/classes/Room/types.d.ts +0 -112
- package/lib/typescript/classes/index.d.ts +0 -4
- package/lib/typescript/components/Avatar/index.d.ts +0 -4
- package/lib/typescript/components/Chat/Bubble/index.d.ts +0 -4
- package/lib/typescript/components/Chat/Composer/Input/index.d.ts +0 -7
- package/lib/typescript/components/Chat/Composer/Send/index.d.ts +0 -4
- package/lib/typescript/components/Chat/Composer/index.d.ts +0 -8
- package/lib/typescript/components/Chat/Media/Image/index.d.ts +0 -7
- package/lib/typescript/components/Chat/Media/index.d.ts +0 -4
- package/lib/typescript/components/Chat/Message/Touchable/index.d.ts +0 -4
- package/lib/typescript/components/Chat/Message/index.d.ts +0 -8
- package/lib/typescript/components/Chat/SystemMessage/index.d.ts +0 -4
- package/lib/typescript/components/Chat/TypingFooter/index.d.ts +0 -4
- package/lib/typescript/components/Chat/index.d.ts +0 -8
- package/lib/typescript/components/Chat/types.d.ts +0 -844
- package/lib/typescript/components/ChatProvider/index.d.ts +0 -10
- package/lib/typescript/components/ChatProvider/types.d.ts +0 -7
- package/lib/typescript/components/Inbox/Item/Initials/index.d.ts +0 -4
- package/lib/typescript/components/Inbox/Item/ItemDate/index.d.ts +0 -4
- package/lib/typescript/components/Inbox/Item/Separator/index.d.ts +0 -6
- package/lib/typescript/components/Inbox/Item/Subtitle/index.d.ts +0 -3
- package/lib/typescript/components/Inbox/Item/Swipeable/index.d.ts +0 -4
- package/lib/typescript/components/Inbox/Item/Title/index.d.ts +0 -3
- package/lib/typescript/components/Inbox/Item/UnreadIndicator/index.d.ts +0 -4
- package/lib/typescript/components/Inbox/Item/index.d.ts +0 -6
- package/lib/typescript/components/Inbox/index.d.ts +0 -4
- package/lib/typescript/components/Inbox/types.d.ts +0 -304
- package/lib/typescript/components/RoomCreator/Content/Footer/Button/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/Content/Footer/Input/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/Content/Footer/index.d.ts +0 -3
- package/lib/typescript/components/RoomCreator/Content/Item/Icon/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/Content/Item/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/Content/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/Header/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/types.d.ts +0 -208
- package/lib/typescript/components/TypingIndicator/index.d.ts +0 -9
- package/lib/typescript/components/index.d.ts +0 -12
- package/lib/typescript/helpers/getInitials.d.ts +0 -1
- package/lib/typescript/hooks/index.d.ts +0 -8
- package/lib/typescript/hooks/useCreator/index.d.ts +0 -27
- package/lib/typescript/hooks/useInbox/index.d.ts +0 -29
- package/lib/typescript/hooks/useInbox/types.d.ts +0 -5
- package/lib/typescript/hooks/useMessages/index.d.ts +0 -24
- package/lib/typescript/hooks/useMessages/types.d.ts +0 -5
- package/lib/typescript/hooks/useRoom/index.d.ts +0 -26
- package/lib/typescript/hooks/useRoom/types.d.ts +0 -5
- package/lib/typescript/hooks/useSend/useSendToGroup/index.d.ts +0 -6
- package/lib/typescript/hooks/useSend/useSendToPeople/index.d.ts +0 -6
- package/lib/typescript/hooks/useTyping/index.d.ts +0 -36
- package/lib/typescript/hooks/useViewMessages/index.d.ts +0 -18
- package/lib/typescript/hooks/useViewMessages/types.d.ts +0 -20
- package/lib/typescript/index.d.ts +0 -11
- package/src/ChatContext/index.tsx +0 -9
- package/src/ChatContext/types.ts +0 -4
- package/src/classes/Chat/index.ts +0 -46
- package/src/classes/Chat/types.ts +0 -23
- package/src/classes/Inbox/index.ts +0 -12
- package/src/classes/Inbox/types.ts +0 -3
- package/src/classes/Message/index.ts +0 -310
- package/src/classes/Message/types.ts +0 -118
- package/src/classes/Reaction/index.ts +0 -108
- package/src/classes/Reaction/types.ts +0 -37
- package/src/classes/Room/index.ts +0 -323
- package/src/classes/Room/types.ts +0 -161
- package/src/classes/index.ts +0 -4
- package/src/components/Avatar/index.tsx +0 -25
- package/src/components/Chat/Bubble/index.tsx +0 -139
- package/src/components/Chat/Composer/Input/index.tsx +0 -45
- package/src/components/Chat/Composer/Send/index.tsx +0 -51
- package/src/components/Chat/Composer/index.tsx +0 -184
- package/src/components/Chat/Media/Image/index.tsx +0 -26
- package/src/components/Chat/Media/index.tsx +0 -11
- package/src/components/Chat/Message/Swiper/Action/index.tsx +0 -7
- package/src/components/Chat/Message/Swiper/index.tsx +0 -32
- package/src/components/Chat/Message/Touchable/index.tsx +0 -60
- package/src/components/Chat/Message/index.tsx +0 -328
- package/src/components/Chat/SystemMessage/index.tsx +0 -44
- package/src/components/Chat/TypingFooter/index.tsx +0 -48
- package/src/components/Chat/index.tsx +0 -592
- package/src/components/Chat/types.ts +0 -911
- package/src/components/Chat-Old/Bubble/index.tsx +0 -58
- package/src/components/Chat-Old/Composer/Input/index.tsx +0 -34
- package/src/components/Chat-Old/Composer/Send/index.tsx +0 -37
- package/src/components/Chat-Old/Composer/index.tsx +0 -131
- package/src/components/Chat-Old/Message/index.tsx +0 -160
- package/src/components/Chat-Old/Swiper/Action/index.tsx +0 -7
- package/src/components/Chat-Old/Swiper/index.tsx +0 -30
- package/src/components/Chat-Old/SystemMessage/index.tsx +0 -44
- package/src/components/Chat-Old/index.tsx +0 -356
- package/src/components/Chat-Old/types.ts +0 -752
- package/src/components/ChatProvider/index.tsx +0 -31
- package/src/components/ChatProvider/types.ts +0 -8
- package/src/components/Inbox/Item/Circle/index.tsx +0 -47
- package/src/components/Inbox/Item/Circle/types.ts +0 -8
- package/src/components/Inbox/Item/Initials/index.tsx +0 -41
- package/src/components/Inbox/Item/ItemDate/index.tsx +0 -26
- package/src/components/Inbox/Item/Separator/index.tsx +0 -13
- package/src/components/Inbox/Item/Subtitle/index.tsx +0 -23
- package/src/components/Inbox/Item/Swipeable/index.tsx +0 -143
- package/src/components/Inbox/Item/Title/index.tsx +0 -23
- package/src/components/Inbox/Item/UnreadIndicator/index.tsx +0 -84
- package/src/components/Inbox/Item/index.tsx +0 -307
- package/src/components/Inbox/index.tsx +0 -315
- package/src/components/Inbox/question.md +0 -21
- package/src/components/Inbox/readme.md +0 -21
- package/src/components/Inbox/types.ts +0 -371
- package/src/components/RoomCreator/Content/Footer/Button/index.tsx +0 -55
- package/src/components/RoomCreator/Content/Footer/Input/index.tsx +0 -27
- package/src/components/RoomCreator/Content/Footer/index.tsx +0 -72
- package/src/components/RoomCreator/Content/Item/Icon/index.tsx +0 -16
- package/src/components/RoomCreator/Content/Item/index.tsx +0 -87
- package/src/components/RoomCreator/Content/index.tsx +0 -75
- package/src/components/RoomCreator/Header/index.tsx +0 -74
- package/src/components/RoomCreator/index.tsx +0 -177
- package/src/components/RoomCreator/types.ts +0 -233
- package/src/components/TypingIndicator/index.tsx +0 -169
- package/src/components/index.ts +0 -18
- package/src/helpers/getInitials.ts +0 -11
- package/src/helpers/sortByAvatar.ts +0 -1
- package/src/hooks/index.ts +0 -8
- package/src/hooks/useCreateRoom/index.ts +0 -34
- package/src/hooks/useCreator/index.ts +0 -33
- package/src/hooks/useInbox/index.ts +0 -76
- package/src/hooks/useInbox/types.ts +0 -6
- package/src/hooks/useMessages/index.ts +0 -109
- package/src/hooks/useMessages/types.ts +0 -6
- package/src/hooks/useRoom/index.ts +0 -82
- package/src/hooks/useRoom/types.ts +0 -6
- package/src/hooks/useSend/useSendToGroup/index.ts +0 -38
- package/src/hooks/useSend/useSendToPeople/index.ts +0 -38
- package/src/hooks/useTyping/index.ts +0 -154
- package/src/hooks/useTypingOLD/index.ts +0 -67
- package/src/hooks/useTypingOLD/types.ts +0 -7
- package/src/hooks/useViewMessages/index.ts +0 -61
- package/src/hooks/useViewMessages/types.ts +0 -22
- package/src/hooks/useViewMessagesOld/index.ts +0 -39
- package/src/index.ts +0 -13
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","View","Text","StyleSheet","TouchableOpacity","Icon","Avatar","Initials","getInitials","memo","props","selected","console","log","id","onPress","toggleSelected","renderSelectedIcon","iconProps","activeColor","selectedIconActiveColor","inactiveColor","selectedIconInactiveColor","active","renderAvatarOrInitials","avatar","name","styles","container","wrapper","content","handle","checkContainer","create","paddingHorizontal","paddingVertical","flexDirection","alignItems","flex","marginLeft","fontWeight","image","height","width","borderRadius","overflow","justifyContent","check","backgroundColor","checked"],"mappings":"2KAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OAASC,IAAT,CAAeC,IAAf,CAAqBC,UAArB,CAAiCC,gBAAjC,KAAyD,cAAzD,CAEA,MAAOC,CAAAA,IAAP,KAAiB,QAAjB,CACA,MAAOC,CAAAA,MAAP,KAAmB,iBAAnB,CACA,MAAOC,CAAAA,QAAP,KAAqB,8BAArB,CACA,OAASC,WAAT,KAA4B,iCAA5B,CAEA,cAAeR,CAAAA,KAAK,CAACS,IAAN,CAAW,SAACC,KAAD,CAAiC,CAC1D,GAAIA,KAAK,CAACC,QAAV,CAAoBC,OAAO,CAACC,GAAR,CAAY,YAAZ,CAA0BH,KAAK,CAACI,EAAhC,EACpB,GAAMC,CAAAA,OAAO,CAAG,QAAVA,CAAAA,OAAU,SAAML,CAAAA,KAAK,CAACM,cAAN,CAAqBN,KAAK,CAACI,EAA3B,CAAN,EAAhB,CACA,GAAMG,CAAAA,kBAAkB,CAAG,QAArBA,CAAAA,kBAAqB,EAAM,CAChC,GAAIP,KAAK,CAACO,kBAAN,GAA6B,IAAjC,CAAuC,MAAO,KAAP,CACvC,GAAMC,CAAAA,SAAS,CAAG,CACjBC,WAAW,CAAET,KAAK,CAACU,uBAAN,EAAiC,SAD7B,CAEjBC,aAAa,CAAEX,KAAK,CAACY,yBAAN,EAAmC,WAFjC,CAGjBC,MAAM,CAAEb,KAAK,CAACC,QAHG,CA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E,QAFJ,CAPuB,CAWhCP,OAAO,CAAE,CACRQ,IAAI,CAAE,CADE,CAERC,UAAU,CAAE,EAFJ,CAXuB,CAehCb,IAAI,CAAE,CACLc,UAAU,CAAE,MADP,CAf0B,CAkBhCC,KAAK,CAAE,CACNC,MAAM,CAAE,EADF,CAENC,KAAK,CAAE,EAFD,CAGNC,YAAY,CAAE,EAHR,CAINC,QAAQ,CAAE,QAJJ,CAlByB,CAwBhCb,cAAc,CAAE,CACfc,cAAc,CAAE,QADD,CAxBgB,CA2BhCC,KAAK,CAAE,CACNL,MAAM,CAAE,EADF,CAENC,KAAK,CAAE,EAFD,CAGNC,YAAY,CAAE,IAHR,CAINI,eAAe,CAAE,WAJX,CA3ByB,CAkChCC,OAAO,CAAE,CAERX,IAAI,CAAE,CAFE,CAGRD,UAAU,CAAE,QAHJ,CAIRS,cAAc,CAAE,YAJR,CAlCuB,CAAlB,CAAf","sourcesContent":["import React from 'react'\nimport { View, Text, StyleSheet, TouchableOpacity } from 'react-native'\nimport { RoomCreatorItemProps } from '../../types'\nimport Icon from './Icon'\nimport Avatar from '../../../Avatar'\nimport Initials from '../../../Inbox/Item/Initials'\nimport { getInitials } from '../../../../helpers/getInitials'\n\nexport default React.memo((props: RoomCreatorItemProps) => {\n\tif (props.selected) console.log('selected!!', props.id)\n\tconst onPress = () => props.toggleSelected(props.id)\n\tconst renderSelectedIcon = () => {\n\t\tif (props.renderSelectedIcon === null) return null\n\t\tconst iconProps = {\n\t\t\tactiveColor: props.selectedIconActiveColor || '#147EFB',\n\t\t\tinactiveColor: props.selectedIconInactiveColor || '#D3D3D360',\n\t\t\tactive: props.selected\n\t\t}\n\t\tif (props.renderSelectedIcon) return props.renderSelectedIcon(iconProps)\n\n\t\treturn <Icon {...iconProps} />\n\t}\n\tconst renderAvatarOrInitials = () => {\n\t\treturn props.avatar ? (\n\t\t\t<Avatar avatar={props.avatar} size={50} />\n\t\t) : (\n\t\t\t<Initials size={50} initials={getInitials(props.name)} />\n\t\t)\n\t}\n\treturn (\n\t\t<View>\n\t\t\t<TouchableOpacity onPress={onPress} style={styles.container}>\n\t\t\t\t<View style={styles.wrapper}>\n\t\t\t\t\t{renderAvatarOrInitials()}\n\t\t\t\t\t<View style={styles.content}>\n\t\t\t\t\t\t{!!props.handle && <Text style={styles.name}>{props.handle}</Text>}\n\t\t\t\t\t\t<Text>{props.name}</Text>\n\t\t\t\t\t</View>\n\t\t\t\t\t<View style={styles.checkContainer}>{renderSelectedIcon()}</View>\n\t\t\t\t</View>\n\t\t\t</TouchableOpacity>\n\t\t</View>\n\t)\n})\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tpaddingHorizontal: 16,\n\t\tpaddingVertical: 10\n\t\t// borderBottomWidth: 0.5,\n\t\t// borderBottomColor: 'lightgray'\n\t},\n\twrapper: {\n\t\tflexDirection: 'row',\n\t\talignItems: 'center'\n\t},\n\tcontent: {\n\t\tflex: 1,\n\t\tmarginLeft: 16\n\t},\n\tname: {\n\t\tfontWeight: 'bold'\n\t},\n\timage: {\n\t\theight: 50,\n\t\twidth: 50,\n\t\tborderRadius: 25,\n\t\toverflow: 'hidden'\n\t},\n\tcheckContainer: {\n\t\tjustifyContent: 'center'\n\t},\n\tcheck: {\n\t\theight: 25,\n\t\twidth: 25,\n\t\tborderRadius: 12.5,\n\t\tbackgroundColor: 'lightgray'\n\t\t// overflow: 'hidden',\n\t},\n\tchecked: {\n\t\t// backgroundColor: 'blue',\n\t\tflex: 1,\n\t\talignItems: 'center',\n\t\tjustifyContent: 'flex-start'\n\t\t// paddingBottom: 4,\n\t}\n})\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _extends from"@babel/runtime/helpers/extends";import _defineProperty from"@babel/runtime/helpers/defineProperty";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/RoomCreator/Content/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React,{useCallback}from'react';import{View,FlatList,StyleSheet}from'react-native';import Item from'./Item';import Footer from'./Footer';export default(function(props){var renderItem=function renderItem(_ref){var item=_ref.item;if(props.renderItem===null)return null;var itemProps=_objectSpread({},item,{selected:!!props.selected[item.id],toggleSelected:props.toggleSelected,renderSelectedIcon:props.renderSelectedIcon,selectedIconActiveColor:props.selectedIconActiveColor,selectedIconInactiveColor:props.selectedIconInactiveColor});if(props.renderItem)return props.renderItem(itemProps);return React.createElement(Item,_extends({},itemProps,{__source:{fileName:_jsxFileName,lineNumber:27}}));};var keyExtractor=useCallback(function(item){return item.id;},[]);var renderFooter=function renderFooter(){if(props.renderFooter===null)return null;var footerProps={renderButton:props.renderButton,buttons:props.buttons,ButtonComponent:props.ButtonComponent,ready:props.ready,selected:props.selected,enableTextInput:!!props.enableTextInput,inputContainerStyle:props.inputContainerStyle,inputStyle:props.inputStyle,showInputWhenNotReady:!!props.showInputWhenNotReady,inputProps:props.inputProps,onChangeText:props.onChangeText,text:props.text};if(props.renderFooter)return props.renderFooter(footerProps);return React.createElement(Footer,_extends({},footerProps,{__source:{fileName:_jsxFileName,lineNumber:51}}));};return React.createElement(View,{style:styles.container,__source:{fileName:_jsxFileName,lineNumber:55}},React.createElement(View,{style:styles.wrapper,__source:{fileName:_jsxFileName,lineNumber:56}},React.createElement(FlatList,{bounces:false,keyExtractor:keyExtractor,renderItem:renderItem,data:props.users,extraData:props.selected,keyboardDismissMode:"on-drag",keyboardShouldPersistTaps:"handled",__source:{fileName:_jsxFileName,lineNumber:57}}),renderFooter()));});var styles=StyleSheet.create({container:{backgroundColor:'white',flex:1},wrapper:{flex:1,justifyContent:'space-between'}});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","useCallback","View","FlatList","StyleSheet","Item","Footer","props","renderItem","item","itemProps","selected","id","toggleSelected","renderSelectedIcon","selectedIconActiveColor","selectedIconInactiveColor","keyExtractor","renderFooter","footerProps","renderButton","buttons","ButtonComponent","ready","enableTextInput","inputContainerStyle","inputStyle","showInputWhenNotReady","inputProps","onChangeText","text","styles","container","wrapper","users","create","backgroundColor","flex","justifyContent"],"mappings":"qgCAAA,MAAOA,CAAAA,KAAP,EAAgBC,WAAhB,KAAmC,OAAnC,CACA,OAASC,IAAT,CAAeC,QAAf,CAAyBC,UAAzB,KAA2C,cAA3C,CACA,MAAOC,CAAAA,IAAP,KAAiB,QAAjB,CAOA,MAAOC,CAAAA,MAAP,KAAmB,UAAnB,CAEA,eAAe,SAACC,KAAD,CAAoC,CAClD,GAAMC,CAAAA,UAAU,CAAG,QAAbA,CAAAA,UAAa,MAA8B,IAA3BC,CAAAA,IAA2B,MAA3BA,IAA2B,CAChD,GAAIF,KAAK,CAACC,UAAN,GAAqB,IAAzB,CAA+B,MAAO,KAAP,CAE/B,GAAME,CAAAA,SAA+B,kBACjCD,IADiC,EAEpCE,QAAQ,CAAE,CAAC,CAACJ,KAAK,CAACI,QAAN,CAAeF,IAAI,CAACG,EAApB,CAFwB,CAGpCC,cAAc,CAAEN,KAAK,CAACM,cAHc,CAIpCC,kBAAkB,CAAEP,KAAK,CAACO,kBAJU,CAKpCC,uBAAuB,CAAER,KAAK,CAACQ,uBALK,CAMpCC,yBAAyB,CAAET,KAAK,CAACS,yBANG,EAArC,CASA,GAAIT,KAAK,CAACC,UAAV,CAAsB,MAAOD,CA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AAE,KADV,CAEC,YAAY,CAAEhB,YAFf,CAGC,UAAU,CAAET,UAHb,CAIC,IAAI,CAAED,KAAK,CAAC2B,KAJb,CAKC,SAAS,CAAE3B,KAAK,CAACI,QALlB,CAMC,mBAAmB,CAAC,SANrB,CAOC,yBAAyB,CAAC,SAP3B,iDADD,CAUEO,YAAY,EAVd,CADD,CADD,CAgBA,CA1DD,EA4DA,GAAMa,CAAAA,MAAM,CAAG3B,UAAU,CAAC+B,MAAX,CAAkB,CAChCH,SAAS,CAAE,CAAEI,eAAe,CAAE,OAAnB,CAA4BC,IAAI,CAAE,CAAlC,CADqB,CAEhCJ,OAAO,CAAE,CAAEI,IAAI,CAAE,CAAR,CAAWC,cAAc,CAAE,eAA3B,CAFuB,CAAlB,CAAf","sourcesContent":["import React, { useCallback } from 'react'\nimport { View, FlatList, StyleSheet } from 'react-native'\nimport Item from './Item'\nimport {\n\tRoomCreatorContentProps,\n\tRoomCreatorFooterProps,\n\tRoomCreatorItemProps,\n\tUser\n} from '../types'\nimport Footer from './Footer'\n\nexport default (props: RoomCreatorContentProps) => {\n\tconst renderItem = ({ item }: { item: User }) => {\n\t\tif (props.renderItem === null) return null\n\n\t\tconst itemProps: RoomCreatorItemProps = {\n\t\t\t...item,\n\t\t\tselected: !!props.selected[item.id],\n\t\t\ttoggleSelected: props.toggleSelected,\n\t\t\trenderSelectedIcon: props.renderSelectedIcon,\n\t\t\tselectedIconActiveColor: props.selectedIconActiveColor,\n\t\t\tselectedIconInactiveColor: props.selectedIconInactiveColor\n\t\t}\n\n\t\tif (props.renderItem) return props.renderItem(itemProps)\n\n\t\treturn <Item {...itemProps} />\n\t}\n\n\tconst keyExtractor = useCallback((item: User) => item.id, [])\n\n\tconst renderFooter = () => {\n\t\tif (props.renderFooter === null) return null\n\n\t\tconst footerProps: RoomCreatorFooterProps = {\n\t\t\trenderButton: props.renderButton,\n\t\t\tbuttons: props.buttons,\n\t\t\tButtonComponent: props.ButtonComponent,\n\t\t\tready: props.ready,\n\t\t\tselected: props.selected,\n\t\t\tenableTextInput: !!props.enableTextInput,\n\t\t\tinputContainerStyle: props.inputContainerStyle,\n\t\t\tinputStyle: props.inputStyle,\n\t\t\tshowInputWhenNotReady: !!props.showInputWhenNotReady,\n\t\t\tinputProps: props.inputProps,\n\t\t\tonChangeText: props.onChangeText,\n\t\t\ttext: props.text\n\t\t}\n\t\tif (props.renderFooter) return props.renderFooter(footerProps)\n\n\t\treturn <Footer {...footerProps} />\n\t}\n\n\treturn (\n\t\t<View style={styles.container}>\n\t\t\t<View style={styles.wrapper}>\n\t\t\t\t<FlatList\n\t\t\t\t\tbounces={false}\n\t\t\t\t\tkeyExtractor={keyExtractor}\n\t\t\t\t\trenderItem={renderItem}\n\t\t\t\t\tdata={props.users}\n\t\t\t\t\textraData={props.selected}\n\t\t\t\t\tkeyboardDismissMode=\"on-drag\"\n\t\t\t\t\tkeyboardShouldPersistTaps=\"handled\"\n\t\t\t\t/>\n\t\t\t\t{renderFooter()}\n\t\t\t</View>\n\t\t</View>\n\t)\n}\n\nconst styles = StyleSheet.create({\n\tcontainer: { backgroundColor: 'white', flex: 1 },\n\twrapper: { flex: 1, justifyContent: 'space-between' }\n})\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/RoomCreator/Header/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React from'react';import{View,Text,StyleSheet,Image}from'react-native';import Animated from'react-native-reanimated';export default(function(props){return React.createElement(Animated.View,{style:[styles.container,{backgroundColor:props.backgroundColor},props.containerStyle],__source:{fileName:_jsxFileName,lineNumber:8}},React.createElement(View,{style:[styles.notchContainer],__source:{fileName:_jsxFileName,lineNumber:15}},React.createElement(View,{style:styles.notch,__source:{fileName:_jsxFileName,lineNumber:16}})),React.createElement(View,{style:styles.wrapper,__source:{fileName:_jsxFileName,lineNumber:18}},!!props.image&&React.createElement(View,{style:[styles.imageContainer,props.imageStyle],__source:{fileName:_jsxFileName,lineNumber:20}},React.createElement(Image,{style:[styles.image],source:{uri:props.image},__source:{fileName:_jsxFileName,lineNumber:21}})),React.createElement(View,{__source:{fileName:_jsxFileName,lineNumber:24}},!!props.title&&React.createElement(Text,{style:[styles.text,props.titleStyle],__source:{fileName:_jsxFileName,lineNumber:26}},props.title),!!props.subtitle&&React.createElement(Text,{style:[props.subtitleStyle],__source:{fileName:_jsxFileName,lineNumber:29}},props.subtitle))));});var styles=StyleSheet.create({container:{borderTopRightRadius:10,borderTopLeftRadius:10,overflow:'hidden',backgroundColor:'white',borderBottomColor:'lightgray',borderBottomWidth:1,padding:10,zIndex:-1},wrapper:{flexDirection:'row'},text:{fontWeight:'bold',fontSize:18},notchContainer:{alignItems:'center',paddingVertical:10},notch:{width:40,height:5,borderRadius:5,backgroundColor:'lightgray'},image:_objectSpread({},StyleSheet.absoluteFillObject),imageContainer:{height:80,width:80,marginRight:10}});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","View","Text","StyleSheet","Image","Animated","props","styles","container","backgroundColor","containerStyle","notchContainer","notch","wrapper","image","imageContainer","imageStyle","uri","title","text","titleStyle","subtitle","subtitleStyle","create","borderTopRightRadius","borderTopLeftRadius","overflow","borderBottomColor","borderBottomWidth","padding","zIndex","flexDirection","fontWeight","fontSize","alignItems","paddingVertical","width","height","borderRadius","absoluteFillObject","marginRight"],"mappings":"+8BAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OAASC,IAAT,CAAeC,IAAf,CAAqBC,UAArB,CAAiCC,KAAjC,KAA8C,cAA9C,CAEA,MAAOC,CAAAA,QAAP,KAAqB,yBAArB,CAEA,eAAe,SAACC,KAAD,CAAmC,CACjD,MACC,qBAAC,QAAD,CAAU,IAAV,EACC,KAAK,CAAE,CACNC,MAAM,CAACC,SADD,CAEN,CAAEC,eAAe,CAAEH,KAAK,CAACG,eAAzB,CAFM,CAGNH,KAAK,CAACI,cAHA,CADR,gDAOC,oBAAC,IAAD,EAAM,KAAK,CAAE,CAACH,MAAM,CAACI,cAAR,CAAb,iDACC,oBAAC,IAAD,EAAM,KAAK,CAAEJ,MAAM,CAACK,KAApB,iDADD,CAPD,CAUC,oBAAC,IAAD,EAAM,KAAK,CAAEL,MAAM,CAACM,OAApB,iDACE,CAAC,CAACP,KAAK,CAACQ,KAAR,EACA,oBAAC,IAAD,EAAM,KAAK,CAAE,CAACP,MAAM,CAACQ,cAAR,CAAwBT,KAAK,CAACU,UAA9B,CAAb,iDACC,oBAAC,KAAD,EAAO,KAAK,CAAE,CAACT,MAAM,CAACO,KAAR,CAAd,CAA8B,MAAM,CAAE,CAAEG,GAAG,CAAEX,KAAK,CAACQ,KAAb,CAAtC,iDADD,CAFF,CAMC,oBAAC,IAAD,kDACE,CAAC,CAACR,KAAK,CAACY,KAAR,EACA,oBAAC,IAAD,EAAM,KAAK,CAAE,CAACX,MAAM,CAACY,IAAR,CAAcb,KAAK,CAACc,UAApB,CAAb,iDAA+Cd,KAAK,CAACY,KAArD,CAFF,CAIE,CAAC,CAACZ,KAAK,CAACe,QAAR,EACA,oBAAC,IAAD,EAAM,KAAK,CAAE,CAACf,KAAK,CAACgB,aAAP,CAAb,iDAAqChB,KAAK,CAACe,QAA3C,CALF,CAND,CAVD,CADD,CA4BA,CA7BD,EA+BA,GAAMd,CAAAA,MAAM,CAAGJ,UAAU,CAACoB,MAAX,CAAkB,CAChCf,SAAS,CAAE,CAEVgB,oBAAoB,CAAE,EAFZ,CAGVC,mBAAmB,CAAE,EAHX,CAIVC,QAAQ,CAAE,QAJA,CAKVjB,eAAe,CAAE,OALP,CAMVkB,iBAAiB,CAAE,WANT,CAOVC,iBAAiB,CAAE,CAPT,CAQVC,OAAO,CAAE,EARC,CASVC,MAAM,CAAE,CAAC,CATC,CADqB,CAYhCjB,OAAO,CAAE,CACRkB,aAAa,CAAE,KADP,CAZuB,CAehCZ,IAAI,CAAE,CACLa,UAAU,CAAE,MADP,CAELC,QAAQ,CAAE,EAFL,CAf0B,CAmBhCtB,cAAc,CAAE,CACfuB,UAAU,CAAE,QADG,CAEfC,eAAe,CAAE,EAFF,CAnBgB,CAuBhCvB,KAAK,CAAE,CACNwB,KAAK,CAAE,EADD,CAENC,MAAM,CAAE,CAFF,CAGNC,YAAY,CAAE,CAHR,CAIN7B,eAAe,CAAE,WAJX,CAvByB,CA6BhCK,KAAK,kBACDX,UAAU,CAACoC,kBADV,CA7B2B,CAgChCxB,cAAc,CAAE,CACfsB,MAAM,CAAE,EADO,CAEfD,KAAK,CAAE,EAFQ,CAGfI,WAAW,CAAE,EAHE,CAhCgB,CAAlB,CAAf","sourcesContent":["import React from 'react'\nimport { View, Text, StyleSheet, Image } from 'react-native'\nimport { RoomCreatorHeaderProps } from '../types'\nimport Animated from 'react-native-reanimated'\n\nexport default (props: RoomCreatorHeaderProps) => {\n\treturn (\n\t\t<Animated.View\n\t\t\tstyle={[\n\t\t\t\tstyles.container,\n\t\t\t\t{ backgroundColor: props.backgroundColor },\n\t\t\t\tprops.containerStyle\n\t\t\t]}\n\t\t>\n\t\t\t<View style={[styles.notchContainer]}>\n\t\t\t\t<View style={styles.notch} />\n\t\t\t</View>\n\t\t\t<View style={styles.wrapper}>\n\t\t\t\t{!!props.image && (\n\t\t\t\t\t<View style={[styles.imageContainer, props.imageStyle]}>\n\t\t\t\t\t\t<Image style={[styles.image]} source={{ uri: props.image }} />\n\t\t\t\t\t</View>\n\t\t\t\t)}\n\t\t\t\t<View>\n\t\t\t\t\t{!!props.title && (\n\t\t\t\t\t\t<Text style={[styles.text, props.titleStyle]}>{props.title}</Text>\n\t\t\t\t\t)}\n\t\t\t\t\t{!!props.subtitle && (\n\t\t\t\t\t\t<Text style={[props.subtitleStyle]}>{props.subtitle}</Text>\n\t\t\t\t\t)}\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t</Animated.View>\n\t)\n}\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\t// height: 75,\n\t\tborderTopRightRadius: 10,\n\t\tborderTopLeftRadius: 10,\n\t\toverflow: 'hidden',\n\t\tbackgroundColor: 'white',\n\t\tborderBottomColor: 'lightgray',\n\t\tborderBottomWidth: 1,\n\t\tpadding: 10,\n\t\tzIndex: -1\n\t},\n\twrapper: {\n\t\tflexDirection: 'row'\n\t},\n\ttext: {\n\t\tfontWeight: 'bold',\n\t\tfontSize: 18\n\t},\n\tnotchContainer: {\n\t\talignItems: 'center',\n\t\tpaddingVertical: 10\n\t},\n\tnotch: {\n\t\twidth: 40,\n\t\theight: 5,\n\t\tborderRadius: 5,\n\t\tbackgroundColor: 'lightgray'\n\t},\n\timage: {\n\t\t...StyleSheet.absoluteFillObject\n\t},\n\timageContainer: {\n\t\theight: 80,\n\t\twidth: 80,\n\t\tmarginRight: 10\n\t}\n})\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _extends from"@babel/runtime/helpers/extends";import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/RoomCreator/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[typeof Symbol==="function"?Symbol.toPrimitive:"@@toPrimitive"];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}import React,{useMemo,useRef,useState,useEffect}from'react';import BottomSheet from'reanimated-bottom-sheet';import Header from'./Header';import Content from'./Content';import Animated from'react-native-reanimated';var Value=Animated.Value,useCode=Animated.useCode,block=Animated.block,cond=Animated.cond,eq=Animated.eq,call=Animated.call,and=Animated.and;var initialSelected={};function RoomCreator(props){var sheetRef=useRef(null);var callbackNode=useMemo(function(){return props.callbackNode||new Value(1);},[props.callbackNode]);var _useState=useState(initialSelected),_useState2=_slicedToArray(_useState,2),selectedState=_useState2[0],setSelected=_useState2[1];var _useState3=useState(''),_useState4=_slicedToArray(_useState3,2),text=_useState4[0],setText=_useState4[1];var ref=props.sheetRef!==undefined?props.sheetRef:sheetRef;var selected=props.selected||selectedState;var ready=useMemo(function(){return props.isReadyFunc?props.isReadyFunc(selected):!!Object.keys(selected).filter(Boolean).length;},[props,selected]);var mounted=useRef(0);useCode(function(){return block([cond(eq(callbackNode,1),call([],onDidClose),cond(and(eq(callbackNode,0),(mounted.current,1)),call([],onDidOpen)))]);},[callbackNode,onDidClose,onDidOpen]);useEffect(function(){if(!mounted.current)mounted.current=1;},[]);function reset(){setSelected(initialSelected);setText('');}var toggleSelected=function toggleSelected(id){if(props.onSelectItem)return props.onSelectItem(id);setSelected(function(currentlySelected){var user=props.users.find(function(u){return u.id===id;});if(currentlySelected[id]||!user){var pressed=currentlySelected[id],ommitted=_objectWithoutProperties(currentlySelected,[id].map(_toPropertyKey));return ommitted;}return _objectSpread({},currentlySelected,_defineProperty({},id,user.type));});};var open=function open(){return ref.current&&ref.current.snapTo(1);};var close=function close(){return ref.current&&ref.current.snapTo(0);};if(props.creatorRef){props.creatorRef.current={open:open,close:close};}function onDidClose(){if(props.onDidClose)props.onDidClose();reset();}function onDidOpen(){if(props.onDidOpen)props.onDidOpen();}var renderHeader=function renderHeader(){var headerProps={callbackNode:callbackNode,image:props.headerImage,imageStyle:props.headerImageStyle,subtitle:props.headerSubtitle,subtitleStyle:props.headerSubtitleStyle,title:props.headerTitle||'New Message',titleStyle:props.headerTitleStyle,backgroundColor:props.headerBackgroundColor||'#f8f8f8',containerStyle:props.headerContainerStyle};if(props.renderHeader)return props.renderHeader(headerProps);if(props.renderHeader===null)return null;return React.createElement(Header,_extends({},headerProps,{__source:{fileName:_jsxFileName,lineNumber:121}}));};var renderContent=function renderContent(){var contentProps={toggleSelected:toggleSelected,selected:selected,renderFooter:props.renderFooter,buttons:props.buttons,renderButton:props.renderButton,ButtonComponent:props.ButtonComponent,users:props.users,renderItem:props.renderItem,ready:ready,renderSelectedIcon:props.renderSelectedIcon,selectedIconActiveColor:props.selectedIconActiveColor,selectedIconInactiveColor:props.selectedIconInactiveColor,enableTextInput:props.enableTextInput,inputContainerStyle:props.inputContainerStyle,inputStyle:props.inputStyle,showInputWhenNotReady:props.showInputWhenNotReady,inputProps:props.inputProps,onChangeText:setText,text:text};if(props.renderContent)return props.renderContent(contentProps);if(props.renderContent===null)return null;return React.createElement(Content,_extends({},contentProps,{__source:{fileName:_jsxFileName,lineNumber:149}}));};var snapPoints=useMemo(function(){return props.snapPoints||['0%','90%'];},[props.snapPoints]);var initialSnap=props.startOpen?1:0;var renderSheet=function renderSheet(){return React.createElement(BottomSheet,_extends({initialSnap:initialSnap},props.sheetProps,{renderHeader:renderHeader,renderContent:renderContent,snapPoints:snapPoints,callbackNode:callbackNode,ref:ref},{__source:{fileName:_jsxFileName,lineNumber:160}}));};return React.createElement(React.Fragment,null,renderSheet());}export default RoomCreator;
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","useMemo","useRef","useState","useEffect","BottomSheet","Header","Content","Animated","Value","useCode","block","cond","eq","call","and","initialSelected","RoomCreator","props","sheetRef","callbackNode","selectedState","setSelected","text","setText","ref","undefined","selected","ready","isReadyFunc","Object","keys","filter","Boolean","length","mounted","onDidClose","current","onDidOpen","reset","toggleSelected","id","onSelectItem","currentlySelected","user","users","find","u","pressed","ommitted","type","open","snapTo","close","creatorRef","renderHeader","headerProps","image","headerImage","imageStyle","headerImageStyle","subtitle","headerSubtitle","subtitleStyle","headerSubtitleStyle","title","headerTitle","titleStyle","headerTitleStyle","backgroundColor","headerBackgroundColor","containerStyle","headerContainerStyle","renderContent","contentProps","renderFooter","buttons","renderButton","ButtonComponent","renderItem","renderSelectedIcon","selectedIconActiveColor","selectedIconInactiveColor","enableTextInput","inputContainerStyle","inputStyle","showInputWhenNotReady","inputProps","onChangeText","snapPoints","initialSnap","startOpen","renderSheet","sheetProps"],"mappings":"4nDAAA,MAAOA,CAAAA,KAAP,EAAgBC,OAAhB,CAAyBC,MAAzB,CAAiCC,QAAjC,CAA2CC,SAA3C,KAA4D,OAA5D,CACA,MAAOC,CAAAA,WAAP,KAAwB,yBAAxB,CACA,MAAOC,CAAAA,MAAP,KAAmB,UAAnB,CACA,MAAOC,CAAAA,OAAP,KAAoB,WAApB,CACA,MAAOC,CA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YAApB,CAAP,CACzB,GAAIxD,KAAK,CAACuD,aAAN,GAAwB,IAA5B,CAAkC,MAAO,KAAP,CAElC,MAAO,qBAAC,OAAD,aAAaC,YAAb,oDAAP,CACA,CA1BD,CA4BA,GAAMe,CAAAA,UAAU,CAAGxF,OAAO,CAAC,iBAAMiB,CAAAA,KAAK,CAACuE,UAAN,EAAoB,CAAC,IAAD,CAAO,KAAP,CAA1B,EAAD,CAA0C,CACnEvE,KAAK,CAACuE,UAD6D,CAA1C,CAA1B,CAIA,GAAMC,CAAAA,WAAW,CAAGxE,KAAK,CAACyE,SAAN,CAAkB,CAAlB,CAAsB,CAA1C,CAEA,GAAMC,CAAAA,WAAW,CAAG,QAAdA,CAAAA,WAAc,EAAM,CACzB,MACC,qBAAC,WAAD,UACK,CAAEF,WAAW,CAAXA,WAAF,CADL,CAEKxE,KAAK,CAAC2E,UAFX,CAGK,CACHtC,YAAY,CAAZA,YADG,CAEHkB,aAAa,CAAbA,aAFG,CAGHgB,UAAU,CAAVA,UAHG,CAIHrE,YAAY,CAAZA,YAJG,CAKHK,GAAG,CAAHA,GALG,CAHL,oDADD,CAaA,CAdD,CAgBA,MAAO,yCAAGmE,WAAW,EAAd,CAAP,CACA,CAED,cAAe3E,CAAAA,WAAf","sourcesContent":["import React, { useMemo, useRef, useState, useEffect } from 'react'\nimport BottomSheet from 'reanimated-bottom-sheet'\nimport Header from './Header'\nimport Content from './Content'\nimport Animated from 'react-native-reanimated'\nimport {\n\tRoomCreatorProps,\n\tSelected,\n\tRoomCreatorContentProps,\n\tRoomCreatorHeaderProps\n} from './types'\n\nconst { Value, useCode, block, cond, eq, call, and } = Animated\n\nconst initialSelected: Selected = {}\n\nfunction RoomCreator(props: RoomCreatorProps) {\n\tconst sheetRef = useRef<BottomSheet>(null)\n\tconst callbackNode = useMemo(() => props.callbackNode || new Value(1), [\n\t\tprops.callbackNode\n\t])\n\tconst [selectedState, setSelected] = useState<Selected>(initialSelected)\n\tconst [text, setText] = useState('')\n\n\tconst ref = props.sheetRef !== undefined ? props.sheetRef : sheetRef\n\n\t// should we handle selected state or not\n\tconst selected = props.selected || selectedState\n\n\tconst ready = useMemo(\n\t\t() =>\n\t\t\tprops.isReadyFunc\n\t\t\t\t? props.isReadyFunc(selected)\n\t\t\t\t: !!Object.keys(selected).filter(Boolean).length,\n\t\t[props, selected]\n\t)\n\n\tconst mounted = useRef(0)\n\n\tuseCode(\n\t\t() =>\n\t\t\tblock([\n\t\t\t\tcond(\n\t\t\t\t\t// if the sheet just opened\n\t\t\t\t\teq(callbackNode, 1),\n\t\t\t\t\tcall([], onDidClose),\n\t\t\t\t\t// if the sheet just closed\n\t\t\t\t\tcond(\n\t\t\t\t\t\tand(eq(callbackNode, 0), (mounted.current, 1)),\n\t\t\t\t\t\tcall([], onDidOpen)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t]),\n\t\t[callbackNode, onDidClose, onDidOpen]\n\t)\n\n\tuseEffect(() => {\n\t\tif (!mounted.current) mounted.current = 1\n\t}, [])\n\n\tfunction reset() {\n\t\tsetSelected(initialSelected)\n\t\tsetText('')\n\t}\n\n\tconst toggleSelected = (id: string) => {\n\t\tif (props.onSelectItem) return props.onSelectItem(id)\n\n\t\tsetSelected(currentlySelected => {\n\t\t\tconst user = props.users.find(u => u.id === id)\n\t\t\tif (currentlySelected[id] || !user) {\n\t\t\t\tconst { [id]: pressed, ...ommitted } = currentlySelected\n\t\t\t\treturn ommitted\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...currentlySelected,\n\t\t\t\t[id]: user.type\n\t\t\t}\n\t\t})\n\t}\n\n\tconst open = () => ref.current && ref.current.snapTo(1)\n\tconst close = () => ref.current && ref.current.snapTo(0)\n\n\tif (props.creatorRef) {\n\t\tprops.creatorRef.current = {\n\t\t\topen,\n\t\t\tclose\n\t\t}\n\t}\n\n\t// useEffect(() => {\n\t// \tif (props.isOpen === true) open()\n\t// \telse close()\n\t// }, [props.isOpen])\n\n\tfunction onDidClose() {\n\t\tif (props.onDidClose) props.onDidClose()\n\t\treset()\n\t}\n\n\tfunction onDidOpen() {\n\t\tif (props.onDidOpen) props.onDidOpen()\n\t}\n\n\tconst renderHeader = () => {\n\t\tconst headerProps: RoomCreatorHeaderProps = {\n\t\t\tcallbackNode,\n\t\t\timage: props.headerImage,\n\t\t\timageStyle: props.headerImageStyle,\n\t\t\tsubtitle: props.headerSubtitle,\n\t\t\tsubtitleStyle: props.headerSubtitleStyle,\n\t\t\ttitle: props.headerTitle || 'New Message',\n\t\t\ttitleStyle: props.headerTitleStyle,\n\t\t\tbackgroundColor: props.headerBackgroundColor || '#f8f8f8',\n\t\t\tcontainerStyle: props.headerContainerStyle\n\t\t}\n\t\tif (props.renderHeader) return props.renderHeader(headerProps)\n\t\tif (props.renderHeader === null) return null\n\n\t\treturn <Header {...headerProps} />\n\t}\n\n\tconst renderContent = () => {\n\t\tconst contentProps: RoomCreatorContentProps = {\n\t\t\ttoggleSelected,\n\t\t\tselected,\n\t\t\trenderFooter: props.renderFooter,\n\t\t\tbuttons: props.buttons,\n\t\t\trenderButton: props.renderButton,\n\t\t\tButtonComponent: props.ButtonComponent,\n\t\t\tusers: props.users,\n\t\t\trenderItem: props.renderItem,\n\t\t\tready,\n\t\t\trenderSelectedIcon: props.renderSelectedIcon,\n\t\t\tselectedIconActiveColor: props.selectedIconActiveColor,\n\t\t\tselectedIconInactiveColor: props.selectedIconInactiveColor,\n\t\t\tenableTextInput: props.enableTextInput,\n\t\t\tinputContainerStyle: props.inputContainerStyle,\n\t\t\tinputStyle: props.inputStyle,\n\t\t\tshowInputWhenNotReady: props.showInputWhenNotReady,\n\t\t\tinputProps: props.inputProps,\n\t\t\tonChangeText: setText,\n\t\t\ttext\n\t\t}\n\t\tif (props.renderContent) return props.renderContent(contentProps)\n\t\tif (props.renderContent === null) return null\n\n\t\treturn <Content {...contentProps} />\n\t}\n\n\tconst snapPoints = useMemo(() => props.snapPoints || ['0%', '90%'], [\n\t\tprops.snapPoints\n\t])\n\n\tconst initialSnap = props.startOpen ? 1 : 0\n\n\tconst renderSheet = () => {\n\t\treturn (\n\t\t\t<BottomSheet\n\t\t\t\t{...{ initialSnap }}\n\t\t\t\t{...props.sheetProps}\n\t\t\t\t{...{\n\t\t\t\t\trenderHeader,\n\t\t\t\t\trenderContent,\n\t\t\t\t\tsnapPoints,\n\t\t\t\t\tcallbackNode,\n\t\t\t\t\tref\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn <>{renderSheet()}</>\n}\n\nexport default RoomCreator\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/TypingIndicator/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React from'react';import{View,StyleSheet}from'react-native';import{LinearGradient}from'expo-linear-gradient';import Animated,{Easing}from'react-native-reanimated';var Value=Animated.Value,useCode=Animated.useCode,interpolate=Animated.interpolate,Clock=Animated.Clock,set=Animated.set,block=Animated.block,startClock=Animated.startClock,cond=Animated.cond,stopClock=Animated.stopClock,timing=Animated.timing;var dots=[1,2,3];var length=dots.length;export default function(props){var animatedValue=new Value(0);var config={duration:2500,toValue:new Value(length+1),easing:Easing.inOut(Easing.linear)};useCode(function(){return set(animatedValue,runLoop(config));},[animatedValue]);var _props$theme=props.theme,theme=_props$theme===void 0?'red':_props$theme;if(props.hide)return null;var renderDot=function renderDot(index){var opacity=interpolate(animatedValue,{inputRange:[index-1,index,index+1],outputRange:[0,1,0]});return React.createElement(View,{key:index.toString(),style:styles.dot,__source:{fileName:_jsxFileName,lineNumber:41}},React.createElement(LinearGradient,_extends({colors:props.dotEmptyColors||themes[theme].emptyDotColors,start:[0.9,0.9],end:[0.1,0.1]},{style:{flex:1},__source:{fileName:_jsxFileName,lineNumber:42}})),React.createElement(Animated.View,{style:_objectSpread({opacity:opacity},StyleSheet.absoluteFillObject),__source:{fileName:_jsxFileName,lineNumber:50}},React.createElement(LinearGradient,_extends({colors:props.dotColors||themes[theme].dotColors,start:[0.1,0.1],end:[0.9,0.9]},{style:{flex:1},__source:{fileName:_jsxFileName,lineNumber:51}}))));};return React.createElement(View,{style:styles.container,__source:{fileName:_jsxFileName,lineNumber:64}},React.createElement(LinearGradient,_extends({colors:props.backgroundColors||themes[theme].backgroundColors,start:[0.1,0.1],end:[0.9,0.9]},{style:styles.wrapper,__source:{fileName:_jsxFileName,lineNumber:65}}),React.createElement(View,{style:styles.dots,__source:{fileName:_jsxFileName,lineNumber:73}},dots.map(renderDot))));}var themes={purple:{backgroundColors:['#7950f2','#5f3dc4'],dotColors:['white','white'],emptyDotColors:['#adb5bd','#adb5bd']},red:{backgroundColors:['#E5E5EA','#E5E5EA'],dotColors:['#ff8000','#ec2a80'],emptyDotColors:['#D1D1D6','#D1D1D6']},default:{backgroundColors:['#E5E5EA','#E5E5EA'],dotColors:['#8E8E93','#8E8E93'],emptyDotColors:['#D1D1D6','#D1D1D6']}};var dotSize=9;var padding=dotSize/4;var paddingVertical=padding*5;var totalHeight=dotSize+paddingVertical*2;var styles=StyleSheet.create({container:{alignItems:'flex-start'},wrapper:{paddingHorizontal:padding*3,paddingVertical:paddingVertical,borderRadius:totalHeight/2},dots:{flexDirection:'row'},dot:{height:dotSize,width:dotSize,borderRadius:dotSize/2,backgroundColor:'white',marginHorizontal:padding,overflow:'hidden'}});function runLoop(config){var clock=new Clock();var state={finished:new Value(0),position:new Value(0),time:new Value(0),frameTime:new Value(0)};return block([startClock(clock),timing(clock,state,config),cond(state.finished,[stopClock(clock),set(state.finished,0),set(state.position,0),set(state.time,0),set(state.frameTime,0),startClock(clock)]),state.position]);}
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","View","StyleSheet","LinearGradient","Animated","Easing","Value","useCode","interpolate","Clock","set","block","startClock","cond","stopClock","timing","dots","length","props","animatedValue","config","duration","toValue","easing","inOut","linear","runLoop","theme","hide","renderDot","index","opacity","inputRange","outputRange","toString","styles","dot","colors","dotEmptyColors","themes","emptyDotColors","start","end","flex","absoluteFillObject","dotColors","container","backgroundColors","wrapper","map","purple","red","default","dotSize","padding","paddingVertical","totalHeight","create","alignItems","paddingHorizontal","borderRadius","flexDirection","height","width","backgroundColor","marginHorizontal","overflow","clock","state","finished","position","time","frameTime"],"mappings":"igCAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OAASC,IAAT,CAAeC,UAAf,KAAiC,cAAjC,CACA,OAASC,cAAT,KAA+B,sBAA/B,CACA,MAAOC,CAAAA,QAAP,EAAmBC,MAAnB,KAAiC,yBAAjC,C,GAGCC,CAAAA,K,CAUGF,Q,CAVHE,K,CACAC,O,CASGH,Q,CATHG,O,CACAC,W,CAQGJ,Q,CARHI,W,CACAC,K,CAOGL,Q,CAPHK,K,CACAC,G,CAMGN,Q,CANHM,G,CACAC,K,CAKGP,Q,CALHO,K,CACAC,U,CAIGR,Q,CAJHQ,U,CACAC,I,CAGGT,Q,CAHHS,I,CACAC,S,CAEGV,Q,CAFHU,S,CACAC,M,CACGX,Q,C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,CAAAA,KAAJ,CAAU,CAAV,CADG,CAEbgE,QAAQ,CAAE,GAAIhE,CAAAA,KAAJ,CAAU,CAAV,CAFG,CAGbiE,IAAI,CAAE,GAAIjE,CAAAA,KAAJ,CAAU,CAAV,CAHO,CAIbkE,SAAS,CAAE,GAAIlE,CAAAA,KAAJ,CAAU,CAAV,CAJE,CAAd,CAOA,MAAOK,CAAAA,KAAK,CAAC,CAEZC,UAAU,CAACuD,KAAD,CAFE,CAKZpD,MAAM,CAACoD,KAAD,CAAQC,KAAR,CAAehD,MAAf,CALM,CAQZP,IAAI,CAACuD,KAAK,CAACC,QAAP,CAAiB,CAEpBvD,SAAS,CAACqD,KAAD,CAFW,CAKpBzD,GAAG,CAAC0D,KAAK,CAACC,QAAP,CAAiB,CAAjB,CALiB,CAOpB3D,GAAG,CAAC0D,KAAK,CAACE,QAAP,CAAiB,CAAjB,CAPiB,CAUpB5D,GAAG,CAAC0D,KAAK,CAACG,IAAP,CAAa,CAAb,CAViB,CAWpB7D,GAAG,CAAC0D,KAAK,CAACI,SAAP,CAAkB,CAAlB,CAXiB,CAcpB5D,UAAU,CAACuD,KAAD,CAdU,CAAjB,CARQ,CAyBZC,KAAK,CAACE,QAzBM,CAAD,CAAZ,CA2BA","sourcesContent":["import React from 'react'\nimport { View, StyleSheet } from 'react-native'\nimport { LinearGradient } from 'expo-linear-gradient'\nimport Animated, { Easing } from 'react-native-reanimated'\n\nconst {\n\tValue,\n\tuseCode,\n\tinterpolate,\n\tClock,\n\tset,\n\tblock,\n\tstartClock,\n\tcond,\n\tstopClock,\n\ttiming\n} = Animated\n\nconst dots = [1, 2, 3]\nconst length = dots.length\n\nexport default function(props: TypingIndicatorProps) {\n\tconst animatedValue = new Value(0)\n\tconst config = {\n\t\tduration: 2500,\n\t\ttoValue: new Value(length + 1),\n\t\teasing: Easing.inOut(Easing.linear)\n\t}\n\tuseCode(() => set(animatedValue, runLoop(config)), [animatedValue])\n\n\tconst { theme = 'red' } = props\n\n\tif (props.hide) return null\n\n\tconst renderDot = (index: number) => {\n\t\tconst opacity = interpolate(animatedValue, {\n\t\t\tinputRange: [index - 1, index, index + 1],\n\t\t\toutputRange: [0, 1, 0]\n\t\t})\n\t\treturn (\n\t\t\t<View key={index.toString()} style={styles.dot}>\n\t\t\t\t<LinearGradient\n\t\t\t\t\t{...{\n\t\t\t\t\t\tcolors: props.dotEmptyColors || themes[theme].emptyDotColors,\n\t\t\t\t\t\tstart: [0.9, 0.9],\n\t\t\t\t\t\tend: [0.1, 0.1]\n\t\t\t\t\t}}\n\t\t\t\t\tstyle={{ flex: 1 }}\n\t\t\t\t/>\n\t\t\t\t<Animated.View style={{ opacity, ...StyleSheet.absoluteFillObject }}>\n\t\t\t\t\t<LinearGradient\n\t\t\t\t\t\t{...{\n\t\t\t\t\t\t\tcolors: props.dotColors || themes[theme].dotColors,\n\t\t\t\t\t\t\tstart: [0.1, 0.1],\n\t\t\t\t\t\t\tend: [0.9, 0.9]\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={{ flex: 1 }}\n\t\t\t\t\t/>\n\t\t\t\t</Animated.View>\n\t\t\t</View>\n\t\t)\n\t}\n\treturn (\n\t\t<View style={styles.container}>\n\t\t\t<LinearGradient\n\t\t\t\t{...{\n\t\t\t\t\tcolors: props.backgroundColors || themes[theme].backgroundColors,\n\t\t\t\t\tstart: [0.1, 0.1],\n\t\t\t\t\tend: [0.9, 0.9]\n\t\t\t\t}}\n\t\t\t\tstyle={styles.wrapper}\n\t\t\t>\n\t\t\t\t<View style={styles.dots}>{dots.map(renderDot)}</View>\n\t\t\t</LinearGradient>\n\t\t</View>\n\t)\n}\n\nconst themes = {\n\tpurple: {\n\t\tbackgroundColors: ['#7950f2', '#5f3dc4'],\n\t\tdotColors: ['white', 'white'],\n\t\temptyDotColors: ['#adb5bd', '#adb5bd']\n\t},\n\tred: {\n\t\tbackgroundColors: ['#E5E5EA', '#E5E5EA'],\n\t\tdotColors: ['#ff8000', '#ec2a80'],\n\t\temptyDotColors: ['#D1D1D6', '#D1D1D6']\n\t},\n\tdefault: {\n\t\tbackgroundColors: ['#E5E5EA', '#E5E5EA'],\n\t\tdotColors: ['#8E8E93', '#8E8E93'],\n\t\temptyDotColors: ['#D1D1D6', '#D1D1D6']\n\t}\n}\n\nexport interface TypingIndicatorProps {\n\thide?: boolean\n\tbackgroundColors?: string[]\n\tdotColors?: string[]\n\tdotEmptyColors?: string[]\n\ttheme?: 'purple' | 'red' | 'default'\n}\n\nconst dotSize = 9\nconst padding = dotSize / 4\nconst paddingVertical = padding * 5\nconst totalHeight = dotSize + paddingVertical * 2\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\talignItems: 'flex-start'\n\t},\n\twrapper: {\n\t\tpaddingHorizontal: padding * 3,\n\t\tpaddingVertical,\n\t\tborderRadius: totalHeight / 2\n\t},\n\tdots: {\n\t\tflexDirection: 'row'\n\t},\n\tdot: {\n\t\theight: dotSize,\n\t\twidth: dotSize,\n\t\tborderRadius: dotSize / 2,\n\t\tbackgroundColor: 'white',\n\t\tmarginHorizontal: padding,\n\t\toverflow: 'hidden'\n\t}\n})\n\nfunction runLoop(config: Animated.TimingConfig) {\n\tconst clock = new Clock()\n\n\tconst state = {\n\t\tfinished: new Value(0),\n\t\tposition: new Value(0),\n\t\ttime: new Value(0),\n\t\tframeTime: new Value(0)\n\t}\n\n\treturn block([\n\t\t// start right away\n\t\tstartClock(clock),\n\n\t\t// process your state\n\t\ttiming(clock, state, config),\n\n\t\t// when over (processed by timing at the end)\n\t\tcond(state.finished, [\n\t\t\t// we stop\n\t\t\tstopClock(clock),\n\n\t\t\t// set flag ready to be restarted\n\t\t\tset(state.finished, 0),\n\t\t\t// same value as the initial defined in the state creation\n\t\t\tset(state.position, 0),\n\n\t\t\t// very important to reset this ones !!! as mentioned in the doc about timing is saying\n\t\t\tset(state.time, 0),\n\t\t\tset(state.frameTime, 0),\n\n\t\t\t// and we restart\n\t\t\tstartClock(clock)\n\t\t]),\n\n\t\tstate.position\n\t])\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export{default as Inbox}from'./Inbox';export{default as RoomCreator}from'./RoomCreator';export{default as CreateRoomList}from'./RoomCreator/Content';export{default as TypingIndicator}from'./TypingIndicator';export{default as Messages}from'./Chat';export{default as Avatar}from'./Avatar';export{default as ChatProvider,chat,fuego,setChat,setFuego}from'./ChatProvider';export{default as Initials}from'./Inbox/Item/Initials';export{default as Bubble}from'./Chat/Bubble';export{default as UnreadIndicator}from'./Inbox/Item/UnreadIndicator';export{default as Composer}from'./Chat/Composer';export{default as SystemMessage}from'./Chat/SystemMessage';
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["default","Inbox","RoomCreator","CreateRoomList","TypingIndicator","Messages","Avatar","ChatProvider","chat","fuego","setChat","setFuego","Initials","Bubble","UnreadIndicator","Composer","SystemMessage"],"mappings":"AAAA,OAASA,OAAO,GAAIC,CAAAA,KAApB,KAAiC,SAAjC,CACA,OAASD,OAAO,GAAIE,CAAAA,WAApB,KAAuC,eAAvC,CACA,OAASF,OAAO,GAAIG,CAAAA,cAApB,KAA0C,uBAA1C,CACA,OAASH,OAAO,GAAII,CAAAA,eAApB,KAA2C,mBAA3C,CACA,OAASJ,OAAO,GAAIK,CAAAA,QAApB,KAAoC,QAApC,CACA,OAASL,OAAO,GAAIM,CAAAA,MAApB,KAAkC,UAAlC,CACA,OACCN,OAAO,GAAIO,CAAAA,YADZ,CAECC,IAFD,CAGCC,KAHD,CAICC,OAJD,CAKCC,QALD,KAMO,gBANP,CAOA,OAASX,OAAO,GAAIY,CAAAA,QAApB,KAAoC,uBAApC,CACA,OAASZ,OAAO,GAAIa,CAAAA,MAApB,KAAkC,eAAlC,CACA,OAASb,OAAO,GAAIc,CAAAA,eAApB,KAA2C,8BAA3C,CACA,OAASd,OAAO,GAAIe,CAAAA,QAApB,KAAoC,iBAApC,CACA,OAASf,OAAO,GAAIgB,CAAAA,aAApB,KAAyC,sBAAzC","sourcesContent":["export { default as Inbox } from './Inbox'\nexport { default as RoomCreator } from './RoomCreator'\nexport { default as CreateRoomList } from './RoomCreator/Content'\nexport { default as TypingIndicator } from './TypingIndicator'\nexport { default as Messages } from './Chat'\nexport { default as Avatar } from './Avatar'\nexport {\n\tdefault as ChatProvider,\n\tchat,\n\tfuego,\n\tsetChat,\n\tsetFuego,\n} from './ChatProvider'\nexport { default as Initials } from './Inbox/Item/Initials'\nexport { default as Bubble } from './Chat/Bubble'\nexport { default as UnreadIndicator } from './Inbox/Item/UnreadIndicator'\nexport { default as Composer } from './Chat/Composer'\nexport { default as SystemMessage } from './Chat/SystemMessage'\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export var getInitials=function getInitials(name){var _ref;var maxLength=arguments.length>1&&arguments[1]!==undefined?arguments[1]:2;var parts=(_ref=name==null?void 0:name.split(' '))!=null?_ref:'';var initials='';for(var i=0;i<parts.length;i++){if(parts[i].length>0&&parts[i]!==''){initials+=parts[i][0];}}if(maxLength)initials=initials.slice(0,maxLength);return initials;};
|
|
2
|
-
//# sourceMappingURL=getInitials.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["getInitials.ts"],"names":["getInitials","name","maxLength","parts","split","initials","i","length","slice"],"mappings":"AAAA,MAAO,IAAMA,CAAAA,WAAW,CAAG,QAAdA,CAAAA,WAAc,CAASC,IAAT,CAA6C,aAAfC,CAAAA,SAAe,2DAAH,CAAG,CACvE,GAAMC,CAAAA,KAAK,OAAGF,IAAH,cAAGA,IAAI,CAAEG,KAAN,CAAY,GAAZ,CAAH,aAAuB,EAAlC,CACA,GAAIC,CAAAA,QAAQ,CAAG,EAAf,CACA,IAAK,GAAIC,CAAAA,CAAC,CAAG,CAAb,CAAgBA,CAAC,CAAGH,KAAK,CAACI,MAA1B,CAAkCD,CAAC,EAAnC,CAAuC,CACtC,GAAIH,KAAK,CAACG,CAAD,CAAL,CAASC,MAAT,CAAkB,CAAlB,EAAuBJ,KAAK,CAACG,CAAD,CAAL,GAAa,EAAxC,CAA4C,CAC3CD,QAAQ,EAAIF,KAAK,CAACG,CAAD,CAAL,CAAS,CAAT,CAAZ,CACA,CACD,CACD,GAAIJ,SAAJ,CAAeG,QAAQ,CAAGA,QAAQ,CAACG,KAAT,CAAe,CAAf,CAAkBN,SAAlB,CAAX,CACf,MAAOG,CAAAA,QAAP,CACA,CAVM","sourcesContent":["export const getInitials = function(name: string | null, maxLength = 2) {\n\tconst parts = name?.split(' ') ?? ''\n\tlet initials = ''\n\tfor (let i = 0; i < parts.length; i++) {\n\t\tif (parts[i].length > 0 && parts[i] !== '') {\n\t\t\tinitials += parts[i][0]\n\t\t}\n\t}\n\tif (maxLength) initials = initials.slice(0, maxLength)\n\treturn initials\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["sortByAvatar.ts"],"names":["a","b","avatar"],"mappings":"AAAA,eAAe,SAACA,CAAD,CAAIC,CAAJ,QAAWD,CAAAA,CAAC,CAACE,MAAF,CAAWD,CAAC,CAACC,MAAb,CAAsB,CAAtB,CAA0B,CAAC,CAAtC,EAAf","sourcesContent":["export default (a, b) => (a.avatar > b.avatar ? 1 : -1)\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export{default as useMessages}from'./useMessages';export{default as useRoom}from'./useRoom';export{default as useTyping}from'./useTyping';export{default as useInbox}from'./useInbox';export{default as useCreator}from'./useCreator';export{default as useViewMessages}from'./useViewMessages';export{default as useSendToPeople}from'./useSend/useSendToPeople';export{default as useSendToGroup}from'./useSend/useSendToGroup';
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["default","useMessages","useRoom","useTyping","useInbox","useCreator","useViewMessages","useSendToPeople","useSendToGroup"],"mappings":"AAAA,OAASA,OAAO,GAAIC,CAAAA,WAApB,KAAuC,eAAvC,CACA,OAASD,OAAO,GAAIE,CAAAA,OAApB,KAAmC,WAAnC,CACA,OAASF,OAAO,GAAIG,CAAAA,SAApB,KAAqC,aAArC,CACA,OAASH,OAAO,GAAII,CAAAA,QAApB,KAAoC,YAApC,CACA,OAASJ,OAAO,GAAIK,CAAAA,UAApB,KAAsC,cAAtC,CACA,OAASL,OAAO,GAAIM,CAAAA,eAApB,KAA2C,mBAA3C,CACA,OAASN,OAAO,GAAIO,CAAAA,eAApB,KAA2C,2BAA3C,CACA,OAASP,OAAO,GAAIQ,CAAAA,cAApB,KAA0C,0BAA1C","sourcesContent":["export { default as useMessages } from './useMessages'\nexport { default as useRoom } from './useRoom'\nexport { default as useTyping } from './useTyping'\nexport { default as useInbox } from './useInbox'\nexport { default as useCreator } from './useCreator'\nexport { default as useViewMessages } from './useViewMessages'\nexport { default as useSendToPeople } from './useSend/useSendToPeople'\nexport { default as useSendToGroup } from './useSend/useSendToGroup'\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useState,useRef,useEffect}from'react';import Room from'../../classes/Room';function useCreateRoom(){var _useState=useState(false),_useState2=_slicedToArray(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _useState3=useState(null),_useState4=_slicedToArray(_useState3,2),error=_useState4[0],setError=_useState4[1];var roomRef=useRef(null);var recipientsRef=useRef(null);useEffect(function(){var start=function start(){return _regeneratorRuntime.async(function start$(_context){while(1){switch(_context.prev=_context.next){case 0:if(!(loading&&roomRef.current&&recipientsRef.current)){_context.next=11;break;}_context.prev=1;roomRef.current=null;recipientsRef.current=null;_context.next=6;return _regeneratorRuntime.awrap(new Room(roomRef.current).create());case 6:_context.next=11;break;case 8:_context.prev=8;_context.t0=_context["catch"](1);console.error('useCreateRoom hook error:',_context.t0);case 11:case"end":return _context.stop();}}},null,null,[[1,8]]);};start();},[loading]);var create=function create(room){roomRef.current=room;setLoading(true);};return{create:create,loading:loading,error:error};}export default useCreateRoom;
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useState","useRef","useEffect","Room","useCreateRoom","loading","setLoading","error","setError","roomRef","recipientsRef","start","current","create","console","room"],"mappings":"6HAAA,OAASA,QAAT,CAAmBC,MAAnB,CAA2BC,SAA3B,KAA4C,OAA5C,CAEA,MAAOC,CAAAA,IAAP,KAAiB,oBAAjB,CAEA,QAASC,CAAAA,aAAT,EAAyD,eAC1BJ,QAAQ,CAAC,KAAD,CADkB,wCACjDK,OADiD,eACxCC,UADwC,8BAE9BN,QAAQ,CAAC,IAAD,CAFsB,yCAEjDO,KAFiD,eAE1CC,QAF0C,eAGxD,GAAMC,CAAAA,OAAO,CAAGR,MAAM,CAAmB,IAAnB,CAAtB,CACA,GAAMS,CAAAA,aAAa,CAAGT,MAAM,CAAkB,IAAlB,CAA5B,CAEAC,SAAS,CAAC,UAAM,CACf,GAAMS,CAAAA,KAAK,CAAG,QAARA,CAAAA,KAAQ,uHACTN,OAAO,EAAII,OAAO,CAACG,OAAnB,EAA8BF,aAAa,CAACE,OADnC,2CAGXH,OAAO,CAACG,OAAR,CAAkB,IAAlB,CACAF,aAAa,CAACE,OAAd,CAAwB,IAAxB,CAJW,iDAKL,GAAIT,CAAAA,IAAJ,CAASM,OAAO,CAACG,OAAjB,EAA0BC,MAA1B,EALK,wFAOXC,OAAO,CAACP,KAAR,CAAc,2BAAd,cAPW,iEAAd,CAWAI,KAAK,GACL,CAbQ,CAaN,CAACN,OAAD,CAbM,CAAT,CAeA,GAAMQ,CAAAA,MAAM,CAAG,QAATA,CAAAA,MAAS,CAACE,IAAD,CAAqB,CACnCN,OAAO,CAACG,OAAR,CAAkBG,IAAlB,CACAT,UAAU,CAAC,IAAD,CAAV,CACA,CAHD,CAKA,MAAO,CAAEO,MAAM,CAANA,MAAF,CAAUR,OAAO,CAAPA,OAAV,CAAmBE,KAAK,CAALA,KAAnB,CAAP,CACA,CAED,cAAeH,CAAAA,aAAf","sourcesContent":["import { useState, useRef, useEffect } from 'react'\nimport { NewRoomModel } from '../../classes/Room/types'\nimport Room from '../../classes/Room'\n\nfunction useCreateRoom<RoomModel extends NewRoomModel>() {\n\tconst [loading, setLoading] = useState(false)\n\tconst [error, setError] = useState(null)\n\tconst roomRef = useRef<RoomModel | null>(null)\n\tconst recipientsRef = useRef<string[] | null>(null)\n\n\tuseEffect(() => {\n\t\tconst start = async () => {\n\t\t\tif (loading && roomRef.current && recipientsRef.current) {\n\t\t\t\ttry {\n\t\t\t\t\troomRef.current = null\n\t\t\t\t\trecipientsRef.current = null\n\t\t\t\t\tawait new Room(roomRef.current).create()\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.error('useCreateRoom hook error:', e)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tstart()\n\t}, [loading])\n\n\tconst create = (room: RoomModel) => {\n\t\troomRef.current = room\n\t\tsetLoading(true)\n\t}\n\n\treturn { create, loading, error }\n}\n\nexport default useCreateRoom\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useRef}from'react';export default(function(){var creator=useRef();var open=function open(){return creator.current&&creator.current.open();};var close=function close(){return creator.current&&creator.current.close();};return[creator,{open:open,close:close}];});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useRef","creator","open","current","close"],"mappings":"AAAA,OAASA,MAAT,KAAyC,OAAzC,CAuBA,eAAe,UAGV,CACJ,GAAMC,CAAAA,OAAO,CAAGD,MAAM,EAAtB,CACA,GAAME,CAAAA,IAAI,CAAG,QAAPA,CAAAA,IAAO,SAAMD,CAAAA,OAAO,CAACE,OAAR,EAAmBF,OAAO,CAACE,OAAR,CAAgBD,IAAhB,EAAzB,EAAb,CACA,GAAME,CAAAA,KAAK,CAAG,QAARA,CAAAA,KAAQ,SAAMH,CAAAA,OAAO,CAACE,OAAR,EAAmBF,OAAO,CAACE,OAAR,CAAgBC,KAAhB,EAAzB,EAAd,CAEA,MAAO,CAACH,OAAD,CAAU,CAAEC,IAAI,CAAJA,IAAF,CAAQE,KAAK,CAALA,KAAR,CAAV,CAAP,CACA,CATD","sourcesContent":["import { useRef, MutableRefObject } from 'react'\nimport { RoomCreatorRef } from '../../components/RoomCreator/types'\n\n/**\n * React hook for managing RoomCreator component in usechat\n *\n * @returns An array with a ref and then convenience functions for the creator\n * [ref, { open, close }]\n *\n * **Required** In order for the methods to work, you must pass creator to sheetRef prop.\n *\n * @example\n * ```javascript\n * export default () => {\n * \tconst [creator, { open, close }]\n *\n * \t// ...some other method\n * const onPress = () => open()\n *\n * \treturn <RoomCreator sheetRef={creator} />\n * }\n * ```\n */\nexport default (): [\n\tMutableRefObject<RoomCreatorRef | undefined>,\n\t{ open: () => void; close: () => void }\n] => {\n\tconst creator = useRef<RoomCreatorRef>()\n\tconst open = () => creator.current && creator.current.open()\n\tconst close = () => creator.current && creator.current.close()\n\n\treturn [creator, { open, close }]\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import{useFuego}from'@nandorojo/fuego';import{useMemo}from'react';import{fuego}from'../../components/ChatProvider/index';import{chat}from'../../components/ChatProvider';import{Room}from'../..';var orderBy=['lastMessage.createdAt','desc'];export default(function(){var config=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var currentUser=fuego.auth().currentUser;var uid=config.uid||currentUser&¤tUser.uid;var where=useMemo(function(){return['currentMembers','array-contains',uid];},[uid]);var path=chat.roomsCollection;var query=useMemo(function(){return _objectSpread({listen:true,where:where,orderBy:orderBy},config,{path:path});},[config,where,path]);var _useFuego=useFuego(query,options),data=_useFuego.data,response=_objectWithoutProperties(_useFuego,["data"]);var rooms=useMemo(function(){function isListOfRoomDocs(inbox){return!!inbox;}if(data&&isListOfRoomDocs(data)){var formatted=data.map(function(room){return _objectSpread({},room,{lastMessage:_objectSpread({},room.lastMessage,{createdAt:room.lastMessage.createdAt.toDate()}),unreadCount:new Room(room).getUnreadCount()});});return formatted;}return[];},[data]);return _objectSpread({data:rooms},response,{path:path});});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useFuego","useMemo","fuego","chat","Room","orderBy","config","options","currentUser","auth","uid","where","path","roomsCollection","query","listen","data","response","rooms","isListOfRoomDocs","inbox","formatted","map","room","lastMessage","createdAt","toDate","unreadCount","getUnreadCount"],"mappings":"o7BAAA,OAASA,QAAT,KAAyB,kBAAzB,CACA,OAASC,OAAT,KAAwB,OAAxB,CAIA,OAASC,KAAT,KAAsB,qCAAtB,CACA,OAASC,IAAT,KAAqB,+BAArB,CAIA,OAASC,IAAT,KAAqB,OAArB,CAEA,GAAMC,CAAAA,OAAoB,CAAG,CAAC,uBAAD,CAA0B,MAA1B,CAA7B,CAeA,eAAe,UAGV,IAFJC,CAAAA,MAEI,2DAFqB,EAErB,IADJC,CAAAA,OACI,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OP,CAAAA,SAAP,CACA,CACD,MAAO,EAAP,CACA,CAlBoB,CAkBlB,CAACL,IAAD,CAlBkB,CAArB,CAoBA,sBAASA,IAAI,CAAEE,KAAf,EAAyBD,QAAzB,EAAmCL,IAAI,CAAJA,IAAnC,GACA,CAhDD","sourcesContent":["import { useFuego } from '@nandorojo/fuego'\nimport { useMemo } from 'react'\nimport { WhereFilterOp } from '@firebase/firestore-types'\nimport { QueryDataHandler } from '@nandorojo/fuego/lib/typescript/hooks/useFuego/types'\nimport { OrderByItem } from '@nandorojo/fuego/lib/typescript/FuegoQuery/types'\nimport { fuego } from '../../components/ChatProvider/index'\nimport { chat } from '../../components/ChatProvider'\nimport { ExistingRoomDocument } from '../../classes/Room/types'\nimport { InboxModel } from '../../classes/Inbox/types'\nimport { UseInboxConfig } from './types'\nimport { Room } from '../..'\n\nconst orderBy: OrderByItem = ['lastMessage.createdAt', 'desc']\n\n/**\n * React hook to query the chat inbox in realtime. Used with the [Juice.Inbox] component from Juice.\n *\n * @example\n * ```\n * const { data } = useInbox()\n *\n * return <Juice.Inbox rooms={data} />\n * ```\n *\n * @returns\n * { data, loading, path, error } and other values returned by useFuego() hook. Data is properly formatted for rendering.\n */\nexport default (\n\tconfig: UseInboxConfig = {},\n\toptions: QueryDataHandler<ExistingRoomDocument> = {}\n) => {\n\tconst currentUser = fuego.auth().currentUser as firebase.User\n\tconst uid = config.uid || (currentUser && currentUser.uid)\n\n\tconst where: [string, WhereFilterOp, string] = useMemo(() => {\n\t\t// useMemo to avoid re-making the array every render,\n\t\t// since that would refresh the useFuego each time\n\t\treturn ['currentMembers', 'array-contains' as WhereFilterOp, uid]\n\t\t// if the uid updates, then it recreates\n\t\t// re: [uid]\n\t}, [uid])\n\n\tconst path = chat.roomsCollection\n\tconst query = useMemo(\n\t\t() => ({\n\t\t\tlisten: true,\n\t\t\twhere,\n\t\t\torderBy,\n\t\t\t...config,\n\t\t\tpath\n\t\t}),\n\t\t[config, where, path]\n\t)\n\tconst { data, ...response } = useFuego<ExistingRoomDocument>(query, options)\n\tconst rooms = useMemo(() => {\n\t\tfunction isListOfRoomDocs(\n\t\t\tinbox: typeof data\n\t\t): inbox is ExistingRoomDocument[] {\n\t\t\treturn !!(inbox as ExistingRoomDocument[])\n\t\t}\n\t\tif (data && isListOfRoomDocs(data)) {\n\t\t\tconst formatted: InboxModel = data.map(room => ({\n\t\t\t\t...room,\n\t\t\t\tlastMessage: {\n\t\t\t\t\t...room.lastMessage,\n\t\t\t\t\tcreatedAt: room.lastMessage.createdAt.toDate()\n\t\t\t\t},\n\t\t\t\tunreadCount: new Room(room).getUnreadCount()\n\t\t\t}))\n\t\t\treturn formatted\n\t\t}\n\t\treturn []\n\t}, [data])\n\n\treturn { data: rooms, ...response, path }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import{useMemo,useCallback,useState,useEffect,useRef}from'react';import{useFuego}from'@nandorojo/fuego';import Room from'../../classes/Room';import Message from'../../classes/Message';var LIMIT=30;var orderBy=['createdAt','desc'];export default(function(_ref){var id=_ref.id,config=_objectWithoutProperties(_ref,["id"]);var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _ref2=new Room({id:id}),path=_ref2.messagesPath;var _useState=useState(LIMIT),_useState2=_slicedToArray(_useState,2),limit=_useState2[0],setLimit=_useState2[1];var currentLimit=useRef(limit);var latestFetchMoreId=useRef(null);var query=useMemo(function(){return _objectSpread({listen:true,orderBy:orderBy},config,{path:path,limit:limit});},[path,config,limit]);useEffect(function(){currentLimit.current=limit;},[limit]);var _useFuego=useFuego(query,options),data=_useFuego.data,loading=_useFuego.loading,error=_useFuego.error,ref=_useFuego.ref;var send=useCallback(function(message){return new Message(message).formatForSend().send(id);},[id]);var edit=useCallback(function(message){return new Message(message).edit(id);},[id]);var formattedMessages=useMemo(function(){function isArrayOfMessageDocuments(m){return!!m;}if(data&&isArrayOfMessageDocuments(data)){var formatted=new Message(data).formatForRender();return formatted;}return[];},[data]);var fetchMore=function fetchMore(){var lastMessageId=formattedMessages[formattedMessages.length-1]&&formattedMessages[formattedMessages.length-1].id;if(lastMessageId&&lastMessageId!==latestFetchMoreId.current){latestFetchMoreId.current=lastMessageId;setLimit(function(l){return l+LIMIT;});}};var empty=useMemo(function(){return!(formattedMessages&&formattedMessages.length);},[formattedMessages]);var fetchingMore=loading&&formattedMessages.length;return{data:formattedMessages,loading:loading,error:error,ref:ref,path:path,empty:empty,send:send,edit:edit,fetchMore:fetchMore,fetchingMore:fetchingMore};});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useMemo","useCallback","useState","useEffect","useRef","useFuego","Room","Message","LIMIT","orderBy","id","config","options","path","messagesPath","limit","setLimit","currentLimit","latestFetchMoreId","query","listen","current","data","loading","error","ref","send","message","formatForSend","edit","formattedMessages","isArrayOfMessageDocuments","m","formatted","formatForRender","fetchMore","lastMessageId","length","l","empty","fetchingMore"],"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R,EAAF,CAAR,CACA,CACD,CATD,CAUA,GAAM+B,CAAAA,KAAc,CAAGvC,OAAO,CAC7B,iBAAM,EAAE8B,iBAAiB,EAAIA,iBAAiB,CAACO,MAAzC,CAAN,EAD6B,CAE7B,CAACP,iBAAD,CAF6B,CAA9B,CAKA,GAAMU,CAAAA,YAAY,CAAGjB,OAAO,EAAIO,iBAAiB,CAACO,MAAlD,CAIA,MAAO,CACNf,IAAI,CAAEQ,iBADA,CAENP,OAAO,CAAPA,OAFM,CAGNC,KAAK,CAALA,KAHM,CAINC,GAAG,CAAHA,GAJM,CAKNZ,IAAI,CAAJA,IALM,CAMN0B,KAAK,CAALA,KANM,CAONb,IAAI,CAAJA,IAPM,CAQNG,IAAI,CAAJA,IARM,CASNM,SAAS,CAATA,SATM,CAUNK,YAAY,CAAZA,YAVM,CAAP,CAYA,CAlFD","sourcesContent":["import { useMemo, useCallback, useState, useEffect, useRef } from 'react'\nimport { useFuego } from '@nandorojo/fuego'\nimport { UseMessagesConfig } from './types'\nimport Room from '../../classes/Room'\nimport {\n\tNewMessageModel,\n\tEditMessageModel,\n\tMessageModelDocument,\n} from '../../classes/Message/types'\nimport Message from '../../classes/Message'\nimport {\n\tUseQueryConfig,\n\tQueryDataHandler,\n} from '@nandorojo/fuego/lib/typescript/hooks/useFuego/types'\n\nconst LIMIT = 30\n\nconst orderBy: UseQueryConfig['orderBy'] = ['createdAt', 'desc']\n/**\n *\tReact hook to set up a lisener for a room's messages\n *\n * \t@param { id } the roomId, along with other query options from `useFuego` hook\n *\n *\t@returns { data: formattedMessages, loading, error, ref, path, empty, send, edit, fetchMore }\n * data is formatted for rendering.\n */\nexport default (\n\t{ id, ...config }: UseMessagesConfig,\n\toptions: QueryDataHandler<MessageModelDocument> = {}\n) => {\n\tconst { messagesPath: path } = new Room({ id })\n\tconst [limit, setLimit] = useState(LIMIT)\n\tconst currentLimit = useRef(limit)\n\tconst latestFetchMoreId = useRef<null | string>(null)\n\tconst query = useMemo(\n\t\t() => ({\n\t\t\tlisten: true,\n\t\t\torderBy,\n\t\t\t...config,\n\t\t\tpath,\n\t\t\tlimit,\n\t\t}),\n\t\t[path, config, limit]\n\t)\n\tuseEffect(() => {\n\t\tcurrentLimit.current = limit\n\t}, [limit])\n\tconst { data, loading, error, ref } = useFuego<MessageModelDocument>(\n\t\tquery,\n\t\toptions\n\t)\n\tconst send = useCallback(\n\t\t(message: NewMessageModel[]) => {\n\t\t\treturn new Message(message as NewMessageModel[]).formatForSend().send(id)\n\t\t},\n\t\t[id]\n\t)\n\tconst edit = useCallback(\n\t\t(message: EditMessageModel) => {\n\t\t\treturn new Message(message).edit(id)\n\t\t},\n\t\t[id]\n\t)\n\tconst formattedMessages: NewMessageModel[] = useMemo(() => {\n\t\tfunction isArrayOfMessageDocuments(\n\t\t\tm: typeof data\n\t\t): m is MessageModelDocument[] {\n\t\t\treturn !!(m as MessageModelDocument[])\n\t\t}\n\t\tif (data && isArrayOfMessageDocuments(data)) {\n\t\t\tconst formatted: NewMessageModel[] = new Message(\n\t\t\t\tdata\n\t\t\t).formatForRender() as NewMessageModel[]\n\t\t\treturn formatted\n\t\t}\n\t\treturn []\n\t}, [data])\n\tconst fetchMore = () => {\n\t\tconst lastMessageId =\n\t\t\tformattedMessages[formattedMessages.length - 1] &&\n\t\t\tformattedMessages[formattedMessages.length - 1].id\n\t\t// make sure we don't fetch more if the latest message is unchanged, or if it doesn't even exist\n\t\tif (lastMessageId && lastMessageId !== latestFetchMoreId.current) {\n\t\t\tlatestFetchMoreId.current = lastMessageId\n\t\t\tsetLimit(l => l + LIMIT)\n\t\t}\n\t}\n\tconst empty: boolean = useMemo(\n\t\t() => !(formattedMessages && formattedMessages.length),\n\t\t[formattedMessages]\n\t)\n\n\tconst fetchingMore = loading && formattedMessages.length\n\n\t// TODO add reply to message function\n\n\treturn {\n\t\tdata: formattedMessages,\n\t\tloading,\n\t\terror,\n\t\tref,\n\t\tpath,\n\t\tempty,\n\t\tsend,\n\t\tedit,\n\t\tfetchMore,\n\t\tfetchingMore,\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import{useFuego}from'@nandorojo/fuego';import Room from'../../classes/Room';import{useMemo}from'react';export default(function(_ref){var id=_ref.id,config=_objectWithoutProperties(_ref,["id"]);var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _ref2=new Room({id:id}),path=_ref2.path;var _useFuego=useFuego(_objectSpread({},config,{path:path}),options),data=_useFuego.data,loading=_useFuego.loading,error=_useFuego.error,ref=_useFuego.ref;var create=function create(room){return new Room(room).createViaCallable();};var edit=function edit(room){return new Room(room).edit();};var members=data&&data.members;var usersAreTyping=useMemo(function(){return!!(members&&new Room({members:members}).getUsersTyping().length);},[members]);var namesOfUsersTyping=useMemo(function(){return members&&new Room({members:members}).getUsersTyping().map(function(user){return user.name;})||[];},[members]);var room=useMemo(function(){function isDocument(r){return!!r;}if(data&&isDocument(data)){var model=_objectSpread({},data,{lastMessage:_objectSpread({},data.lastMessage,{createdAt:data.lastMessage.createdAt.toDate()})});return model;}return null;},[data]);return{data:room,loading:loading,error:error,ref:ref,create:create,edit:edit,usersAreTyping:usersAreTyping,namesOfUsersTyping:namesOfUsersTyping};});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useFuego","Room","useMemo","id","config","options","path","data","loading","error","ref","create","room","createViaCallable","edit","members","usersAreTyping","getUsersTyping","length","namesOfUsersTyping","map","user","name","isDocument","r","model","lastMessage","createdAt","toDate"],"mappings":"o7BAAA,OAASA,QAAT,KAAyB,kBAAzB,CACA,MAAOC,CAAAA,IAAP,KAAiB,oBAAjB,CAUA,OAASC,OAAT,KAAwB,OAAxB,CAeA,eAAe,cAGV,IAFFC,CAAAA,EAEE,MAFFA,EAEE,CAFKC,MAEL,0CADJC,CAAAA,OACI,2DAD8C,EAC9C,WACa,GAAIJ,CAAAA,IAAJ,CAAS,CAAEE,EAAE,CAAFA,EAAF,CAAT,CADb,CACIG,IADJ,OACIA,IADJ,eAEkCN,QAAQ,kBAEzCI,MAFyC,EAG5CE,IAAI,CAAJA,IAH4C,GAK7CD,OAL6C,CAF1C,CAEIE,IAFJ,WAEIA,IAFJ,CAEUC,OAFV,WAEUA,OAFV,CAEmBC,KAFnB,WAEmBA,KAFnB,CAE0BC,GAF1B,WAE0BA,GAF1B,CASJ,GAAMC,CAAAA,MAAM,CAAG,QAATA,CAAAA,MAAS,CAACC,IAAD,CAAmC,CACjD,MAAO,IAAIX,CAAAA,IAAJ,CAASW,IAAT,EAAeC,iBAAf,EAAP,CACA,CAFD,CAGA,GAAMC,CAAAA,IAAI,CAAG,QAAPA,CAAAA,IAAO,CAACF,IAAD,CAAyB,CACrC,MAAO,IAAIX,CAAAA,IAAJ,CAASW,IAAT,EAAeE,IAAf,EAAP,CACA,CAFD,CAGA,GAAMC,CAAAA,OAAO,CAAGR,IAAI,EAAKA,IAAD,CAA+BQ,OAAvD,CACA,GAAMC,CAAAA,cAAc,CAAG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nandorojo/fuego'\nimport Room from '../../classes/Room'\nimport {\n\tEditRoomModel,\n\tRoomPropertiesModel,\n\tCreateCallableRoomModel,\n\tExistingRoomDocument,\n\tExistingRoomModel\n} from '../../classes/Room/types'\nimport { UseRoomType } from './types'\nimport { QueryDataHandler } from '@nandorojo/fuego/lib/typescript/hooks/useFuego/types'\nimport { useMemo } from 'react'\n\n/**\n * Fetches or subscribes to a chatroom. It automatically handles unmounts, etc.\n *\n * @param config - config dictionary.\n * @param config.id - Required: the unique ID for this chatroom, typically generated by the backend. If using the [[useInbox]] hook, each item in [[useInbox]]'s data array has this ID.\n * @param config.listen Boolean to determine if this room should update state as a subscription. Default false.\n * @param options - added options dictionary for useRoom\n *\n * @remarks Look at the fuego library's useFuego hook to see all the available arguments for config and options.\n *\n * @returns { data: room, loading, error, ref, create, edit, usersAreTyping, namesOfUsersTyping } data is formatted for rendering room.\n */\n\nexport default (\n\t{ id, ...config }: UseRoomType,\n\toptions: QueryDataHandler<ExistingRoomDocument> = {}\n) => {\n\tconst { path } = new Room({ id } as RoomPropertiesModel)\n\tconst { data, loading, error, ref } = useFuego<ExistingRoomDocument>(\n\t\t{\n\t\t\t...config,\n\t\t\tpath\n\t\t},\n\t\toptions\n\t)\n\tconst create = (room: CreateCallableRoomModel) => {\n\t\treturn new Room(room).createViaCallable()\n\t}\n\tconst edit = (room: EditRoomModel) => {\n\t\treturn new Room(room).edit()\n\t}\n\tconst members = data && (data as ExistingRoomDocument).members\n\tconst usersAreTyping = useMemo(() => {\n\t\treturn !!(members && new Room({ members }).getUsersTyping().length)\n\t}, [members])\n\tconst namesOfUsersTyping = useMemo(() => {\n\t\treturn (\n\t\t\t(members &&\n\t\t\t\tnew Room({ members }).getUsersTyping().map(user => user.name)) ||\n\t\t\t[]\n\t\t)\n\t}, [members])\n\tconst room = useMemo(() => {\n\t\tfunction isDocument(r: typeof data): r is ExistingRoomDocument {\n\t\t\treturn !!(r as ExistingRoomDocument)\n\t\t}\n\t\tif (data && isDocument(data)) {\n\t\t\tconst model: ExistingRoomModel = {\n\t\t\t\t...data,\n\t\t\t\tlastMessage: {\n\t\t\t\t\t...data.lastMessage,\n\t\t\t\t\tcreatedAt: data.lastMessage.createdAt.toDate()\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn model\n\t\t}\n\t\treturn null\n\t}, [data])\n\treturn {\n\t\tdata: room,\n\t\tloading,\n\t\terror,\n\t\tref,\n\t\tcreate,\n\t\tedit,\n\t\tusersAreTyping,\n\t\tnamesOfUsersTyping\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useState,useRef,useEffect,useCallback}from'react';import Message from'../../../classes/Message';export default function(){var _useState=useState(false),_useState2=_slicedToArray(_useState,2),uploading=_useState2[0],setUploading=_useState2[1];var _useState3=useState(null),_useState4=_slicedToArray(_useState3,2),error=_useState4[0],setError=_useState4[1];var messageRef=useRef(null);var recipientsRef=useRef(null);useEffect(function(){if(uploading){var run=function run(){return _regeneratorRuntime.async(function run$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;if(!(messageRef.current&&recipientsRef.current)){_context.next=4;break;}_context.next=4;return _regeneratorRuntime.awrap(new Message(messageRef.current).sendToGroup(recipientsRef.current));case 4:messageRef.current=null;recipientsRef.current=null;setUploading(false);_context.next=13;break;case 9:_context.prev=9;_context.t0=_context["catch"](0);console.error("failure sending message from useSendToPeople",_context.t0);setError(_context.t0);case 13:case"end":return _context.stop();}}},null,null,[[0,9]]);};run();}},[uploading]);var send=useCallback(function(message,recipients){messageRef.current=message;recipientsRef.current=recipients;setUploading(true);},[]);return{send:send,uploading:uploading,error:error};}
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useState","useRef","useEffect","useCallback","Message","uploading","setUploading","error","setError","messageRef","recipientsRef","run","current","sendToGroup","console","send","message","recipients"],"mappings":"6HAAA,OAASA,QAAT,CAAmBC,MAAnB,CAA2BC,SAA3B,CAAsCC,WAAtC,KAAyD,OAAzD,CAEA,MAAOC,CAAAA,OAAP,KAAoB,0BAApB,CAEA,cAAe,WAAiD,eAC7BJ,QAAQ,CAAC,KAAD,CADqB,wCACxDK,SADwD,eAC7CC,YAD6C,8BAErCN,QAAQ,CAAC,IAAD,CAF6B,yCAExDO,KAFwD,eAEjDC,QAFiD,eAG/D,GAAMC,CAAAA,UAAU,CAAGR,MAAM,CAAsB,IAAtB,CAAzB,CACA,GAAMS,CAAAA,aAAa,CAAGT,MAAM,CAAkB,IAAlB,CAA5B,CAEAC,SAAS,CAAC,UAAM,CACf,GAAIG,SAAJ,CAAe,CACd,GAAMM,CAAAA,GAAG,CAAG,QAANA,CAAAA,GAAM,qIAENF,UAAU,CAACG,OAAX,EAAsBF,aAAa,CAACE,OAF9B,2EAGH,GAAIR,CAAAA,OAAJ,CAAYK,UAAU,CAACG,OAAvB,EAAgCC,WAAhC,CACLH,aAAa,CAACE,OADT,CAHG,SAMVH,UAAU,CAACG,OAAX,CAAqB,IAArB,CACAF,aAAa,CAACE,OAAd,CAAwB,IAAxB,CACAN,YAAY,CAAC,KAAD,CAAZ,CARU,+EAUVQ,OAAO,CAACP,KAAR,6DACAC,QAAQ,aAAR,CAXU,iEAAZ,CAcAG,GAAG,GACH,CACD,CAlBQ,CAkBN,CAACN,SAAD,CAlBM,CAAT,CAoBA,GAAMU,CAAAA,IAAI,CAAGZ,WAAW,CAAC,SAACa,OAAD,CAAwBC,UAAxB,CAAiD,CACzER,UAAU,CAACG,OAAX,CAAqBI,OAArB,CACAN,aAAa,CAACE,OAAd,CAAwBK,UAAxB,CACAX,YAAY,CAAC,IAAD,CAAZ,CACA,CAJuB,CAIrB,EAJqB,CAAxB,CAMA,MAAO,CAAES,IAAI,CAAJA,IAAF,CAAQV,SAAS,CAATA,SAAR,CAAmBE,KAAK,CAALA,KAAnB,CAAP,CACA","sourcesContent":["import { useState, useRef, useEffect, useCallback } from 'react'\nimport { NewMessageModel } from '../../../classes/Message/types'\nimport Message from '../../../classes/Message'\n\nexport default function<MessageModel extends NewMessageModel>() {\n\tconst [uploading, setUploading] = useState(false)\n\tconst [error, setError] = useState(null)\n\tconst messageRef = useRef<MessageModel | null>(null)\n\tconst recipientsRef = useRef<string[] | null>(null)\n\n\tuseEffect(() => {\n\t\tif (uploading) {\n\t\t\tconst run = async () => {\n\t\t\t\ttry {\n\t\t\t\t\tif (messageRef.current && recipientsRef.current)\n\t\t\t\t\t\tawait new Message(messageRef.current).sendToGroup(\n\t\t\t\t\t\t\trecipientsRef.current\n\t\t\t\t\t\t)\n\t\t\t\t\tmessageRef.current = null\n\t\t\t\t\trecipientsRef.current = null\n\t\t\t\t\tsetUploading(false)\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.error(`failure sending message from useSendToPeople`, e)\n\t\t\t\t\tsetError(e)\n\t\t\t\t}\n\t\t\t}\n\t\t\trun()\n\t\t}\n\t}, [uploading])\n\n\tconst send = useCallback((message: MessageModel, recipients: string[]) => {\n\t\tmessageRef.current = message\n\t\trecipientsRef.current = recipients\n\t\tsetUploading(true)\n\t}, [])\n\n\treturn { send, uploading, error }\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useState,useRef,useEffect,useCallback}from'react';import Message from'../../../classes/Message';export default function(){var _useState=useState(false),_useState2=_slicedToArray(_useState,2),uploading=_useState2[0],setUploading=_useState2[1];var _useState3=useState(null),_useState4=_slicedToArray(_useState3,2),error=_useState4[0],setError=_useState4[1];var messageRef=useRef(null);var recipientsRef=useRef(null);useEffect(function(){if(uploading){var run=function run(){return _regeneratorRuntime.async(function run$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;if(!(messageRef.current&&recipientsRef.current)){_context.next=4;break;}_context.next=4;return _regeneratorRuntime.awrap(new Message(messageRef.current).sendToPeople(recipientsRef.current));case 4:messageRef.current=null;recipientsRef.current=null;setUploading(false);_context.next=13;break;case 9:_context.prev=9;_context.t0=_context["catch"](0);console.error("failure sending message from useSendToPeople",_context.t0);setError(_context.t0);case 13:case"end":return _context.stop();}}},null,null,[[0,9]]);};run();}},[uploading]);var send=useCallback(function(message,recipients){messageRef.current=message;recipientsRef.current=recipients;setUploading(true);},[]);return{send:send,uploading:uploading,error:error};}
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useState","useRef","useEffect","useCallback","Message","uploading","setUploading","error","setError","messageRef","recipientsRef","run","current","sendToPeople","console","send","message","recipients"],"mappings":"6HAAA,OAASA,QAAT,CAAmBC,MAAnB,CAA2BC,SAA3B,CAAsCC,WAAtC,KAAyD,OAAzD,CAEA,MAAOC,CAAAA,OAAP,KAAoB,0BAApB,CAEA,cAAe,WAAiD,eAC7BJ,QAAQ,CAAC,KAAD,CADqB,wCACxDK,SADwD,eAC7CC,YAD6C,8BAErCN,QAAQ,CAAC,IAAD,CAF6B,yCAExDO,KAFwD,eAEjDC,QAFiD,eAG/D,GAAMC,CAAAA,UAAU,CAAGR,MAAM,CAAsB,IAAtB,CAAzB,CACA,GAAMS,CAAAA,aAAa,CAAGT,MAAM,CAAkB,IAAlB,CAA5B,CAEAC,SAAS,CAAC,UAAM,CACf,GAAIG,SAAJ,CAAe,CACd,GAAMM,CAAAA,GAAG,CAAG,QAANA,CAAAA,GAAM,qIAENF,UAAU,CAACG,OAAX,EAAsBF,aAAa,CAACE,OAF9B,2EAGH,GAAIR,CAAAA,OAAJ,CAAYK,UAAU,CAACG,OAAvB,EAAgCC,YAAhC,CACLH,aAAa,CAACE,OADT,CAHG,SAMVH,UAAU,CAACG,OAAX,CAAqB,IAArB,CACAF,aAAa,CAACE,OAAd,CAAwB,IAAxB,CACAN,YAAY,CAAC,KAAD,CAAZ,CARU,+EAUVQ,OAAO,CAACP,KAAR,6DACAC,QAAQ,aAAR,CAXU,iEAAZ,CAcAG,GAAG,GACH,CACD,CAlBQ,CAkBN,CAACN,SAAD,CAlBM,CAAT,CAoBA,GAAMU,CAAAA,IAAI,CAAGZ,WAAW,CAAC,SAACa,OAAD,CAAwBC,UAAxB,CAAiD,CACzER,UAAU,CAACG,OAAX,CAAqBI,OAArB,CACAN,aAAa,CAACE,OAAd,CAAwBK,UAAxB,CACAX,YAAY,CAAC,IAAD,CAAZ,CACA,CAJuB,CAIrB,EAJqB,CAAxB,CAMA,MAAO,CAAES,IAAI,CAAJA,IAAF,CAAQV,SAAS,CAATA,SAAR,CAAmBE,KAAK,CAALA,KAAnB,CAAP,CACA","sourcesContent":["import { useState, useRef, useEffect, useCallback } from 'react'\nimport { NewMessageModel } from '../../../classes/Message/types'\nimport Message from '../../../classes/Message'\n\nexport default function<MessageModel extends NewMessageModel>() {\n\tconst [uploading, setUploading] = useState(false)\n\tconst [error, setError] = useState(null)\n\tconst messageRef = useRef<MessageModel | null>(null)\n\tconst recipientsRef = useRef<string[] | null>(null)\n\n\tuseEffect(() => {\n\t\tif (uploading) {\n\t\t\tconst run = async () => {\n\t\t\t\ttry {\n\t\t\t\t\tif (messageRef.current && recipientsRef.current)\n\t\t\t\t\t\tawait new Message(messageRef.current).sendToPeople(\n\t\t\t\t\t\t\trecipientsRef.current\n\t\t\t\t\t\t)\n\t\t\t\t\tmessageRef.current = null\n\t\t\t\t\trecipientsRef.current = null\n\t\t\t\t\tsetUploading(false)\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.error(`failure sending message from useSendToPeople`, e)\n\t\t\t\t\tsetError(e)\n\t\t\t\t}\n\t\t\t}\n\t\t\trun()\n\t\t}\n\t}, [uploading])\n\n\tconst send = useCallback((message: MessageModel, recipients: string[]) => {\n\t\tmessageRef.current = message\n\t\trecipientsRef.current = recipients\n\t\tsetUploading(true)\n\t}, [])\n\n\treturn { send, uploading, error }\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useEffect,useState,useMemo,useRef}from'react';import{useFuegoContext}from'@nandorojo/fuego';export default(function(_ref){var roomId=_ref.roomId,text=_ref.text,_ref$delay=_ref.delay,delay=_ref$delay===void 0?5000:_ref$delay;var _useFuegoContext=useFuegoContext(),auth=_useFuegoContext.auth,firebase=_useFuegoContext.firebase;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),ready=_useState2[0],setReady=_useState2[1];var _auth=auth(),currentUser=_auth.currentUser;try{if(!currentUser)throw new Error('🤯 error in useTyping hook. Looks like there is not a valid user signed in. \nConsider using the FuegoGate component from @nandorojo/fuego and wrapping it around your app.');}catch(e){console.error(e);}var _ref2=currentUser,uid=_ref2.uid;var databaseRef=useMemo(function(){return firebase.database().ref("/typing/"+uid);},[uid,firebase]);var previouslyTyped=useRef('');var timer=useRef();var lastStateSent=useRef('nothing');useEffect(function(){var subscriptionRef=firebase.database().ref('.info/connected');var notTyping={state:'nothing',lastChanged:firebase.database.ServerValue.TIMESTAMP,roomId:roomId};subscriptionRef.on('value',function _callee(snapshot){return _regeneratorRuntime.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(snapshot.val()){_context.next=2;break;}return _context.abrupt("return");case 2:_context.prev=2;_context.next=5;return _regeneratorRuntime.awrap(databaseRef.onDisconnect().set(notTyping));case 5:setReady(true);_context.next=11;break;case 8:_context.prev=8;_context.t0=_context["catch"](2);console.error("useTyping error within snapshot listener "+_context.t0);case 11:case"end":return _context.stop();}}},null,null,[[2,8]]);});return function(){subscriptionRef.off('value');(function _callee2(){return _regeneratorRuntime.async(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;lastStateSent.current=notTyping.state;_context2.next=4;return _regeneratorRuntime.awrap(databaseRef.set(notTyping));case 4:_context2.next=9;break;case 6:_context2.prev=6;_context2.t0=_context2["catch"](0);console.error('useTyping errored on unmount setting not typing');case 9:case"end":return _context2.stop();}}},null,null,[[0,6]]);})();};},[roomId,databaseRef,firebase]);useEffect(function(){try{if(ready&&text!==previouslyTyped.current){previouslyTyped.current=text;var notTyping={state:'nothing',lastChanged:firebase.database.ServerValue.TIMESTAMP,roomId:roomId};var isTyping={state:'typing',lastChanged:firebase.database.ServerValue.TIMESTAMP,roomId:roomId};var setValue=text?isTyping:notTyping;if(setValue.state!==lastStateSent.current){lastStateSent.current=setValue.state;databaseRef.set(setValue);}if(delay!==null&&setValue.state==='typing'){timer.current=setTimeout(function(){lastStateSent.current=notTyping.state;databaseRef.set(notTyping);},delay);}}}catch(e){console.error('error in useTyping after timer',e);}return function(){if(timer.current)clearTimeout(timer.current);};},[ready,text,roomId,delay,uid,databaseRef,firebase]);});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useEffect","useState","useMemo","useRef","useFuegoContext","roomId","text","delay","auth","firebase","ready","setReady","currentUser","Error","e","console","error","uid","databaseRef","database","ref","previouslyTyped","timer","lastStateSent","subscriptionRef","notTyping","state","lastChanged","ServerValue","TIMESTAMP","on","snapshot","val","onDisconnect","set","off","current","isTyping","setValue","setTimeout","clearTimeout"],"mappings":"6HAAA,OAASA,SAAT,CAAoBC,QAApB,CAA8BC,OAA9B,CAAuCC,MAAvC,KAAqD,OAArD,CACA,OAASC,eAAT,KAAgC,kBAAhC,CAiCA,eAAe,cAQT,IAPLC,CAAAA,MAOK,MAPLA,MAOK,CANLC,IAMK,MANLA,IAMK,iBALLC,KAKK,CALLA,KAKK,qBALG,IAKH,iCACsBH,eAAe,EADrC,CACGI,IADH,kBACGA,IADH,CACSC,QADT,kBACSA,QADT,eAEqBR,Q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,SAAhB,EACA,CAHyB,CAGvBlB,KAHuB,CAA1B,CAIA,CACD,CACD,CAAC,MAAOO,CAAP,CAAU,CACXC,OAAO,CAACC,KAAR,CAAc,gCAAd,CAAgDF,CAAhD,EACA,CAED,MAAO,WAAM,CACZ,GAAIQ,KAAK,CAACc,OAAV,CAAmBI,YAAY,CAAClB,KAAK,CAACc,OAAP,CAAZ,CACnB,CAFD,CAGA,CA3CQ,CA2CN,CAAC1B,KAAD,CAAQJ,IAAR,CAAcD,MAAd,CAAsBE,KAAtB,CAA6BU,GAA7B,CAAkCC,WAAlC,CAA+CT,QAA/C,CA3CM,CAAT,CA4CA,CAnHD","sourcesContent":["import { useEffect, useState, useMemo, useRef } from 'react'\nimport { useFuegoContext } from '@nandorojo/fuego'\nimport { Typing } from '../../classes/Room/types'\n\n/**\n * useTyping automatically updates the backend whenever a user is typing.\n *\n * @param options - A dictionary to configure the typing.\n * @param options.roomId - **Required** unique id of the room you're typing in.\n * @param options.text - **Required** The current text state of your chat input\n * @param options.delay (Optional) Set the timeout delay to mark typing false. Set null if you don't want a time out.\n *\n * @example\n * ```javascript\n * // input text state\n * const [text, setText] = useState('')\n * // let's say we're getting our room id from our react-navigation params\n * const navigation = useNavigation()\n * const roomId = navigation.params.id\n *\n * useTyping({ roomId, text })\n *\n * <ChatComponent text={text} onChangeText={setText} />\n * ```\n *\n * @returns\n * Doesn't return anything. We live in an undefined world, I suppose.\n *\n * @remarks\n * The actual data of who is typing is stored in the chatroom object.\n * If you want to get this data realtime in a room, consider using useRoom({ listen: true }). This data will also be in useInbox().\n * See docs for useRoom or useInbox for more.\n *\n */\nexport default ({\n\troomId,\n\ttext,\n\tdelay = 5000\n}: {\n\troomId: string\n\ttext: string\n\tdelay?: number | null\n}) => {\n\tconst { auth, firebase } = useFuegoContext()\n\tconst [ready, setReady] = useState(false)\n\tconst { currentUser } = auth()\n\ttry {\n\t\tif (!currentUser)\n\t\t\tthrow new Error(\n\t\t\t\t'🤯 error in useTyping hook. Looks like there is not a valid user signed in. \\nConsider using the FuegoGate component from @nandorojo/fuego and wrapping it around your app.'\n\t\t\t)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n\tconst { uid } = currentUser as firebase.User\n\tconst databaseRef = useMemo(() => firebase.database().ref(`/typing/${uid}`), [\n\t\tuid,\n\t\tfirebase\n\t])\n\tconst previouslyTyped = useRef('')\n\n\tconst timer = useRef<NodeJS.Timeout>()\n\n\tconst lastStateSent = useRef<IsTyping['state']>('nothing')\n\n\t// initialize the typing set to false when we disconnect\n\t// once that is set up, then we can mark that we are indeed typing elsewhere\n\t// ^ that will be done in the next hook\n\tuseEffect(() => {\n\t\tconst subscriptionRef = firebase.database().ref('.info/connected')\n\t\tconst notTyping: IsTyping = {\n\t\t\tstate: 'nothing',\n\t\t\tlastChanged: firebase.database.ServerValue.TIMESTAMP,\n\t\t\troomId\n\t\t}\n\n\t\tsubscriptionRef.on('value', async snapshot => {\n\t\t\tif (!snapshot.val()) return\n\n\t\t\ttry {\n\t\t\t\tawait databaseRef.onDisconnect().set(notTyping)\n\t\t\t\tsetReady(true)\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(`useTyping error within snapshot listener ${e}`)\n\t\t\t}\n\t\t})\n\n\t\treturn () => {\n\t\t\t// clean up the listener on unmount\n\t\t\tsubscriptionRef.off('value')\n\t\t\t;(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tlastStateSent.current = notTyping.state\n\t\t\t\t\tawait databaseRef.set(notTyping)\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.error('useTyping errored on unmount setting not typing')\n\t\t\t\t}\n\t\t\t})()\n\t\t}\n\t}, [roomId, databaseRef, firebase])\n\n\t// every time we type something new, upload that we're typing\n\t// and after a certain delay, we mark typing false\n\t// however, if we type before that timer has completed,\n\t// we clean it up and start it over\n\tuseEffect(() => {\n\t\ttry {\n\t\t\t// we're ready to upload from the previous effect\n\t\t\t// ...and the text we typed just changed.\n\t\t\t// if text is empty, set to false\n\t\t\tif (ready && text !== previouslyTyped.current) {\n\t\t\t\tpreviouslyTyped.current = text\n\n\t\t\t\tconst notTyping: IsTyping = {\n\t\t\t\t\tstate: 'nothing',\n\t\t\t\t\tlastChanged: firebase.database.ServerValue.TIMESTAMP,\n\t\t\t\t\troomId\n\t\t\t\t}\n\t\t\t\tconst isTyping: IsTyping = {\n\t\t\t\t\tstate: 'typing',\n\t\t\t\t\tlastChanged: firebase.database.ServerValue.TIMESTAMP,\n\t\t\t\t\troomId\n\t\t\t\t}\n\n\t\t\t\t// if the text is empty, we set it to not typing\n\t\t\t\tconst setValue = text ? isTyping : notTyping\n\n\t\t\t\t// don't resend the state we just sent to avoid redundancy\n\t\t\t\tif (setValue.state !== lastStateSent.current) {\n\t\t\t\t\tlastStateSent.current = setValue.state\n\t\t\t\t\tdatabaseRef.set(setValue)\n\t\t\t\t}\n\n\t\t\t\t// only need a notTyping timer timer if we're typing\n\t\t\t\tif (delay !== null && setValue.state === 'typing') {\n\t\t\t\t\ttimer.current = setTimeout(() => {\n\t\t\t\t\t\tlastStateSent.current = notTyping.state\n\t\t\t\t\t\tdatabaseRef.set(notTyping)\n\t\t\t\t\t}, delay)\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error('error in useTyping after timer', e)\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (timer.current) clearTimeout(timer.current)\n\t\t}\n\t}, [ready, text, roomId, delay, uid, databaseRef, firebase])\n}\n\ninterface IsTyping extends Typing {\n\troomId: string\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import{useEffect,useRef}from'react';import{Room}from'../../index';import{fuego}from'../../components/ChatProvider';export default(function(config){var delay=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1500;var _config$text=config.text,text=_config$text===void 0?'':_config$text,id=config.id;var _ref=new Room({id:id}),path=_ref.path;var ref=fuego.db.doc(path);var timer=useRef();var user=fuego.auth().currentUser;var uid=user&&user.uid||'tester_name';var mounted=useRef(false);var lastTyped=useRef(0);useEffect(function(){try{if(mounted.current){var typedAt=Date.now();lastTyped.current=typedAt;ref.update(_defineProperty({},"members."+uid+".typing",true));timer.current=setTimeout(function(){ref.update(_defineProperty({},"members."+uid+".typing",false));},delay);}else{mounted.current=true;}}catch(e){console.error('use typing update error',e);}return function(){if(timer.current)clearTimeout(timer.current);};},[text,uid,delay,path]);useEffect(function(){return function(){try{ref.update(_defineProperty({},"members."+uid+".typing",false));}catch(e){console.error('unmount usetyping error',e);}};},[]);});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useEffect","useRef","Room","fuego","config","delay","text","id","path","ref","db","doc","timer","user","auth","currentUser","uid","mounted","lastTyped","current","typedAt","Date","now","update","setTimeout","e","console","error","clearTimeout"],"mappings":"mEAAA,OAASA,SAAT,CAAoBC,MAApB,KAAkC,OAAlC,CACA,OAASC,IAAT,KAAqB,aAArB,CACA,OAASC,KAAT,KAAsB,+BAAtB,CAWA,eAAe,SAACC,MAAD,CAAmD,IAAzBC,CAAAA,KAAyB,2DAAT,IAAS,kBACvCD,MADuC,CACzDE,IADyD,CACzDA,IADyD,uBAClD,EADkD,cAC9CC,EAD8C,CACvCH,MADuC,CAC9CG,EAD8C,UAEhD,GAAIL,CAAAA,IAAJ,CAAS,CAAEK,EAAE,CAAFA,EAAF,CAAT,CAFgD,CAEzDC,IAFyD,MAEzDA,IAFyD,CAGjE,GAAMC,CAAAA,GAAG,CAAGN,KAAK,CAACO,EAAN,CAASC,GAAT,CAAaH,IAAb,CAAZ,CACA,GAAMI,CAAAA,KAAK,CAAGX,MAAM,EAApB,CACA,GAAMY,CAAAA,IAAI,CAAGV,KAAK,CAACW,IAAN,GAAaC,WAA1B,CACA,GAAMC,CAAAA,GAAG,CAAIH,IAAI,EAAIA,IAAI,CAACG,GAAd,EAAsB,aAAlC,CAEA,GAAMC,CAAAA,OAAO,CAAGhB,MAAM,CAAC,KAAD,CAAtB,CACA,GAAMiB,CAAAA,SAAS,CAAGjB,MAAM,CAAC,CAAD,CAAxB,CAEAD,SAAS,CAAC,UAAM,CACf,GAAI,CACH,GAAIiB,OAAO,CAACE,OAAZ,CAAqB,CACpB,GAAMC,CAAAA,OAAO,CAAGC,IAAI,CAACC,GAAL,EAAhB,CAEAJ,SAAS,CAACC,OAAV,CAAoBC,OAApB,CAEAX,GAAG,CAACc,MAAJ,+BACaP,GADb,WAC4B,IAD5B,GAIAJ,KAAK,CAACO,OAAN,CAAgBK,UAAU,CAAC,UAAM,CAChCf,GAAG,CAACc,MAAJ,+BACaP,GADb,WAC4B,KAD5B,GAGA,CAJyB,CAIvBX,KAJuB,CAA1B,CAMA,CAfD,IAeO,CACNY,OAAO,CAACE,OAAR,CAAkB,IAAlB,CACA,CACD,CAAC,MAAOM,CAAP,CAAU,CACXC,OAAO,CAACC,KAAR,CAAc,yBAAd,CAAyCF,CAAzC,EACA,CAED,MAAO,WAAM,CAEZ,GAAIb,KAAK,CAACO,OAAV,CAAmBS,YAAY,CAAChB,KAAK,CAACO,OAAP,CAAZ,CACnB,CAHD,CAIA,CA5BQ,CA4BN,CAACb,IAAD,CAAOU,GAAP,CAAYX,KAAZ,CAAmBG,IAAnB,CA5BM,CAAT,CA8BAR,SAAS,CAAC,UAAM,CACf,MAAO,WAAM,CACZ,GAAI,CAEHS,GAAG,CAACc,MAAJ,+BACaP,GADb,WAC4B,KAD5B,GAGA,CAAC,MAAOS,CAAP,CAAU,CACXC,OAAO,CAACC,KAAR,CAAc,yBAAd,CAAyCF,CAAzC,EACA,CACD,CATD,CAUA,CAXQ,CAWN,EAXM,CAAT,CAYA,CArDD","sourcesContent":["import { useEffect, useRef } from 'react'\nimport { Room } from '../../index'\nimport { fuego } from '../../components/ChatProvider'\nimport { UseTypingConfig } from './types'\n\n/**\n * useTyping updates the backend every time a user types, setting it to false after a certain delay.\n *\n * @param config { text, id } A dictionary that takes in the Input's current text value and the chatroom ID.\n * @param delay How long the timer delay should be before the backend is told we're no longer typing.\n *\n * @returns undefined\n */\nexport default (config: UseTypingConfig, delay: number = 1500) => {\n\tconst { text = '', id } = config\n\tconst { path } = new Room({ id })\n\tconst ref = fuego.db.doc(path)\n\tconst timer = useRef<number>()\n\tconst user = fuego.auth().currentUser as firebase.User\n\tconst uid = (user && user.uid) || 'tester_name'\n\t// ensures that typing only happens on update, not on mount\n\tconst mounted = useRef(false)\n\tconst lastTyped = useRef(0)\n\n\tuseEffect(() => {\n\t\ttry {\n\t\t\tif (mounted.current) {\n\t\t\t\tconst typedAt = Date.now()\n\t\t\t\t// const last = lastTyped.current\n\t\t\t\tlastTyped.current = typedAt\n\t\t\t\t// if ((typedAt - last) / 1000 >= delay) {\n\t\t\t\tref.update({\n\t\t\t\t\t[`members.${uid}.typing`]: true\n\t\t\t\t\t// [`members.${uid}.lastTyped`]: new Date()\n\t\t\t\t})\n\t\t\t\ttimer.current = setTimeout(() => {\n\t\t\t\t\tref.update({\n\t\t\t\t\t\t[`members.${uid}.typing`]: false\n\t\t\t\t\t})\n\t\t\t\t}, delay)\n\t\t\t\t// }\n\t\t\t} else {\n\t\t\t\tmounted.current = true\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error('use typing update error', e)\n\t\t}\n\n\t\treturn () => {\n\t\t\t// cleanup on update\n\t\t\tif (timer.current) clearTimeout(timer.current)\n\t\t}\n\t}, [text, uid, delay, path])\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\ttry {\n\t\t\t\t// mark indicator as false\n\t\t\t\tref.update({\n\t\t\t\t\t[`members.${uid}.typing`]: false\n\t\t\t\t})\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error('unmount usetyping error', e)\n\t\t\t}\n\t\t}\n\t}, [])\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useRef,useCallback,useEffect}from'react';import Room from'../../classes/Room';export default function(config){var methods=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var roomId=config.roomId;var lastUploadedMessageId=useRef(null);var onViewMessages=methods.onViewMessages;var roomIdRef=useRef(roomId);var onViewMessagesRef=useRef(onViewMessages);useEffect(function(){roomIdRef.current=roomId;if(onViewMessages)onViewMessagesRef.current=onViewMessages;},[roomId,onViewMessages]);return useCallback(function(_ref){var visibleMessages=_ref.visibleMessages,latestMessageId=_ref.latestMessageId;var message=visibleMessages&&visibleMessages.find(function(i){return i.id===latestMessageId;});if(visibleMessages&&visibleMessages.length&&onViewMessagesRef.current){onViewMessagesRef.current({visibleMessages:visibleMessages});}if(message&&message.id!==lastUploadedMessageId.current){lastUploadedMessageId.current=message.id;new Room({id:roomIdRef.current}).viewMessage(message.id,message.createdAt);}},[]);}
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useRef","useCallback","useEffect","Room","config","methods","roomId","lastUploadedMessageId","onViewMessages","roomIdRef","onViewMessagesRef","current","visibleMessages","latestMessageId","message","find","i","id","length","viewMessage","createdAt"],"mappings":"AAAA,OAASA,MAAT,CAAiBC,WAAjB,CAA8BC,SAA9B,KAA+C,OAA/C,CAEA,MAAOC,CAAAA,IAAP,KAAiB,oBAAjB,CAeA,cAAe,UACdC,MADc,CAGb,IADDC,CAAAA,OACC,2DADwC,EACxC,IACOC,CAAAA,MADP,CACkBF,MADlB,CACOE,MADP,CAED,GAAMC,CAAAA,qBAAqB,CAAGP,MAAM,CAAgB,IAAhB,CAApC,CAFC,GAGOQ,CAAAA,cAHP,CAG0BH,OAH1B,CAGOG,cAHP,CAKD,GAAMC,CAAAA,SAAS,CAAGT,MAAM,CAACM,MAAD,CAAxB,CACA,GAAMI,CAAAA,iBAAiB,CAAGV,MAAM,CAACQ,cAAD,CAAhC,CAEAN,SAAS,CAAC,UAAM,CACfO,SAAS,CAACE,OAAV,CAAoBL,MAApB,CACA,GAAIE,cAAJ,CAAoBE,iBAAiB,CAACC,OAAlB,CAA4BH,cAA5B,CACpB,CAHQ,CAGN,CAACF,MAAD,CAASE,cAAT,CAHM,CAAT,CAKA,MAAOP,CAAAA,WAAW,CACjB,cAMM,IALLW,CAAAA,eAKK,MALLA,eAKK,CAJLC,eAIK,MAJLA,eAIK,CACL,GAAMC,CAAAA,OAAO,CACZF,eAAe,EAAIA,eAAe,CAACG,IAAhB,CAAqB,SAAAC,CAAC,QAAIA,CAAAA,CAAC,CAACC,EAAF,GAASJ,eAAb,EAAtB,CADpB,CAEA,GACCD,eAAe,EACfA,eAAe,CAACM,MADhB,EAEAR,iBAAiB,CAACC,OAHnB,CAIE,CACDD,iBAAiB,CAACC,OAAlB,CAA0B,CAAEC,eAAe,CAAfA,eAAF,CAA1B,EACA,CACD,GAAIE,OAAO,EAAIA,OAAO,CAACG,EAAR,GAAeV,qBAAqB,CAACI,OAApD,CAA6D,CAC5DJ,qBAAqB,CAACI,OAAtB,CAAgCG,OAAO,CAACG,EAAxC,CACA,GAAId,CAAAA,IAAJ,CAAS,CAAEc,EAAE,CAAER,SAAS,CAACE,OAAhB,CAAT,EAAoCQ,WAApC,CACCL,OAAO,CAACG,EADT,CAECH,OAAO,CAACM,SAFT,EAIA,CACD,CAxBgB,CAyBjB,EAzBiB,CAAlB,CA2BA","sourcesContent":["import { useRef, useCallback, useEffect } from 'react'\nimport { NewMessageModel } from '../../classes/Message/types'\nimport Room from '../../classes/Room'\nimport { UseViewMessagesConfig, UseViewMessagesMethods } from './types'\n\n/**\n * React hook that returns a function useful for marking messages as viewed on the backend.\n * It works by only clearing unread count when you've reached the most recent message, leveraging React Native FlatList's onViewableItemsChanged.\n * This is only useful if you're using the Juice chat backend.\n *\n * @example\n * ```js\n * const onViewMessages = useViewMessages({ roomId: 'some_chat_room_id' })\n *\n * return <Juice.Chat onViewMessages={onViewMessages} />\n * ```\n */\nexport default function<Model extends NewMessageModel = NewMessageModel>(\n\tconfig: UseViewMessagesConfig,\n\tmethods: UseViewMessagesMethods<Model> = {}\n) {\n\tconst { roomId } = config\n\tconst lastUploadedMessageId = useRef<string | null>(null)\n\tconst { onViewMessages } = methods\n\n\tconst roomIdRef = useRef(roomId)\n\tconst onViewMessagesRef = useRef(onViewMessages)\n\n\tuseEffect(() => {\n\t\troomIdRef.current = roomId\n\t\tif (onViewMessages) onViewMessagesRef.current = onViewMessages\n\t}, [roomId, onViewMessages])\n\n\treturn useCallback(\n\t\t({\n\t\t\tvisibleMessages,\n\t\t\tlatestMessageId\n\t\t}: {\n\t\t\tvisibleMessages: Model[] | null\n\t\t\tlatestMessageId: string | null\n\t\t}) => {\n\t\t\tconst message =\n\t\t\t\tvisibleMessages && visibleMessages.find(i => i.id === latestMessageId)\n\t\t\tif (\n\t\t\t\tvisibleMessages &&\n\t\t\t\tvisibleMessages.length &&\n\t\t\t\tonViewMessagesRef.current\n\t\t\t) {\n\t\t\t\tonViewMessagesRef.current({ visibleMessages })\n\t\t\t}\n\t\t\tif (message && message.id !== lastUploadedMessageId.current) {\n\t\t\t\tlastUploadedMessageId.current = message.id\n\t\t\t\tnew Room({ id: roomIdRef.current }).viewMessage(\n\t\t\t\t\tmessage.id,\n\t\t\t\t\tmessage.createdAt\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\t\t[]\n\t)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useRef,useMemo,useCallback,useEffect}from'react';import Room from'../../classes/Room';export default function(_ref){var messages=_ref.messages,roomId=_ref.roomId;var lastMessageId=useRef(null);var formatted=useMemo(function(){return messages||[];},[messages]);var messagesRef=useRef([]);var roomIdRef=useRef('');useEffect(function(){roomIdRef.current=roomId;messagesRef.current=formatted;},[formatted,roomId]);var onViewableItemsChanged=useCallback(function(info){info.viewableItems.forEach(function(item){if(!item.isViewable)return;var message=item.item;var id=message.id;var mostRecentMessageId=messagesRef.current[0].id;if(id===mostRecentMessageId&&lastMessageId.current!==id){lastMessageId.current=id;new Room({id:roomIdRef.current}).viewMessage(id,message.createdAt);}});},[]);return onViewableItemsChanged;}
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useRef","useMemo","useCallback","useEffect","Room","messages","roomId","lastMessageId","formatted","messagesRef","roomIdRef","current","onViewableItemsChanged","info","viewableItems","forEach","item","isViewable","message","id","mostRecentMessageId","viewMessage","createdAt"],"mappings":"AAAA,OAASA,MAAT,CAAiBC,OAAjB,CAA0BC,WAA1B,CAAuCC,SAAvC,KAAwD,OAAxD,CAGA,MAAOC,CAAAA,IAAP,KAAiB,oBAAjB,CAEA,cAAe,eAMZ,IALFC,CAAAA,QAKE,MALFA,QAKE,CAJFC,MAIE,MAJFA,MAIE,CACF,GAAMC,CAAAA,aAAa,CAAGP,MAAM,CAAgB,IAAhB,CAA5B,CACA,GAAMQ,CAAAA,SAAkB,CAAGP,OAAO,CAAC,iBAAMI,CAAAA,QAAQ,EAAI,EAAlB,EAAD,CAAuB,CAACA,QAAD,CAAvB,CAAlC,CAEA,GAAMI,CAAAA,WAAW,CAAGT,MAAM,CAAU,EAAV,CAA1B,CACA,GAAMU,CAAAA,SAAS,CAAGV,MAAM,CAAC,EAAD,CAAxB,CAEAG,SAAS,CAAC,UAAM,CACfO,SAAS,CAACC,OAAV,CAAoBL,MAApB,CACAG,WAAW,CAACE,OAAZ,CAAsBH,SAAtB,CACA,CAHQ,CAGN,CAACA,SAAD,CAAYF,MAAZ,CAHM,CAAT,CAKA,GAAMM,CAAAA,sBAEqB,CAAGV,WAAW,CAAC,SAAAW,IAAI,CAAI,CACjDA,IAAI,CAACC,aAAL,CAAmBC,OAAnB,CAA2B,SAACC,IAAD,CAAqB,CAC/C,GAAI,CAACA,IAAI,CAACC,UAAV,CAAsB,OACtB,GAAMC,CAAAA,OAAO,CAAGF,IAAI,CAACA,IAArB,CACA,GAAMG,CAAAA,EAAE,CAAGD,OAAO,CAACC,EAAnB,CACA,GAAMC,CAAAA,mBAAmB,CAAGX,WAAW,CAACE,OAAZ,CAAoB,CAApB,EAAuBQ,EAAnD,CACA,GAAIA,EAAE,GAAKC,mBAAP,EAA8Bb,aAAa,CAACI,OAAd,GAA0BQ,EAA5D,CAAgE,CAC/DZ,aAAa,CAACI,OAAd,CAAwBQ,EAAxB,CACA,GAAIf,CAAAA,IAAJ,CAAS,CAAEe,EAAE,CAAET,SAAS,CAACC,OAAhB,CAAT,EAAoCU,WAApC,CAAgDF,EAAhD,CAAoDD,OAAO,CAACI,SAA5D,EACA,CACD,CATD,EAUA,CAXwC,CAWtC,EAXsC,CAFzC,CAcA,MAAOV,CAAAA,sBAAP,CACA","sourcesContent":["import { useRef, useMemo, useCallback, useEffect } from 'react'\nimport { NewMessageModel } from '../../classes/Message/types'\nimport { FlatListProps, ViewToken } from 'react-native'\nimport Room from '../../classes/Room'\n\nexport default function<Model extends NewMessageModel>({\n\tmessages,\n\troomId\n}: {\n\tmessages: Model[] | null\n\troomId: string\n}) {\n\tconst lastMessageId = useRef<string | null>(null)\n\tconst formatted: Model[] = useMemo(() => messages || [], [messages])\n\n\tconst messagesRef = useRef<Model[]>([])\n\tconst roomIdRef = useRef('')\n\n\tuseEffect(() => {\n\t\troomIdRef.current = roomId\n\t\tmessagesRef.current = formatted\n\t}, [formatted, roomId])\n\n\tconst onViewableItemsChanged: FlatListProps<\n\t\tModel\n\t>['onViewableItemsChanged'] = useCallback(info => {\n\t\tinfo.viewableItems.forEach((item: ViewToken) => {\n\t\t\tif (!item.isViewable) return\n\t\t\tconst message = item.item as Model\n\t\t\tconst id = message.id\n\t\t\tconst mostRecentMessageId = messagesRef.current[0].id\n\t\t\tif (id === mostRecentMessageId && lastMessageId.current !== id) {\n\t\t\t\tlastMessageId.current = id\n\t\t\t\tnew Room({ id: roomIdRef.current }).viewMessage(id, message.createdAt)\n\t\t\t}\n\t\t})\n\t}, [])\n\treturn onViewableItemsChanged\n}\n"]}
|
package/lib/module/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export*from'./components';export*from'./classes';export*from'./hooks';import*as ChatType from'./components/Chat/types';import*as InboxType from'./components/Inbox/types';import*as MessageType from'./classes/Message/types';import*as RoomType from'./classes/Room/types';export var ChatTypes=ChatType;export var InboxTypes=InboxType;export var MessageTypes=MessageType;export var RoomTypes=RoomType;
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["ChatType","InboxType","MessageType","RoomType","ChatTypes","InboxTypes","MessageTypes","RoomTypes"],"mappings":"AAAA,WAAc,cAAd,CACA,WAAc,WAAd,CACA,WAAc,SAAd,CAEA,MAAO,GAAKA,CAAAA,QAAZ,KAA0B,yBAA1B,CACA,MAAO,GAAKC,CAAAA,SAAZ,KAA2B,0BAA3B,CACA,MAAO,GAAKC,CAAAA,WAAZ,KAA6B,yBAA7B,CACA,MAAO,GAAKC,CAAAA,QAAZ,KAA0B,sBAA1B,CAEA,MAAO,IAAMC,CAAAA,SAAS,CAAGJ,QAAlB,CACP,MAAO,IAAMK,CAAAA,UAAU,CAAGJ,SAAnB,CACP,MAAO,IAAMK,CAAAA,YAAY,CAAGJ,WAArB,CACP,MAAO,IAAMK,CAAAA,SAAS,CAAGJ,QAAlB","sourcesContent":["export * from './components'\nexport * from './classes'\nexport * from './hooks'\n\nimport * as ChatType from './components/Chat/types'\nimport * as InboxType from './components/Inbox/types'\nimport * as MessageType from './classes/Message/types'\nimport * as RoomType from './classes/Room/types'\n\nexport const ChatTypes = ChatType\nexport const InboxTypes = InboxType\nexport const MessageTypes = MessageType\nexport const RoomTypes = RoomType\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ChatConfig } from './types';
|
|
2
|
-
export default class Chat {
|
|
3
|
-
private chat;
|
|
4
|
-
constructor(chat?: ChatConfig);
|
|
5
|
-
get roomsCollection(): string;
|
|
6
|
-
get messagesCollection(): string;
|
|
7
|
-
get httpCallables(): {
|
|
8
|
-
sendMessageFromFeed: string;
|
|
9
|
-
sendMessageToPeople: string;
|
|
10
|
-
sendMessageToGroup: string;
|
|
11
|
-
createRoom: string;
|
|
12
|
-
sendMessageToRooms: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare type RoomPathFunc = (roomId: string) => string;
|
|
2
|
-
export interface ChatConfig {
|
|
3
|
-
roomsCollection?: string;
|
|
4
|
-
messagesCollection?: string;
|
|
5
|
-
httpCallables?: {
|
|
6
|
-
sendMessageFromFeed: string;
|
|
7
|
-
sendMessageToPeople: string;
|
|
8
|
-
sendMessageToGroup: string;
|
|
9
|
-
sendMessageToRooms: string;
|
|
10
|
-
createRoom: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export interface ChatModel {
|
|
14
|
-
roomsCollection: string;
|
|
15
|
-
messagesCollection: string;
|
|
16
|
-
httpCallables: {
|
|
17
|
-
sendMessageFromFeed: string;
|
|
18
|
-
sendMessageToPeople: string;
|
|
19
|
-
sendMessageToGroup: string;
|
|
20
|
-
};
|
|
21
|
-
}
|