[IMPROVE] Remove Omnichannel visitor's navigation history (#3534)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
1ea6fe1133
commit
b75e192e20
|
@ -328,7 +328,6 @@
|
||||||
"N_users": "{{n}} مستخدمين",
|
"N_users": "{{n}} مستخدمين",
|
||||||
"N_channels": "{{n}} القنوات",
|
"N_channels": "{{n}} القنوات",
|
||||||
"Name": "اسم",
|
"Name": "اسم",
|
||||||
"Navigation_history": "تاريخ التصفح",
|
|
||||||
"Never": "أبداً",
|
"Never": "أبداً",
|
||||||
"New_Message": "رسالة جديدة",
|
"New_Message": "رسالة جديدة",
|
||||||
"New_Password": "كلمة مرور جديدة",
|
"New_Password": "كلمة مرور جديدة",
|
||||||
|
|
|
@ -330,7 +330,6 @@
|
||||||
"N_users": "{{n}} Benutzer",
|
"N_users": "{{n}} Benutzer",
|
||||||
"N_channels": "{{n}} Kanäle",
|
"N_channels": "{{n}} Kanäle",
|
||||||
"Name": "Name",
|
"Name": "Name",
|
||||||
"Navigation_history": "Navigations-Verlauf",
|
|
||||||
"Never": "Niemals",
|
"Never": "Niemals",
|
||||||
"New_Message": "Neue Nachricht",
|
"New_Message": "Neue Nachricht",
|
||||||
"New_Password": "Neues Kennwort",
|
"New_Password": "Neues Kennwort",
|
||||||
|
|
|
@ -331,7 +331,6 @@
|
||||||
"N_users": "{{n}} users",
|
"N_users": "{{n}} users",
|
||||||
"N_channels": "{{n}} channels",
|
"N_channels": "{{n}} channels",
|
||||||
"Name": "Name",
|
"Name": "Name",
|
||||||
"Navigation_history": "Navigation history",
|
|
||||||
"Never": "Never",
|
"Never": "Never",
|
||||||
"New_Message": "New Message",
|
"New_Message": "New Message",
|
||||||
"New_Password": "New Password",
|
"New_Password": "New Password",
|
||||||
|
|
|
@ -330,7 +330,6 @@
|
||||||
"N_users": "{{n}} utilisateurs",
|
"N_users": "{{n}} utilisateurs",
|
||||||
"N_channels": "{{n}} canaux",
|
"N_channels": "{{n}} canaux",
|
||||||
"Name": "Nom",
|
"Name": "Nom",
|
||||||
"Navigation_history": "Historique de navigation",
|
|
||||||
"Never": "Jamais",
|
"Never": "Jamais",
|
||||||
"New_Message": "Nouveau message",
|
"New_Message": "Nouveau message",
|
||||||
"New_Password": "Nouveau mot de passe",
|
"New_Password": "Nouveau mot de passe",
|
||||||
|
|
|
@ -322,7 +322,6 @@
|
||||||
"N_people_reacted": "{{n}} persone hanno reagito",
|
"N_people_reacted": "{{n}} persone hanno reagito",
|
||||||
"N_users": "{{n}} utenti",
|
"N_users": "{{n}} utenti",
|
||||||
"Name": "Nome",
|
"Name": "Nome",
|
||||||
"Navigation_history": "Cronologia di navigazione",
|
|
||||||
"Never": "Mai",
|
"Never": "Mai",
|
||||||
"New_Message": "Nuovo messaggio",
|
"New_Message": "Nuovo messaggio",
|
||||||
"New_Password": "Nuova password",
|
"New_Password": "Nuova password",
|
||||||
|
|
|
@ -330,7 +330,6 @@
|
||||||
"N_users": "{{n}} gebruikers",
|
"N_users": "{{n}} gebruikers",
|
||||||
"N_channels": "{{n}} kanalen",
|
"N_channels": "{{n}} kanalen",
|
||||||
"Name": "Naam",
|
"Name": "Naam",
|
||||||
"Navigation_history": "Navigatie geschiedenis",
|
|
||||||
"Never": "Nooit",
|
"Never": "Nooit",
|
||||||
"New_Message": "Nieuw bericht",
|
"New_Message": "Nieuw bericht",
|
||||||
"New_Password": "Nieuw wachtwoord",
|
"New_Password": "Nieuw wachtwoord",
|
||||||
|
|
|
@ -309,7 +309,6 @@
|
||||||
"N_users": "{{n}} usuários",
|
"N_users": "{{n}} usuários",
|
||||||
"N_channels": "{{n}} canais",
|
"N_channels": "{{n}} canais",
|
||||||
"Name": "Nome",
|
"Name": "Nome",
|
||||||
"Navigation_history": "Histórico de navegação",
|
|
||||||
"Never": "Nunca",
|
"Never": "Nunca",
|
||||||
"New_Message": "Nova Mensagem",
|
"New_Message": "Nova Mensagem",
|
||||||
"New_Password": "Nova Senha",
|
"New_Password": "Nova Senha",
|
||||||
|
|
|
@ -329,7 +329,6 @@
|
||||||
"N_users": "{{n}} utilizadores",
|
"N_users": "{{n}} utilizadores",
|
||||||
"N_channels": "{{n}} canais",
|
"N_channels": "{{n}} canais",
|
||||||
"Name": "Nome",
|
"Name": "Nome",
|
||||||
"Navigation_history": "Histórico de navegação",
|
|
||||||
"Never": "Nunca",
|
"Never": "Nunca",
|
||||||
"New_Message": "Nova Mensagem",
|
"New_Message": "Nova Mensagem",
|
||||||
"New_Password": "Nova Palavra-passe",
|
"New_Password": "Nova Palavra-passe",
|
||||||
|
|
|
@ -330,7 +330,6 @@
|
||||||
"N_users": "{{n}} пользователи",
|
"N_users": "{{n}} пользователи",
|
||||||
"N_channels": "{{n}} каналов",
|
"N_channels": "{{n}} каналов",
|
||||||
"Name": "Имя",
|
"Name": "Имя",
|
||||||
"Navigation_history": "История навигации",
|
|
||||||
"Never": "Никогда",
|
"Never": "Никогда",
|
||||||
"New_Message": "Новое сообщение",
|
"New_Message": "Новое сообщение",
|
||||||
"New_Password": "Новый пароль",
|
"New_Password": "Новый пароль",
|
||||||
|
|
|
@ -323,7 +323,6 @@
|
||||||
"N_people_reacted": "{{n}} kişi tepki verdi",
|
"N_people_reacted": "{{n}} kişi tepki verdi",
|
||||||
"N_users": "{{n}} kullanıcı",
|
"N_users": "{{n}} kullanıcı",
|
||||||
"Name": "İsim",
|
"Name": "İsim",
|
||||||
"Navigation_history": "Gezinti geçmişi",
|
|
||||||
"Never": "Asla",
|
"Never": "Asla",
|
||||||
"New_Message": "Yeni İleti",
|
"New_Message": "Yeni İleti",
|
||||||
"New_Password": "Yeni Şifre",
|
"New_Password": "Yeni Şifre",
|
||||||
|
|
|
@ -320,7 +320,6 @@
|
||||||
"N_people_reacted": "{{n}} 人回复",
|
"N_people_reacted": "{{n}} 人回复",
|
||||||
"N_users": "{{n}} 位用户",
|
"N_users": "{{n}} 位用户",
|
||||||
"Name": "名称",
|
"Name": "名称",
|
||||||
"Navigation_history": "浏览历史记录",
|
|
||||||
"Never": "从不",
|
"Never": "从不",
|
||||||
"New_Message": "新信息",
|
"New_Message": "新信息",
|
||||||
"New_Password": "新密码",
|
"New_Password": "新密码",
|
||||||
|
|
|
@ -321,7 +321,6 @@
|
||||||
"N_people_reacted": "{{n}} 人回复",
|
"N_people_reacted": "{{n}} 人回复",
|
||||||
"N_users": "{{n}} 位使用者",
|
"N_users": "{{n}} 位使用者",
|
||||||
"Name": "名稱",
|
"Name": "名稱",
|
||||||
"Navigation_history": "瀏覽歷史記錄",
|
|
||||||
"Never": "從不",
|
"Never": "從不",
|
||||||
"New_Message": "新訊息",
|
"New_Message": "新訊息",
|
||||||
"New_Password": "新密碼",
|
"New_Password": "新密碼",
|
||||||
|
|
|
@ -1138,10 +1138,6 @@ const RocketChat = {
|
||||||
// RC 0.36.0
|
// RC 0.36.0
|
||||||
return this.methodCallWrapper('livechat:transfer', transferData);
|
return this.methodCallWrapper('livechat:transfer', transferData);
|
||||||
},
|
},
|
||||||
getPagesLivechat(rid, offset) {
|
|
||||||
// RC 2.3.0
|
|
||||||
return this.sdk.get(`livechat/visitors.pagesVisited/${rid}?count=50&offset=${offset}`);
|
|
||||||
},
|
|
||||||
getDepartmentInfo(departmentId) {
|
getDepartmentInfo(departmentId) {
|
||||||
// RC 2.2.0
|
// RC 2.2.0
|
||||||
return this.sdk.get(`livechat/department/${departmentId}?includeAgents=false`);
|
return this.sdk.get(`livechat/department/${departmentId}?includeAgents=false`);
|
||||||
|
|
|
@ -21,7 +21,6 @@ import MessagesView from '../views/MessagesView';
|
||||||
import AutoTranslateView from '../views/AutoTranslateView';
|
import AutoTranslateView from '../views/AutoTranslateView';
|
||||||
import DirectoryView from '../views/DirectoryView';
|
import DirectoryView from '../views/DirectoryView';
|
||||||
import NotificationPrefView from '../views/NotificationPreferencesView';
|
import NotificationPrefView from '../views/NotificationPreferencesView';
|
||||||
import VisitorNavigationView from '../views/VisitorNavigationView';
|
|
||||||
import ForwardLivechatView from '../views/ForwardLivechatView';
|
import ForwardLivechatView from '../views/ForwardLivechatView';
|
||||||
import LivechatEditView from '../views/LivechatEditView';
|
import LivechatEditView from '../views/LivechatEditView';
|
||||||
import PickerView from '../views/PickerView';
|
import PickerView from '../views/PickerView';
|
||||||
|
@ -114,11 +113,6 @@ const ChatsStackNavigator = () => {
|
||||||
component={NotificationPrefView}
|
component={NotificationPrefView}
|
||||||
options={NotificationPrefView.navigationOptions}
|
options={NotificationPrefView.navigationOptions}
|
||||||
/>
|
/>
|
||||||
<ChatsStack.Screen
|
|
||||||
name='VisitorNavigationView'
|
|
||||||
component={VisitorNavigationView}
|
|
||||||
options={VisitorNavigationView.navigationOptions}
|
|
||||||
/>
|
|
||||||
<ChatsStack.Screen
|
<ChatsStack.Screen
|
||||||
name='ForwardLivechatView'
|
name='ForwardLivechatView'
|
||||||
component={ForwardLivechatView}
|
component={ForwardLivechatView}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import MessagesView from '../../views/MessagesView';
|
||||||
import AutoTranslateView from '../../views/AutoTranslateView';
|
import AutoTranslateView from '../../views/AutoTranslateView';
|
||||||
import DirectoryView from '../../views/DirectoryView';
|
import DirectoryView from '../../views/DirectoryView';
|
||||||
import NotificationPrefView from '../../views/NotificationPreferencesView';
|
import NotificationPrefView from '../../views/NotificationPreferencesView';
|
||||||
import VisitorNavigationView from '../../views/VisitorNavigationView';
|
|
||||||
import ForwardLivechatView from '../../views/ForwardLivechatView';
|
import ForwardLivechatView from '../../views/ForwardLivechatView';
|
||||||
import CannedResponsesListView from '../../views/CannedResponsesListView';
|
import CannedResponsesListView from '../../views/CannedResponsesListView';
|
||||||
import CannedResponseDetail from '../../views/CannedResponseDetail';
|
import CannedResponseDetail from '../../views/CannedResponseDetail';
|
||||||
|
@ -158,11 +157,6 @@ const ModalStackNavigator = React.memo(({ navigation }: INavigation) => {
|
||||||
component={NotificationPrefView}
|
component={NotificationPrefView}
|
||||||
options={NotificationPrefView.navigationOptions}
|
options={NotificationPrefView.navigationOptions}
|
||||||
/>
|
/>
|
||||||
<ModalStack.Screen
|
|
||||||
name='VisitorNavigationView'
|
|
||||||
component={VisitorNavigationView}
|
|
||||||
options={VisitorNavigationView.navigationOptions}
|
|
||||||
/>
|
|
||||||
<ModalStack.Screen
|
<ModalStack.Screen
|
||||||
name='ForwardLivechatView'
|
name='ForwardLivechatView'
|
||||||
component={ForwardLivechatView}
|
component={ForwardLivechatView}
|
||||||
|
|
|
@ -97,9 +97,6 @@ export type ModalStackParamList = {
|
||||||
rid: string;
|
rid: string;
|
||||||
room: IRoom;
|
room: IRoom;
|
||||||
};
|
};
|
||||||
VisitorNavigationView: {
|
|
||||||
rid: string;
|
|
||||||
};
|
|
||||||
ForwardLivechatView: {
|
ForwardLivechatView: {
|
||||||
rid: string;
|
rid: string;
|
||||||
};
|
};
|
||||||
|
|
|
@ -86,9 +86,6 @@ export type ChatsStackParamList = {
|
||||||
rid: string;
|
rid: string;
|
||||||
room: Model;
|
room: Model;
|
||||||
};
|
};
|
||||||
VisitorNavigationView: {
|
|
||||||
rid: string;
|
|
||||||
};
|
|
||||||
ForwardLivechatView: {
|
ForwardLivechatView: {
|
||||||
rid: string;
|
rid: string;
|
||||||
};
|
};
|
||||||
|
|
|
@ -253,7 +253,6 @@ export default {
|
||||||
RA_GO_AUTOTRANSLATE: 'ra_go_autotranslate',
|
RA_GO_AUTOTRANSLATE: 'ra_go_autotranslate',
|
||||||
RA_GO_NOTIFICATIONPREF: 'ra_go_notification_pref',
|
RA_GO_NOTIFICATIONPREF: 'ra_go_notification_pref',
|
||||||
RA_GO_FORWARDLIVECHAT: 'ra_go_forward_livechat',
|
RA_GO_FORWARDLIVECHAT: 'ra_go_forward_livechat',
|
||||||
RA_GO_VISITORNAVIGATION: 'ra_go_visitor_navigation',
|
|
||||||
RA_SHARE: 'ra_share',
|
RA_SHARE: 'ra_share',
|
||||||
RA_LEAVE: 'ra_leave',
|
RA_LEAVE: 'ra_leave',
|
||||||
RA_LEAVE_F: 'ra_leave_f',
|
RA_LEAVE_F: 'ra_leave_f',
|
||||||
|
|
|
@ -1197,23 +1197,6 @@ class RoomActionsView extends React.Component {
|
||||||
<List.Separator />
|
<List.Separator />
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{['l'].includes(t) && !this.isOmnichannelPreview ? (
|
|
||||||
<>
|
|
||||||
<List.Item
|
|
||||||
title='Navigation_history'
|
|
||||||
onPress={() =>
|
|
||||||
this.onPressTouchable({
|
|
||||||
route: 'VisitorNavigationView',
|
|
||||||
params: { rid }
|
|
||||||
})
|
|
||||||
}
|
|
||||||
left={() => <List.Icon name='history' />}
|
|
||||||
showActionIndicator
|
|
||||||
/>
|
|
||||||
<List.Separator />
|
|
||||||
</>
|
|
||||||
) : null}
|
|
||||||
</List.Section>
|
</List.Section>
|
||||||
|
|
||||||
{this.renderLastSection()}
|
{this.renderLastSection()}
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
import { FlatList, StyleSheet, Text } from 'react-native';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
import { withTheme } from '../theme';
|
|
||||||
import RocketChat from '../lib/rocketchat';
|
|
||||||
import { themes } from '../constants/colors';
|
|
||||||
import openLink from '../utils/openLink';
|
|
||||||
import I18n from '../i18n';
|
|
||||||
import debounce from '../utils/debounce';
|
|
||||||
import * as List from '../containers/List';
|
|
||||||
import SafeAreaView from '../containers/SafeAreaView';
|
|
||||||
import sharedStyles from './Styles';
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
noResult: {
|
|
||||||
fontSize: 16,
|
|
||||||
paddingVertical: 56,
|
|
||||||
...sharedStyles.textSemibold,
|
|
||||||
...sharedStyles.textAlignCenter
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const Item = ({ item }) => (
|
|
||||||
<List.Item
|
|
||||||
title={item.navigation?.page?.title || I18n.t('Empty_title')}
|
|
||||||
onPress={() => openLink(item.navigation?.page?.location?.href)}
|
|
||||||
translateTitle={false}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
Item.propTypes = {
|
|
||||||
item: PropTypes.object
|
|
||||||
};
|
|
||||||
|
|
||||||
const VisitorNavigationView = ({ route, theme }) => {
|
|
||||||
let offset;
|
|
||||||
let total = 0;
|
|
||||||
const [pages, setPages] = useState([]);
|
|
||||||
|
|
||||||
const getPages = async () => {
|
|
||||||
const rid = route.params?.rid;
|
|
||||||
if (rid) {
|
|
||||||
try {
|
|
||||||
const result = await RocketChat.getPagesLivechat(rid, offset);
|
|
||||||
if (result.success) {
|
|
||||||
setPages(result.pages);
|
|
||||||
offset = result.pages.length;
|
|
||||||
({ total } = result);
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// do nothig
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getPages();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const onEndReached = debounce(() => {
|
|
||||||
if (pages.length <= total) {
|
|
||||||
getPages();
|
|
||||||
}
|
|
||||||
}, 300);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<SafeAreaView>
|
|
||||||
<FlatList
|
|
||||||
data={pages}
|
|
||||||
renderItem={({ item }) => <Item item={item} theme={theme} />}
|
|
||||||
ItemSeparatorComponent={List.Separator}
|
|
||||||
ListFooterComponent={List.Separator}
|
|
||||||
ListHeaderComponent={List.Separator}
|
|
||||||
contentContainerStyle={List.styles.contentContainerStyleFlatList}
|
|
||||||
ListEmptyComponent={() => (
|
|
||||||
<Text style={[styles.noResult, { color: themes[theme].titleText }]}>{I18n.t('No_results_found')}</Text>
|
|
||||||
)}
|
|
||||||
keyExtractor={item => item}
|
|
||||||
onEndReached={onEndReached}
|
|
||||||
onEndReachedThreshold={5}
|
|
||||||
/>
|
|
||||||
</SafeAreaView>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
VisitorNavigationView.propTypes = {
|
|
||||||
theme: PropTypes.string,
|
|
||||||
route: PropTypes.object
|
|
||||||
};
|
|
||||||
VisitorNavigationView.navigationOptions = {
|
|
||||||
title: I18n.t('Navigation_history')
|
|
||||||
};
|
|
||||||
|
|
||||||
export default withTheme(VisitorNavigationView);
|
|
Loading…
Reference in New Issue