@axelor/aos-mobile-message 8.4.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/README.md +42 -0
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +19 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/mail-message-api.d.ts +53 -0
- package/lib/api/mail-message-api.js +133 -0
- package/lib/api/mail-message-api.js.map +1 -0
- package/lib/components/atoms/AuthorText/AuthorText.d.ts +8 -0
- package/lib/components/atoms/AuthorText/AuthorText.js +41 -0
- package/lib/components/atoms/AuthorText/AuthorText.js.map +1 -0
- package/lib/components/atoms/Avatar/Avatar.d.ts +9 -0
- package/lib/components/atoms/Avatar/Avatar.js +49 -0
- package/lib/components/atoms/Avatar/Avatar.js.map +1 -0
- package/lib/components/atoms/ExpandableText/ExpandableText.d.ts +7 -0
- package/lib/components/atoms/ExpandableText/ExpandableText.js +68 -0
- package/lib/components/atoms/ExpandableText/ExpandableText.js.map +1 -0
- package/lib/components/atoms/MessageBox/MessageBox.d.ts +12 -0
- package/lib/components/atoms/MessageBox/MessageBox.js +63 -0
- package/lib/components/atoms/MessageBox/MessageBox.js.map +1 -0
- package/lib/components/atoms/MessageFlags/MessageFlags.d.ts +9 -0
- package/lib/components/atoms/MessageFlags/MessageFlags.js +74 -0
- package/lib/components/atoms/MessageFlags/MessageFlags.js.map +1 -0
- package/lib/components/atoms/TrackItem/TrackItem.d.ts +10 -0
- package/lib/components/atoms/TrackItem/TrackItem.js +59 -0
- package/lib/components/atoms/TrackItem/TrackItem.js.map +1 -0
- package/lib/components/atoms/index.d.ts +6 -0
- package/lib/components/atoms/index.js +24 -0
- package/lib/components/atoms/index.js.map +1 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.js +22 -0
- package/lib/components/index.js.map +1 -0
- package/lib/components/molecules/CommentCard/CommentCard.d.ts +14 -0
- package/lib/components/molecules/CommentCard/CommentCard.js +60 -0
- package/lib/components/molecules/CommentCard/CommentCard.js.map +1 -0
- package/lib/components/molecules/NotificationCard/NotificationCard.d.ts +19 -0
- package/lib/components/molecules/NotificationCard/NotificationCard.js +59 -0
- package/lib/components/molecules/NotificationCard/NotificationCard.js.map +1 -0
- package/lib/components/molecules/SendMessageBox/SendMessageBox.d.ts +13 -0
- package/lib/components/molecules/SendMessageBox/SendMessageBox.js +62 -0
- package/lib/components/molecules/SendMessageBox/SendMessageBox.js.map +1 -0
- package/lib/components/molecules/UnsubscribeIcon/UnsubscribeIcon.d.ts +3 -0
- package/lib/components/molecules/UnsubscribeIcon/UnsubscribeIcon.js +47 -0
- package/lib/components/molecules/UnsubscribeIcon/UnsubscribeIcon.js.map +1 -0
- package/lib/components/molecules/index.d.ts +4 -0
- package/lib/components/molecules/index.js +22 -0
- package/lib/components/molecules/index.js.map +1 -0
- package/lib/components/organisms/MailMessageCard/MailMessageCard.d.ts +22 -0
- package/lib/components/organisms/MailMessageCard/MailMessageCard.js +148 -0
- package/lib/components/organisms/MailMessageCard/MailMessageCard.js.map +1 -0
- package/lib/components/organisms/index.d.ts +1 -0
- package/lib/components/organisms/index.js +19 -0
- package/lib/components/organisms/index.js.map +1 -0
- package/lib/components/templates/MailMessageView/MailMessageView.d.ts +9 -0
- package/lib/components/templates/MailMessageView/MailMessageView.js +69 -0
- package/lib/components/templates/MailMessageView/MailMessageView.js.map +1 -0
- package/lib/components/templates/index.d.ts +1 -0
- package/lib/components/templates/index.js +19 -0
- package/lib/components/templates/index.js.map +1 -0
- package/lib/features/asyncFunctions-index.d.ts +1 -0
- package/lib/features/asyncFunctions-index.js +19 -0
- package/lib/features/asyncFunctions-index.js.map +1 -0
- package/lib/features/index.d.ts +1 -0
- package/lib/features/index.js +19 -0
- package/lib/features/index.js.map +1 -0
- package/lib/features/mailMessageSlice.d.ts +110 -0
- package/lib/features/mailMessageSlice.js +180 -0
- package/lib/features/mailMessageSlice.js.map +1 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +19 -0
- package/lib/hooks/index.js.map +1 -0
- package/lib/hooks/use-is-subscribed.d.ts +1 -0
- package/lib/hooks/use-is-subscribed.js +25 -0
- package/lib/hooks/use-is-subscribed.js.map +1 -0
- package/lib/hooks/use-message-header-actions.d.ts +1 -0
- package/lib/hooks/use-message-header-actions.js +162 -0
- package/lib/hooks/use-message-header-actions.js.map +1 -0
- package/lib/i18n/en.json +32 -0
- package/lib/i18n/fr.json +32 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +48 -0
- package/lib/index.js.map +1 -0
- package/lib/screens/InboxScreen.d.ts +3 -0
- package/lib/screens/InboxScreen.js +35 -0
- package/lib/screens/InboxScreen.js.map +1 -0
- package/lib/screens/MailMessageAttachedFilesScreen.d.ts +5 -0
- package/lib/screens/MailMessageAttachedFilesScreen.js +37 -0
- package/lib/screens/MailMessageAttachedFilesScreen.js.map +1 -0
- package/lib/screens/MailMessageLinkFilesScreen.d.ts +5 -0
- package/lib/screens/MailMessageLinkFilesScreen.js +88 -0
- package/lib/screens/MailMessageLinkFilesScreen.js.map +1 -0
- package/lib/screens/MailMessageScreen.d.ts +5 -0
- package/lib/screens/MailMessageScreen.js +32 -0
- package/lib/screens/MailMessageScreen.js.map +1 -0
- package/lib/screens/index.d.ts +43 -0
- package/lib/screens/index.js +53 -0
- package/lib/screens/index.js.map +1 -0
- package/lib/types/inbox-type.d.ts +5 -0
- package/lib/types/inbox-type.js +24 -0
- package/lib/types/inbox-type.js.map +1 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.js +21 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/mail-message-notification-type.d.ts +13 -0
- package/lib/types/mail-message-notification-type.js +48 -0
- package/lib/types/mail-message-notification-type.js.map +1 -0
- package/lib/types/mail-message-type.d.ts +17 -0
- package/lib/types/mail-message-type.js +55 -0
- package/lib/types/mail-message-type.js.map +1 -0
- package/lib/utils/date.d.ts +2 -0
- package/lib/utils/date.js +24 -0
- package/lib/utils/date.js.map +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +20 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/mailMessagesGenericAction.d.ts +24 -0
- package/lib/utils/mailMessagesGenericAction.js +53 -0
- package/lib/utils/mailMessagesGenericAction.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
19
|
+
import { ActivityIndicator, StyleSheet, TouchableOpacity, View, } from 'react-native';
|
|
20
|
+
import { useIsFocused, useTranslator } from '@axelor/aos-mobile-core';
|
|
21
|
+
import { Icon, OUTSIDE_INDICATOR, Text, useClickOutside, useClickOutsideContext, useThemeColor, } from '@axelor/aos-mobile-ui';
|
|
22
|
+
import { Avatar, AVATAR_SIZE, AVATAR_PADDING, AuthorText } from '../../atoms';
|
|
23
|
+
import { CommentCard, NotificationCard, SendMessageBox } from '../../molecules';
|
|
24
|
+
import { fetchRepliesApi } from '../../../api';
|
|
25
|
+
import { MailMessageType } from '../../../types';
|
|
26
|
+
const MailMessageCard = ({ messageId, author, avatar, body, eventText, eventTime, files, style, relatedName, subject, type, flags, relatedId, relatedModel, isInbox, numReplies, getParentReplies, }) => {
|
|
27
|
+
const I18n = useTranslator();
|
|
28
|
+
const Colors = useThemeColor();
|
|
29
|
+
const isFocused = useIsFocused();
|
|
30
|
+
const [areRepliesVisible, setAreRepliesVisible] = useState(false);
|
|
31
|
+
const [replies, setReplies] = useState([]);
|
|
32
|
+
const [numberReplies, setNumberReplies] = useState(0);
|
|
33
|
+
const [isMessageBoxVisible, setIsMessageBoxVisible] = useState(false);
|
|
34
|
+
const [isToggleMBDisabled, setIsToggleMBDisabled] = useState(false);
|
|
35
|
+
const getReplies = useCallback((newMessage) => fetchRepliesApi({ messageId })
|
|
36
|
+
.then(res => {
|
|
37
|
+
const _replies = res?.data?.data;
|
|
38
|
+
setAreRepliesVisible(current => {
|
|
39
|
+
if (current || newMessage == null) {
|
|
40
|
+
setReplies(_replies);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const newReply = _replies.find(msg => msg.id === newMessage.id);
|
|
44
|
+
setReplies([newReply]);
|
|
45
|
+
}
|
|
46
|
+
setNumberReplies(_replies.length);
|
|
47
|
+
return true;
|
|
48
|
+
});
|
|
49
|
+
})
|
|
50
|
+
.catch(() => setReplies([])), [messageId]);
|
|
51
|
+
const styles = useMemo(() => getStyles(Colors.secondaryColor.background), [Colors.secondaryColor.background]);
|
|
52
|
+
const wrapperRef = useRef(null);
|
|
53
|
+
const clickOutside = useClickOutside({ wrapperRef });
|
|
54
|
+
const { setRef } = useClickOutsideContext();
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (isFocused && isToggleMBDisabled) {
|
|
57
|
+
setRef(wrapperRef?.current);
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
setIsToggleMBDisabled(false);
|
|
60
|
+
}, 100);
|
|
61
|
+
}
|
|
62
|
+
}, [isFocused, isToggleMBDisabled, setRef]);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (isMessageBoxVisible &&
|
|
65
|
+
clickOutside === OUTSIDE_INDICATOR &&
|
|
66
|
+
!isToggleMBDisabled) {
|
|
67
|
+
setIsMessageBoxVisible(false);
|
|
68
|
+
}
|
|
69
|
+
}, [clickOutside, isMessageBoxVisible, isToggleMBDisabled]);
|
|
70
|
+
const isReply = useMemo(() => !!getParentReplies, [getParentReplies]);
|
|
71
|
+
return (<View style={[styles.container, style]}>
|
|
72
|
+
<View>
|
|
73
|
+
<Avatar style={styles.avatar} avatar={avatar}/>
|
|
74
|
+
{(numberReplies > 0 || numReplies > 0) && (<TouchableOpacity style={styles.displayRepliesContainer} activeOpacity={0.9} onPress={() => {
|
|
75
|
+
setAreRepliesVisible(current => {
|
|
76
|
+
if (!current) {
|
|
77
|
+
getReplies();
|
|
78
|
+
}
|
|
79
|
+
return !current;
|
|
80
|
+
});
|
|
81
|
+
}}>
|
|
82
|
+
<Text textColor={Colors.secondaryColor_dark.background}>
|
|
83
|
+
{numberReplies > 0 ? numberReplies : numReplies}
|
|
84
|
+
</Text>
|
|
85
|
+
<Icon name="chat-dots"/>
|
|
86
|
+
</TouchableOpacity>)}
|
|
87
|
+
{areRepliesVisible && <View style={styles.verticalRule}/>}
|
|
88
|
+
</View>
|
|
89
|
+
<View style={styles.flexOne}>
|
|
90
|
+
<View style={styles.flexOne}>
|
|
91
|
+
<AuthorText author={author} eventText={eventText} eventTime={eventTime}/>
|
|
92
|
+
{type === MailMessageType.status.comment && (<CommentCard style={styles.card} subject={subject} files={files} value={body} flags={isReply ? null : flags} relatedId={relatedId} relatedModel={relatedModel} isInbox={isInbox}/>)}
|
|
93
|
+
{type === MailMessageType.status.notification && (<NotificationCard style={styles.card} relatedName={relatedName} subject={subject} tracks={JSON.parse(body ?? '{}').tracks} tag={JSON.parse(body ?? '{}').tags[0]} flags={isReply ? null : flags} relatedId={relatedId} relatedModel={relatedModel} isInbox={isInbox}/>)}
|
|
94
|
+
{isInbox && !isMessageBoxVisible && (<TouchableOpacity style={styles.replyContainer} activeOpacity={0.9} onPress={() => setIsMessageBoxVisible(true)}>
|
|
95
|
+
<Icon name="arrow-90deg-left" size={12}/>
|
|
96
|
+
<Text style={styles.replyText} fontSize={12}>
|
|
97
|
+
{I18n.t('Message_Respond')}
|
|
98
|
+
</Text>
|
|
99
|
+
</TouchableOpacity>)}
|
|
100
|
+
<SendMessageBox style={styles.messageBox} hideMessageBox={!isMessageBoxVisible} model={relatedModel} modelId={relatedId} parentId={messageId} onSend={message => {
|
|
101
|
+
getParentReplies
|
|
102
|
+
? getParentReplies(message)
|
|
103
|
+
: getReplies(message);
|
|
104
|
+
setIsMessageBoxVisible(false);
|
|
105
|
+
}} wrapperRef={wrapperRef} onLinkFiles={() => setIsToggleMBDisabled(true)}/>
|
|
106
|
+
</View>
|
|
107
|
+
{areRepliesVisible &&
|
|
108
|
+
(numberReplies === 0 ? (<ActivityIndicator size="large" color={Colors.inverseColor.background}/>) : (replies.map(item => (<MailMessageCard style={styles.replyCard} messageId={item.id} author={item.$author?.fullName} avatar={item.$avatar} body={item.body} eventText={item.$eventText} eventTime={item.$eventTime} files={item.$files} relatedName={item.relatedName} subject={item.subject} type={item.type} flags={item.$flags} relatedId={item.relatedId} relatedModel={item.relatedModel} isInbox={isInbox} getParentReplies={getReplies} key={item.id}/>))))}
|
|
109
|
+
</View>
|
|
110
|
+
</View>);
|
|
111
|
+
};
|
|
112
|
+
const getStyles = (verticalRuleColor) => StyleSheet.create({
|
|
113
|
+
container: { flexDirection: 'row', marginTop: 10 },
|
|
114
|
+
avatar: { paddingBottom: 5 },
|
|
115
|
+
displayRepliesContainer: {
|
|
116
|
+
flexDirection: 'row',
|
|
117
|
+
justifyContent: 'center',
|
|
118
|
+
gap: 5,
|
|
119
|
+
paddingVertical: 5,
|
|
120
|
+
},
|
|
121
|
+
verticalRule: {
|
|
122
|
+
flex: 1,
|
|
123
|
+
alignSelf: 'center',
|
|
124
|
+
width: 1,
|
|
125
|
+
marginTop: 5,
|
|
126
|
+
backgroundColor: verticalRuleColor,
|
|
127
|
+
},
|
|
128
|
+
flexOne: { flex: 1 },
|
|
129
|
+
card: {
|
|
130
|
+
flex: 1,
|
|
131
|
+
width: '100%',
|
|
132
|
+
marginTop: 2,
|
|
133
|
+
paddingHorizontal: 5,
|
|
134
|
+
zIndex: 5,
|
|
135
|
+
},
|
|
136
|
+
replyContainer: {
|
|
137
|
+
flexDirection: 'row',
|
|
138
|
+
justifyContent: 'flex-end',
|
|
139
|
+
gap: 5,
|
|
140
|
+
paddingTop: 3,
|
|
141
|
+
paddingHorizontal: 10,
|
|
142
|
+
},
|
|
143
|
+
replyText: { textDecorationLine: 'underline' },
|
|
144
|
+
messageBox: { width: null },
|
|
145
|
+
replyCard: { marginLeft: -((AVATAR_SIZE + AVATAR_PADDING) / 2) },
|
|
146
|
+
});
|
|
147
|
+
export default MailMessageCard;
|
|
148
|
+
//# sourceMappingURL=MailMessageCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MailMessageCard.js","sourceRoot":"","sources":["../../../../src/components/organisms/MailMessageCard/MailMessageCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/E,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,IAAI,GACL,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,yBAAyB,CAAC;AACpE,OAAO,EACL,IAAI,EACJ,iBAAiB,EACjB,IAAI,EACJ,eAAe,EACf,sBAAsB,EACtB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAC,MAAM,iBAAiB,CAAC;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aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAC;IAChD,MAAM,EAAE,EAAC,aAAa,EAAE,CAAC,EAAC;IAC1B,uBAAuB,EAAE;QACvB,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,QAAQ;QACxB,GAAG,EAAE,CAAC;QACN,eAAe,EAAE,CAAC;KACnB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,CAAC;QACP,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,CAAC;QACR,SAAS,EAAE,CAAC;QACZ,eAAe,EAAE,iBAAiB;KACnC;IACD,OAAO,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,CAAC;QACZ,iBAAiB,EAAE,CAAC;QACpB,MAAM,EAAE,CAAC;KACV;IACD,cAAc,EAAE;QACd,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,UAAU;QAC1B,GAAG,EAAE,CAAC;QACN,UAAU,EAAE,CAAC;QACb,iBAAiB,EAAE,EAAE;KACtB;IACD,SAAS,EAAE,EAAC,kBAAkB,EAAE,WAAW,EAAC;IAC5C,UAAU,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC;IACzB,SAAS,EAAE,EAAC,UAAU,EAAE,CAAC,CAAC,CAAC,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,EAAC;CAC/D,CAAC,CAAC;AAEL,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MailMessageCard } from './MailMessageCard/MailMessageCard';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export { default as MailMessageCard } from './MailMessageCard/MailMessageCard';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/organisms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface MailMessageViewProps {
|
|
3
|
+
model: string;
|
|
4
|
+
modelId: number;
|
|
5
|
+
date?: string;
|
|
6
|
+
hideMessageBox?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const MailMessageView: ({ model, modelId, date, hideMessageBox: _hideMessageBox, }: MailMessageViewProps) => React.JSX.Element;
|
|
9
|
+
export default MailMessageView;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
19
|
+
import { KeyboardAvoidingView, Platform, StyleSheet, View } from 'react-native';
|
|
20
|
+
import { useDispatch, useSelector, useTranslator } from '@axelor/aos-mobile-core';
|
|
21
|
+
import { ChipSelect, Screen, ScrollList, useThemeColor, } from '@axelor/aos-mobile-ui';
|
|
22
|
+
import { MailMessageCard } from '../../organisms';
|
|
23
|
+
import { SendMessageBox } from '../../molecules';
|
|
24
|
+
import { getMailMessages } from '../../../features/mailMessageSlice';
|
|
25
|
+
import { MailMessageType } from '../../../types';
|
|
26
|
+
const MailMessageView = ({ model, modelId, date, hideMessageBox: _hideMessageBox = false, }) => {
|
|
27
|
+
const I18n = useTranslator();
|
|
28
|
+
const Colors = useThemeColor();
|
|
29
|
+
const dispatch = useDispatch();
|
|
30
|
+
const [selectedStatus, setSelectedStatus] = useState([]);
|
|
31
|
+
const { loading, moreLoading, isListEnd, mailMessagesList } = useSelector(state => state.mailMessages);
|
|
32
|
+
const fetchMailMessagesAPI = useCallback((page) => {
|
|
33
|
+
dispatch(getMailMessages({ model, modelId, date, page }));
|
|
34
|
+
}, [date, dispatch, model, modelId]);
|
|
35
|
+
const filterOnStatus = useCallback((list) => {
|
|
36
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
else if (!Array.isArray(selectedStatus) ||
|
|
40
|
+
selectedStatus.length === 0) {
|
|
41
|
+
return list;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const selectedType = selectedStatus[0].key;
|
|
45
|
+
return selectedType === MailMessageType.status.all
|
|
46
|
+
? list
|
|
47
|
+
: list.filter(item => item.type === selectedType);
|
|
48
|
+
}
|
|
49
|
+
}, [selectedStatus]);
|
|
50
|
+
const filteredList = useMemo(() => filterOnStatus(mailMessagesList), [filterOnStatus, mailMessagesList]);
|
|
51
|
+
const hideMessageBox = useMemo(() => _hideMessageBox ||
|
|
52
|
+
selectedStatus?.[0]?.key === MailMessageType.status.notification, [_hideMessageBox, selectedStatus]);
|
|
53
|
+
return (<KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : 'height'} keyboardVerticalOffset={Platform.OS === 'ios' ? 40 : 100} style={styles.flexOne}>
|
|
54
|
+
<Screen removeSpaceOnTop>
|
|
55
|
+
<View style={styles.flexOne}>
|
|
56
|
+
<ScrollList loadingList={loading} data={filteredList} renderItem={({ item }) => (<MailMessageCard key={item.id} author={item.$author?.fullName} avatar={item.$avatar} body={item.body} eventText={item.$eventText} eventTime={item.$eventTime} files={item.$files} subject={item.subject} type={item.type} flags={item.$flags} relatedId={modelId} relatedModel={model}/>)} fetchData={fetchMailMessagesAPI} filter={false} moreLoading={moreLoading} isListEnd={isListEnd} translator={I18n.t}/>
|
|
57
|
+
</View>
|
|
58
|
+
<ChipSelect mode="switch" onChangeValue={setSelectedStatus} isRefresh selectionItems={MailMessageType.getSelectionItems(I18n, Colors, selectedStatus)} chipNumberOfLines={1}/>
|
|
59
|
+
<SendMessageBox hideMessageBox={hideMessageBox} model={model} modelId={modelId}/>
|
|
60
|
+
</Screen>
|
|
61
|
+
</KeyboardAvoidingView>);
|
|
62
|
+
};
|
|
63
|
+
const styles = StyleSheet.create({
|
|
64
|
+
flexOne: {
|
|
65
|
+
flex: 1,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
export default MailMessageView;
|
|
69
|
+
//# sourceMappingURL=MailMessageView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MailMessageView.js","sourceRoot":"","sources":["../../../../src/components/templates/MailMessageView/MailMessageView.t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Q,CACb,aAAa,CAAC,CAAC,iBAAiB,CAAC,CACjC,SAAS,CACT,cAAc,CAAC,CAAC,eAAe,CAAC,iBAAiB,CAC/C,IAAI,EACJ,MAAM,EACN,cAAc,CACf,CAAC,CACF,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAEvB;QAAA,CAAC,cAAc,CACb,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,OAAO,CAAC,CAAC,OAAO,CAAC,EAErB;MAAA,EAAE,MAAM,CACV;IAAA,EAAE,oBAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MailMessageView } from './MailMessageView/MailMessageView';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export { default as MailMessageView } from './MailMessageView/MailMessageView';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/templates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { countUnreadMailMessages, fetchInboxMessages, getMailMessages, getModelSubscribers, markAllMailMessageAsRead, modifyMailMessagesFlags, registerModel, registerModelId, saveInboxFolder, sendMailMessageComment, saveLinkFiles, subscribeModel, unsubscribeModel, } from './mailMessageSlice';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export { countUnreadMailMessages, fetchInboxMessages, getMailMessages, getModelSubscribers, markAllMailMessageAsRead, modifyMailMessagesFlags, registerModel, registerModelId, saveInboxFolder, sendMailMessageComment, saveLinkFiles, subscribeModel, unsubscribeModel, } from './mailMessageSlice';
|
|
19
|
+
//# sourceMappingURL=asyncFunctions-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncFunctions-index.js","sourceRoot":"","sources":["../../src/features/asyncFunctions-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,aAAa,EACb,cAAc,EACd,gBAAgB,GACjB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { mailMessagesReducer as mailMessages } from './mailMessageSlice';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export { mailMessagesReducer as mailMessages } from './mailMessageSlice';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/features/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,mBAAmB,IAAI,YAAY,EAAC,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export const getMailMessages: import("@reduxjs/toolkit").AsyncThunk<any, void, {
|
|
2
|
+
state?: unknown;
|
|
3
|
+
dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction>;
|
|
4
|
+
extra?: unknown;
|
|
5
|
+
rejectValue?: unknown;
|
|
6
|
+
serializedErrorType?: unknown;
|
|
7
|
+
pendingMeta?: unknown;
|
|
8
|
+
fulfilledMeta?: unknown;
|
|
9
|
+
rejectedMeta?: unknown;
|
|
10
|
+
}>;
|
|
11
|
+
export const sendMailMessageComment: import("@reduxjs/toolkit").AsyncThunk<any, void, {
|
|
12
|
+
state?: unknown;
|
|
13
|
+
dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction>;
|
|
14
|
+
extra?: unknown;
|
|
15
|
+
rejectValue?: unknown;
|
|
16
|
+
serializedErrorType?: unknown;
|
|
17
|
+
pendingMeta?: unknown;
|
|
18
|
+
fulfilledMeta?: unknown;
|
|
19
|
+
rejectedMeta?: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
export const getModelSubscribers: import("@reduxjs/toolkit").AsyncThunk<any, void, {
|
|
22
|
+
state?: unknown;
|
|
23
|
+
dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction>;
|
|
24
|
+
extra?: unknown;
|
|
25
|
+
rejectValue?: unknown;
|
|
26
|
+
serializedErrorType?: unknown;
|
|
27
|
+
pendingMeta?: unknown;
|
|
28
|
+
fulfilledMeta?: unknown;
|
|
29
|
+
rejectedMeta?: unknown;
|
|
30
|
+
}>;
|
|
31
|
+
export const subscribeModel: import("@reduxjs/toolkit").AsyncThunk<void, void, {
|
|
32
|
+
state?: unknown;
|
|
33
|
+
dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction>;
|
|
34
|
+
extra?: unknown;
|
|
35
|
+
rejectValue?: unknown;
|
|
36
|
+
serializedErrorType?: unknown;
|
|
37
|
+
pendingMeta?: unknown;
|
|
38
|
+
fulfilledMeta?: unknown;
|
|
39
|
+
rejectedMeta?: unknown;
|
|
40
|
+
}>;
|
|
41
|
+
export const unsubscribeModel: import("@reduxjs/toolkit").AsyncThunk<void, void, {
|
|
42
|
+
state?: unknown;
|
|
43
|
+
dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction>;
|
|
44
|
+
extra?: unknown;
|
|
45
|
+
rejectValue?: unknown;
|
|
46
|
+
serializedErrorType?: unknown;
|
|
47
|
+
pendingMeta?: unknown;
|
|
48
|
+
fulfilledMeta?: unknown;
|
|
49
|
+
rejectedMeta?: unknown;
|
|
50
|
+
}>;
|
|
51
|
+
export const countUnreadMailMessages: import("@reduxjs/toolkit").AsyncThunk<any, void, {
|
|
52
|
+
state?: unknown;
|
|
53
|
+
dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction>;
|
|
54
|
+
extra?: unknown;
|
|
55
|
+
rejectValue?: unknown;
|
|
56
|
+
serializedErrorType?: unknown;
|
|
57
|
+
pendingMeta?: unknown;
|
|
58
|
+
fulfilledMeta?: unknown;
|
|
59
|
+
rejectedMeta?: unknown;
|
|
60
|
+
}>;
|
|
61
|
+
export const markAllMailMessageAsRead: import("@reduxjs/toolkit").AsyncThunk<void, void, {
|
|
62
|
+
state?: unknown;
|
|
63
|
+
dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction>;
|
|
64
|
+
extra?: unknown;
|
|
65
|
+
rejectValue?: unknown;
|
|
66
|
+
serializedErrorType?: unknown;
|
|
67
|
+
pendingMeta?: unknown;
|
|
68
|
+
fulfilledMeta?: unknown;
|
|
69
|
+
rejectedMeta?: unknown;
|
|
70
|
+
}>;
|
|
71
|
+
export const modifyMailMessagesFlags: import("@reduxjs/toolkit").AsyncThunk<void, void, {
|
|
72
|
+
state?: unknown;
|
|
73
|
+
dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction>;
|
|
74
|
+
extra?: unknown;
|
|
75
|
+
rejectValue?: unknown;
|
|
76
|
+
serializedErrorType?: unknown;
|
|
77
|
+
pendingMeta?: unknown;
|
|
78
|
+
fulfilledMeta?: unknown;
|
|
79
|
+
rejectedMeta?: unknown;
|
|
80
|
+
}>;
|
|
81
|
+
export const fetchInboxMessages: import("@reduxjs/toolkit").AsyncThunk<any, void, {
|
|
82
|
+
state?: unknown;
|
|
83
|
+
dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction>;
|
|
84
|
+
extra?: unknown;
|
|
85
|
+
rejectValue?: unknown;
|
|
86
|
+
serializedErrorType?: unknown;
|
|
87
|
+
pendingMeta?: unknown;
|
|
88
|
+
fulfilledMeta?: unknown;
|
|
89
|
+
rejectedMeta?: unknown;
|
|
90
|
+
}>;
|
|
91
|
+
export const registerModel: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "mailMessages/registerModel">;
|
|
92
|
+
export const registerModelId: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "mailMessages/registerModelId">;
|
|
93
|
+
export const saveInboxFolder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "mailMessages/saveInboxFolder">;
|
|
94
|
+
export const saveLinkFiles: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "mailMessages/saveLinkFiles">;
|
|
95
|
+
export const mailMessagesReducer: import("redux").Reducer<import("immer").WritableDraft<{
|
|
96
|
+
loading: boolean;
|
|
97
|
+
moreLoading: boolean;
|
|
98
|
+
isListEnd: boolean;
|
|
99
|
+
mailMessagesList: any[];
|
|
100
|
+
modelFollowersList: any[];
|
|
101
|
+
unreadMessages: number;
|
|
102
|
+
model: any;
|
|
103
|
+
modelId: any;
|
|
104
|
+
loadingInbox: boolean;
|
|
105
|
+
moreLoadingInbox: boolean;
|
|
106
|
+
isInboxListEnd: boolean;
|
|
107
|
+
inboxList: any[];
|
|
108
|
+
inboxFolder: InboxFolder;
|
|
109
|
+
linkFiles: any[];
|
|
110
|
+
}>>;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
19
|
+
import { generateInifiniteScrollCases, handlerApiCall, } from '@axelor/aos-mobile-core';
|
|
20
|
+
import { countUnreadMessages, fetchInboxMessages as _fetchInboxMessages, fetchMailMessages, fetchModelSubscribers, modifyMailMessagesFlags as _modifyMailMessagesFlags, postMailMessageComment, readAllMailMessages, subscribeRequest, unsubscribeRequest, } from '../api/mail-message-api';
|
|
21
|
+
import { InboxFolder } from '../types';
|
|
22
|
+
export const getMailMessages = createAsyncThunk('mailMessages/getMailMessages', async function (data, { getState }) {
|
|
23
|
+
return handlerApiCall({
|
|
24
|
+
fetchFunction: fetchMailMessages,
|
|
25
|
+
data: data,
|
|
26
|
+
action: 'Message_SliceAction_FetchMailMessages',
|
|
27
|
+
getState: getState,
|
|
28
|
+
responseOptions: { isArrayResponse: true },
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
export const sendMailMessageComment = createAsyncThunk('mailMessages/sendMailMessageComment', async function (data, { getState, dispatch }) {
|
|
32
|
+
const fetchMailMessageData = { model: data?.model, modelId: data?.modelId };
|
|
33
|
+
return handlerApiCall({
|
|
34
|
+
fetchFunction: postMailMessageComment,
|
|
35
|
+
data: data,
|
|
36
|
+
action: 'Message_SliceAction_PostMailMessageComment',
|
|
37
|
+
getState: getState,
|
|
38
|
+
responseOptions: { isArrayResponse: false },
|
|
39
|
+
}).then(res => {
|
|
40
|
+
dispatch(getMailMessages({ ...fetchMailMessageData, page: 0 }));
|
|
41
|
+
return res;
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
export const getModelSubscribers = createAsyncThunk('mailMessages/getModelSubscribers', async function (data, { getState }) {
|
|
45
|
+
return handlerApiCall({
|
|
46
|
+
fetchFunction: fetchModelSubscribers,
|
|
47
|
+
data: data,
|
|
48
|
+
action: 'Message_SliceAction_FetchModelSubscribers',
|
|
49
|
+
getState: getState,
|
|
50
|
+
responseOptions: { isArrayResponse: true },
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
export const subscribeModel = createAsyncThunk('mailMessages/subscribeModel', async function (data, { getState, dispatch }) {
|
|
54
|
+
return handlerApiCall({
|
|
55
|
+
fetchFunction: subscribeRequest,
|
|
56
|
+
data: data,
|
|
57
|
+
action: 'Message_SliceAction_SubscribeToModel',
|
|
58
|
+
getState: getState,
|
|
59
|
+
responseOptions: { isArrayResponse: false },
|
|
60
|
+
}).then(() => {
|
|
61
|
+
dispatch(getModelSubscribers(data));
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
export const unsubscribeModel = createAsyncThunk('mailMessages/unsubscribeModel', async function (data, { getState, dispatch }) {
|
|
65
|
+
return handlerApiCall({
|
|
66
|
+
fetchFunction: unsubscribeRequest,
|
|
67
|
+
data: data,
|
|
68
|
+
action: 'Message_SliceAction_UnsubscribeFromModel',
|
|
69
|
+
getState: getState,
|
|
70
|
+
responseOptions: { isArrayResponse: false },
|
|
71
|
+
}).then(() => {
|
|
72
|
+
dispatch(getModelSubscribers(data));
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
export const countUnreadMailMessages = createAsyncThunk('mailMessages/countUnreadMailMessages', async function (data, { getState }) {
|
|
76
|
+
return handlerApiCall({
|
|
77
|
+
fetchFunction: countUnreadMessages,
|
|
78
|
+
data: data,
|
|
79
|
+
action: 'Message_SliceAction_CountUnreadMailMessages',
|
|
80
|
+
getState: getState,
|
|
81
|
+
responseOptions: { isArrayResponse: true, returnTotal: true },
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
export const markAllMailMessageAsRead = createAsyncThunk('mailMessages/markAllMailMessageAsRead', async function (data, { getState, dispatch }) {
|
|
85
|
+
const fetchMailMessageData = { model: data?.model, modelId: data?.modelId };
|
|
86
|
+
return handlerApiCall({
|
|
87
|
+
fetchFunction: readAllMailMessages,
|
|
88
|
+
data: data,
|
|
89
|
+
action: 'Message_SliceAction_MarkAllMailMessageAsRead',
|
|
90
|
+
getState: getState,
|
|
91
|
+
responseOptions: { returnTotal: true },
|
|
92
|
+
}).then(() => {
|
|
93
|
+
dispatch(getMailMessages({ ...fetchMailMessageData, page: 0 }));
|
|
94
|
+
dispatch(countUnreadMailMessages(fetchMailMessageData));
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
export const modifyMailMessagesFlags = createAsyncThunk('mailMessages/modifyMailMessagesFlags', async function (data, { getState, dispatch }) {
|
|
98
|
+
const fetchMailMessageData = { model: data?.model, modelId: data?.modelId };
|
|
99
|
+
return handlerApiCall({
|
|
100
|
+
fetchFunction: _modifyMailMessagesFlags,
|
|
101
|
+
data,
|
|
102
|
+
action: 'Message_SliceAction_ModifyMailMessagesFlags',
|
|
103
|
+
getState,
|
|
104
|
+
responseOptions: { isArrayResponse: false },
|
|
105
|
+
}).then(() => {
|
|
106
|
+
if (data?.isInbox) {
|
|
107
|
+
dispatch(fetchInboxMessages({ folder: data?.inboxFolder, page: 0 }));
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
dispatch(getMailMessages({ ...fetchMailMessageData, page: 0 }));
|
|
111
|
+
dispatch(countUnreadMailMessages(fetchMailMessageData));
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
export const fetchInboxMessages = createAsyncThunk('mailMessages/fetchInboxMessages', async function (data, { getState }) {
|
|
116
|
+
return handlerApiCall({
|
|
117
|
+
fetchFunction: _fetchInboxMessages,
|
|
118
|
+
data,
|
|
119
|
+
action: 'Message_SliceAction_FetchInboxMessages',
|
|
120
|
+
getState,
|
|
121
|
+
responseOptions: { isArrayResponse: true },
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
const initialState = {
|
|
125
|
+
loading: false,
|
|
126
|
+
moreLoading: false,
|
|
127
|
+
isListEnd: false,
|
|
128
|
+
mailMessagesList: [],
|
|
129
|
+
modelFollowersList: [],
|
|
130
|
+
unreadMessages: 0,
|
|
131
|
+
model: null,
|
|
132
|
+
modelId: null,
|
|
133
|
+
loadingInbox: false,
|
|
134
|
+
moreLoadingInbox: false,
|
|
135
|
+
isInboxListEnd: false,
|
|
136
|
+
inboxList: [],
|
|
137
|
+
inboxFolder: InboxFolder.Inbox,
|
|
138
|
+
linkFiles: [],
|
|
139
|
+
};
|
|
140
|
+
const mailMessagesSlice = createSlice({
|
|
141
|
+
name: 'mailMessages',
|
|
142
|
+
initialState,
|
|
143
|
+
reducers: {
|
|
144
|
+
registerModel: (state, action) => {
|
|
145
|
+
state.model = action.payload;
|
|
146
|
+
},
|
|
147
|
+
registerModelId: (state, action) => {
|
|
148
|
+
state.modelId = action.payload;
|
|
149
|
+
},
|
|
150
|
+
saveInboxFolder: (state, action) => {
|
|
151
|
+
state.inboxFolder = action.payload;
|
|
152
|
+
},
|
|
153
|
+
saveLinkFiles: (state, action) => {
|
|
154
|
+
state.linkFiles = action.payload;
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
extraReducers: builder => {
|
|
158
|
+
generateInifiniteScrollCases(builder, getMailMessages, {
|
|
159
|
+
loading: 'loading',
|
|
160
|
+
moreLoading: 'moreLoading',
|
|
161
|
+
isListEnd: 'isListEnd',
|
|
162
|
+
list: 'mailMessagesList',
|
|
163
|
+
});
|
|
164
|
+
generateInifiniteScrollCases(builder, fetchInboxMessages, {
|
|
165
|
+
loading: 'loadingInbox',
|
|
166
|
+
moreLoading: 'moreLoadingInbox',
|
|
167
|
+
isListEnd: 'isInboxListEnd',
|
|
168
|
+
list: 'inboxList',
|
|
169
|
+
});
|
|
170
|
+
builder.addCase(getModelSubscribers.fulfilled, (state, action) => {
|
|
171
|
+
state.modelFollowersList = action.payload ?? [];
|
|
172
|
+
});
|
|
173
|
+
builder.addCase(countUnreadMailMessages.fulfilled, (state, action) => {
|
|
174
|
+
state.unreadMessages = action.payload;
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
export const { registerModel, registerModelId, saveInboxFolder, saveLinkFiles } = mailMessagesSlice.actions;
|
|
179
|
+
export const mailMessagesReducer = mailMessagesSlice.reducer;
|
|
180
|
+
//# sourceMappingURL=mailMessageSlice.js.map
|