@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,219 +1,219 @@
1
- import React from 'react';
2
- import {
3
- ActivityIndicator,
4
- Text,
5
- TextInput,
6
- TouchableOpacity,
7
- View,
8
- } from 'react-native';
9
- import Icon from 'react-native-vector-icons/Feather';
10
- import { colors } from '@controleonline/../../src/styles/colors';
11
-
12
- import {withOpacity} from '@controleonline/../../src/styles/branding';
13
- import CompactFilterSelector from '@controleonline/ui-default/src/react/components/filters/CompactFilterSelector';
14
-
15
- import {
16
- normalizeMarketplaceCatalogProduct,
17
- normalizeMarketplaceCatalogTabProps,
18
- } from '../../MarketplaceIntegrationPage/utils';
19
- import MarketplaceProductCard from '../../MarketplaceIntegrationPage/components/MarketplaceProductCard';
20
- import styles from '../styles';
21
- import {
22
- filterTabs,
23
- MINIMUM_REQUIRED_ITEMS as DEFAULT_MINIMUM_REQUIRED_ITEMS,
24
- } from '../utils';
25
-
26
- const resolveButtonPalette = (palette, accentColor) => {
27
- const primaryBackground =
28
- palette.buttonBackground || accentColor || palette.primary;
29
- const primaryBorder = palette.buttonBorder || primaryBackground;
30
- const primaryText = palette.buttonText || palette.white;
31
- const primaryIcon = palette.buttonIcon || primaryText;
32
- const disabledBackground =
33
- palette.buttonDisabledBackground || palette.border;
34
- const disabledBorder = palette.buttonBorderSecondary || palette.border;
35
- const disabledText = palette.buttonDisabledText || palette.textSecondary;
36
-
37
- return {
38
- primaryBackground,
39
- primaryBorder,
40
- primaryText,
41
- primaryIcon,
42
- disabledBackground,
43
- disabledBorder,
44
- disabledText,
45
- };
46
- };
47
-
48
- // Aba separada para seleção e publicação do catálogo 99Food.
49
- export default function Food99CatalogTab(props) {
50
- const {
51
- shadowStyle,
52
- accentColor,
53
- providerKey,
54
- selectionSummaryTone,
55
- search,
56
- setSearch,
57
- filterKey,
58
- setFilterKey,
59
- tabCounts,
60
- productsResponse,
61
- selectedEligibleProducts,
62
- previewLoading,
63
- onPreview,
64
- filteredProducts,
65
- selectedProductSet,
66
- onToggleProduct,
67
- onMarkCardPressHandled,
68
- minimumRequiredItems,
69
- palette = colors,
70
- } = normalizeMarketplaceCatalogTabProps(props, {
71
- providerKey: props?.providerKey || '99food',
72
- defaultMinimumRequiredItems: DEFAULT_MINIMUM_REQUIRED_ITEMS,
73
- });
74
-
75
- const normalizedProducts = React.useMemo(
76
- () =>
77
- filteredProducts.map(product =>
78
- normalizeMarketplaceCatalogProduct(product, providerKey),
79
- ),
80
- [filteredProducts, providerKey],
81
- );
82
-
83
- const filterOptions = filterTabs.map(tab => ({
84
- key: tab.key,
85
- label: `${tab.label} (${tabCounts[tab.key] || 0})`,
86
- }));
87
- const selectedFilterLabel =
88
- filterOptions.find(option => option.key === filterKey)?.label ||
89
- filterOptions[0]?.label ||
90
- 'Todos';
91
- const buttonPalette = resolveButtonPalette(palette, accentColor);
92
- const previewDisabled =
93
- previewLoading || selectedEligibleProducts.length < minimumRequiredItems;
94
-
95
- return (
96
- <View style={[styles.panel, shadowStyle]}>
97
- <View style={styles.panelHeader}>
98
- <View>
99
- <Text style={styles.panelTitle}>Selecao de produtos</Text>
100
- <Text style={styles.panelSubtitle}>
101
- Escolha pelo menos {minimumRequiredItems} produtos elegiveis para o
102
- catalogo.
103
- </Text>
104
- </View>
105
- <View
106
- style={[
107
- styles.selectionBadge,
108
- {backgroundColor: withOpacity(selectionSummaryTone, 0.12)},
109
- ]}>
110
- <Text
111
- style={[styles.selectionBadgeText, {color: selectionSummaryTone}]}>
112
- {selectedEligibleProducts.length}/{minimumRequiredItems}
113
- </Text>
114
- </View>
115
- </View>
116
-
117
- <View style={styles.searchBox}>
118
- <Icon name="search" size={16} color={palette.textSecondary} />
119
- <TextInput
120
- value={search}
121
- onChangeText={setSearch}
122
- placeholder="Buscar produto, categoria ou codigo"
123
- placeholderTextColor={palette.textSecondary}
124
- style={styles.searchInput}
125
- />
126
- </View>
127
-
128
- <CompactFilterSelector
129
- icon="filter"
130
- label={selectedFilterLabel}
131
- title="Produtos do catalogo"
132
- accentColor={accentColor}
133
- active={filterKey !== filterTabs[0]?.key}
134
- options={filterOptions}
135
- selectedKey={filterKey}
136
- onSelect={optionKey => {
137
- setFilterKey(optionKey);
138
- return true;
139
- }}
140
- />
141
-
142
- <View style={styles.selectionSummaryRow}>
143
- <Text style={styles.selectionSummaryText}>
144
- {productsResponse?.eligible_product_count || 0} produtos aptos no
145
- cadastro atual
146
- </Text>
147
- <TouchableOpacity
148
- style={[
149
- styles.previewButton,
150
- {
151
- borderWidth: 1,
152
- borderColor: previewDisabled
153
- ? buttonPalette.disabledBorder
154
- : buttonPalette.primaryBorder,
155
- },
156
- {
157
- backgroundColor:
158
- previewDisabled
159
- ? buttonPalette.disabledBackground
160
- : buttonPalette.primaryBackground,
161
- },
162
- ]}
163
- onPress={onPreview}
164
- disabled={previewDisabled}>
165
- {previewLoading ? (
166
- <ActivityIndicator
167
- size="small"
168
- color={buttonPalette.disabledText}
169
- />
170
- ) : (
171
- <>
172
- <Icon
173
- name="eye"
174
- size={15}
175
- color={
176
- previewDisabled
177
- ? buttonPalette.disabledText
178
- : buttonPalette.primaryIcon
179
- }
180
- />
181
- <Text
182
- style={[
183
- styles.previewButtonText,
184
- {
185
- color: previewDisabled
186
- ? buttonPalette.disabledText
187
- : buttonPalette.primaryText,
188
- },
189
- ]}>
190
- Pre-visualizar menu
191
- </Text>
192
- </>
193
- )}
194
- </TouchableOpacity>
195
- </View>
196
-
197
- {normalizedProducts.length > 0 ? (
198
- <View style={styles.productsList}>
199
- {normalizedProducts.map(product => (
200
- <MarketplaceProductCard
201
- key={product.id}
202
- product={product}
203
- accentColor={accentColor}
204
- selected={selectedProductSet.has(String(product.id))}
205
- onPress={onToggleProduct}
206
- onMarkCardPressHandled={onMarkCardPressHandled}
207
- />
208
- ))}
209
- </View>
210
- ) : (
211
- <View style={styles.emptyProducts}>
212
- <Text style={styles.emptyProductsText}>
213
- Nenhum produto encontrado para este filtro.
214
- </Text>
215
- </View>
216
- )}
217
- </View>
218
- );
219
- }
1
+ import React from 'react';
2
+ import {
3
+ ActivityIndicator,
4
+ Text,
5
+ TextInput,
6
+ TouchableOpacity,
7
+ View,
8
+ } from 'react-native';
9
+ import Icon from 'react-native-vector-icons/Feather';
10
+ import { colors } from '@controleonline/ui-layout/src/styles/colors';
11
+
12
+ import {withOpacity} from '@controleonline/ui-layout/src/styles/branding';
13
+ import CompactFilterSelector from '@controleonline/ui-default/src/react/components/filters/CompactFilterSelector';
14
+
15
+ import {
16
+ normalizeMarketplaceCatalogProduct,
17
+ normalizeMarketplaceCatalogTabProps,
18
+ } from '../../MarketplaceIntegrationPage/utils';
19
+ import MarketplaceProductCard from '../../MarketplaceIntegrationPage/components/MarketplaceProductCard';
20
+ import styles from '../styles';
21
+ import {
22
+ filterTabs,
23
+ MINIMUM_REQUIRED_ITEMS as DEFAULT_MINIMUM_REQUIRED_ITEMS,
24
+ } from '../utils';
25
+
26
+ const resolveButtonPalette = (palette, accentColor) => {
27
+ const primaryBackground =
28
+ palette.buttonBackground || accentColor || palette.primary;
29
+ const primaryBorder = palette.buttonBorder || primaryBackground;
30
+ const primaryText = palette.buttonText || palette.white;
31
+ const primaryIcon = palette.buttonIcon || primaryText;
32
+ const disabledBackground =
33
+ palette.buttonDisabledBackground || palette.border;
34
+ const disabledBorder = palette.buttonBorderSecondary || palette.border;
35
+ const disabledText = palette.buttonDisabledText || palette.textSecondary;
36
+
37
+ return {
38
+ primaryBackground,
39
+ primaryBorder,
40
+ primaryText,
41
+ primaryIcon,
42
+ disabledBackground,
43
+ disabledBorder,
44
+ disabledText,
45
+ };
46
+ };
47
+
48
+ // Aba separada para seleção e publicação do catálogo 99Food.
49
+ export default function Food99CatalogTab(props) {
50
+ const {
51
+ shadowStyle,
52
+ accentColor,
53
+ providerKey,
54
+ selectionSummaryTone,
55
+ search,
56
+ setSearch,
57
+ filterKey,
58
+ setFilterKey,
59
+ tabCounts,
60
+ productsResponse,
61
+ selectedEligibleProducts,
62
+ previewLoading,
63
+ onPreview,
64
+ filteredProducts,
65
+ selectedProductSet,
66
+ onToggleProduct,
67
+ onMarkCardPressHandled,
68
+ minimumRequiredItems,
69
+ palette = colors,
70
+ } = normalizeMarketplaceCatalogTabProps(props, {
71
+ providerKey: props?.providerKey || '99food',
72
+ defaultMinimumRequiredItems: DEFAULT_MINIMUM_REQUIRED_ITEMS,
73
+ });
74
+
75
+ const normalizedProducts = React.useMemo(
76
+ () =>
77
+ filteredProducts.map(product =>
78
+ normalizeMarketplaceCatalogProduct(product, providerKey),
79
+ ),
80
+ [filteredProducts, providerKey],
81
+ );
82
+
83
+ const filterOptions = filterTabs.map(tab => ({
84
+ key: tab.key,
85
+ label: `${tab.label} (${tabCounts[tab.key] || 0})`,
86
+ }));
87
+ const selectedFilterLabel =
88
+ filterOptions.find(option => option.key === filterKey)?.label ||
89
+ filterOptions[0]?.label ||
90
+ 'Todos';
91
+ const buttonPalette = resolveButtonPalette(palette, accentColor);
92
+ const previewDisabled =
93
+ previewLoading || selectedEligibleProducts.length < minimumRequiredItems;
94
+
95
+ return (
96
+ <View style={[styles.panel, shadowStyle]}>
97
+ <View style={styles.panelHeader}>
98
+ <View>
99
+ <Text style={styles.panelTitle}>Selecao de produtos</Text>
100
+ <Text style={styles.panelSubtitle}>
101
+ Escolha pelo menos {minimumRequiredItems} produtos elegiveis para o
102
+ catalogo.
103
+ </Text>
104
+ </View>
105
+ <View
106
+ style={[
107
+ styles.selectionBadge,
108
+ {backgroundColor: withOpacity(selectionSummaryTone, 0.12)},
109
+ ]}>
110
+ <Text
111
+ style={[styles.selectionBadgeText, {color: selectionSummaryTone}]}>
112
+ {selectedEligibleProducts.length}/{minimumRequiredItems}
113
+ </Text>
114
+ </View>
115
+ </View>
116
+
117
+ <View style={styles.searchBox}>
118
+ <Icon name="search" size={16} color={palette.textSecondary} />
119
+ <TextInput
120
+ value={search}
121
+ onChangeText={setSearch}
122
+ placeholder="Buscar produto, categoria ou codigo"
123
+ placeholderTextColor={palette.textSecondary}
124
+ style={styles.searchInput}
125
+ />
126
+ </View>
127
+
128
+ <CompactFilterSelector
129
+ icon="filter"
130
+ label={selectedFilterLabel}
131
+ title="Produtos do catalogo"
132
+ accentColor={accentColor}
133
+ active={filterKey !== filterTabs[0]?.key}
134
+ options={filterOptions}
135
+ selectedKey={filterKey}
136
+ onSelect={optionKey => {
137
+ setFilterKey(optionKey);
138
+ return true;
139
+ }}
140
+ />
141
+
142
+ <View style={styles.selectionSummaryRow}>
143
+ <Text style={styles.selectionSummaryText}>
144
+ {productsResponse?.eligible_product_count || 0} produtos aptos no
145
+ cadastro atual
146
+ </Text>
147
+ <TouchableOpacity
148
+ style={[
149
+ styles.previewButton,
150
+ {
151
+ borderWidth: 1,
152
+ borderColor: previewDisabled
153
+ ? buttonPalette.disabledBorder
154
+ : buttonPalette.primaryBorder,
155
+ },
156
+ {
157
+ backgroundColor:
158
+ previewDisabled
159
+ ? buttonPalette.disabledBackground
160
+ : buttonPalette.primaryBackground,
161
+ },
162
+ ]}
163
+ onPress={onPreview}
164
+ disabled={previewDisabled}>
165
+ {previewLoading ? (
166
+ <ActivityIndicator
167
+ size="small"
168
+ color={buttonPalette.disabledText}
169
+ />
170
+ ) : (
171
+ <>
172
+ <Icon
173
+ name="eye"
174
+ size={15}
175
+ color={
176
+ previewDisabled
177
+ ? buttonPalette.disabledText
178
+ : buttonPalette.primaryIcon
179
+ }
180
+ />
181
+ <Text
182
+ style={[
183
+ styles.previewButtonText,
184
+ {
185
+ color: previewDisabled
186
+ ? buttonPalette.disabledText
187
+ : buttonPalette.primaryText,
188
+ },
189
+ ]}>
190
+ Pre-visualizar menu
191
+ </Text>
192
+ </>
193
+ )}
194
+ </TouchableOpacity>
195
+ </View>
196
+
197
+ {normalizedProducts.length > 0 ? (
198
+ <View style={styles.productsList}>
199
+ {normalizedProducts.map(product => (
200
+ <MarketplaceProductCard
201
+ key={product.id}
202
+ product={product}
203
+ accentColor={accentColor}
204
+ selected={selectedProductSet.has(String(product.id))}
205
+ onPress={onToggleProduct}
206
+ onMarkCardPressHandled={onMarkCardPressHandled}
207
+ />
208
+ ))}
209
+ </View>
210
+ ) : (
211
+ <View style={styles.emptyProducts}>
212
+ <Text style={styles.emptyProductsText}>
213
+ Nenhum produto encontrado para este filtro.
214
+ </Text>
215
+ </View>
216
+ )}
217
+ </View>
218
+ );
219
+ }