@messenger-box/platform-mobile 0.0.1-alpha.326 → 0.0.1-alpha.335

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.0.1-alpha.335](https://github.com/CDEBase/messenger-box/compare/v0.0.1-alpha.334...v0.0.1-alpha.335) (2023-04-18)
7
+
8
+ **Note:** Version bump only for package @messenger-box/platform-mobile
9
+
10
+ ## [0.0.1-alpha.329](https://github.com/CDEBase/messenger-box/compare/v0.0.1-alpha.328...v0.0.1-alpha.329) (2023-04-15)
11
+
12
+ **Note:** Version bump only for package @messenger-box/platform-mobile
13
+
6
14
  ## [0.0.1-alpha.326](https://github.com/CDEBase/messenger-box/compare/v0.0.1-alpha.325...v0.0.1-alpha.326) (2023-04-11)
7
15
 
8
16
  **Note:** Version bump only for package @messenger-box/platform-mobile
package/lib/index.js CHANGED
@@ -90,6 +90,8 @@ exports.inboxFeature = void 0;
90
90
  const React = __importStar(__webpack_require__(/*! react */ "react"));
91
91
  const client_react_1 = __webpack_require__(/*! @common-stack/client-react */ "@common-stack/client-react");
92
92
  const DialogMessages_1 = __webpack_require__(/*! ../screens/inbox/DialogMessages */ "./src/screens/inbox/DialogMessages.tsx");
93
+ const native_base_1 = __webpack_require__(/*! native-base */ "native-base");
94
+ const vector_icons_1 = __webpack_require__(/*! @expo/vector-icons */ "@expo/vector-icons");
93
95
  const inboxConfig = {
94
96
  ['//message']: {
95
97
  exact: true,
@@ -97,12 +99,15 @@ const inboxConfig = {
97
99
  props: {
98
100
  initialParams: { channelId: null },
99
101
  component: (props) => { var _a, _b; return React.createElement(DialogMessages_1.DialogMessages, Object.assign({}, props, { channelId: (_b = (_a = props === null || props === void 0 ? void 0 : props.route) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.channelId })); },
100
- options: {
101
- headerShown: true,
102
- title: 'Inbox',
103
- headerBackTitleVisible: false,
104
- gestureEnabled: false,
105
- swipeEnabled: false,
102
+ options: ({ navigation }) => {
103
+ return {
104
+ headerShown: true,
105
+ title: 'Inbox',
106
+ headerBackTitleVisible: false,
107
+ gestureEnabled: false,
108
+ swipeEnabled: false,
109
+ headerLeft: (props) => (React.createElement(native_base_1.IconButton, { onPress: () => navigation.goBack(), icon: React.createElement(native_base_1.Icon, { size: 'lg', as: vector_icons_1.MaterialIcons, name: "arrow-back-ios", color: 'black' }) })),
110
+ };
106
111
  },
107
112
  },
108
113
  },
@@ -261,7 +266,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
261
266
  return result;
262
267
  };
263
268
  Object.defineProperty(exports, "__esModule", ({ value: true }));
264
- exports.DialogsListItem = void 0;
269
+ exports.DialogsListItem = exports.DialogsListItemComponent = void 0;
265
270
  const react_1 = __importStar(__webpack_require__(/*! react */ "react"));
266
271
  const native_base_1 = __webpack_require__(/*! native-base */ "native-base");
267
272
  const date_fns_1 = __webpack_require__(/*! date-fns */ "date-fns");
@@ -283,7 +288,7 @@ const createdAtText = (value) => {
283
288
  * - Get Reservation info: reservation date, status
284
289
  * - Add ability to get property information: name, logo
285
290
  */
286
- const DialogsListItem = function DialogsListItem({ currentUser,
291
+ const DialogsListItemComponent = function DialogsListItem({ currentUser,
287
292
  // users,
288
293
  selectedChannelId, channel, onOpen, }) {
289
294
  var _a, _b, _c;
@@ -357,7 +362,8 @@ selectedChannelId, channel, onOpen, }) {
357
362
  react_1.default.createElement(native_base_1.Box, { flex: 0.2 },
358
363
  react_1.default.createElement(native_base_1.Text, { color: "gray.500" }, lastMessage ? createdAtText(lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.createdAt) : '')))))));
359
364
  };
360
- exports.DialogsListItem = DialogsListItem;
365
+ exports.DialogsListItemComponent = DialogsListItemComponent;
366
+ exports.DialogsListItem = react_1.default.memo(exports.DialogsListItemComponent);
361
367
 
362
368
 
363
369
  /***/ }),
@@ -886,7 +892,7 @@ const config_1 = __webpack_require__(/*! ../config */ "./src/screens/inbox/confi
886
892
  const user_auth0_client_1 = __webpack_require__(/*! @adminide-stack/user-auth0-client */ "@adminide-stack/user-auth0-client");
887
893
  const SlackMessageContainer_1 = __webpack_require__(/*! ../components/SlackMessageContainer */ "./src/screens/inbox/components/SlackMessageContainer/index.ts");
888
894
  const { MESSAGES_PER_PAGE, CALL_TO_ACTION_BOX_BGCOLOR, CALL_TO_ACTION_PATH, CALL_TO_ACTION_BUTTON_BORDERCOLOR, CALL_TO_ACTION_TEXT_COLOR, } = config_1.config;
889
- function ConversationView({ channelId }) {
895
+ const ConversationViewComponent = ({ channelId }) => {
890
896
  var _a;
891
897
  const [channelToTop, setChannelToTop] = (0, react_1.useState)(0);
892
898
  const [channelMessages, setChannelMessages] = (0, react_1.useState)([]);
@@ -902,15 +908,11 @@ function ConversationView({ channelId }) {
902
908
  const [msg, setMsg] = (0, react_1.useState)('');
903
909
  const [loading, setLoading] = (0, react_1.useState)(false);
904
910
  const [imageLoading, setImageLoading] = (0, react_1.useState)(false);
905
- //const [expoTokens, setExpoTokens] = useState<any[]>([]);
911
+ const [expoTokens, setExpoTokens] = (0, react_1.useState)([]);
906
912
  const [isShowImageViewer, setImageViewer] = (0, react_1.useState)(false);
907
913
  const [imageObject, setImageObject] = (0, react_1.useState)({});
908
914
  const { startUpload } = (0, platform_client_1.useUploadFilesNative)();
909
915
  const [sendMsg] = (0, platform_client_1.useSendMessagesMutation)();
910
- react_1.default.useEffect(() => {
911
- if (selectedImage)
912
- setImageLoading(false);
913
- }, [selectedImage]);
914
916
  const { data, loading: messageLoading, refetch, } = (0, platform_client_1.useMessagesQuery)({
915
917
  variables: {
916
918
  channelId: channelId === null || channelId === void 0 ? void 0 : channelId.toString(),
@@ -924,20 +926,7 @@ function ConversationView({ channelId }) {
924
926
  id: channelId === null || channelId === void 0 ? void 0 : channelId.toString(),
925
927
  },
926
928
  });
927
- const expoTokens = (0, react_1.useMemo)(() => {
928
- var _a, _b, _c, _d, _e, _f, _g, _h;
929
- if (!((_b = (_a = channelsDetail === null || channelsDetail === void 0 ? void 0 : channelsDetail.viewChannelDetail) === null || _a === void 0 ? void 0 : _a.members) === null || _b === void 0 ? void 0 : _b.length)) {
930
- return [];
931
- }
932
- const channelData = (_e = (_d = (_c = channelsDetail === null || channelsDetail === void 0 ? void 0 : channelsDetail.viewChannelDetail) === null || _c === void 0 ? void 0 : _c.members) === null || _d === void 0 ? void 0 : _d.filter((mu) => { var _a; return ((_a = mu === null || mu === void 0 ? void 0 : mu.user) === null || _a === void 0 ? void 0 : _a.id) != (auth === null || auth === void 0 ? void 0 : auth.id); })) !== null && _e !== void 0 ? _e : [];
933
- const tokens = (_h = (_g = (_f = channelData === null || channelData === void 0 ? void 0 : channelData.map((u) => {
934
- var _a, _b, _c, _d;
935
- return (_d = (_c = (_b = (_a = u === null || u === void 0 ? void 0 : u.user) === null || _a === void 0 ? void 0 : _a.tokens) === null || _b === void 0 ? void 0 : _b.filter((t) => (t === null || t === void 0 ? void 0 : t.type) == 'EXPO_NOTIFICATION_TOKEN')) === null || _c === void 0 ? void 0 : _c.map((et) => et === null || et === void 0 ? void 0 : et.token)) !== null && _d !== void 0 ? _d : [];
936
- })) === null || _f === void 0 ? void 0 : _f.flat(1)) === null || _g === void 0 ? void 0 : _g.filter((t) => t)) !== null && _h !== void 0 ? _h : [];
937
- return tokens;
938
- }, [channelsDetail === null || channelsDetail === void 0 ? void 0 : channelsDetail.viewChannelDetail]);
939
- const { data: users } = (0, platform_client_1.useGetAllUsersQuery)();
940
- const currentUser = (0, react_1.useMemo)(() => { var _a; return (_a = users === null || users === void 0 ? void 0 : users.getUsers) === null || _a === void 0 ? void 0 : _a.find(({ alias }) => alias === null || alias === void 0 ? void 0 : alias.includes(auth === null || auth === void 0 ? void 0 : auth.auth0UserId)); }, [users, auth]);
929
+ // const { data: users } = useGetAllUsersQuery();
941
930
  const { data: checkForMessages } = (0, platform_client_1.useCheckForNewMessagesQuery)({
942
931
  variables: {
943
932
  channelId: channelId === null || channelId === void 0 ? void 0 : channelId.toString(),
@@ -946,21 +935,99 @@ function ConversationView({ channelId }) {
946
935
  fetchPolicy: 'network-only',
947
936
  pollInterval: 5000,
948
937
  });
938
+ (0, native_1.useFocusEffect)(react_1.default.useCallback(() => {
939
+ // Do something when the screen is focused
940
+ refetchChannelDetail({ id: channelId === null || channelId === void 0 ? void 0 : channelId.toString() });
941
+ refetch({
942
+ channelId: channelId === null || channelId === void 0 ? void 0 : channelId.toString(),
943
+ limit: MESSAGES_PER_PAGE,
944
+ }).then(({ data }) => {
945
+ if (!(data === null || data === void 0 ? void 0 : data.messages)) {
946
+ return;
947
+ }
948
+ const { data: messages, totalCount } = data.messages;
949
+ setTotalCount(totalCount);
950
+ setChannelMessages((oldMessages) => (0, lodash_1.uniqBy)([...oldMessages, ...messages], ({ id }) => id));
951
+ });
952
+ return () => {
953
+ // Do something when the screen is unfocused
954
+ // Useful for cleanup functions
955
+ setTotalCount(0);
956
+ setChannelMessages([]);
957
+ };
958
+ }, []));
959
+ react_1.default.useEffect(() => {
960
+ var _a, _b, _c, _d, _e, _f, _g, _h;
961
+ if ((_b = (_a = channelsDetail === null || channelsDetail === void 0 ? void 0 : channelsDetail.viewChannelDetail) === null || _a === void 0 ? void 0 : _a.members) === null || _b === void 0 ? void 0 : _b.length) {
962
+ const channelData = (_e = (_d = (_c = channelsDetail === null || channelsDetail === void 0 ? void 0 : channelsDetail.viewChannelDetail) === null || _c === void 0 ? void 0 : _c.members) === null || _d === void 0 ? void 0 : _d.filter((mu) => { var _a; return ((_a = mu === null || mu === void 0 ? void 0 : mu.user) === null || _a === void 0 ? void 0 : _a.id) != (auth === null || auth === void 0 ? void 0 : auth.id); })) !== null && _e !== void 0 ? _e : [];
963
+ const tokens = (_h = (_g = (_f = channelData === null || channelData === void 0 ? void 0 : channelData.map((u) => {
964
+ var _a, _b, _c, _d;
965
+ return (_d = (_c = (_b = (_a = u === null || u === void 0 ? void 0 : u.user) === null || _a === void 0 ? void 0 : _a.tokens) === null || _b === void 0 ? void 0 : _b.filter((t) => (t === null || t === void 0 ? void 0 : t.type) == 'EXPO_NOTIFICATION_TOKEN')) === null || _c === void 0 ? void 0 : _c.map((et) => et === null || et === void 0 ? void 0 : et.token)) !== null && _d !== void 0 ? _d : [];
966
+ })) === null || _f === void 0 ? void 0 : _f.flat(1)) === null || _g === void 0 ? void 0 : _g.filter((t) => t)) !== null && _h !== void 0 ? _h : [];
967
+ if ((tokens === null || tokens === void 0 ? void 0 : tokens.length) > 0)
968
+ setExpoTokens(tokens);
969
+ }
970
+ }, [channelsDetail]);
971
+ react_1.default.useEffect(() => {
972
+ if (selectedImage)
973
+ setImageLoading(false);
974
+ }, [selectedImage]);
975
+ // const currentUser = useMemo(
976
+ // () => users?.getUsers?.find(({ alias }: any) => alias?.includes(auth?.auth0UserId)),
977
+ // [users, auth],
978
+ // );
979
+ // useEffect(() => {
980
+ // if (data?.messages?.data && (loadingOldMessages || channelMessages.length === 0)) {
981
+ // const { data: messages, totalCount: messeageTotalCount } = data.messages;
982
+ // if (messages && messages.length > 0) {
983
+ // setChannelMessages((oldMessages: any) => uniqBy([...messages, ...oldMessages], ({ id }) => id));
984
+ // }
985
+ // if (totalCount !== messeageTotalCount) setTotalCount(messeageTotalCount);
986
+ // }
987
+ // }, [data, loadingOldMessages, channelMessages]);
949
988
  (0, react_1.useEffect)(() => {
950
989
  var _a;
951
- if (((_a = data === null || data === void 0 ? void 0 : data.messages) === null || _a === void 0 ? void 0 : _a.data) && (loadingOldMessages || channelMessages.length === 0)) {
990
+ if ((_a = data === null || data === void 0 ? void 0 : data.messages) === null || _a === void 0 ? void 0 : _a.data) {
952
991
  const { data: messages, totalCount: messeageTotalCount } = data.messages;
953
- if (messages && messages.length > 0 && totalCount !== messeageTotalCount) {
992
+ if (messages && messages.length > 0) {
954
993
  setChannelMessages((oldMessages) => (0, lodash_1.uniqBy)([...messages, ...oldMessages], ({ id }) => id));
994
+ setLoadingOldMessages(false);
955
995
  }
956
996
  if (totalCount !== messeageTotalCount)
957
997
  setTotalCount(messeageTotalCount);
958
998
  }
959
- }, [data, loadingOldMessages, channelMessages]);
999
+ }, [data]);
1000
+ // useEffect(() => {
1001
+ // if (data?.messages?.data) {
1002
+ // const { data: messages, totalCount: messeageTotalCount } = data.messages;
1003
+ // console.log('messeageTotalCount',messeageTotalCount)
1004
+ // console.log('totalCount',totalCount)
1005
+ // if (messages && messages.length > 0) {
1006
+ // setChannelMessages((oldMessages: any) => uniqBy([...messages, ...oldMessages], ({ id }) => id));
1007
+ // }
1008
+ // if (totalCount !== messeageTotalCount) setTotalCount(messeageTotalCount);
1009
+ // }
1010
+ // }, [data]);
1011
+ // useEffect(() => {
1012
+ // if (checkForMessages?.messages?.totalCount > totalCount) {
1013
+ // const numberOfNewMessages = checkForMessages?.messages?.totalCount - totalCount;
1014
+ // refetch({
1015
+ // limit: numberOfNewMessages,
1016
+ // }).then(({ data }) => {
1017
+ // if (!data?.messages) {
1018
+ // return;
1019
+ // }
1020
+ // const { data: messages, totalCount }:any = data.messages;
1021
+ // setTotalCount(totalCount);
1022
+ // setChannelMessages((oldMessages:any) => uniqBy([...oldMessages, ...messages], ({ id }) => id));
1023
+ // });
1024
+ // }
1025
+ // }, [checkForMessages, totalCount]);
960
1026
  (0, react_1.useEffect)(() => {
961
1027
  var _a, _b;
962
1028
  if (((_a = checkForMessages === null || checkForMessages === void 0 ? void 0 : checkForMessages.messages) === null || _a === void 0 ? void 0 : _a.totalCount) > totalCount) {
963
1029
  const numberOfNewMessages = ((_b = checkForMessages === null || checkForMessages === void 0 ? void 0 : checkForMessages.messages) === null || _b === void 0 ? void 0 : _b.totalCount) - totalCount;
1030
+ console.log('new msg check');
964
1031
  refetch({
965
1032
  limit: numberOfNewMessages,
966
1033
  }).then(({ data }) => {
@@ -972,17 +1039,46 @@ function ConversationView({ channelId }) {
972
1039
  setChannelMessages((oldMessages) => (0, lodash_1.uniqBy)([...oldMessages, ...messages], ({ id }) => id));
973
1040
  });
974
1041
  }
975
- }, [checkForMessages, totalCount, refetch]);
1042
+ }, [checkForMessages, totalCount]);
1043
+ // const onFetchOld = useCallback(() => {
1044
+ // // if (data?.messages?.totalCount > channelMessages.length) {
1045
+ // //if(channelMessages.length !== data?.messages?.totalCount){
1046
+ // if(totalCount > channelMessages.length){
1047
+ // setLoadingOldMessages(true);
1048
+ // refetch({ skip: channelMessages.length });
1049
+ // }
1050
+ // }, [data, channelMessages]);
1051
+ // const onFetchOld = () => {
1052
+ // // if (data?.messages?.totalCount > channelMessages.length) {
1053
+ // //if(channelMessages.length !== data?.messages?.totalCount){
1054
+ // if(totalCount > channelMessages.length){
1055
+ // setLoadingOldMessages(true);
1056
+ // refetch({ skip: channelMessages.length });
1057
+ // }
1058
+ // };
976
1059
  const onFetchOld = (0, react_1.useCallback)(() => {
977
1060
  var _a;
978
- // if (data?.messages?.totalCount > channelMessages.length) {
979
- if (channelMessages.length !== ((_a = data === null || data === void 0 ? void 0 : data.messages) === null || _a === void 0 ? void 0 : _a.totalCount)) {
1061
+ if (((_a = data === null || data === void 0 ? void 0 : data.messages) === null || _a === void 0 ? void 0 : _a.totalCount) > channelMessages.length) {
980
1062
  setLoadingOldMessages(true);
981
1063
  refetch({ skip: channelMessages.length });
982
1064
  }
983
1065
  }, [data, channelMessages]);
1066
+ // const onFetchOld = () => {
1067
+ // if(totalCount > channelMessages.length){
1068
+ // console.log('totalCount',totalCount)
1069
+ // console.log('channelMessages.length',channelMessages.length)
1070
+ // setLoadingOldMessages(true);
1071
+ // refetch({
1072
+ // skip: channelMessages.length
1073
+ // });
1074
+ // }
1075
+ // };
1076
+ // const isCloseToTop = ({ layoutMeasurement, contentOffset, contentSize }) => {
1077
+ // return contentOffset.y <= 100; // 100px from top
1078
+ // };
984
1079
  const isCloseToTop = ({ layoutMeasurement, contentOffset, contentSize }) => {
985
- return contentOffset.y <= 100; // 100px from top
1080
+ const paddingToTop = 60;
1081
+ return contentSize.height - layoutMeasurement.height - paddingToTop <= contentOffset.y;
986
1082
  };
987
1083
  const dataURLtoFile = (dataurl, filename) => {
988
1084
  var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], bstr = (0, base_64_1.encode)(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
@@ -1027,10 +1123,86 @@ function ConversationView({ channelId }) {
1027
1123
  }),
1028
1124
  });
1029
1125
  };
1030
- const handleSend = (0, react_1.useCallback)(async (message) => {
1031
- // if (!(message && channelId)) {
1032
- // return;
1033
- // }
1126
+ // const handleSend = useCallback(
1127
+ // async (message: string) => {
1128
+ // // if (!(message && channelId)) {
1129
+ // // return;
1130
+ // // }
1131
+ // if (!channelId) return;
1132
+ // if (!message && message != ' ' && images.length == 0) return;
1133
+ // setLoading(true);
1134
+ // const { data } = await sendMsg({
1135
+ // variables: {
1136
+ // channelId,
1137
+ // content: message,
1138
+ // },
1139
+ // update: (cache, { data, errors }) => {
1140
+ // if (!data || errors) {
1141
+ // setLoading(false);
1142
+ // return;
1143
+ // }
1144
+ // setChannelMessages((messages) => [...messages, data?.sendMessage]);
1145
+ // setTotalCount((t) => t + 1);
1146
+ // setChannelToTop(channelToTop + 1);
1147
+ // setLoading(false);
1148
+ // const title: String = currentUser?.givenName+' '+currentUser?.familyName+' in Followup Chat';
1149
+ // const body: String = message;
1150
+ // const notificationData: any = {
1151
+ // url: config.INBOX_MESSEGE_PATH,
1152
+ // params: { channelId, hideTabBar: true },
1153
+ // screen: 'DialogMessages',
1154
+ // };
1155
+ // console.log('expo to',JSON.stringify(expoTokens));
1156
+ // if (expoTokens?.length > 0) {
1157
+ // const to: any = expoTokens?.length > 0 ? expoTokens : [];
1158
+ // sendPushNotification(title, body, notificationData, to);
1159
+ // }
1160
+ // setMsg('');
1161
+ // },
1162
+ // });
1163
+ // if (images && images.length > 0 && data?.sendMessage?.id) {
1164
+ // const { id: postId } = data.sendMessage;
1165
+ // setLoading(true);
1166
+ // const uploadResponse = await startUpload({
1167
+ // file: images,
1168
+ // saveUploadedFile: {
1169
+ // variables: {
1170
+ // postId,
1171
+ // },
1172
+ // },
1173
+ // createUploadLink: {
1174
+ // variables: {
1175
+ // postId,
1176
+ // },
1177
+ // },
1178
+ // });
1179
+ // if (uploadResponse?.error) setLoading(false);
1180
+ // const uploadedFiles = uploadResponse.data as unknown as IFileInfo[];
1181
+ // if (uploadResponse.data) {
1182
+ // setImage('');
1183
+ // setFiles([]);
1184
+ // setImages([]);
1185
+ // setLoading(false);
1186
+ // }
1187
+ // setChannelMessages((messages) =>
1188
+ // messages.map((message) => {
1189
+ // if (message.id === postId) {
1190
+ // return {
1191
+ // ...message,
1192
+ // files: {
1193
+ // totalCount: uploadedFiles.length,
1194
+ // data: uploadedFiles,
1195
+ // },
1196
+ // };
1197
+ // }
1198
+ // return message;
1199
+ // }),
1200
+ // );
1201
+ // }
1202
+ // },
1203
+ // [setChannelMessages, currentUser, channelId, images,expoTokens],
1204
+ // );
1205
+ const handleSend = async (message) => {
1034
1206
  var _a;
1035
1207
  if (!channelId)
1036
1208
  return;
@@ -1043,6 +1215,7 @@ function ConversationView({ channelId }) {
1043
1215
  content: message,
1044
1216
  },
1045
1217
  update: (cache, { data, errors }) => {
1218
+ var _a, _b;
1046
1219
  if (!data || errors) {
1047
1220
  setLoading(false);
1048
1221
  return;
@@ -1051,7 +1224,11 @@ function ConversationView({ channelId }) {
1051
1224
  setTotalCount((t) => t + 1);
1052
1225
  setChannelToTop(channelToTop + 1);
1053
1226
  setLoading(false);
1054
- const title = (currentUser === null || currentUser === void 0 ? void 0 : currentUser.givenName) + ' ' + (currentUser === null || currentUser === void 0 ? void 0 : currentUser.familyName) + ' in Followup Chat';
1227
+ setMsg('');
1228
+ const givenName = (_a = auth === null || auth === void 0 ? void 0 : auth.givenName) !== null && _a !== void 0 ? _a : '';
1229
+ const familyName = (_b = auth === null || auth === void 0 ? void 0 : auth.familyName) !== null && _b !== void 0 ? _b : '';
1230
+ const fullName = givenName ? givenName + ' ' + familyName : '';
1231
+ const title = fullName ? fullName + ' in Followup Chat' : 'Followup Chat';
1055
1232
  const body = message;
1056
1233
  const notificationData = {
1057
1234
  url: config_1.config.INBOX_MESSEGE_PATH,
@@ -1063,7 +1240,6 @@ function ConversationView({ channelId }) {
1063
1240
  const to = (expoTokens === null || expoTokens === void 0 ? void 0 : expoTokens.length) > 0 ? expoTokens : [];
1064
1241
  sendPushNotification(title, body, notificationData, to);
1065
1242
  }
1066
- setMsg('');
1067
1243
  },
1068
1244
  });
1069
1245
  if (images && images.length > 0 && ((_a = data === null || data === void 0 ? void 0 : data.sendMessage) === null || _a === void 0 ? void 0 : _a.id)) {
@@ -1101,7 +1277,7 @@ function ConversationView({ channelId }) {
1101
1277
  return message;
1102
1278
  }));
1103
1279
  }
1104
- }, [setChannelMessages, currentUser, channelId, images]);
1280
+ };
1105
1281
  const messageList = (0, react_1.useMemo)(() => {
1106
1282
  let currentDate = '';
1107
1283
  let res = [];
@@ -1205,16 +1381,28 @@ function ConversationView({ channelId }) {
1205
1381
  // return <SlackMessage {...props} messageTextStyle={messageTextStyle} />;
1206
1382
  return react_1.default.createElement(SlackMessageContainer_1.SlackMessage, Object.assign({}, props, { isShowImageViewer: isShowImageViewer, setImageViewer: setImageViewerObject }));
1207
1383
  };
1208
- return (react_1.default.createElement(react_native_gifted_chat_1.GiftedChat, { wrapInSafeArea: false, renderLoading: () => react_1.default.createElement(native_base_1.Spinner, null), messages: messageList, onSend: (messages) => {
1384
+ return (react_1.default.createElement(react_native_gifted_chat_1.GiftedChat, { wrapInSafeArea: false, renderLoading: () => react_1.default.createElement(native_base_1.Spinner, null), messages: messageList,
1385
+ // listViewProps={{
1386
+ // scrollEventThrottle: 400,
1387
+ // onScroll: ({ nativeEvent }) => { console.log('scroll')
1388
+ // if (!loadingOldMessages && isCloseToTop(nativeEvent)) {
1389
+ // onFetchOld();
1390
+ // }
1391
+ // }
1392
+ // }}
1393
+ onSend: async (messages) => {
1209
1394
  var _a, _b;
1210
- handleSend((_b = (_a = messages[0]) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : ' ');
1395
+ await handleSend((_b = (_a = messages[0]) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : ' ');
1211
1396
  }, text: msg ? msg : ' ', onInputTextChanged: (text) => setMsg(text), renderFooter: () => (loading ? react_1.default.createElement(native_base_1.Spinner, null) : imageLoading ? react_1.default.createElement(native_base_1.Spinner, null) : ''), scrollToBottom: true, user: {
1212
- _id: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.id) || '',
1213
- }, isTyping: true, alwaysShowSend: loading ? false : true, onLoadEarlier: onFetchOld, infiniteScroll: true, renderSend: renderSend,
1397
+ // _id: currentUser?.id || '',
1398
+ _id: (auth === null || auth === void 0 ? void 0 : auth.id) || '',
1399
+ }, isTyping: true, alwaysShowSend: loading ? false : true, onLoadEarlier: () => onFetchOld(), infiniteScroll: true, renderSend: renderSend,
1214
1400
  // loadEarlier={checkForMessages?.messages?.totalCount > totalCount}
1215
- loadEarlier: channelMessages.length !== ((_a = data === null || data === void 0 ? void 0 : data.messages) === null || _a === void 0 ? void 0 : _a.totalCount), renderMessageText: renderMessageText, minInputToolbarHeight: 50, renderActions: renderActions, renderAccessory: renderAccessory, renderMessage: renderMessage, renderChatFooter: () => (react_1.default.createElement(SlackMessageContainer_1.ImageViewerModal, { isVisible: isShowImageViewer, setVisible: setImageViewer, modalContent: modalContent })), lightboxProps: { underlayColor: 'transparent', springConfig: { tension: 90000, friction: 90000 }, disabled: true } }));
1216
- }
1217
- exports.ConversationView = ConversationView;
1401
+ //loadEarlier={channelMessages.length !== data?.messages?.totalCount}
1402
+ // loadEarlier={totalCount > channelMessages.length}
1403
+ loadEarlier: ((_a = data === null || data === void 0 ? void 0 : data.messages) === null || _a === void 0 ? void 0 : _a.totalCount) > channelMessages.length, renderMessageText: (props) => renderMessageText(props), minInputToolbarHeight: 50, renderActions: renderActions, renderAccessory: renderAccessory, renderMessage: (props) => renderMessage(props), renderChatFooter: () => (react_1.default.createElement(SlackMessageContainer_1.ImageViewerModal, { isVisible: isShowImageViewer, setVisible: setImageViewer, modalContent: modalContent })), lightboxProps: { underlayColor: 'transparent', springConfig: { tension: 90000, friction: 90000 }, disabled: true } }));
1404
+ };
1405
+ exports.ConversationView = react_1.default.memo(ConversationViewComponent);
1218
1406
 
1219
1407
 
1220
1408
  /***/ }),
@@ -1261,7 +1449,7 @@ const platform_client_1 = __webpack_require__(/*! @messenger-box/platform-client
1261
1449
  const user_auth0_client_1 = __webpack_require__(/*! @adminide-stack/user-auth0-client */ "@adminide-stack/user-auth0-client");
1262
1450
  const client_1 = __webpack_require__(/*! @admin-layout/client */ "@admin-layout/client");
1263
1451
  const config_1 = __webpack_require__(/*! ../config */ "./src/screens/inbox/config/index.ts");
1264
- const Dialogs = (props) => {
1452
+ const DialogsComponent = (props) => {
1265
1453
  const { channelFilters, channelRole } = props;
1266
1454
  const { params } = (0, native_1.useRoute)();
1267
1455
  const auth = (0, react_redux_1.useSelector)(user_auth0_client_1.userSelector);
@@ -1335,7 +1523,7 @@ const Dialogs = (props) => {
1335
1523
  react_1.default.createElement(native_base_1.Icon, { as: vector_icons_1.Ionicons, name: "chatbubbles", size: 'xl' }),
1336
1524
  react_1.default.createElement(native_base_1.Text, null, "You don't have any messages yet!")))), keyExtractor: (item, index) => 'key' + index })));
1337
1525
  };
1338
- exports.Dialogs = Dialogs;
1526
+ exports.Dialogs = react_1.default.memo(DialogsComponent);
1339
1527
 
1340
1528
 
1341
1529
  /***/ }),