@controleonline/ui-crm 1.0.82 → 1.0.86
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/.release/rc-manifest.json +5 -5
- package/package.json +1 -1
- package/src/react/components/conversation/AttachmentPreview.js +1 -1
- package/src/react/components/conversation/MessageBubble.js +12 -23
- package/src/react/components/conversation/OptionPicker.js +1 -1
- package/src/react/components/conversation/PeopleAvatar.js +55 -0
- package/src/react/components/conversation/useChatPalette.js +2 -0
- package/src/react/pages/mcp/McpPage.js +1 -1
- package/src/react/pages/settings/GeneralSettings.styles.js +11 -9
- package/src/react/pages/settings/sections/AttendanceSettings.js +57 -0
- package/src/react/pages/settings/sections/TicketSettingsSection.js +9 -4
- package/src/react/pages/tickets/AssignAiModal.js +4 -3
- package/src/react/pages/tickets/TicketFunnelPage.js +6 -4
- package/src/react/pages/tickets/ticketUtils.js +3 -2
- package/src/react/pages/tickets/tickets.styles.js +53 -59
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.85",
|
|
3
3
|
"rc": 1,
|
|
4
|
-
"branch": "rc/1.0.
|
|
5
|
-
"baseMaster": "
|
|
4
|
+
"branch": "rc/1.0.85-rc.1",
|
|
5
|
+
"baseMaster": "311dec704aa59ca6ca112fe06455114988c7e8fd",
|
|
6
6
|
"tasks": [
|
|
7
|
-
|
|
7
|
+
95
|
|
8
8
|
],
|
|
9
9
|
"frozen": true,
|
|
10
10
|
"repositories": {
|
|
11
|
-
"ControleOnline/ui-crm": "
|
|
11
|
+
"ControleOnline/ui-crm": "dcc46f89f3a7fed41a1700145caaf8e4fb091eef"
|
|
12
12
|
}
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -36,7 +36,7 @@ export default function AttachmentPreview({file, palette, onCancel, onSend}) {
|
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<Modal transparent animationType="fade" visible onRequestClose={onCancel}>
|
|
39
|
-
<View style={{flex: 1, backgroundColor:
|
|
39
|
+
<View style={{flex: 1, backgroundColor: palette.overlay, alignItems: 'center', justifyContent: 'center', padding: 16}}>
|
|
40
40
|
<View style={{width: '100%', maxWidth: 520, borderRadius: 14, overflow: 'hidden', backgroundColor: palette.panel}}>
|
|
41
41
|
<View style={{flexDirection: 'row', alignItems: 'center', paddingHorizontal: 12, paddingVertical: 10, borderBottomWidth: 1, borderBottomColor: palette.border}}>
|
|
42
42
|
<TouchableOpacity onPress={onCancel} accessibilityLabel="Descartar anexo" style={{padding: 4, marginRight: 8}}>
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @agents One message, WhatsApp-like:
|
|
3
|
-
*
|
|
2
|
+
* @agents One message, WhatsApp group-like: requests are group conversations, so every other participant
|
|
3
|
+
* (customer, team member, the AI person) has an avatar (photo or initials) beside the bubble with the
|
|
4
|
+
* name below it, when the speaker changes. My own messages: no avatar, ticks. Internal notes highlighted.
|
|
4
5
|
*/
|
|
5
6
|
import React from 'react';
|
|
6
7
|
import {Text, View} from 'react-native';
|
|
7
8
|
import Attachment from './Attachment';
|
|
9
|
+
import PeopleAvatar from './PeopleAvatar';
|
|
10
|
+
import {fileIdOf} from './fileApi';
|
|
8
11
|
import RichText from './RichText';
|
|
9
12
|
|
|
10
|
-
const {
|
|
13
|
+
const {timeLabel} = require('./formatText');
|
|
11
14
|
|
|
12
15
|
const TICKS = {pending: '🕓', processing: '🕓', done: '✓✓', error: '⚠'};
|
|
13
16
|
|
|
14
17
|
export default function MessageBubble({item, side, kind, author, showAuthor, palette}) {
|
|
15
18
|
const mine = side === 'right';
|
|
19
|
+
// "Você" (describe) or a message still being sent: my own, no avatar.
|
|
20
|
+
const self = author === 'Você' || Boolean(item?.localId);
|
|
16
21
|
const note = kind === 'note';
|
|
17
22
|
const bg = note ? palette.noteBubble : mine ? palette.mineBubble : palette.otherBubble;
|
|
18
23
|
const fg = mine && !note ? palette.mineText : palette.otherText;
|
|
@@ -21,22 +26,8 @@ export default function MessageBubble({item, side, kind, author, showAuthor, pal
|
|
|
21
26
|
const isFileLabel = item?.file && /^Anexo(:|$)/.test(body);
|
|
22
27
|
|
|
23
28
|
return (
|
|
24
|
-
<View style={{flexDirection: 'row'
|
|
25
|
-
{!
|
|
26
|
-
<View
|
|
27
|
-
style={{
|
|
28
|
-
width: 32,
|
|
29
|
-
height: 32,
|
|
30
|
-
borderRadius: 16,
|
|
31
|
-
marginRight: 6,
|
|
32
|
-
marginTop: 2,
|
|
33
|
-
alignItems: 'center',
|
|
34
|
-
justifyContent: 'center',
|
|
35
|
-
backgroundColor: showAuthor ? palette.chipActive : 'transparent',
|
|
36
|
-
}}>
|
|
37
|
-
{showAuthor ? <Text style={{color: palette.chipActiveText, fontWeight: '700', fontSize: 12}}>{initialsOf(author)}</Text> : null}
|
|
38
|
-
</View>
|
|
39
|
-
) : null}
|
|
29
|
+
<View style={{flexDirection: mine ? 'row-reverse' : 'row', alignItems: 'flex-start', gap: 4, marginVertical: 2, paddingHorizontal: 8}}>
|
|
30
|
+
{!self ? (showAuthor ? <PeopleAvatar peopleId={fileIdOf(item?.registeredBy)} name={author} palette={palette} /> : <View style={{width: 56}} />) : null}
|
|
40
31
|
<View
|
|
41
32
|
style={{
|
|
42
33
|
maxWidth: '78%',
|
|
@@ -51,10 +42,8 @@ export default function MessageBubble({item, side, kind, author, showAuthor, pal
|
|
|
51
42
|
paddingTop: 6,
|
|
52
43
|
paddingBottom: 4,
|
|
53
44
|
}}>
|
|
54
|
-
{showAuthor &&
|
|
55
|
-
<Text style={{color:
|
|
56
|
-
{note ? `${author} · nota interna` : author}
|
|
57
|
-
</Text>
|
|
45
|
+
{showAuthor && note ? (
|
|
46
|
+
<Text style={{color: palette.noteBorder, fontWeight: '700', fontSize: 12, marginBottom: 2}}>nota interna</Text>
|
|
58
47
|
) : null}
|
|
59
48
|
{item?.file ? <Attachment file={item.file} color={fg} /> : null}
|
|
60
49
|
{body && !isFileLabel ? <RichText value={body} style={{color: fg, fontSize: 15, lineHeight: 20}} linkColor={fg} /> : null}
|
|
@@ -36,7 +36,7 @@ export default function OptionPicker({label, value, options, onChange, placehold
|
|
|
36
36
|
{editable ? <Text style={{color: palette.muted, fontSize: 10}}>▾</Text> : null}
|
|
37
37
|
</TouchableOpacity>
|
|
38
38
|
<Modal visible={open} transparent animationType="fade" onRequestClose={() => setOpen(false)}>
|
|
39
|
-
<Pressable style={{flex: 1, backgroundColor:
|
|
39
|
+
<Pressable style={{flex: 1, backgroundColor: palette.overlay, justifyContent: 'center', padding: 24}} onPress={() => setOpen(false)}>
|
|
40
40
|
<Pressable style={{backgroundColor: palette.panel, borderRadius: 12, maxHeight: '75%', paddingVertical: 8, borderWidth: 1, borderColor: palette.border}}>
|
|
41
41
|
<Text style={{color: palette.text, fontWeight: '700', fontSize: 16, paddingHorizontal: 16, paddingVertical: 8}}>{label}</Text>
|
|
42
42
|
<ScrollView>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @agents Avatar of a conversation participant (group chat look): the person's photo (people_media,
|
|
3
|
+
* cached per person for the whole app) or their initials; the name goes right below.
|
|
4
|
+
*/
|
|
5
|
+
import React, {useEffect, useState} from 'react';
|
|
6
|
+
import {Image, Text, View} from 'react-native';
|
|
7
|
+
import {api} from '@controleonline/ui-common/src/api';
|
|
8
|
+
import {fileIdOf, fileSource} from './fileApi';
|
|
9
|
+
import {toItems} from './requestApi';
|
|
10
|
+
|
|
11
|
+
const {initialsOf} = require('./formatText');
|
|
12
|
+
|
|
13
|
+
const photoCache = new Map();
|
|
14
|
+
|
|
15
|
+
const photoOf = peopleId => {
|
|
16
|
+
if (!photoCache.has(peopleId)) {
|
|
17
|
+
photoCache.set(
|
|
18
|
+
peopleId,
|
|
19
|
+
api
|
|
20
|
+
.fetch('/people_media', {params: {people: peopleId, itemsPerPage: 1, 'order[id]': 'DESC'}})
|
|
21
|
+
.then(res => {
|
|
22
|
+
const fileId = fileIdOf(toItems(res)[0]?.file);
|
|
23
|
+
return fileId ? fileSource(fileId) : null;
|
|
24
|
+
})
|
|
25
|
+
.catch(() => null),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
return photoCache.get(peopleId);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default function PeopleAvatar({peopleId, name, palette, size = 34}) {
|
|
32
|
+
const [source, setSource] = useState(null);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
let alive = true;
|
|
35
|
+
if (peopleId) photoOf(peopleId).then(s => alive && setSource(s));
|
|
36
|
+
return () => {
|
|
37
|
+
alive = false;
|
|
38
|
+
};
|
|
39
|
+
}, [peopleId]);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<View style={{width: 56, alignItems: 'center'}}>
|
|
43
|
+
{source ? (
|
|
44
|
+
<Image source={source} style={{width: size, height: size, borderRadius: size / 2}} />
|
|
45
|
+
) : (
|
|
46
|
+
<View style={{width: size, height: size, borderRadius: size / 2, alignItems: 'center', justifyContent: 'center', backgroundColor: palette.chipActive}}>
|
|
47
|
+
<Text style={{color: palette.chipActiveText, fontWeight: '700', fontSize: 12}}>{initialsOf(name)}</Text>
|
|
48
|
+
</View>
|
|
49
|
+
)}
|
|
50
|
+
<Text numberOfLines={2} style={{color: palette.muted, fontSize: 10, textAlign: 'center', marginTop: 2}}>
|
|
51
|
+
{name}
|
|
52
|
+
</Text>
|
|
53
|
+
</View>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -34,6 +34,8 @@ export default function useChatPalette() {
|
|
|
34
34
|
inputBorder: t.inputBorder || t.cardBorder,
|
|
35
35
|
inputText: t.inputText || t.textPrimary,
|
|
36
36
|
placeholder: t.inputPlaceholderText || t.textMuted,
|
|
37
|
+
// Modal backdrop: theme token; derived from the text color only when the theme has none.
|
|
38
|
+
overlay: t.modalOverlay || t.overlayBackground || withOpacity(t.textPrimary || t.cardText, 0.55),
|
|
37
39
|
danger: t.error || t.iconDanger,
|
|
38
40
|
success: t.success || t.iconSuccess,
|
|
39
41
|
};
|
|
@@ -131,7 +131,7 @@ export default function McpPage() {
|
|
|
131
131
|
{!narrow || !showChat ? list : null}
|
|
132
132
|
{!narrow || showChat ? <View style={{flex: 1, minWidth: 0}}>{chat}</View> : null}
|
|
133
133
|
<Modal visible={chooser} transparent animationType="fade" onRequestClose={() => setChooser(false)}>
|
|
134
|
-
<Pressable style={{flex: 1, backgroundColor:
|
|
134
|
+
<Pressable style={{flex: 1, backgroundColor: palette.overlay, justifyContent: 'center', padding: 24}} onPress={() => setChooser(false)}>
|
|
135
135
|
<Pressable style={{backgroundColor: palette.panel, borderRadius: 14, padding: 16, borderWidth: 1, borderColor: palette.border, maxWidth: 420, width: '100%', alignSelf: 'center'}}>
|
|
136
136
|
<Text style={{color: palette.text, fontWeight: '700', fontSize: 17, marginBottom: 12}}>Nova solicitação</Text>
|
|
137
137
|
{REQUEST_TYPES.map(t => (
|
|
@@ -80,7 +80,9 @@ export const buildGeneralSettingsPalette = themeColors => ({
|
|
|
80
80
|
modalBorder: themeColors.modalBorder,
|
|
81
81
|
modalCloseIcon: themeColors.modalCloseIcon,
|
|
82
82
|
modalHeaderText: themeColors.modalHeaderText,
|
|
83
|
+
modalOverlay: themeColors.modalOverlay,
|
|
83
84
|
modalText: themeColors.modalText,
|
|
85
|
+
overlayBackground: themeColors.overlayBackground,
|
|
84
86
|
navigationActiveBackground: themeColors.navigationActiveBackground,
|
|
85
87
|
navigationBackground: themeColors.navigationBackground,
|
|
86
88
|
navigationBorder: themeColors.navigationBorder,
|
|
@@ -381,15 +383,15 @@ export const createGeneralSettingsStyles = palette =>
|
|
|
381
383
|
borderColor: palette.listItemSelectedBorder,
|
|
382
384
|
backgroundColor: palette.listItemSelectedBackground,
|
|
383
385
|
},
|
|
384
|
-
franchiseAddressOptionCopy: {
|
|
385
|
-
flex: 1,
|
|
386
|
-
marginLeft: 12,
|
|
387
|
-
},
|
|
388
|
-
franchiseAddressName: {
|
|
389
|
-
fontSize: 14,
|
|
390
|
-
fontWeight: '700',
|
|
391
|
-
color: palette.listItemText,
|
|
392
|
-
},
|
|
386
|
+
franchiseAddressOptionCopy: {
|
|
387
|
+
flex: 1,
|
|
388
|
+
marginLeft: 12,
|
|
389
|
+
},
|
|
390
|
+
franchiseAddressName: {
|
|
391
|
+
fontSize: 14,
|
|
392
|
+
fontWeight: '700',
|
|
393
|
+
color: palette.listItemText,
|
|
394
|
+
},
|
|
393
395
|
primaryButton: {
|
|
394
396
|
marginTop: 16,
|
|
395
397
|
justifyContent: 'center',
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @agents One kind of request (support / relationship): who attends first (AI by default, or a person),
|
|
3
|
+
* the AI's name (the AI is a person of the company, e.g. "Tião IA") and the welcome message sent in
|
|
4
|
+
* its name. Saved with PUT /tickets/settings {attendance: {[type]: {first, ai_name, welcome}}}.
|
|
5
|
+
*/
|
|
6
|
+
import React, {useEffect, useState} from 'react';
|
|
7
|
+
import {Text, TextInput, TouchableOpacity, View} from 'react-native';
|
|
8
|
+
|
|
9
|
+
const FIRST = [
|
|
10
|
+
{value: 'ai', label: 'IA primeiro (encaminha para uma pessoa quando precisar)'},
|
|
11
|
+
{value: 'human', label: 'Pessoa primeiro'},
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export default function AttendanceSettings({type, value, onSave, palette, styles, Choice}) {
|
|
15
|
+
const [name, setName] = useState(value?.ai_name || '');
|
|
16
|
+
const [welcome, setWelcome] = useState(value?.welcome || '');
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setName(value?.ai_name || '');
|
|
19
|
+
setWelcome(value?.welcome || '');
|
|
20
|
+
}, [value?.ai_name, value?.welcome]);
|
|
21
|
+
|
|
22
|
+
const input = {
|
|
23
|
+
borderWidth: 1,
|
|
24
|
+
borderColor: palette.inputBorder || palette.cardBorder,
|
|
25
|
+
backgroundColor: palette.inputBackground || palette.cardBackground,
|
|
26
|
+
color: palette.inputText || palette.textPrimary,
|
|
27
|
+
borderRadius: 10,
|
|
28
|
+
paddingHorizontal: 12,
|
|
29
|
+
paddingVertical: 8,
|
|
30
|
+
marginBottom: 8,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<View style={{marginBottom: 12}}>
|
|
35
|
+
<Text style={styles.sectionTitle}>Primeiro atendimento</Text>
|
|
36
|
+
{FIRST.map(o => (
|
|
37
|
+
<Choice key={o.value} palette={palette} active={(value?.first || 'ai') === o.value} label={o.label} onPress={() => onSave({[type]: {first: o.value}})} />
|
|
38
|
+
))}
|
|
39
|
+
<Text style={[styles.sectionTitle, {marginTop: 8}]}>Nome da IA</Text>
|
|
40
|
+
<TextInput style={input} value={name} onChangeText={setName} maxLength={60} placeholder="Ex.: Tião IA" placeholderTextColor={palette.inputPlaceholderText || palette.textMuted} />
|
|
41
|
+
<Text style={styles.sectionTitle}>Mensagem de boas-vindas</Text>
|
|
42
|
+
<TextInput
|
|
43
|
+
style={[input, {minHeight: 70, textAlignVertical: 'top'}]}
|
|
44
|
+
value={welcome}
|
|
45
|
+
onChangeText={setWelcome}
|
|
46
|
+
multiline
|
|
47
|
+
placeholder="Enviada em nome da IA quando a solicitação começa (vazio = sem mensagem)"
|
|
48
|
+
placeholderTextColor={palette.inputPlaceholderText || palette.textMuted}
|
|
49
|
+
/>
|
|
50
|
+
<TouchableOpacity
|
|
51
|
+
onPress={() => onSave({[type]: {ai_name: name, welcome}})}
|
|
52
|
+
style={{alignSelf: 'flex-start', paddingVertical: 8, paddingHorizontal: 14, borderRadius: 10, backgroundColor: palette.primary}}>
|
|
53
|
+
<Text style={{color: palette.buttonText || palette.cardBackground, fontWeight: '700'}}>Salvar nome e boas-vindas</Text>
|
|
54
|
+
</TouchableOpacity>
|
|
55
|
+
</View>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -12,6 +12,7 @@ import useToastMessage from '@controleonline/ui-crm/src/react/hooks/useToastMess
|
|
|
12
12
|
import {fetchTicketSettings, saveTicketSettings} from '../../../components/conversation/requestApi';
|
|
13
13
|
import {useGeneralSettingsPalette, useGeneralSettingsStyles} from '../GeneralSettings.styles';
|
|
14
14
|
import GeneralSettingsSection from '../GeneralSettingsSection';
|
|
15
|
+
import AttendanceSettings from './AttendanceSettings';
|
|
15
16
|
import {useGeneralSettingsConfig} from '../GeneralSettings.shared';
|
|
16
17
|
|
|
17
18
|
const STRATEGIES = [
|
|
@@ -41,7 +42,7 @@ const Choice = ({active, label, onPress, palette, multi}) => (
|
|
|
41
42
|
borderWidth: 2,
|
|
42
43
|
marginRight: 10,
|
|
43
44
|
borderColor: palette.primary,
|
|
44
|
-
backgroundColor: active ? palette.primary :
|
|
45
|
+
backgroundColor: active ? palette.primary : palette.cardBackground,
|
|
45
46
|
}}
|
|
46
47
|
/>
|
|
47
48
|
<Text style={{color: palette.textPrimary, flex: 1}}>{label}</Text>
|
|
@@ -90,12 +91,16 @@ export default function TicketSettingsSection() {
|
|
|
90
91
|
|
|
91
92
|
if (!settings) return <ActivityIndicator style={{marginTop: 16}} />;
|
|
92
93
|
const employees = settings.employees || [];
|
|
94
|
+
const attendance = type => (
|
|
95
|
+
<AttendanceSettings type={type} value={settings.attendance?.[type]} onSave={patch => save({attendance: patch})} palette={palette} styles={styles} Choice={Choice} />
|
|
96
|
+
);
|
|
93
97
|
|
|
94
98
|
return (
|
|
95
99
|
<View>
|
|
96
100
|
<GeneralSettingsSection
|
|
97
101
|
title="Suporte"
|
|
98
|
-
description="
|
|
102
|
+
description="Com IA primeiro, o chamado fica com a IA (sem responsável) até ela resolver ou encaminhar. Pessoas: distribuição entre as marcadas abaixo, que respondem e aparecem como responsáveis em Atendimento de suporte.">
|
|
103
|
+
{attendance('support')}
|
|
99
104
|
<Text style={styles.sectionTitle}>Regra de distribuição</Text>
|
|
100
105
|
{STRATEGIES.map(s => (
|
|
101
106
|
<Choice key={s.value} palette={palette} active={settings.support_strategy === s.value} label={s.label} onPress={() => save({support_strategy: s.value})} />
|
|
@@ -109,8 +114,8 @@ export default function TicketSettingsSection() {
|
|
|
109
114
|
|
|
110
115
|
<GeneralSettingsSection
|
|
111
116
|
title="Comercial (CRM)"
|
|
112
|
-
description="
|
|
113
|
-
|
|
117
|
+
description="Quando vai para uma pessoa, segue a distribuição de clientes do CRM: cada cliente é atendido pelo seu vendedor; clientes sem vendedor recebem um pela estratégia da aba CRM.">
|
|
118
|
+
{attendance('relationship')}
|
|
114
119
|
</GeneralSettingsSection>
|
|
115
120
|
{saving ? <ActivityIndicator style={{marginTop: 8}} /> : null}
|
|
116
121
|
</View>
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import React, {useState} from 'react';
|
|
5
5
|
import {ActivityIndicator, Modal, Text, TextInput, TouchableOpacity, View} from 'react-native';
|
|
6
|
-
import
|
|
6
|
+
import useTicketStyles from './tickets.styles';
|
|
7
7
|
|
|
8
8
|
export default function AssignAiModal({visible, ticketName, onCancel, onConfirm}) {
|
|
9
|
+
const {styles, palette} = useTicketStyles();
|
|
9
10
|
const [instructions, setInstructions] = useState('');
|
|
10
11
|
const [busy, setBusy] = useState(false);
|
|
11
12
|
|
|
@@ -33,7 +34,7 @@ export default function AssignAiModal({visible, ticketName, onCancel, onConfirm}
|
|
|
33
34
|
value={instructions}
|
|
34
35
|
onChangeText={setInstructions}
|
|
35
36
|
placeholder="Instruções (opcional): o que perguntar, qual oferta apresentar…"
|
|
36
|
-
placeholderTextColor=
|
|
37
|
+
placeholderTextColor={palette.placeholder}
|
|
37
38
|
multiline
|
|
38
39
|
/>
|
|
39
40
|
<View style={styles.modalActions}>
|
|
@@ -41,7 +42,7 @@ export default function AssignAiModal({visible, ticketName, onCancel, onConfirm}
|
|
|
41
42
|
<Text style={styles.ghostBtnText}>Cancelar</Text>
|
|
42
43
|
</TouchableOpacity>
|
|
43
44
|
<TouchableOpacity style={styles.primaryBtn} onPress={confirm} disabled={busy}>
|
|
44
|
-
{busy ? <ActivityIndicator color=
|
|
45
|
+
{busy ? <ActivityIndicator color={palette.chipActiveText} /> : <Text style={styles.primaryBtnText}>Atribuir</Text>}
|
|
45
46
|
</TouchableOpacity>
|
|
46
47
|
</View>
|
|
47
48
|
</View>
|
|
@@ -11,7 +11,7 @@ import useToastMessage from '../../hooks/useToastMessage';
|
|
|
11
11
|
import AssignAiModal from './AssignAiModal';
|
|
12
12
|
import useRealtimeReload from './useRealtimeReload';
|
|
13
13
|
import {assignAi, fetchStatuses, fetchTickets, fetchTriage, moveTicket} from './ticketApi';
|
|
14
|
-
import
|
|
14
|
+
import useTicketStyles from './tickets.styles';
|
|
15
15
|
|
|
16
16
|
const {idOf, conversationChannel} = require('../mcp/mcpChatUtils');
|
|
17
17
|
const {TICKET_TYPES, buildColumns, neighbourStatus, personName, timeAgo} = require('./ticketUtils');
|
|
@@ -19,6 +19,7 @@ const {TICKET_TYPES, buildColumns, neighbourStatus, personName, timeAgo} = requi
|
|
|
19
19
|
const CHANNEL_LABELS = {whatsapp: 'WhatsApp', email: 'E-mail', web: 'Site'};
|
|
20
20
|
|
|
21
21
|
const TicketCard = ({task, columns, onMove, onAssign, onOpen}) => {
|
|
22
|
+
const {styles} = useTicketStyles();
|
|
22
23
|
const previous = neighbourStatus(columns, task, -1);
|
|
23
24
|
const next = neighbourStatus(columns, task, 1);
|
|
24
25
|
const channel = conversationChannel(task);
|
|
@@ -29,7 +30,7 @@ const TicketCard = ({task, columns, onMove, onAssign, onOpen}) => {
|
|
|
29
30
|
{[personName(task.client), timeAgo(task.alterDate)].filter(Boolean).join(' · ')}
|
|
30
31
|
</Text>
|
|
31
32
|
<View style={styles.badges}>
|
|
32
|
-
{task.aiAgent ? <View style={[styles.badge, styles.badgeAi]}><Text style={styles.badgeText}>IA atendendo</Text></View> : null}
|
|
33
|
+
{task.aiAgent ? <View style={[styles.badge, styles.badgeAi]}><Text style={[styles.badgeText, styles.badgeAiText]}>IA atendendo</Text></View> : null}
|
|
33
34
|
{CHANNEL_LABELS[channel] ? <View style={styles.badge}><Text style={styles.badgeText}>{CHANNEL_LABELS[channel]}</Text></View> : null}
|
|
34
35
|
</View>
|
|
35
36
|
<View style={styles.cardActions}>
|
|
@@ -43,6 +44,7 @@ const TicketCard = ({task, columns, onMove, onAssign, onOpen}) => {
|
|
|
43
44
|
|
|
44
45
|
export default function TicketFunnelPage({type = 'relationship'}) {
|
|
45
46
|
const navigation = useNavigation();
|
|
47
|
+
const {styles, palette} = useTicketStyles();
|
|
46
48
|
const {showError, showSuccess} = useToastMessage();
|
|
47
49
|
const peopleStore = useStore('people');
|
|
48
50
|
const companyId = idOf(peopleStore?.getters?.currentCompany || peopleStore?.getters?.mainCompany);
|
|
@@ -114,14 +116,14 @@ export default function TicketFunnelPage({type = 'relationship'}) {
|
|
|
114
116
|
<Text style={styles.title}>{meta.title}</Text>
|
|
115
117
|
<Text style={styles.subtitle}>{`${tickets.length} tickets · ${triage.length} em triagem pela IA`}</Text>
|
|
116
118
|
</View>
|
|
117
|
-
<TextInput style={styles.search} value={search} onChangeText={setSearch} placeholder="Buscar cliente ou título" placeholderTextColor=
|
|
119
|
+
<TextInput style={styles.search} value={search} onChangeText={setSearch} placeholder="Buscar cliente ou título" placeholderTextColor={palette.placeholder} />
|
|
118
120
|
</View>
|
|
119
121
|
{loading ? (
|
|
120
122
|
<ActivityIndicator style={styles.spinner} />
|
|
121
123
|
) : (
|
|
122
124
|
<ScrollView horizontal style={styles.board} contentContainerStyle={styles.boardContent}>
|
|
123
125
|
{columns.map(column => (
|
|
124
|
-
<View key={column.key} style={[styles.column, {borderTopColor: column.color}]}>
|
|
126
|
+
<View key={column.key} style={[styles.column, column.color ? {borderTopColor: column.color} : null]}>
|
|
125
127
|
<View style={styles.columnHeader}>
|
|
126
128
|
<Text style={styles.columnTitle}>{column.title}</Text>
|
|
127
129
|
<Text style={styles.columnCount}>{column.tasks.length}</Text>
|
|
@@ -28,13 +28,14 @@ const buildColumns = (statuses, tasks, triage = []) => {
|
|
|
28
28
|
return ra - rb || ia - ib;
|
|
29
29
|
});
|
|
30
30
|
const columns = [
|
|
31
|
-
{key: TRIAGE_COLUMN, title: 'Triagem IA', color:
|
|
31
|
+
{key: TRIAGE_COLUMN, title: 'Triagem IA', color: null, status: null, tasks: (triage || []).filter(isCustomerConversation)},
|
|
32
32
|
];
|
|
33
33
|
sorted.forEach(status => {
|
|
34
34
|
columns.push({
|
|
35
35
|
key: String(idOf(status)),
|
|
36
36
|
title: status.status || status.name || `#${idOf(status)}`,
|
|
37
|
-
|
|
37
|
+
// Status color comes from the database; without one the column uses the theme primary.
|
|
38
|
+
color: status.color || null,
|
|
38
39
|
status,
|
|
39
40
|
tasks: [],
|
|
40
41
|
});
|
|
@@ -1,61 +1,55 @@
|
|
|
1
|
+
import {useMemo} from 'react';
|
|
1
2
|
import {StyleSheet} from 'react-native';
|
|
3
|
+
import useChatPalette from '../../components/conversation/useChatPalette';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// modal
|
|
55
|
-
modalBackdrop: {flex: 1, backgroundColor: 'rgba(0,0,0,0.6)', justifyContent: 'center', alignItems: 'center', padding: 16},
|
|
56
|
-
modalCard: {width: '100%', maxWidth: 480, backgroundColor: '#15202b', borderRadius: 14, padding: 16, gap: 10},
|
|
57
|
-
modalTitle: {color: '#e7e9ea', fontSize: 16, fontWeight: '700'},
|
|
58
|
-
modalText: {color: '#8b98a5', fontSize: 13, lineHeight: 18},
|
|
59
|
-
modalInput: {minHeight: 90, flex: 0},
|
|
60
|
-
modalActions: {flexDirection: 'row', justifyContent: 'flex-end', gap: 8},
|
|
61
|
-
});
|
|
5
|
+
/*
|
|
6
|
+
* @agents Ticket funnel/modal styles. Colors come only from the theme (useChatPalette → theme store +
|
|
7
|
+
* company theme); no color literals here (agents-mcp code-quality: theme tokens only).
|
|
8
|
+
*/
|
|
9
|
+
export const makeTicketStyles = p =>
|
|
10
|
+
StyleSheet.create({
|
|
11
|
+
root: {flex: 1, backgroundColor: p.background},
|
|
12
|
+
header: {flexDirection: 'row', alignItems: 'center', gap: 8, padding: 12, borderBottomWidth: 1, borderBottomColor: p.border},
|
|
13
|
+
headerText: {flex: 1, minWidth: 0},
|
|
14
|
+
title: {color: p.text, fontSize: 18, fontWeight: '700'},
|
|
15
|
+
subtitle: {color: p.muted, fontSize: 12, marginTop: 2},
|
|
16
|
+
search: {minWidth: 180, maxWidth: 280, flex: 1, borderWidth: 1, borderColor: p.inputBorder, borderRadius: 10, paddingHorizontal: 10, paddingVertical: 6, color: p.inputText, backgroundColor: p.input},
|
|
17
|
+
board: {flex: 1},
|
|
18
|
+
boardContent: {padding: 12, gap: 12},
|
|
19
|
+
column: {width: 290, backgroundColor: p.panel, borderRadius: 12, borderTopWidth: 3, borderTopColor: p.primary, maxHeight: '100%'},
|
|
20
|
+
columnHeader: {flexDirection: 'row', justifyContent: 'space-between', padding: 10},
|
|
21
|
+
columnTitle: {color: p.text, fontWeight: '700', fontSize: 13, textTransform: 'capitalize'},
|
|
22
|
+
columnCount: {color: p.muted, fontSize: 12},
|
|
23
|
+
columnBody: {paddingHorizontal: 8, paddingBottom: 8},
|
|
24
|
+
card: {backgroundColor: p.otherBubble, borderWidth: 1, borderColor: p.border, borderRadius: 10, padding: 10, marginBottom: 8},
|
|
25
|
+
cardTitle: {color: p.text, fontSize: 13, fontWeight: '600'},
|
|
26
|
+
cardMeta: {color: p.muted, fontSize: 11, marginTop: 4},
|
|
27
|
+
badges: {flexDirection: 'row', flexWrap: 'wrap', gap: 4, marginTop: 6},
|
|
28
|
+
badge: {borderRadius: 6, paddingHorizontal: 6, paddingVertical: 2, backgroundColor: p.chip},
|
|
29
|
+
badgeAi: {backgroundColor: p.chipActive},
|
|
30
|
+
badgeText: {color: p.chipText, fontSize: 10, fontWeight: '600'},
|
|
31
|
+
badgeAiText: {color: p.chipActiveText},
|
|
32
|
+
cardActions: {flexDirection: 'row', gap: 6, marginTop: 8},
|
|
33
|
+
iconBtn: {borderWidth: 1, borderColor: p.border, borderRadius: 8, paddingHorizontal: 8, paddingVertical: 4},
|
|
34
|
+
iconBtnText: {color: p.text, fontSize: 12},
|
|
35
|
+
emptyText: {color: p.muted, fontSize: 12, padding: 8},
|
|
36
|
+
spinner: {marginTop: 24},
|
|
37
|
+
input: {flex: 1, minHeight: 40, maxHeight: 140, borderWidth: 1, borderColor: p.inputBorder, borderRadius: 12, paddingHorizontal: 12, paddingVertical: 8, color: p.inputText, backgroundColor: p.input},
|
|
38
|
+
primaryBtn: {backgroundColor: p.chipActive, borderRadius: 10, paddingHorizontal: 14, paddingVertical: 10, alignItems: 'center', justifyContent: 'center'},
|
|
39
|
+
primaryBtnText: {color: p.chipActiveText, fontWeight: '700'},
|
|
40
|
+
ghostBtn: {borderWidth: 1, borderColor: p.chipActive, borderRadius: 10, paddingHorizontal: 12, paddingVertical: 8},
|
|
41
|
+
ghostBtnText: {color: p.chipActive, fontWeight: '600', fontSize: 12},
|
|
42
|
+
// modal
|
|
43
|
+
modalBackdrop: {flex: 1, backgroundColor: p.overlay, justifyContent: 'center', alignItems: 'center', padding: 16},
|
|
44
|
+
modalCard: {width: '100%', maxWidth: 480, backgroundColor: p.modalBackground || p.panel, borderRadius: 14, padding: 16, gap: 10},
|
|
45
|
+
modalTitle: {color: p.modalHeaderText || p.text, fontSize: 16, fontWeight: '700'},
|
|
46
|
+
modalText: {color: p.modalText || p.muted, fontSize: 13, lineHeight: 18},
|
|
47
|
+
modalInput: {minHeight: 90, flex: 0},
|
|
48
|
+
modalActions: {flexDirection: 'row', justifyContent: 'flex-end', gap: 8},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export default function useTicketStyles() {
|
|
52
|
+
const palette = useChatPalette();
|
|
53
|
+
const styles = useMemo(() => makeTicketStyles(palette), [palette]);
|
|
54
|
+
return {styles, palette};
|
|
55
|
+
}
|