@controleonline/ui-common 1.2.134 → 1.2.135

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.
Files changed (66) hide show
  1. package/.release/rc-manifest.json +12 -5
  2. package/package.json +6 -2
  3. package/src/react/components/CategoryForm.js +539 -539
  4. package/src/react/components/DefaultProvider.native.js +2 -2
  5. package/src/react/components/DefaultProvider.web.js +2 -2
  6. package/src/react/components/LinkedOrderProductsTab.js +17 -8
  7. package/src/react/components/LinkedOrderProductsTab.styles.js +15 -0
  8. package/src/react/components/documentDetails/DocumentDetailsShell.js +147 -0
  9. package/src/react/components/documentDetails/DocumentDetailsShell.styles.js +163 -0
  10. package/src/react/components/documentDetails/DocumentSheet.js +87 -0
  11. package/src/react/components/integrations/IntegrationHero/index.js +1 -1
  12. package/src/react/components/integrations/IntegrationHero/styles.js +2 -2
  13. package/src/react/components/integrations/IntegrationTabs/index.js +1 -1
  14. package/src/react/components/integrations/IntegrationTabs/styles.js +1 -1
  15. package/src/react/hooks/useLinkedOrderSummary.js +41 -0
  16. package/src/react/pages/Connections.styles.js +72 -72
  17. package/src/react/pages/Devices/detail/DeviceDetailHeader.js +1 -1
  18. package/src/react/pages/Devices/detail/DeviceDetailMovementSections.js +1 -1
  19. package/src/react/pages/Devices/detail/useDeviceDetailStateA.js +2 -2
  20. package/src/react/pages/Devices/detail/useDeviceDetailStateB.js +2 -2
  21. package/src/react/pages/Devices/deviceTypes/DeviceGroupCard.js +1 -1
  22. package/src/react/pages/Devices/deviceTypes/shared.js +2 -2
  23. package/src/react/pages/Devices.js +2 -2
  24. package/src/react/pages/Devices.styles.js +353 -353
  25. package/src/react/pages/Food99IntegrationPage/components/Food99CatalogTab.js +219 -219
  26. package/src/react/pages/Food99IntegrationPage/components/Food99OverviewTab.js +134 -134
  27. package/src/react/pages/Food99IntegrationPage/components/Food99PreviewModal.js +173 -173
  28. package/src/react/pages/Food99IntegrationPage/components/Food99QuickWalletModal.js +1 -1
  29. package/src/react/pages/Food99IntegrationPage/components/Food99SettingsTab.js +306 -306
  30. package/src/react/pages/Food99IntegrationPage/components/Food99StoreTab.js +417 -417
  31. package/src/react/pages/Food99IntegrationPage/index.js +1530 -1530
  32. package/src/react/pages/Food99IntegrationPage/styles.js +792 -792
  33. package/src/react/pages/IFoodIntegrationPage/components/IFoodOperationsTab.js +267 -267
  34. package/src/react/pages/IFoodIntegrationPage/components/IFoodOverviewTab.js +118 -118
  35. package/src/react/pages/IFoodIntegrationPage/components/IFoodPreviewModal.js +101 -101
  36. package/src/react/pages/IFoodIntegrationPage/components/IFoodStoreTab.js +150 -150
  37. package/src/react/pages/IFoodIntegrationPage/index.js +1298 -1298
  38. package/src/react/pages/Imports.js +1 -1
  39. package/src/react/pages/Imports.styles.js +223 -223
  40. package/src/react/pages/IntegrationConfigPage.js +2 -2
  41. package/src/react/pages/Integrations.js +2 -15
  42. package/src/react/pages/Integrations.styles.js +130 -130
  43. package/src/react/pages/LinkedInIntegrationPage.js +2 -2
  44. package/src/react/pages/ManagerOrderNotificationsPage.js +642 -642
  45. package/src/react/pages/MarketplaceIntegrationPage/components/MarketplaceProductCard.js +205 -205
  46. package/src/react/pages/MercadoLivreIntegrationPage.js +2 -2
  47. package/src/react/pages/PrinterDeviceDetailPage.js +1915 -1915
  48. package/src/react/pages/PrinterDeviceFormPage.js +2 -2
  49. package/src/react/pages/WhatsAppConnectionPage.styles.js +315 -279
  50. package/src/react/pages/WhatsAppProviderForm.js +1 -1
  51. package/src/react/pages/whatsAppConnectionHelpers.js +38 -10
  52. package/src/react/router/__tests__/publicRoutes.test.js +12 -0
  53. package/src/react/router/publicRoutes.js +3 -0
  54. package/src/react/utils/clientPortfolioParams.js +42 -0
  55. package/src/react/utils/commercialDocumentOrders.js +13 -20
  56. package/src/react/utils/documentFileContent.js +61 -0
  57. package/src/react/utils/fileUrl.js +1 -1
  58. package/src/react/utils/linkedOrderPayload.js +43 -0
  59. package/src/react/utils/orderProductsSummary.js +28 -0
  60. package/src/react/utils/peopleDisplay.js +8 -13
  61. package/src/store/connections/customActions.js +16 -14
  62. package/src/store/connections/index.js +109 -105
  63. package/src/tests/react/utils/clientPortfolioParams.test.js +30 -0
  64. package/src/tests/react/utils/documentFileContent.test.js +29 -0
  65. package/src/tests/react/utils/linkedOrderPayload.test.js +46 -0
  66. package/src/tests/react/utils/orderProductsSummary.test.js +24 -0
@@ -1,205 +1,205 @@
1
- import React, {useState} from 'react';
2
- import {Text, TouchableOpacity, View} from 'react-native';
3
- import Icon from 'react-native-vector-icons/Feather';
4
-
5
- import {withOpacity} from '@controleonline/../../src/styles/branding';
6
-
7
- import styles from '../../Food99IntegrationPage/styles';
8
-
9
- // Card compartilhado para o catálogo de marketplace.
10
- export default function MarketplaceProductCard({
11
- product,
12
- selected,
13
- accentColor,
14
- onPress,
15
- onMarkCardPressHandled,
16
- }) {
17
- const eligible = Boolean(product?.eligible);
18
- const published = Boolean(product?.published);
19
- const childGroups = Array.isArray(product?.children) ? product.children : [];
20
- const childCount = childGroups.reduce(
21
- (total, group) =>
22
- total + (Array.isArray(group.items) ? group.items.length : 0),
23
- 0,
24
- );
25
- const [childrenExpanded, setChildrenExpanded] = useState(false);
26
-
27
- const handleToggleChildren = event => {
28
- event?.preventDefault?.();
29
- event?.stopPropagation?.();
30
- onMarkCardPressHandled?.();
31
- setChildrenExpanded(current => !current);
32
- };
33
-
34
- return (
35
- <TouchableOpacity
36
- style={[
37
- styles.productCard,
38
- selected && {
39
- borderColor: accentColor,
40
- backgroundColor: withOpacity(accentColor, 0.04),
41
- },
42
- ]}
43
- activeOpacity={0.88}
44
- onPress={() => onPress?.(product?.sourceProduct || product)}>
45
- <View style={styles.productMain}>
46
- <View
47
- style={[
48
- styles.productStatusIcon,
49
- {backgroundColor: eligible ? '#DCFCE7' : '#FEE2E2'},
50
- ]}>
51
- <Icon
52
- name={selected ? 'check-circle' : eligible ? 'circle' : 'x-circle'}
53
- size={16}
54
- color={selected ? accentColor : eligible ? '#16A34A' : '#DC2626'}
55
- />
56
- </View>
57
-
58
- <View style={styles.productContent}>
59
- <View style={styles.productTitleRow}>
60
- <Text style={styles.productName} numberOfLines={1}>
61
- {product?.name}
62
- </Text>
63
- <Text style={styles.productPrice}>
64
- R$ {Number(product?.price || 0).toFixed(2)}
65
- </Text>
66
- </View>
67
-
68
- <Text style={styles.productMeta} numberOfLines={1}>
69
- {product?.categoryName || 'Sem categoria'} •{' '}
70
- {product?.productType || 'produto'}
71
- </Text>
72
-
73
- {!!product?.description && (
74
- <Text style={styles.productDescription} numberOfLines={1}>
75
- {product.description}
76
- </Text>
77
- )}
78
-
79
- {product?.code ? (
80
- <Text style={styles.productCode}>
81
- {product?.codeLabel || 'Codigo'}: {product.code}
82
- </Text>
83
- ) : (
84
- <Text style={styles.productCode}>
85
- {product?.noCodeLabel || 'Sem codigo'}
86
- </Text>
87
- )}
88
-
89
- {published && (
90
- <Text style={styles.productRemoteState}>
91
- {product?.publishedLabel || 'Ja publicado no catalogo'}
92
- </Text>
93
- )}
94
-
95
- {!eligible &&
96
- Array.isArray(product?.blockers) &&
97
- product.blockers.length > 0 && (
98
- <Text style={styles.productBlocker}>
99
- {product.blockers.join(' • ')}
100
- </Text>
101
- )}
102
-
103
- {childCount > 0 && (
104
- <TouchableOpacity
105
- activeOpacity={0.8}
106
- onPressIn={onMarkCardPressHandled}
107
- onPress={handleToggleChildren}
108
- style={[
109
- styles.productDisclosureButton,
110
- {
111
- borderColor: accentColor,
112
- backgroundColor: withOpacity(accentColor, 0.08),
113
- },
114
- ]}>
115
- <Text
116
- style={[
117
- styles.productDisclosureButtonText,
118
- {color: accentColor},
119
- ]}>
120
- {childrenExpanded
121
- ? 'Ocultar filhos'
122
- : `Mostrar filhos (${childCount})`}
123
- </Text>
124
- <Icon
125
- name={childrenExpanded ? 'chevron-up' : 'chevron-down'}
126
- size={14}
127
- color={accentColor}
128
- />
129
- </TouchableOpacity>
130
- )}
131
-
132
- {childrenExpanded && childCount > 0 && (
133
- <View style={styles.childrenSection}>
134
- <Text style={styles.childrenSectionLabel}>
135
- {product?.childrenSectionLabel || 'Filhos consultados'}
136
- </Text>
137
-
138
- {childGroups.map(group => {
139
- const groupItems = Array.isArray(group.items)
140
- ? group.items
141
- : [];
142
- const requiredLabel = group.required
143
- ? 'Obrigatorio'
144
- : 'Opcional';
145
- const rangeParts = [];
146
-
147
- if (Number(group.minimum ?? 0) > 0) {
148
- rangeParts.push(`min ${group.minimum}`);
149
- }
150
-
151
- if (Number(group.maximum ?? 0) > 0) {
152
- rangeParts.push(`max ${group.maximum}`);
153
- }
154
-
155
- const groupMeta = [requiredLabel, ...rangeParts].join(' • ');
156
-
157
- return (
158
- <View
159
- key={`${group.id ?? group.name}`}
160
- style={styles.childGroupCard}>
161
- <View style={styles.childGroupHeader}>
162
- <Text style={styles.childGroupTitle} numberOfLines={1}>
163
- {group.name}
164
- </Text>
165
- <Text style={styles.childGroupMeta} numberOfLines={1}>
166
- {groupMeta}
167
- </Text>
168
- </View>
169
-
170
- <View style={styles.childItemsList}>
171
- {groupItems.map(item => (
172
- <View
173
- key={`${item.id ?? item.code ?? item.name}`}
174
- style={styles.childItemRow}>
175
- <View style={styles.childItemContent}>
176
- <Text
177
- style={styles.childItemName}
178
- numberOfLines={1}>
179
- {item.name}
180
- </Text>
181
- <Text
182
- style={styles.childItemMeta}
183
- numberOfLines={1}>
184
- {item.code
185
- ? `${product?.childItemCodeLabel || 'Codigo'}: ${item.code}`
186
- : product?.childItemNoCodeLabel || 'Sem codigo'}
187
- {item.description ? ` • ${item.description}` : ''}
188
- </Text>
189
- </View>
190
- <Text style={styles.childItemPrice}>
191
- R$ {Number(item.price || 0).toFixed(2)}
192
- </Text>
193
- </View>
194
- ))}
195
- </View>
196
- </View>
197
- );
198
- })}
199
- </View>
200
- )}
201
- </View>
202
- </View>
203
- </TouchableOpacity>
204
- );
205
- }
1
+ import React, {useState} from 'react';
2
+ import {Text, TouchableOpacity, View} from 'react-native';
3
+ import Icon from 'react-native-vector-icons/Feather';
4
+
5
+ import {withOpacity} from '@controleonline/ui-layout/src/styles/branding';
6
+
7
+ import styles from '../../Food99IntegrationPage/styles';
8
+
9
+ // Card compartilhado para o catálogo de marketplace.
10
+ export default function MarketplaceProductCard({
11
+ product,
12
+ selected,
13
+ accentColor,
14
+ onPress,
15
+ onMarkCardPressHandled,
16
+ }) {
17
+ const eligible = Boolean(product?.eligible);
18
+ const published = Boolean(product?.published);
19
+ const childGroups = Array.isArray(product?.children) ? product.children : [];
20
+ const childCount = childGroups.reduce(
21
+ (total, group) =>
22
+ total + (Array.isArray(group.items) ? group.items.length : 0),
23
+ 0,
24
+ );
25
+ const [childrenExpanded, setChildrenExpanded] = useState(false);
26
+
27
+ const handleToggleChildren = event => {
28
+ event?.preventDefault?.();
29
+ event?.stopPropagation?.();
30
+ onMarkCardPressHandled?.();
31
+ setChildrenExpanded(current => !current);
32
+ };
33
+
34
+ return (
35
+ <TouchableOpacity
36
+ style={[
37
+ styles.productCard,
38
+ selected && {
39
+ borderColor: accentColor,
40
+ backgroundColor: withOpacity(accentColor, 0.04),
41
+ },
42
+ ]}
43
+ activeOpacity={0.88}
44
+ onPress={() => onPress?.(product?.sourceProduct || product)}>
45
+ <View style={styles.productMain}>
46
+ <View
47
+ style={[
48
+ styles.productStatusIcon,
49
+ {backgroundColor: eligible ? '#DCFCE7' : '#FEE2E2'},
50
+ ]}>
51
+ <Icon
52
+ name={selected ? 'check-circle' : eligible ? 'circle' : 'x-circle'}
53
+ size={16}
54
+ color={selected ? accentColor : eligible ? '#16A34A' : '#DC2626'}
55
+ />
56
+ </View>
57
+
58
+ <View style={styles.productContent}>
59
+ <View style={styles.productTitleRow}>
60
+ <Text style={styles.productName} numberOfLines={1}>
61
+ {product?.name}
62
+ </Text>
63
+ <Text style={styles.productPrice}>
64
+ R$ {Number(product?.price || 0).toFixed(2)}
65
+ </Text>
66
+ </View>
67
+
68
+ <Text style={styles.productMeta} numberOfLines={1}>
69
+ {product?.categoryName || 'Sem categoria'} •{' '}
70
+ {product?.productType || 'produto'}
71
+ </Text>
72
+
73
+ {!!product?.description && (
74
+ <Text style={styles.productDescription} numberOfLines={1}>
75
+ {product.description}
76
+ </Text>
77
+ )}
78
+
79
+ {product?.code ? (
80
+ <Text style={styles.productCode}>
81
+ {product?.codeLabel || 'Codigo'}: {product.code}
82
+ </Text>
83
+ ) : (
84
+ <Text style={styles.productCode}>
85
+ {product?.noCodeLabel || 'Sem codigo'}
86
+ </Text>
87
+ )}
88
+
89
+ {published && (
90
+ <Text style={styles.productRemoteState}>
91
+ {product?.publishedLabel || 'Ja publicado no catalogo'}
92
+ </Text>
93
+ )}
94
+
95
+ {!eligible &&
96
+ Array.isArray(product?.blockers) &&
97
+ product.blockers.length > 0 && (
98
+ <Text style={styles.productBlocker}>
99
+ {product.blockers.join(' • ')}
100
+ </Text>
101
+ )}
102
+
103
+ {childCount > 0 && (
104
+ <TouchableOpacity
105
+ activeOpacity={0.8}
106
+ onPressIn={onMarkCardPressHandled}
107
+ onPress={handleToggleChildren}
108
+ style={[
109
+ styles.productDisclosureButton,
110
+ {
111
+ borderColor: accentColor,
112
+ backgroundColor: withOpacity(accentColor, 0.08),
113
+ },
114
+ ]}>
115
+ <Text
116
+ style={[
117
+ styles.productDisclosureButtonText,
118
+ {color: accentColor},
119
+ ]}>
120
+ {childrenExpanded
121
+ ? 'Ocultar filhos'
122
+ : `Mostrar filhos (${childCount})`}
123
+ </Text>
124
+ <Icon
125
+ name={childrenExpanded ? 'chevron-up' : 'chevron-down'}
126
+ size={14}
127
+ color={accentColor}
128
+ />
129
+ </TouchableOpacity>
130
+ )}
131
+
132
+ {childrenExpanded && childCount > 0 && (
133
+ <View style={styles.childrenSection}>
134
+ <Text style={styles.childrenSectionLabel}>
135
+ {product?.childrenSectionLabel || 'Filhos consultados'}
136
+ </Text>
137
+
138
+ {childGroups.map(group => {
139
+ const groupItems = Array.isArray(group.items)
140
+ ? group.items
141
+ : [];
142
+ const requiredLabel = group.required
143
+ ? 'Obrigatorio'
144
+ : 'Opcional';
145
+ const rangeParts = [];
146
+
147
+ if (Number(group.minimum ?? 0) > 0) {
148
+ rangeParts.push(`min ${group.minimum}`);
149
+ }
150
+
151
+ if (Number(group.maximum ?? 0) > 0) {
152
+ rangeParts.push(`max ${group.maximum}`);
153
+ }
154
+
155
+ const groupMeta = [requiredLabel, ...rangeParts].join(' • ');
156
+
157
+ return (
158
+ <View
159
+ key={`${group.id ?? group.name}`}
160
+ style={styles.childGroupCard}>
161
+ <View style={styles.childGroupHeader}>
162
+ <Text style={styles.childGroupTitle} numberOfLines={1}>
163
+ {group.name}
164
+ </Text>
165
+ <Text style={styles.childGroupMeta} numberOfLines={1}>
166
+ {groupMeta}
167
+ </Text>
168
+ </View>
169
+
170
+ <View style={styles.childItemsList}>
171
+ {groupItems.map(item => (
172
+ <View
173
+ key={`${item.id ?? item.code ?? item.name}`}
174
+ style={styles.childItemRow}>
175
+ <View style={styles.childItemContent}>
176
+ <Text
177
+ style={styles.childItemName}
178
+ numberOfLines={1}>
179
+ {item.name}
180
+ </Text>
181
+ <Text
182
+ style={styles.childItemMeta}
183
+ numberOfLines={1}>
184
+ {item.code
185
+ ? `${product?.childItemCodeLabel || 'Codigo'}: ${item.code}`
186
+ : product?.childItemNoCodeLabel || 'Sem codigo'}
187
+ {item.description ? ` • ${item.description}` : ''}
188
+ </Text>
189
+ </View>
190
+ <Text style={styles.childItemPrice}>
191
+ R$ {Number(item.price || 0).toFixed(2)}
192
+ </Text>
193
+ </View>
194
+ ))}
195
+ </View>
196
+ </View>
197
+ );
198
+ })}
199
+ </View>
200
+ )}
201
+ </View>
202
+ </View>
203
+ </TouchableOpacity>
204
+ );
205
+ }
@@ -16,11 +16,11 @@ import Icon from 'react-native-vector-icons/Feather';
16
16
  import {api} from '@controleonline/ui-common/src/api';
17
17
  import useToastMessage from '@controleonline/ui-crm/src/react/hooks/useToastMessage';
18
18
  import {useStore} from '@store';
19
- import {colors} from '@controleonline/../../src/styles/colors';
19
+ import {colors} from '@controleonline/ui-layout/src/styles/colors';
20
20
  import {
21
21
  resolveThemePalette,
22
22
  withOpacity,
23
- } from '@controleonline/../../src/styles/branding';
23
+ } from '@controleonline/ui-layout/src/styles/branding';
24
24
 
25
25
  import styles from './IntegrationConfigPage.styles';
26
26
  import {