@controleonline/ui-common 1.2.108 → 1.2.109

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.
@@ -1,11 +1,13 @@
1
1
  {
2
- "branch": "rc/1.2.107-rc.1",
3
- "version": "1.2.107",
2
+ "branch": "rc/1.10.89-rc.1",
3
+ "version": "1.10.89",
4
4
  "rc": 1,
5
5
  "frozen": true,
6
- "baseMaster": "93774605e0ca8e93cf4eab72f0b7ab50f46006e4",
7
- "tasks": [1199],
6
+ "baseMaster": "6d1a8d6b6caa1450d8eb30602dac27ba11e7799a",
7
+ "tasks": [
8
+ 1221
9
+ ],
8
10
  "repositories": {
9
- "ControleOnline/ui-common": "5d2a8552c35fab5d550a388b29fa6a0c20455fd3"
11
+ "ControleOnline/ui-common": "0be070a06a8236254cc20a53366cb0aa503514a8"
10
12
  }
11
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@controleonline/ui-common",
3
- "version": "1.2.108",
3
+ "version": "1.2.109",
4
4
  "author": "ControleOnline",
5
5
  "description": "ControleOnline Common Quasar UI Component",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useMemo } from 'react';
2
- import { Platform, Text, TouchableOpacity, View } from 'react-native';
2
+ import { Text, View } from 'react-native';
3
3
  import { SafeAreaView } from 'react-native-safe-area-context';
4
4
  import { useFocusEffect, useNavigation } from '@react-navigation/native';
5
5
  import Icon from 'react-native-vector-icons/Feather';
@@ -7,26 +7,11 @@ import Icon from 'react-native-vector-icons/Feather';
7
7
  import { useStore } from '@store';
8
8
  import { colors } from '@controleonline/../../src/styles/colors';
9
9
  import { createStyles } from './Connections.styles';
10
- import {
11
- resolveThemePalette,
12
- withOpacity,
13
- } from '@controleonline/../../src/styles/branding';
10
+ import { resolveThemePalette } from '@controleonline/../../src/styles/branding';
14
11
  import DefaultTable from '@controleonline/ui-default/src/react/components/table/DefaultTable';
15
12
 
16
13
  const tt = (type, key) => global.t?.t('configs', type, key);
17
14
 
18
- const resolveShadowStyle = textColor =>
19
- Platform.select({
20
- ios: {
21
- shadowColor: textColor,
22
- shadowOffset: { width: 0, height: 8 },
23
- shadowOpacity: 0.08,
24
- shadowRadius: 16,
25
- },
26
- android: { elevation: 3 },
27
- web: { boxShadow: `0 10px 24px ${withOpacity(textColor, 0.08)}` },
28
- });
29
-
30
15
  const formatPhoneLabel = phone => {
31
16
  if (!phone) return tt('connections_label', 'notProvided') || 'Nao informado';
32
17
  if (typeof phone === 'string') return phone;
@@ -41,11 +26,17 @@ const formatPhoneLabel = phone => {
41
26
  };
42
27
 
43
28
  const formatStatusLabel = status => {
44
- if (!status) return tt('connections_status', 'unknown') || '—';
29
+ if (!status) return '—';
45
30
  if (typeof status === 'string') return status;
46
31
  return status?.status || status?.name || '—';
47
32
  };
48
33
 
34
+ const formatChannelLabel = channel => {
35
+ if (channel === 'whatsapp_official') return 'WhatsApp Oficial';
36
+ if (channel === 'whatsapp') return 'WhatsApp';
37
+ return channel || '—';
38
+ };
39
+
49
40
  export default function Connections() {
50
41
  const navigation = useNavigation();
51
42
  const peopleStore = useStore('people');
@@ -54,8 +45,6 @@ export default function Connections() {
54
45
 
55
46
  const { currentCompany } = peopleStore.getters || {};
56
47
  const { colors: themeColors } = themeStore.getters || {};
57
- const items = connectionsStore.getters?.items;
58
- const totalItems = connectionsStore.getters?.totalItems;
59
48
 
60
49
  const brandColors = useMemo(
61
50
  () =>
@@ -63,13 +52,10 @@ export default function Connections() {
63
52
  { ...themeColors, ...(currentCompany?.theme?.colors || {}) },
64
53
  colors,
65
54
  ),
66
- [themeColors, currentCompany?.id],
55
+ [themeColors, currentCompany],
67
56
  );
57
+
68
58
  const styles = useMemo(() => createStyles(brandColors), [brandColors]);
69
- const shadowStyle = useMemo(
70
- () => resolveShadowStyle(brandColors.text),
71
- [brandColors.text],
72
- );
73
59
 
74
60
  const providerId = currentCompany?.id;
75
61
  const peopleIri = useMemo(
@@ -82,11 +68,6 @@ export default function Connections() {
82
68
  [peopleIri],
83
69
  );
84
70
 
85
- const connectionCount = useMemo(() => {
86
- if (typeof totalItems === 'number' && totalItems > 0) return totalItems;
87
- return Array.isArray(items) ? items.length : 0;
88
- }, [items, totalItems]);
89
-
90
71
  useFocusEffect(
91
72
  useCallback(() => {
92
73
  if (!peopleIri || typeof connectionsStore.actions?.getItems !== 'function') {
@@ -109,7 +90,9 @@ export default function Connections() {
109
90
  {item.name || tt('connections_label', 'unnamed') || 'Sem nome'}
110
91
  </Text>
111
92
  <Text style={styles.previewPhone}>{formatPhoneLabel(item.phone)}</Text>
112
- <Text style={styles.previewStatus}>{formatStatusLabel(item.status)}</Text>
93
+ <Text style={styles.previewStatus}>
94
+ {formatChannelLabel(item.channel)} · {formatStatusLabel(item.status)}
95
+ </Text>
113
96
  </View>
114
97
  );
115
98
  },
@@ -137,72 +120,11 @@ export default function Connections() {
137
120
  <SafeAreaView
138
121
  style={[styles.container, { backgroundColor: brandColors.background }]}
139
122
  edges={['bottom']}>
140
- <View style={[styles.heroCard, shadowStyle, { backgroundColor: brandColors.primary }]}>
141
- <View style={styles.heroCopy}>
142
- <Text style={styles.heroEyebrow}>
143
- {tt('connections_eyebrow', 'communication') || 'COMUNICACAO'}
144
- </Text>
145
- <Text style={styles.heroTitle}>
146
- {tt('connections_title', 'connections') || 'Conexoes'}
147
- </Text>
148
- <Text style={styles.heroText}>
149
- {tt('connections_text', 'hero') ||
150
- 'Gerencie os canais de comunicacao conectados com a sua operacao.'}
151
- </Text>
152
- </View>
153
- <View style={styles.heroBadge}>
154
- <Icon name="radio" size={22} color={brandColors.primary} />
155
- </View>
156
- </View>
157
-
158
- <View style={styles.companyRow}>
159
- <View style={styles.companyBadge}>
160
- <Text style={styles.companyBadgeText}>
161
- {`${connectionCount} ${tt('connections_label', 'connections') || 'conexoes'}`}
162
- </Text>
163
- </View>
164
- </View>
165
-
166
- <TouchableOpacity
167
- activeOpacity={0.92}
168
- onPress={openWhatsAppChannel}
169
- style={[styles.channelCard, shadowStyle]}>
170
- <View style={styles.channelTopRow}>
171
- <View
172
- style={[
173
- styles.channelIconWrap,
174
- { backgroundColor: withOpacity(brandColors.success, 0.12) },
175
- ]}>
176
- <Icon name="message-circle" size={20} color={brandColors.success} />
177
- </View>
178
- <View style={styles.channelStatusPill}>
179
- <Text style={styles.channelStatusText}>
180
- {connectionCount > 0
181
- ? `${connectionCount} ${tt('connections_status', 'configured') || 'configurada(s)'}`
182
- : tt('connections_status', 'readyToConfigure') || 'Pronta para configurar'}
183
- </Text>
184
- </View>
185
- </View>
186
- <Text style={styles.channelTitle}>
187
- {tt('connections_label', 'whatsApp') || 'WhatsApp'}
188
- </Text>
189
- <Text style={styles.channelDescription}>
190
- {tt('connections_text', 'whatsApp') ||
191
- 'Conecte numeros, acompanhe status e gere o QR Code de autenticacao.'}
192
- </Text>
193
- <View style={styles.actionRow}>
194
- <Text style={styles.actionText}>
195
- {tt('connections_button', 'openChannel') || 'Abrir canal'}
196
- </Text>
197
- <Icon name="arrow-right" size={18} color={brandColors.primary} />
198
- </View>
199
- </TouchableOpacity>
200
-
201
- <View style={{ flex: 1, marginTop: 12 }}>
123
+ <View style={{ flex: 1, paddingHorizontal: 12, paddingTop: 8 }}>
202
124
  <DefaultTable
203
125
  storeName="connections"
204
126
  requestParams={requestParams}
205
- initialViewMode="cards"
127
+ initialViewMode="table"
206
128
  forceCardsOnCompact
207
129
  showToolbar
208
130
  showRowActions={false}
@@ -219,7 +141,7 @@ export default function Connections() {
219
141
  accentColor={brandColors.primary}
220
142
  onAdd={openWhatsAppChannel}
221
143
  add
222
- addLabel={tt('connections_button', 'openChannel') || 'Abrir canal'}
144
+ addLabel={tt('connections_button', 'openChannel') || 'Configurar WhatsApp'}
223
145
  />
224
146
  </View>
225
147
  </SafeAreaView>