@controleonline/ui-common 1.2.70 → 1.2.75
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/.github/actions/workers/manager/action.yml +147 -0
- package/.github/actions/workers/qa/action.yml +44 -0
- package/.github/actions/workers/security/action.yml +44 -0
- package/.github/actions/workers/technical-documenter/action.yml +51 -0
- package/.github/workflows/manager-worker.yml +168 -0
- package/.github/workflows/publish-npm.yml +45 -0
- package/.gitmodules +3 -0
- package/AGENTS.md +6 -0
- package/README.md +14 -0
- package/package.json +32 -28
- package/src/api/fetch.js +1 -1
- package/src/api/index.js +328 -58
- package/src/react/components/AddImportModal.js +95 -111
- package/src/react/components/AnimatedModal.js +171 -0
- package/src/react/components/AnimatedModal.styles.js +21 -0
- package/src/react/components/AppTypeSwitcher.js +164 -0
- package/src/react/components/AppTypeSwitcher.styles.js +109 -0
- package/src/react/components/BackgroundRuntimeBridge.js +5 -4
- package/src/react/components/BottomNavigationBar.config.js +211 -231
- package/src/react/components/BottomNavigationBar.js +86 -31
- package/src/react/components/BottomNavigationBar.styles.js +118 -110
- package/src/react/components/CategoryForm.js +52 -35
- package/src/react/components/DefaultProvider.native.js +194 -156
- package/src/react/components/DefaultProvider.web.js +188 -112
- package/src/react/components/DeliveryPushBridge.native.js +2 -2
- package/src/react/components/DeviceAlertSoundService.js +3 -3
- package/src/react/components/KioskModeBridge.js +2 -2
- package/src/react/components/LauncherModeBridge.js +2 -2
- package/src/react/components/ManagerPushBridge.native.js +2 -2
- package/src/react/components/NetworkPrinterPreviewModal.js +249 -0
- package/src/react/components/NetworkPrinterPreviewModal.styles.js +159 -0
- package/src/react/components/RemoteCheckoutService.js +28 -20
- package/src/react/components/RuntimeBottomNavigationBar.js +146 -119
- package/src/react/components/RuntimeInfoFooter.js +137 -45
- package/src/react/components/RuntimeInfoFooter.styles.js +3 -0
- package/src/react/components/StateStore.js +258 -0
- package/src/react/components/UnifiedPaymentBar.js +7 -4
- package/src/react/components/UserAvatar.js +160 -0
- package/src/react/components/WebsocketListener.native.js +11 -11
- package/src/react/components/integrations/IntegrationHero/index.js +48 -0
- package/src/react/components/integrations/IntegrationHero/styles.js +57 -0
- package/src/react/components/integrations/IntegrationTabs/index.js +89 -0
- package/src/react/components/integrations/IntegrationTabs/styles.js +44 -0
- package/src/react/config/deviceConfigBootstrap.js +71 -30
- package/src/react/css/orders.js +72 -0
- package/src/react/pages/Connections.js +229 -0
- package/src/react/pages/Connections.styles.js +222 -0
- package/src/react/pages/DeviceDetailPage.js +2814 -0
- package/src/react/pages/DeviceDetailPage.styles.js +308 -0
- package/src/react/pages/Devices/currentDevice.js +194 -0
- package/src/react/pages/Devices/deviceTypes/DeviceGroupCard.js +257 -0
- package/src/react/pages/Devices/deviceTypes/all.js +23 -0
- package/src/react/pages/Devices/deviceTypes/device.js +25 -0
- package/src/react/pages/Devices/deviceTypes/deviceListHelpers.js +178 -0
- package/src/react/pages/Devices/deviceTypes/display.js +26 -0
- package/src/react/pages/Devices/deviceTypes/index.js +145 -0
- package/src/react/pages/Devices/deviceTypes/ipCamera.js +35 -0
- package/src/react/pages/Devices/deviceTypes/pdv.js +88 -0
- package/src/react/pages/Devices/deviceTypes/printer.js +37 -0
- package/src/react/pages/Devices/deviceTypes/shared.js +453 -0
- package/src/react/pages/Devices/deviceTypes/useDeviceNetworkConnectivity.js +145 -0
- package/src/react/pages/Devices.js +183 -0
- package/src/react/pages/Devices.styles.js +353 -0
- package/src/react/pages/Food99IntegrationPage/components/Food99CatalogTab.js +219 -0
- package/src/react/pages/Food99IntegrationPage/components/Food99OverviewTab.js +134 -0
- package/src/react/pages/Food99IntegrationPage/components/Food99PreviewModal.js +173 -0
- package/src/react/pages/Food99IntegrationPage/components/Food99ProductCard.js +1 -0
- package/src/react/pages/Food99IntegrationPage/components/Food99QuickWalletModal.js +181 -0
- package/src/react/pages/Food99IntegrationPage/components/Food99SettingsTab.js +306 -0
- package/src/react/pages/Food99IntegrationPage/components/Food99StoreTab.js +417 -0
- package/src/react/pages/Food99IntegrationPage/index.js +1530 -0
- package/src/react/pages/Food99IntegrationPage/styles.js +792 -0
- package/src/react/pages/Food99IntegrationPage/utils.js +155 -0
- package/src/react/pages/Food99IntegrationPage.js +1 -0
- package/src/react/pages/Food99IntegrationPage.styles.js +1 -0
- package/src/react/pages/GenericLogPage.js +42 -167
- package/src/react/pages/IFoodIntegrationPage/components/IFoodCatalogTab.js +8 -0
- package/src/react/pages/IFoodIntegrationPage/components/IFoodOperationsTab.js +420 -0
- package/src/react/pages/IFoodIntegrationPage/components/IFoodOverviewTab.js +118 -0
- package/src/react/pages/IFoodIntegrationPage/components/IFoodPreviewModal.js +103 -0
- package/src/react/pages/IFoodIntegrationPage/components/IFoodProductCard.js +1 -0
- package/src/react/pages/IFoodIntegrationPage/components/IFoodStoreTab.js +150 -0
- package/src/react/pages/IFoodIntegrationPage/index.js +1298 -0
- package/src/react/pages/IFoodIntegrationPage/styles.js +764 -0
- package/src/react/pages/IFoodIntegrationPage/utils.js +91 -0
- package/src/react/pages/IFoodIntegrationPage.js +1 -0
- package/src/react/pages/IFoodIntegrationPage.styles.js +1 -0
- package/src/react/pages/Imports.js +214 -166
- package/src/react/pages/IntegrationConfigPage.js +744 -0
- package/src/react/pages/IntegrationConfigPage.styles.js +269 -0
- package/src/react/pages/Integrations.js +299 -0
- package/src/react/pages/Integrations.styles.js +130 -0
- package/src/react/pages/ManagerOrderNotificationsPage.js +642 -0
- package/src/react/pages/MarketplaceIntegrationPage/components/MarketplaceProductCard.js +205 -0
- package/src/react/pages/MarketplaceIntegrationPage/components/RemoteMarketplaceMenuTab.js +335 -0
- package/src/react/pages/MarketplaceIntegrationPage/index.js +60 -0
- package/src/react/pages/MarketplaceIntegrationPage/utils.js +137 -0
- package/src/react/pages/MercadoLivreIntegrationPage.js +538 -0
- package/src/react/pages/PrinterDeviceDetailPage.js +1916 -0
- package/src/react/pages/PrinterDeviceDetailPage.styles.js +223 -0
- package/src/react/pages/PrinterDeviceFormPage.js +521 -0
- package/src/react/pages/PrinterDeviceFormPage.styles.js +159 -0
- package/src/react/pages/SettingsPage/PaymentTypesByWalletTab.js +484 -454
- package/src/react/pages/SettingsPage/index.js +1266 -1167
- package/src/react/pages/WhatsAppConnectionPage.js +459 -0
- package/src/react/pages/WhatsAppConnectionPage.styles.js +284 -0
- package/src/react/pages/integrationsCatalog.js +399 -0
- package/src/react/print/providers/local.js +1 -1
- package/src/react/router/publicRoutes.js +25 -0
- package/src/react/services/Cielo/Checkout.js +39 -0
- package/src/react/services/Cielo/Cielo.js +193 -0
- package/src/react/services/Cielo/Print.js +7 -0
- package/src/react/services/InfinitePay/Checkout.js +33 -0
- package/src/react/services/InfinitePay/InfinitePay.js +24 -0
- package/src/react/{utils → services}/paymentGatewayExecution.js +91 -91
- package/src/react/styles/global.js +115 -0
- package/src/react/utils/categoryContexts.js +46 -0
- package/src/react/utils/entityDisplay.js +222 -217
- package/src/react/utils/fileUrl.js +201 -16
- package/src/react/utils/integrationPage.js +16 -0
- package/src/react/utils/menuNavigation.js +31 -0
- package/src/react/utils/orderIdentity.js +277 -0
- package/src/react/utils/remotePayment.js +115 -61
- package/src/react/utils/runtimeFooter.js +40 -22
- package/src/react/utils/runtimeLanguage.js +50 -9
- package/src/react/utils/runtimeMenu.js +190 -98
- package/src/react/utils/runtimeZoom.js +43 -0
- package/src/react/utils/shopConfig.js +72 -34
- package/src/react/utils/shopFranchises.js +182 -23
- package/src/react/utils/socketRuntimePipeline.js +14 -14
- package/src/react/utils/storeColumns.js +23 -4
- package/src/react/utils/userAvatar.js +104 -0
- package/src/store/categories/index.js +48 -20
- package/src/store/configs/index.js +2 -2
- package/src/store/device_config/index.js +62 -21
- package/src/store/entity_log/index.js +22 -1
- package/src/store/imports/customActions.js +51 -0
- package/src/store/imports/index.js +89 -88
- package/src/store/status/index.js +11 -11
- package/src/store/themes/index.js +22 -0
- package/src/store/timezones/index.js +3 -1
- package/src/tests/browser/manager/connections.spec.js +143 -0
- package/src/tests/browser/manager/devices-current.spec.js +343 -0
- package/src/tests/browser/manager/mercado-livre-integration.spec.js +268 -0
- package/src/tests/react/api/deviceHeaders.test.js +114 -0
- package/src/tests/react/api/loadSmokeIndex.test.js +75 -0
- package/src/tests/react/components/AddImportModal.test.js +166 -0
- package/src/tests/react/components/BottomNavigationBar.config.test.js +20 -0
- package/src/tests/react/components/UserAvatar.test.js +52 -0
- package/src/tests/react/config/deviceConfigBootstrap.test.js +47 -0
- package/src/tests/react/pages/DevicePickerStyles.test.js +47 -0
- package/src/tests/react/pages/Devices/deviceListHelpers.test.js +39 -0
- package/src/tests/react/pages/DevicesCurrentDevice.test.js +198 -0
- package/src/tests/react/pages/connectionsHelpers.test.js +34 -0
- package/src/tests/react/pages/mercadoLivreIntegrationPageContract.test.mjs +16 -0
- package/src/tests/react/print/localPrintProvider.test.js +1 -1
- package/src/tests/react/services/Cielo.test.js +190 -0
- package/src/tests/react/store/categoriesOrdering.test.js +26 -0
- package/src/tests/react/utils/appDomain.test.js +62 -0
- package/src/tests/react/utils/entityDisplay.test.js +2 -2
- package/src/tests/react/utils/fileUrl.test.js +62 -0
- package/src/tests/react/utils/formatter.test.mjs +33 -0
- package/src/tests/react/utils/importStatus.test.js +2 -2
- package/src/tests/react/utils/orderIdentity.test.js +139 -0
- package/src/tests/react/utils/remotePayment.test.js +62 -0
- package/src/tests/react/utils/runtimeFooter.test.js +32 -9
- package/src/tests/react/utils/runtimeLanguage.test.js +80 -10
- package/src/tests/react/utils/runtimeMenu.test.js +195 -111
- package/src/tests/react/utils/runtimeZoom.test.js +38 -0
- package/src/tests/react/utils/shopConfig.test.js +75 -0
- package/src/tests/react/utils/shopFranchises.test.js +122 -12
- package/src/tests/react/utils/translate.discovery.test.mjs +170 -0
- package/src/tests/react/utils/translate.test.helpers.mjs +152 -0
- package/src/tests/react/utils/translate.test.mjs +252 -396
- package/src/tests/react/utils/userAvatar.test.js +63 -0
- package/src/utils/appDomain.js +15 -4
- package/src/utils/formatter.js +122 -16
- package/src/utils/integrationConfigs.js +1 -0
- package/src/utils/translate.js +277 -398
- package/src/utils/translateDiscovery.js +96 -0
- package/src/utils/translateNormalize.js +33 -0
- package/src/utils/translatePending.js +92 -0
- package/src/utils/translateStorage.js +142 -0
- package/.github/agents/developer.agent.md +0 -30
- package/.github/agents/devops.agent.md +0 -30
- package/.github/agents/qa.agent.md +0 -30
- package/.github/agents/security.agent.md +0 -30
- package/.github/workflows/npmjs.yml +0 -35
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
const translateLabel = (translate, descriptor) => {
|
|
2
|
-
if (!descriptor || typeof descriptor === 'string') {
|
|
3
|
-
return descriptor || '';
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const translated = translate?.(
|
|
7
|
-
descriptor.store,
|
|
8
|
-
descriptor.type,
|
|
9
|
-
descriptor.key,
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
return translated || descriptor.fallback || descriptor.key || '';
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const resolveBottomNavigationItems = (items = [], translate) =>
|
|
16
|
-
(Array.isArray(items) ? items : []).map(item => ({
|
|
17
|
-
...item,
|
|
18
|
-
label: translateLabel(translate, item?.label),
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
export const resolveBottomNavigationRoute = (routeAliases = {}, routeName) =>
|
|
22
|
-
routeAliases?.[routeName] || routeName || '';
|
|
23
|
-
|
|
24
|
-
export const BOTTOM_NAVIGATION_PRESETS = {
|
|
25
|
-
crmToolbar: {
|
|
26
|
-
items: [
|
|
27
|
-
{
|
|
28
|
-
route: 'HomePage',
|
|
29
|
-
icon: 'home',
|
|
30
|
-
label: {
|
|
31
|
-
store: 'users',
|
|
32
|
-
type: 'label',
|
|
33
|
-
key: 'home',
|
|
34
|
-
fallback: '
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
route: 'CrmIndex',
|
|
39
|
-
icon: 'target',
|
|
40
|
-
label: {
|
|
41
|
-
store: 'users',
|
|
42
|
-
type: 'label',
|
|
43
|
-
key: 'crm',
|
|
44
|
-
fallback: 'CRM',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
route: 'ClientsIndex',
|
|
49
|
-
icon: 'users',
|
|
50
|
-
label: {
|
|
51
|
-
store: 'users',
|
|
52
|
-
type: 'label',
|
|
53
|
-
key: 'clients',
|
|
54
|
-
fallback: '
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
route: 'ProfilePage',
|
|
59
|
-
icon: 'user',
|
|
60
|
-
label: {
|
|
61
|
-
store: 'users',
|
|
62
|
-
type: 'label',
|
|
63
|
-
key: 'profile',
|
|
64
|
-
fallback: '
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
routeAliases: {
|
|
69
|
-
HomePage: 'HomePage',
|
|
70
|
-
CrmIndex: 'CrmIndex',
|
|
71
|
-
ContractsIndex: 'CrmIndex',
|
|
72
|
-
ProposalsIndex: 'CrmIndex',
|
|
73
|
-
ComissionsPage: 'CrmIndex',
|
|
74
|
-
CrmConversation: 'CrmIndex',
|
|
75
|
-
ContractDetails: 'CrmIndex',
|
|
76
|
-
ClientsIndex: 'ClientsIndex',
|
|
77
|
-
ClientDetails: 'ClientsIndex',
|
|
78
|
-
FranchiseesIndex: 'ClientsIndex',
|
|
79
|
-
ProfilePage: 'ProfilePage',
|
|
80
|
-
SettingsPage: 'ProfilePage',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
managerToolbar: {
|
|
84
|
-
items: [
|
|
85
|
-
{
|
|
86
|
-
route: 'HomePage',
|
|
87
|
-
icon: 'home',
|
|
88
|
-
label: {
|
|
89
|
-
store: 'configs',
|
|
90
|
-
type: 'toolbar',
|
|
91
|
-
key: 'home',
|
|
92
|
-
fallback: '
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
route: 'CrmIndex',
|
|
97
|
-
icon: 'dollar-sign',
|
|
98
|
-
label: {
|
|
99
|
-
store: 'configs',
|
|
100
|
-
type: 'toolbar',
|
|
101
|
-
key: 'opportunities',
|
|
102
|
-
fallback: 'Oportunidades',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
route: 'ClientsIndex',
|
|
107
|
-
icon: 'users',
|
|
108
|
-
label: {
|
|
109
|
-
store: 'configs',
|
|
110
|
-
type: 'toolbar',
|
|
111
|
-
key: 'customers',
|
|
112
|
-
fallback: 'Clientes',
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
route: 'ProfilePage',
|
|
117
|
-
icon: 'user',
|
|
118
|
-
label: {
|
|
119
|
-
store: 'configs',
|
|
120
|
-
type: 'toolbar',
|
|
121
|
-
key: 'profile',
|
|
122
|
-
fallback: '
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
routeAliases: {
|
|
127
|
-
HomePage: 'HomePage',
|
|
128
|
-
CrmIndex: 'CrmIndex',
|
|
129
|
-
ContractsIndex: 'CrmIndex',
|
|
130
|
-
ProposalsIndex: 'CrmIndex',
|
|
131
|
-
ComissionsPage: 'CrmIndex',
|
|
132
|
-
CrmConversation: 'CrmIndex',
|
|
133
|
-
ContractDetails: 'CrmIndex',
|
|
134
|
-
ClientsIndex: 'ClientsIndex',
|
|
135
|
-
ClientDetails: 'ClientsIndex',
|
|
136
|
-
FranchiseesIndex: 'ClientsIndex',
|
|
137
|
-
ProfilePage: 'ProfilePage',
|
|
138
|
-
SettingsPage: 'ProfilePage',
|
|
139
|
-
OrderHistoryPage: 'CrmIndex',
|
|
140
|
-
InventoriesPage: 'CrmIndex',
|
|
141
|
-
ProductsPage: 'CrmIndex',
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
managerDock: {
|
|
145
|
-
items: [
|
|
146
|
-
{route: 'HomePage', icon: 'home', label: '
|
|
147
|
-
{route: 'CrmIndex', icon: 'dollar-sign', label: 'Oportunidades'},
|
|
148
|
-
{route: 'ClientsIndex', icon: 'users', label: 'Clientes'},
|
|
149
|
-
{route: 'ProfilePage', icon: 'user', label: 'Perfil'},
|
|
150
|
-
],
|
|
151
|
-
routeAliases: {
|
|
152
|
-
ClientDetails: 'ClientsIndex',
|
|
153
|
-
EmployeesIndex: 'ClientsIndex',
|
|
154
|
-
FranchiseesIndex: 'ClientsIndex',
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
deliveryDock: {
|
|
158
|
-
items: [
|
|
159
|
-
{route: 'HomePage', icon: 'home', label: '
|
|
160
|
-
{route: 'DeliveryOrdersPage', icon: 'shopping-bag', label: 'Pedidos'},
|
|
161
|
-
{
|
|
162
|
-
route: 'DeliveryReceivablesPage',
|
|
163
|
-
icon: 'dollar-sign',
|
|
164
|
-
label: 'Recebiveis',
|
|
165
|
-
},
|
|
166
|
-
{route: 'DeliveryCompaniesPage', icon: 'users', label: 'Empresas'},
|
|
167
|
-
{route: 'DeliveryRateTablesPage', icon: 'list', label: 'Tabelas'},
|
|
168
|
-
],
|
|
1
|
+
const translateLabel = (translate, descriptor) => {
|
|
2
|
+
if (!descriptor || typeof descriptor === 'string') {
|
|
3
|
+
return descriptor || '';
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const translated = translate?.(
|
|
7
|
+
descriptor.store,
|
|
8
|
+
descriptor.type,
|
|
9
|
+
descriptor.key,
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
return translated || descriptor.fallback || descriptor.key || '';
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const resolveBottomNavigationItems = (items = [], translate) =>
|
|
16
|
+
(Array.isArray(items) ? items : []).map(item => ({
|
|
17
|
+
...item,
|
|
18
|
+
label: translateLabel(translate, item?.label),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
export const resolveBottomNavigationRoute = (routeAliases = {}, routeName) =>
|
|
22
|
+
routeAliases?.[routeName] || routeName || '';
|
|
23
|
+
|
|
24
|
+
export const BOTTOM_NAVIGATION_PRESETS = {
|
|
25
|
+
crmToolbar: {
|
|
26
|
+
items: [
|
|
27
|
+
{
|
|
28
|
+
route: 'HomePage',
|
|
29
|
+
icon: 'home',
|
|
30
|
+
label: {
|
|
31
|
+
store: 'users',
|
|
32
|
+
type: 'label',
|
|
33
|
+
key: 'home',
|
|
34
|
+
fallback: 'Início',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
route: 'CrmIndex',
|
|
39
|
+
icon: 'target',
|
|
40
|
+
label: {
|
|
41
|
+
store: 'users',
|
|
42
|
+
type: 'label',
|
|
43
|
+
key: 'crm',
|
|
44
|
+
fallback: 'CRM',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
route: 'ClientsIndex',
|
|
49
|
+
icon: 'users',
|
|
50
|
+
label: {
|
|
51
|
+
store: 'users',
|
|
52
|
+
type: 'label',
|
|
53
|
+
key: 'clients',
|
|
54
|
+
fallback: 'Clientes',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
route: 'ProfilePage',
|
|
59
|
+
icon: 'user',
|
|
60
|
+
label: {
|
|
61
|
+
store: 'users',
|
|
62
|
+
type: 'label',
|
|
63
|
+
key: 'profile',
|
|
64
|
+
fallback: 'Perfil',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
routeAliases: {
|
|
69
|
+
HomePage: 'HomePage',
|
|
70
|
+
CrmIndex: 'CrmIndex',
|
|
71
|
+
ContractsIndex: 'CrmIndex',
|
|
72
|
+
ProposalsIndex: 'CrmIndex',
|
|
73
|
+
ComissionsPage: 'CrmIndex',
|
|
74
|
+
CrmConversation: 'CrmIndex',
|
|
75
|
+
ContractDetails: 'CrmIndex',
|
|
76
|
+
ClientsIndex: 'ClientsIndex',
|
|
77
|
+
ClientDetails: 'ClientsIndex',
|
|
78
|
+
FranchiseesIndex: 'ClientsIndex',
|
|
79
|
+
ProfilePage: 'ProfilePage',
|
|
80
|
+
SettingsPage: 'ProfilePage',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
managerToolbar: {
|
|
84
|
+
items: [
|
|
85
|
+
{
|
|
86
|
+
route: 'HomePage',
|
|
87
|
+
icon: 'home',
|
|
88
|
+
label: {
|
|
89
|
+
store: 'configs',
|
|
90
|
+
type: 'toolbar',
|
|
91
|
+
key: 'home',
|
|
92
|
+
fallback: 'Início',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
route: 'CrmIndex',
|
|
97
|
+
icon: 'dollar-sign',
|
|
98
|
+
label: {
|
|
99
|
+
store: 'configs',
|
|
100
|
+
type: 'toolbar',
|
|
101
|
+
key: 'opportunities',
|
|
102
|
+
fallback: 'Oportunidades',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
route: 'ClientsIndex',
|
|
107
|
+
icon: 'users',
|
|
108
|
+
label: {
|
|
109
|
+
store: 'configs',
|
|
110
|
+
type: 'toolbar',
|
|
111
|
+
key: 'customers',
|
|
112
|
+
fallback: 'Clientes',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
route: 'ProfilePage',
|
|
117
|
+
icon: 'user',
|
|
118
|
+
label: {
|
|
119
|
+
store: 'configs',
|
|
120
|
+
type: 'toolbar',
|
|
121
|
+
key: 'profile',
|
|
122
|
+
fallback: 'Perfil',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
routeAliases: {
|
|
127
|
+
HomePage: 'HomePage',
|
|
128
|
+
CrmIndex: 'CrmIndex',
|
|
129
|
+
ContractsIndex: 'CrmIndex',
|
|
130
|
+
ProposalsIndex: 'CrmIndex',
|
|
131
|
+
ComissionsPage: 'CrmIndex',
|
|
132
|
+
CrmConversation: 'CrmIndex',
|
|
133
|
+
ContractDetails: 'CrmIndex',
|
|
134
|
+
ClientsIndex: 'ClientsIndex',
|
|
135
|
+
ClientDetails: 'ClientsIndex',
|
|
136
|
+
FranchiseesIndex: 'ClientsIndex',
|
|
137
|
+
ProfilePage: 'ProfilePage',
|
|
138
|
+
SettingsPage: 'ProfilePage',
|
|
139
|
+
OrderHistoryPage: 'CrmIndex',
|
|
140
|
+
InventoriesPage: 'CrmIndex',
|
|
141
|
+
ProductsPage: 'CrmIndex',
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
managerDock: {
|
|
145
|
+
items: [
|
|
146
|
+
{route: 'HomePage', icon: 'home', label: 'Início'},
|
|
147
|
+
{route: 'CrmIndex', icon: 'dollar-sign', label: 'Oportunidades'},
|
|
148
|
+
{route: 'ClientsIndex', icon: 'users', label: 'Clientes'},
|
|
149
|
+
{route: 'ProfilePage', icon: 'user', label: 'Perfil'},
|
|
150
|
+
],
|
|
151
|
+
routeAliases: {
|
|
152
|
+
ClientDetails: 'ClientsIndex',
|
|
153
|
+
EmployeesIndex: 'ClientsIndex',
|
|
154
|
+
FranchiseesIndex: 'ClientsIndex',
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
deliveryDock: {
|
|
158
|
+
items: [
|
|
159
|
+
{route: 'HomePage', icon: 'home', label: 'Início'},
|
|
160
|
+
{route: 'DeliveryOrdersPage', icon: 'shopping-bag', label: 'Pedidos'},
|
|
161
|
+
{
|
|
162
|
+
route: 'DeliveryReceivablesPage',
|
|
163
|
+
icon: 'dollar-sign',
|
|
164
|
+
label: 'Recebiveis',
|
|
165
|
+
},
|
|
166
|
+
{route: 'DeliveryCompaniesPage', icon: 'users', label: 'Empresas'},
|
|
167
|
+
{route: 'DeliveryRateTablesPage', icon: 'list', label: 'Tabelas'},
|
|
168
|
+
],
|
|
169
169
|
routeAliases: {
|
|
170
170
|
OrderDetails: 'DeliveryOrdersPage',
|
|
171
171
|
OrderLogisticsPage: 'DeliveryOrdersPage',
|
|
@@ -173,66 +173,46 @@ export const BOTTOM_NAVIGATION_PRESETS = {
|
|
|
173
173
|
DeliveryVehicleSetupPage: 'DeliveryRateTablesPage',
|
|
174
174
|
DeliveryRateTableFormPage: 'DeliveryRateTablesPage',
|
|
175
175
|
DeliveryRateTableCompaniesPage: 'DeliveryRateTablesPage',
|
|
176
|
-
DeliveryCourierSchedulesPage: 'DeliveryCompaniesPage',
|
|
177
|
-
DeliveryCourierScheduleFormPage: 'DeliveryCompaniesPage',
|
|
178
|
-
DeliveryCourierPresencePage: 'DeliveryCompaniesPage',
|
|
179
|
-
DeliveryCourierPresenceHistoryPage: 'DeliveryCompaniesPage',
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
ppcDock: {
|
|
183
|
-
items: [
|
|
184
|
-
{route: 'HomePage', icon: 'home', label: '
|
|
185
|
-
{route: 'DisplayList', icon: 'monitor', label: 'Displays'},
|
|
186
|
-
{route: 'ProfilePage', icon: 'user', label: '
|
|
187
|
-
],
|
|
188
|
-
routeAliases: {},
|
|
189
|
-
},
|
|
190
|
-
posToolbar: {
|
|
191
|
-
items: [
|
|
192
|
-
{
|
|
193
|
-
route: '
|
|
194
|
-
icon: '
|
|
195
|
-
label: {
|
|
196
|
-
store: 'orders',
|
|
197
|
-
type: 'label',
|
|
198
|
-
key: '
|
|
199
|
-
fallback: '
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
route: '
|
|
204
|
-
icon: '
|
|
205
|
-
label: {
|
|
206
|
-
store: 'orders',
|
|
207
|
-
type: 'label',
|
|
208
|
-
key: '
|
|
209
|
-
fallback: '
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
fallback: 'Cash register',
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
route: 'ProfilePage',
|
|
224
|
-
icon: 'user',
|
|
225
|
-
label: {
|
|
226
|
-
store: 'orders',
|
|
227
|
-
type: 'label',
|
|
228
|
-
key: 'profile',
|
|
229
|
-
fallback: 'Profile',
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
],
|
|
233
|
-
routeAliases: {},
|
|
234
|
-
},
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
export const getBottomNavigationPreset = variant =>
|
|
238
|
-
BOTTOM_NAVIGATION_PRESETS[variant] || BOTTOM_NAVIGATION_PRESETS.managerDock;
|
|
176
|
+
DeliveryCourierSchedulesPage: 'DeliveryCompaniesPage',
|
|
177
|
+
DeliveryCourierScheduleFormPage: 'DeliveryCompaniesPage',
|
|
178
|
+
DeliveryCourierPresencePage: 'DeliveryCompaniesPage',
|
|
179
|
+
DeliveryCourierPresenceHistoryPage: 'DeliveryCompaniesPage',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
ppcDock: {
|
|
183
|
+
items: [
|
|
184
|
+
{route: 'HomePage', icon: 'home', label: 'Início'},
|
|
185
|
+
{route: 'DisplayList', icon: 'monitor', label: 'Displays'},
|
|
186
|
+
{route: 'ProfilePage', icon: 'user', label: 'Perfil'},
|
|
187
|
+
],
|
|
188
|
+
routeAliases: {},
|
|
189
|
+
},
|
|
190
|
+
posToolbar: {
|
|
191
|
+
items: [
|
|
192
|
+
{
|
|
193
|
+
route: 'OrderHistoryPage',
|
|
194
|
+
icon: 'shopping-bag',
|
|
195
|
+
label: {
|
|
196
|
+
store: 'orders',
|
|
197
|
+
type: 'label',
|
|
198
|
+
key: 'orders',
|
|
199
|
+
fallback: 'Pedidos',
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
route: 'ProfilePage',
|
|
204
|
+
icon: 'user',
|
|
205
|
+
label: {
|
|
206
|
+
store: 'orders',
|
|
207
|
+
type: 'label',
|
|
208
|
+
key: 'profile',
|
|
209
|
+
fallback: 'Perfil',
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
routeAliases: {},
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export const getBottomNavigationPreset = variant =>
|
|
218
|
+
BOTTOM_NAVIGATION_PRESETS[variant] || BOTTOM_NAVIGATION_PRESETS.managerDock;
|
|
@@ -3,7 +3,7 @@ import {Pressable, Text, View} from 'react-native';
|
|
|
3
3
|
import Icon from 'react-native-vector-icons/Feather';
|
|
4
4
|
import {useTheme} from './DefaultProvider';
|
|
5
5
|
import RuntimeInfoFooter from './RuntimeInfoFooter';
|
|
6
|
-
import {resolveMenuRouteParams} from '
|
|
6
|
+
import {resolveMenuRouteParams} from '../utils/menuNavigation';
|
|
7
7
|
import createStyles from './BottomNavigationBar.styles';
|
|
8
8
|
|
|
9
9
|
const BottomNavigationBar = ({
|
|
@@ -13,40 +13,80 @@ const BottomNavigationBar = ({
|
|
|
13
13
|
disabled = false,
|
|
14
14
|
colors = {},
|
|
15
15
|
testID = 'bottom-navigation',
|
|
16
|
+
useModernWebChromeProps = false,
|
|
16
17
|
}) => {
|
|
17
18
|
const theme = useTheme?.() || {};
|
|
18
19
|
const runtimeFooter = theme?.runtimeFooter || null;
|
|
19
20
|
const registerBottomNavigation =
|
|
20
21
|
theme?.bottomChrome?.registerBottomNavigation || null;
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const
|
|
22
|
+
const activeBackground = colors.navigationActiveBackground;
|
|
23
|
+
const activeBorder = colors.navigationActiveBorder;
|
|
24
|
+
const activeIcon = colors.navigationActiveIcon;
|
|
25
|
+
const activeText = colors.navigationActiveText;
|
|
26
|
+
const dockBackground = colors.navigationBackground;
|
|
27
|
+
const dockBorder = colors.navigationBorder;
|
|
28
|
+
const dockShadow = colors.navigationShadow;
|
|
29
|
+
const inactiveIcon = colors.navigationIcon;
|
|
30
|
+
const inactiveText = colors.navigationText;
|
|
29
31
|
|
|
30
32
|
const styles = useMemo(
|
|
31
33
|
() =>
|
|
32
34
|
createStyles({
|
|
33
|
-
|
|
35
|
+
activeBackground,
|
|
34
36
|
dockBackground,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
activeBg,
|
|
37
|
+
dockBorder,
|
|
38
|
+
dockShadow,
|
|
38
39
|
activeBorder,
|
|
40
|
+
useModernWebChromeProps,
|
|
39
41
|
}),
|
|
40
42
|
[
|
|
41
|
-
|
|
43
|
+
activeBackground,
|
|
42
44
|
activeBorder,
|
|
43
|
-
borderColor,
|
|
44
45
|
dockBackground,
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
dockBorder,
|
|
47
|
+
dockShadow,
|
|
48
|
+
useModernWebChromeProps,
|
|
47
49
|
],
|
|
48
50
|
);
|
|
49
51
|
|
|
52
|
+
const resolveItemColors = ({isActive, isDisabled}) => {
|
|
53
|
+
if (isActive) {
|
|
54
|
+
return {
|
|
55
|
+
iconColor: activeIcon,
|
|
56
|
+
textColor: activeText,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (isDisabled) {
|
|
61
|
+
return {
|
|
62
|
+
iconColor: colors.navigationDisabledIcon,
|
|
63
|
+
textColor: colors.navigationDisabledText,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
iconColor: inactiveIcon,
|
|
69
|
+
textColor: inactiveText,
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const resolveItemStateStyles = ({isActive, isDisabled}) => [
|
|
74
|
+
styles.item,
|
|
75
|
+
isActive && styles.itemActive,
|
|
76
|
+
isDisabled && styles.itemDisabled,
|
|
77
|
+
isDisabled && {
|
|
78
|
+
backgroundColor: colors.navigationDisabledBackground,
|
|
79
|
+
borderColor: colors.navigationDisabledBorder,
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
const resolvePressedStyles = ({pressed, isDisabled}) =>
|
|
84
|
+
pressed && !isDisabled
|
|
85
|
+
? [
|
|
86
|
+
styles.itemPressed,
|
|
87
|
+
]
|
|
88
|
+
: [];
|
|
89
|
+
|
|
50
90
|
useLayoutEffect(() => {
|
|
51
91
|
if (typeof registerBottomNavigation !== 'function') {
|
|
52
92
|
return undefined;
|
|
@@ -69,15 +109,32 @@ const BottomNavigationBar = ({
|
|
|
69
109
|
}
|
|
70
110
|
};
|
|
71
111
|
|
|
112
|
+
const hostProps = useModernWebChromeProps
|
|
113
|
+
? {}
|
|
114
|
+
: {pointerEvents: 'box-none'};
|
|
115
|
+
const hostStyle = useModernWebChromeProps
|
|
116
|
+
? [styles.host, styles.hostPointerEventsBoxNone]
|
|
117
|
+
: styles.host;
|
|
118
|
+
const footerProps = {
|
|
119
|
+
appVersion: runtimeFooter?.appVersion,
|
|
120
|
+
colors: runtimeFooter?.colors || {},
|
|
121
|
+
defaultCompany: runtimeFooter?.defaultCompany,
|
|
122
|
+
device: runtimeFooter?.device,
|
|
123
|
+
useModernWebChromeProps,
|
|
124
|
+
};
|
|
125
|
+
|
|
72
126
|
return (
|
|
73
|
-
<View
|
|
127
|
+
<View {...hostProps} style={hostStyle}>
|
|
74
128
|
<View style={styles.stack}>
|
|
75
129
|
<View style={styles.dock} testID={testID}>
|
|
76
130
|
{routeItems.map(item => {
|
|
77
131
|
const isActive = effectiveActiveRoute === item.route;
|
|
78
132
|
const isDisabled = disabled || item.disabled;
|
|
79
133
|
const iconSize = item.iconSize || 18;
|
|
80
|
-
const iconColor =
|
|
134
|
+
const {iconColor, textColor} = resolveItemColors({
|
|
135
|
+
isActive,
|
|
136
|
+
isDisabled,
|
|
137
|
+
});
|
|
81
138
|
|
|
82
139
|
return (
|
|
83
140
|
<Pressable
|
|
@@ -86,17 +143,20 @@ const BottomNavigationBar = ({
|
|
|
86
143
|
disabled={isDisabled}
|
|
87
144
|
onPress={() => navigateTo(item)}
|
|
88
145
|
style={({pressed}) => [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
pressed && !isDisabled && styles.itemPressed,
|
|
92
|
-
isDisabled && styles.itemDisabled,
|
|
146
|
+
...resolveItemStateStyles({isActive, isDisabled}),
|
|
147
|
+
...resolvePressedStyles({pressed, isDisabled}),
|
|
93
148
|
]}>
|
|
94
|
-
<View style={
|
|
149
|
+
<View style={styles.iconWrap}>
|
|
95
150
|
<Icon color={iconColor} name={item.icon} size={iconSize} />
|
|
96
151
|
</View>
|
|
97
152
|
<Text
|
|
98
153
|
numberOfLines={1}
|
|
99
|
-
style={[
|
|
154
|
+
style={[
|
|
155
|
+
styles.itemLabel,
|
|
156
|
+
{
|
|
157
|
+
color: textColor,
|
|
158
|
+
},
|
|
159
|
+
]}>
|
|
100
160
|
{item.label}
|
|
101
161
|
</Text>
|
|
102
162
|
</Pressable>
|
|
@@ -105,12 +165,7 @@ const BottomNavigationBar = ({
|
|
|
105
165
|
</View>
|
|
106
166
|
|
|
107
167
|
{runtimeFooter && (
|
|
108
|
-
<RuntimeInfoFooter
|
|
109
|
-
appVersion={runtimeFooter.appVersion}
|
|
110
|
-
colors={runtimeFooter.colors || colors}
|
|
111
|
-
defaultCompany={runtimeFooter.defaultCompany}
|
|
112
|
-
device={runtimeFooter.device}
|
|
113
|
-
/>
|
|
168
|
+
<RuntimeInfoFooter {...footerProps} />
|
|
114
169
|
)}
|
|
115
170
|
</View>
|
|
116
171
|
</View>
|