@controleonline/ui-common 1.2.87 → 1.2.89

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 (77) hide show
  1. package/.github/workflows/integration-source-gate.yml +68 -0
  2. package/.github/workflows/manager-worker.yml +7 -156
  3. package/.github/workflows/publish-npm.yml +73 -27
  4. package/.github/workflows/pull-request-checks.yml +7 -5
  5. package/docs/technical/Device-Detail-Alias-UI-Sync.md +141 -0
  6. package/package.json +13 -8
  7. package/src/api/localDB.js +86 -131
  8. package/src/react/components/BottomNavigationBar.js +178 -174
  9. package/src/react/components/BottomNavigationBar.styles.js +139 -118
  10. package/src/react/components/DefaultProvider.native.js +427 -421
  11. package/src/react/components/DefaultProvider.web.js +131 -125
  12. package/src/react/components/RemoteCheckoutService.js +3 -3
  13. package/src/react/components/RuntimeFooterMarqueeText.js +88 -36
  14. package/src/react/components/RuntimeInfoFooter.js +76 -43
  15. package/src/react/components/RuntimeInfoFooter.styles.js +22 -14
  16. package/src/react/config/deviceConfigBootstrap.js +71 -233
  17. package/src/react/config/deviceConfigValues.js +238 -0
  18. package/src/react/pages/Devices/detail/DeviceChargePermissionSection.js +32 -0
  19. package/src/react/pages/Devices/detail/DeviceDetailAlertsCommandsSection.js +4 -22
  20. package/src/react/pages/Devices/detail/DeviceDetailMovementSections.js +6 -2
  21. package/src/react/pages/Devices/detail/DeviceDetailOrdersPrintSection.js +4 -0
  22. package/src/react/pages/Devices/detail/DeviceDetailPdvConfigSection.js +7 -0
  23. package/src/react/pages/Devices/detail/DeviceDetailScreen.js +24 -335
  24. package/src/react/pages/Devices/detail/createDeviceDetailContext.js +20 -0
  25. package/src/react/pages/Devices/detail/deviceDetailHelpers.js +2 -11
  26. package/src/react/pages/Devices/detail/useDeviceDetailActions.js +11 -36
  27. package/src/react/pages/Devices/detail/useDeviceDetailLoaders.js +129 -37
  28. package/src/react/pages/Devices/detail/useDeviceDetailSaves.js +11 -38
  29. package/src/react/pages/Devices/detail/useDeviceDetailStateA.js +9 -28
  30. package/src/react/pages/IntegrationConfigFields.js +1 -0
  31. package/src/react/pages/IntegrationConfigPage.js +101 -45
  32. package/src/react/pages/IntegrationConfigPage.utils.js +21 -13
  33. package/src/react/pages/fetchPeopleConfigs.js +21 -0
  34. package/src/react/pages/integrationsCatalog.js +15 -110
  35. package/src/react/services/Cielo/Cielo.js +9 -9
  36. package/src/react/services/Getnet/Getnet.web.js +25 -0
  37. package/src/react/utils/companyAuthority.js +36 -0
  38. package/src/react/utils/confirmAction.js +12 -0
  39. package/src/react/utils/fileUrl.js +14 -5
  40. package/src/react/utils/paymentDevices.js +375 -270
  41. package/src/react/utils/printerDevices.js +2 -2
  42. package/src/react/utils/runtimeFooter.js +178 -224
  43. package/src/react/utils/runtimeFooterText.js +160 -0
  44. package/src/react/utils/runtimeLanguage.js +5 -5
  45. package/src/react/utils/runtimeZoom.js +29 -5
  46. package/src/react/utils/shopFranchises.js +167 -12
  47. package/src/react/utils/storeColumns.js +235 -217
  48. package/src/react/utils/systemErrorMessage.js +2 -1
  49. package/src/store/integration/index.js +43 -0
  50. package/src/tests/browser/manager/device-detail-apply-config-defined.spec.js +31 -0
  51. package/src/tests/browser/manager/device-detail-composition.spec.js +295 -0
  52. package/src/tests/browser/manager/device-detail-copy-config.spec.js +11 -1
  53. package/src/tests/browser/manager/device-detail-pdv-current-company.spec.js +273 -0
  54. package/src/tests/browser/manager/runtime-footer-rotation.spec.js +397 -0
  55. package/src/tests/react/components/DefaultProviderAuthority.test.js +28 -0
  56. package/src/tests/react/components/RuntimeFooterMarqueeText.build.test.js +29 -0
  57. package/src/tests/react/config/deviceConfigBootstrap.test.js +24 -1
  58. package/src/tests/react/pages/DeviceChargePermissionSection.test.js +42 -0
  59. package/src/tests/react/pages/applyCurrentDeviceConfig.test.js +85 -0
  60. package/src/tests/react/pages/deviceDetailComposition.test.js +65 -0
  61. package/src/tests/react/pages/deviceDetailHookDependencies.test.mjs +31 -0
  62. package/src/tests/react/pages/deviceDetailLoaderDependencies.test.mjs +28 -0
  63. package/src/tests/react/pages/receitaFederalIntegrationContract.test.mjs +27 -6
  64. package/src/tests/react/services/Cielo.test.js +2 -2
  65. package/src/tests/react/utils/companyAuthority.test.js +53 -0
  66. package/src/tests/react/utils/formatter.test.mjs +6 -0
  67. package/src/tests/react/utils/paymentDevices.test.js +72 -0
  68. package/src/tests/react/utils/runtimeFooter.test.js +35 -0
  69. package/src/tests/react/utils/runtimeFooterText.test.js +88 -0
  70. package/src/tests/react/utils/runtimeLanguage.test.js +4 -4
  71. package/src/tests/react/utils/runtimeZoom.test.js +20 -0
  72. package/src/tests/react/utils/shopFranchises.test.js +32 -13
  73. package/src/tests/react/utils/translate.test.mjs +6 -6
  74. package/src/utils/formatter.js +7 -3
  75. package/src/utils/translate.js +16 -16
  76. package/src/utils/translatePending.js +6 -6
  77. package/src/utils/translateStorage.js +2 -2
@@ -21,6 +21,7 @@ import {tt} from './deviceDetailConstants';
21
21
  export default function DeviceDetailOrdersPrintSection(ctx) {
22
22
  const {
23
23
  themeColors,
24
+ shouldShowOrderVisibility,
24
25
  renderHelpButton,
25
26
  renderOptionButtons,
26
27
  renderSwitchRow,
@@ -53,6 +54,7 @@ export default function DeviceDetailOrdersPrintSection(ctx) {
53
54
 
54
55
  return (
55
56
  <>
57
+ {shouldShowOrderVisibility && (
56
58
  <View style={styles.section}>
57
59
  <Text style={styles.sectionTitle}>
58
60
  <Icon name="list" size={13} /> {' '}Pedidos do Device
@@ -120,6 +122,8 @@ export default function DeviceDetailOrdersPrintSection(ctx) {
120
122
  </View>
121
123
  </View>
122
124
 
125
+ )}
126
+
123
127
  {isDisplayDevice && (
124
128
  <View style={styles.section}>
125
129
  <Text style={styles.sectionTitle}>
@@ -11,6 +11,7 @@ import {
11
11
  POS_CHECK_ORDER_TYPE_NONE,
12
12
  POS_CHECK_ORDER_TYPE_TAB,
13
13
  POS_CHECK_ORDER_TYPE_TABLE,
14
+ POS_CHECK_ORDER_TYPE_TABLE_TAB,
14
15
  POS_CHECK_ORDER_TYPE_STAMP,
15
16
  POS_CHECK_ORDER_MANAGEMENT_MODE_MANAGE,
16
17
  POS_CHECK_ORDER_MANAGEMENT_MODE_EXISTING_ONLY,
@@ -164,6 +165,10 @@ export default function DeviceDetailPdvConfigSection(ctx) {
164
165
  label: global.t?.t('orders', 'title', 'table') || 'Table',
165
166
  value: POS_CHECK_ORDER_TYPE_TABLE,
166
167
  },
168
+ {
169
+ label: 'Mesa + Comanda',
170
+ value: POS_CHECK_ORDER_TYPE_TABLE_TAB,
171
+ },
167
172
  {
168
173
  label: global.t?.t('orders', 'title', 'stamp') || 'Stamp',
169
174
  value: POS_CHECK_ORDER_TYPE_STAMP,
@@ -188,6 +193,8 @@ export default function DeviceDetailPdvConfigSection(ctx) {
188
193
  ? POS_CHECK_ORDER_TYPE_TAB
189
194
  : value === POS_CHECK_ORDER_TYPE_TABLE
190
195
  ? POS_CHECK_ORDER_TYPE_TABLE
196
+ : value === POS_CHECK_ORDER_TYPE_TABLE_TAB
197
+ ? POS_CHECK_ORDER_TYPE_TABLE_TAB
191
198
  : value === POS_CHECK_ORDER_TYPE_STAMP
192
199
  ? loyaltyCouponsEnabled
193
200
  ? POS_CHECK_ORDER_TYPE_STAMP
@@ -1,135 +1,25 @@
1
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
- import { Alert, FlatList, Platform, Pressable, ScrollView, Switch, Text, TextInput, TouchableOpacity, View } from 'react-native';
1
+ import React from 'react';
2
+ import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
3
3
  import { SafeAreaView } from 'react-native-safe-area-context';
4
- import { useFocusEffect, useNavigation, useRoute } from '@react-navigation/native';
5
- import {Picker} from '@react-native-picker/picker';
6
- import { useStore } from '@store';
7
- import { api } from '@controleonline/ui-common/src/api';
8
- import Formatter from '@controleonline/ui-common/src/utils/formatter';
4
+
9
5
  import StateStore from '@controleonline/ui-common/src/react/components/StateStore';
10
- import PaymentTypesByWalletTab from '@controleonline/ui-common/src/react/pages/SettingsPage/PaymentTypesByWalletTab';
11
- import { appendScreenMetrics } from '@controleonline/ui-common/src/react/utils/screenMetrics';
12
- import { useMessage } from '@controleonline/ui-common/src/react/components/MessageService';
13
- import { resolveThemePalette, withOpacity } from '@controleonline/../../src/styles/branding';
14
- import { colors } from '@controleonline/../../src/styles/colors';
6
+
15
7
  import Icon from 'react-native-vector-icons/Feather';
16
8
  import styles from '../../DeviceDetailPage.styles';
17
- import packageJson from '@package';
18
- import DefaultTooltip from '@controleonline/ui-default/src/react/components/help/DefaultTooltip';
19
-
20
- import {
21
- canDisplayChangePrinter,
22
- DEVICE_ANDROID_KIOSK_ENABLED_CONFIG_KEY,
23
- DEVICE_ANDROID_LAUNCHER_ENABLED_CONFIG_KEY,
24
- DISPLAY_AUTO_PRINT_PRODUCT_CONFIG_KEY,
25
- DISPLAY_ALLOW_PRINTER_CHANGE_CONFIG_KEY,
26
- DEVICE_ALERT_SOUND_ENABLED_KEY,
27
- DEVICE_ALERT_SOUND_URL_KEY,
28
- DEVICE_ORDER_VISIBILITY_COMPANY,
29
- DEVICE_ORDER_VISIBILITY_DEVICE,
30
- DEVICE_ORDER_VISIBILITY_KEY,
31
- DEVICE_RUNTIME_DEBUG_INFO_ENABLED_KEY,
32
- isPosAutoPrintEnabled,
33
- isPosCashRegisterOpen,
34
- isTruthyValue,
35
- parseConfigsObject,
36
- POS_AUTO_PRINT_ENABLED_CONFIG_KEY,
37
- POS_CASH_MANAGEMENT_MODE_CASH_REGISTER,
38
- POS_CASH_MANAGEMENT_MODE_CONFIG_KEY,
39
- POS_CASH_MANAGEMENT_MODE_DAILY,
40
- POS_CHECK_ORDER_MANAGEMENT_MODE_CONFIG_KEY,
41
- POS_CHECK_ORDER_MANAGEMENT_MODE_EXISTING_ONLY,
42
- POS_CHECK_ORDER_MANAGEMENT_MODE_MANAGE,
43
- POS_CHECK_ORDER_TYPE_CONFIG_KEY,
44
- POS_CHECK_ORDER_TYPE_NONE,
45
- POS_CHECK_ORDER_TYPE_TAB,
46
- POS_CHECK_ORDER_TYPE_TABLE,
47
- POS_CHECK_ORDER_TYPE_STAMP,
48
- POS_DELIVERY_ENABLED_CONFIG_KEY,
49
- POS_OPERATION_MODE_COUNTER,
50
- POS_OPERATION_MODE_CONFIG_KEY,
51
- POS_OPERATION_MODE_OPTIONS,
52
- POS_PRODUCT_SHOWCASE_CONFIG_KEY,
53
- POS_PRINT_MODE_FORM,
54
- POS_PRINT_MODE_ORDER,
55
- getPosOperationModeOption,
56
- isAndroidKioskEnabled,
57
- isAndroidLauncherEnabled,
58
- isPosDeliveryEnabled,
59
- resolvePosCheckOrderManagementMode,
60
- resolvePosCheckOrderType,
61
- resolvePosCheckOrderTypeForShop,
62
- resolveDeviceOrderVisibility,
63
- resolvePosCashManagementMode,
64
- resolvePosOperationMode,
65
- resolvePosPrintMode,
66
- } from '@controleonline/ui-common/src/react/config/deviceConfigBootstrap';
67
9
 
68
- import {
69
- filterDeviceConfigsByCompany,
70
- getCompanyPaymentDeviceOptions,
71
- getPaymentGatewayFromConfigs,
72
- getPaymentGatewayLabel,
73
- isPaymentCapableDeviceConfig,
74
- isPdvPrinterEnabled,
75
- normalizeDeviceId,
76
- normalizeEntityId,
77
- PAYMENT_TYPE_IDS_CONFIG_KEY,
78
- PAYMENT_GATEWAY_CIELO,
79
- PDV_PRINTER_ENABLED_CONFIG_KEY,
80
- ORDER_PAYMENT_DEVICE_CONFIG_KEY,
81
- POS_GATEWAY_CONFIG_KEY,
82
- } from '@controleonline/ui-common/src/react/utils/paymentDevices';
83
- import {
84
- normalizeBooleanConfig,
85
- SHOP_LOYALTY_COUPONS_ENABLED_CONFIG_KEY,
86
- } from '@controleonline/ui-common/src/react/utils/shopConfig';
87
-
88
- import {
89
- getPrinterOptionValue,
90
- getDeviceTypeLabel,
91
- getPrinterLabel,
92
- getPrinterOptions,
93
- } from '@controleonline/ui-common/src/react/utils/printerDevices';
94
- import { buildDeviceAliasStoreUpdates } from '@controleonline/ui-common/src/react/utils/deviceAliasSync';
95
- import { createDeviceDetailRenderers } from './DeviceDetailRenderers';
96
10
  import DeviceDetailHeader from './DeviceDetailHeader';
97
11
  import CopyDeviceConfigModal from '@controleonline/ui-common/src/react/components/CopyDeviceConfigModal';
98
12
  import useDeviceDetailCopyConfig from './useDeviceDetailCopyConfig';
13
+ import DeviceChargePermissionSection from './DeviceChargePermissionSection';
99
14
  import DeviceDetailPdvConfigSection from './DeviceDetailPdvConfigSection';
100
15
  import DeviceDetailOrdersPrintSection from './DeviceDetailOrdersPrintSection';
101
16
  import DeviceDetailAlertsCommandsSection from './DeviceDetailAlertsCommandsSection';
102
17
  import DeviceDetailMovementSections from './DeviceDetailMovementSections';
103
18
  import DeviceDetailPaymentSection from './DeviceDetailPaymentSection';
104
19
 
105
- import { inlineStyle_667_12, inlineStyle_1301_61 } from '../../DeviceDetailPage.styles';
106
-
107
- import {
108
- hex,
109
- DISPLAY_DEVICE_TYPE,
110
- PDV_DEVICE_TYPE,
111
- DISPLAY_DEVICE_LINK_CONFIG_KEY,
112
- DISPLAY_DEVICE_PRINTER_CONFIG_KEY,
113
- PDV_TAB_OPERATION,
114
- PDV_TAB_ORDERS,
115
- PDV_TAB_DEVICE,
116
- PDV_TAB_PAYMENT_TYPES,
117
- PDV_TAB_MOVEMENT,
118
- PDV_DETAIL_TABS,
119
- tt,
120
- } from './deviceDetailConstants';
121
- import {
122
- paymentIcon,
123
- formatApiError,
124
- getDisplayLabel,
125
- getProductShowcaseLabel,
126
- getIsOpen,
127
- confirm,
128
- getDeviceSwitchProps,
129
- } from './deviceDetailHelpers';
130
- import OptionButtonChip from './OptionButtonChip';
131
-
20
+ import { PDV_TAB_PAYMENT_TYPES, PDV_DETAIL_TABS, tt } from './deviceDetailConstants';
132
21
 
22
+ import createDeviceDetailContext from './createDeviceDetailContext';
133
23
  import useDeviceDetailStateA from './useDeviceDetailStateA';
134
24
  import useDeviceDetailStateB from './useDeviceDetailStateB';
135
25
  import useDeviceDetailLoaders from './useDeviceDetailLoaders';
@@ -143,223 +33,18 @@ const DeviceDetailScreen = () => {
143
33
  const loaders = useDeviceDetailLoaders(state);
144
34
  const actions = useDeviceDetailActions({ ...state, ...loaders });
145
35
  const saves = useDeviceDetailSaves({ ...state, ...loaders, ...actions });
36
+ const detailCtx = createDeviceDetailContext(state, loaders, actions, saves);
146
37
  const {
147
- navigation,
148
- deviceId,
149
- deviceConfigStore,
150
- messageApi,
151
- websocketActions,
152
- runtimeCompanyConfigs,
153
- showSystemError,
154
- loyaltyCouponsEnabled,
155
- currentDevice,
156
- currentDeviceConfig,
157
- deviceString,
158
- deviceType,
159
- normalizedInitialConfigs,
160
- initialAlias,
161
- isDisplayDevice,
162
- isPdvDevice,
163
- actionsRef,
164
- stampAutoDisableSignatureRef,
165
- brandColors,
166
- products,
167
- setProducts,
168
- productShowcases,
169
- setProductShowcases,
170
- companyDeviceConfigs,
171
- setCompanyDeviceConfigs,
172
- inflowData,
173
- setInflowData,
174
- configs,
175
- setConfigs,
176
- loadingConfigData,
177
- setLoadingConfigData,
38
+ accent, alias, aliasInput, aliasInputRef, deviceId, deviceString,
39
+ editingAlias, removingDevice, savingAlias, themeColors, brandColors,
40
+ setAliasInput, confirmRemoveDevice, saveAlias, startEditAlias,
41
+ loadingActiveTabData, isPdvDevice, activePdvTab, setActivePdvTab,
42
+ showPdvOperationTab, showPdvOrdersTab, shouldShowOrderVisibility,
43
+ shouldShowDeviceBehavior, shouldShowRemotePayment, shouldShowRemoteCommands,
44
+ actionsRef, currentCompany, loadCompanyConfigs, messageApi,
45
+ refreshCurrentConfig, showSystemError, companyDeviceConfigs,
178
46
  loadingCompanyDeviceConfigs,
179
- setLoadingCompanyDeviceConfigs,
180
- loadingMovementData,
181
- setLoadingMovementData,
182
- actionLoading,
183
- setActionLoading,
184
- activePdvTab,
185
- setActivePdvTab,
186
- savingPaymentTarget,
187
- setSavingPaymentTarget,
188
- savingPdvSettings,
189
- setSavingPdvSettings,
190
- savingPaymentTypes,
191
- setSavingPaymentTypes,
192
- savingPosOperationMode,
193
- setSavingPosOperationMode,
194
- savingProductShowcase,
195
- setSavingProductShowcase,
196
- savingLauncherMode,
197
- setSavingLauncherMode,
198
- savingAlertSound,
199
- setSavingAlertSound,
200
- savingOrderVisibility,
201
- setSavingOrderVisibility,
202
- savingDeviceDeliverySettings,
203
- setSavingDeviceDeliverySettings,
204
- savingRuntimeDebugInfo,
205
- setSavingRuntimeDebugInfo,
206
- sendingCatalogRefresh,
207
- setSendingCatalogRefresh,
208
- loadingProductShowcases,
209
- setLoadingProductShowcases,
210
- search,
211
- setSearch,
212
- devicePaymentTarget,
213
- setDevicePaymentTarget,
214
- pdvGateway,
215
- setPdvGateway,
216
- pdvPrinterEnabled,
217
- setPdvPrinterEnabled,
218
- posOperationMode,
219
- setPosOperationMode,
220
- productShowcaseId,
221
- setProductShowcaseId,
222
- androidKioskEnabled,
223
- setAndroidKioskEnabled,
224
- androidLauncherEnabled,
225
- setAndroidLauncherEnabled,
226
- counterAutoPrintEnabled,
227
- setCounterAutoPrintEnabled,
228
- counterPrintMode,
229
- setCounterPrintMode,
230
- counterCashManagementMode,
231
- setCounterCashManagementMode,
232
- checkOrderType,
233
- setCheckOrderType,
234
- checkOrderManagementMode,
235
- setCheckOrderManagementMode,
236
- deviceOrderVisibility,
237
- setDeviceOrderVisibility,
238
- deviceDeliveryEnabled,
239
- setDeviceDeliveryEnabled,
240
- deviceAlertSoundEnabled,
241
- setDeviceAlertSoundEnabled,
242
- deviceAlertSoundUrl,
243
- setDeviceAlertSoundUrl,
244
- deviceRuntimeDebugInfoEnabled,
245
- setDeviceRuntimeDebugInfoEnabled,
246
- linkedDisplayId,
247
- setLinkedDisplayId,
248
- displayPrinterId,
249
- setDisplayPrinterId,
250
- displayAllowPrinterChange,
251
- setDisplayAllowPrinterChange,
252
- displayAutoPrintProductEnabled,
253
- setDisplayAutoPrintProductEnabled,
254
- savingDisplayPrintingConfig,
255
- setSavingDisplayPrintingConfig,
256
- hasLoadedCurrentConfig,
257
- setHasLoadedCurrentConfig,
258
- hasLoadedCompanyConfigs,
259
- setHasLoadedCompanyConfigs,
260
- hasLoadedMovementData,
261
- setHasLoadedMovementData,
262
- hasLoadedCurrentConfigRef,
263
- hasLoadedCompanyConfigsRef,
264
- hasLoadedMovementDataRef,
265
- hasInitializedPdvTabRef,
266
- alias,
267
- setAlias,
268
- editingAlias,
269
- setEditingAlias,
270
- aliasInput,
271
- setAliasInput,
272
- savingAlias,
273
- setSavingAlias,
274
- removingDevice,
275
- setRemovingDevice,
276
- aliasInputRef,
277
- skipAliasSyncFromStoreRef,
278
- isOpen,
279
- hasLocalPaymentGateway,
280
- paymentDeviceOptions,
281
- displayOptions,
282
- printerOptions,
283
- selectedPosOperationModeOption,
284
- pickerMode,
285
- packageVersion,
286
- appVersion,
287
- runtimeDeviceId,
288
- runtimeDeviceType,
289
- isEditingRuntimeDevice,
290
- resolveDeviceContext,
291
- applyCurrentDeviceConfig,
292
- loadMovementData,
293
- refreshCurrentConfig,
294
- loadCompanyConfigs,
295
- loadProductShowcases,
296
- ensureActiveTabData,
297
- ensureActiveTabDataRef,
298
- handleToggle,
299
- startEditAlias,
300
- cancelEditAlias,
301
- saveAlias,
302
- confirmRemoveDevice,
303
- saveDevicePaymentTarget,
304
- savePdvSettings,
305
- saveProductShowcaseConfig,
306
- savePaymentTypeConfigs,
307
- savePosOperationMode,
308
- saveLauncherMode,
309
- saveDeviceAlertSoundConfig,
310
- saveDeviceOrderVisibility,
311
- saveDeviceDeliverySettings,
312
- saveDeviceRuntimeDebugInfo,
313
- saveDisplayPrintingConfig,
314
- sendCatalogRefreshCommand,
315
- productTotal,
316
- inflowTotal,
317
- wallets,
318
- filteredProducts,
319
- accent,
320
- showPdvOperationTab,
321
- showPdvOrdersTab,
322
- showPdvDeviceTab,
323
- showPdvPaymentTypesTab,
324
- showPdvMovementTab,
325
- loadingActiveTabData,
326
- shouldShowOrderVisibility,
327
- shouldShowRemotePayment,
328
- shouldShowDeviceBehavior,
329
- shouldShowRemoteCommands,
330
- currentCompany,
331
- } = { ...state, ...loaders, ...actions, ...saves };
332
-
333
- const detailCtx = {
334
- themeColors, brandColors, palette,
335
- renderHelpButton, renderOptionButtons, renderSwitchRow, renderProduct,
336
- posOperationMode, setPosOperationMode, savePosOperationMode, savingPosOperationMode,
337
- productShowcaseId, setProductShowcaseId, saveProductShowcaseConfig,
338
- productShowcases, loadingProductShowcases, savingProductShowcase, pickerMode,
339
- counterAutoPrintEnabled, setCounterAutoPrintEnabled,
340
- counterPrintMode, setCounterPrintMode,
341
- checkOrderType, setCheckOrderType,
342
- checkOrderManagementMode, setCheckOrderManagementMode,
343
- cashManagementMode, setCashManagementMode,
344
- androidKioskEnabled, setAndroidKioskEnabled,
345
- androidLauncherEnabled, setAndroidLauncherEnabled,
346
- saveLauncherMode, savingLauncherMode,
347
- orderVisibility, setOrderVisibility, saveDeviceOrderVisibility, savingOrderVisibility,
348
- shouldShowOrderVisibility,
349
- deliveryEnabled, setDeliveryEnabled, saveDeviceDeliverySettings, savingDeliverySettings,
350
- deviceAlertSoundEnabled, setDeviceAlertSoundEnabled, deviceAlertSoundUrl, setDeviceAlertSoundUrl,
351
- saveDeviceAlertSoundConfig, savingAlertSound,
352
- runtimeDebugInfoEnabled, setRuntimeDebugInfoEnabled, saveDeviceRuntimeDebugInfo, savingRuntimeDebugInfo,
353
- devicePaymentTarget, setDevicePaymentTarget, saveDevicePaymentTarget, savingPaymentTarget,
354
- paymentDeviceOptions, displayOptions, printerOptions,
355
- pdvGateway, setPdvGateway, pdvPrinterEnabled, setPdvPrinterEnabled, savePdvSettings, savingPdvSettings,
356
- hasLocalPaymentGateway, loyaltyCouponsEnabled,
357
- sendCatalogRefreshCommand, sendingCatalogRefresh,
358
- showPdvMovementTab, showPdvPaymentTypesTab, showPdvOperationTab,
359
- inflowData, productTotal, wallets, filteredProducts, search, setSearch,
360
- loadingMovementData, deviceId, savePaymentTypeConfigs, savingPaymentTypes,
361
- configs, currentCompany,
362
- };
47
+ } = detailCtx;
363
48
 
364
49
  const {
365
50
  copyModalVisible,
@@ -378,7 +63,6 @@ const DeviceDetailScreen = () => {
378
63
  showSystemError,
379
64
  });
380
65
 
381
-
382
66
  return (
383
67
  <SafeAreaView style={[styles.container, { backgroundColor: brandColors.background }]}>
384
68
  <ScrollView contentContainerStyle={styles.scroll} showsVerticalScrollIndicator={false}>
@@ -469,11 +153,16 @@ const DeviceDetailScreen = () => {
469
153
  {showPdvOperationTab && (
470
154
  <>
471
155
  <DeviceDetailPdvConfigSection {...detailCtx} />
472
- <DeviceDetailOrdersPrintSection {...detailCtx} />
473
- <DeviceDetailAlertsCommandsSection {...detailCtx} />
156
+ <DeviceChargePermissionSection {...detailCtx} />
474
157
  </>
475
158
  )}
476
159
 
160
+ {(showPdvOrdersTab || shouldShowOrderVisibility || detailCtx.isDisplayDevice) && (
161
+ <DeviceDetailOrdersPrintSection {...detailCtx} />
162
+ )}
163
+ {(shouldShowDeviceBehavior || shouldShowRemotePayment || shouldShowRemoteCommands) && (
164
+ <DeviceDetailAlertsCommandsSection {...detailCtx} />
165
+ )}
477
166
  <DeviceDetailPaymentSection {...detailCtx} />
478
167
 
479
168
  </ScrollView>
@@ -0,0 +1,20 @@
1
+ /** Connect section props to the existing state and save contracts. */
2
+ export default function createDeviceDetailContext(state, loaders, actions, saves) {
3
+ return {
4
+ ...state,
5
+ ...loaders,
6
+ ...actions,
7
+ ...saves,
8
+ palette: state.brandColors,
9
+ orderVisibility: state.deviceOrderVisibility,
10
+ setOrderVisibility: state.setDeviceOrderVisibility,
11
+ deliveryEnabled: state.deviceDeliveryEnabled,
12
+ setDeliveryEnabled: state.setDeviceDeliveryEnabled,
13
+ savingDeliverySettings: state.savingDeviceDeliverySettings,
14
+ displayAutoPrintProduct: state.displayAutoPrintProductEnabled,
15
+ setDisplayAutoPrintProduct: state.setDisplayAutoPrintProductEnabled,
16
+ savingDisplayPrinting: state.savingDisplayPrintingConfig,
17
+ runtimeDebugInfoEnabled: state.deviceRuntimeDebugInfoEnabled,
18
+ setRuntimeDebugInfoEnabled: state.setDeviceRuntimeDebugInfoEnabled,
19
+ };
20
+ }
@@ -1,6 +1,6 @@
1
1
  import {normalizeEntityId} from '@controleonline/ui-common/src/react/utils/paymentDevices';
2
2
  import {isPosCashRegisterOpen} from '@controleonline/ui-common/src/react/config/deviceConfigBootstrap';
3
- import {Alert, Platform} from 'react-native';
3
+ import {confirmAction} from '../../../utils/confirmAction';
4
4
  import {PAYMENT_ICONS} from './deviceDetailConstants';
5
5
 
6
6
  export const paymentIcon = label => {
@@ -44,16 +44,7 @@ export const getProductShowcaseLabel = showcase => {
44
44
 
45
45
  export const getIsOpen = configs => isPosCashRegisterOpen(configs);
46
46
 
47
- export const confirm = (msg, cb) => {
48
- if (Platform.OS === 'web' && typeof window !== 'undefined' && window.confirm) {
49
- if (window.confirm(msg)) cb();
50
- } else {
51
- Alert.alert('Confirmação', msg, [
52
- {text: 'Cancelar', style: 'cancel'},
53
- {text: 'Confirmar', onPress: cb},
54
- ]);
55
- }
56
- };
47
+ export const confirm = confirmAction;
57
48
 
58
49
  export const getDeviceSwitchProps = ({disabled = false, palette, value = false}) => {
59
50
  const offTrackColor = disabled ? palette.switchDisabledTrack : palette.switchOffTrack;
@@ -1,43 +1,18 @@
1
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
- import { useNavigation, useRoute } from '@react-navigation/native';
3
- import { useStore } from '@store';
4
- import { useMessage } from '@controleonline/ui-common/src/react/components/MessageService';
5
- import { resolveThemePalette } from '@controleonline/../../src/styles/branding';
6
- import { colors } from '@controleonline/../../src/styles/colors';
7
- import packageJson from '@package';
8
- import {
9
- canDisplayChangePrinter, DEVICE_ANDROID_KIOSK_ENABLED_CONFIG_KEY, DEVICE_ANDROID_LAUNCHER_ENABLED_CONFIG_KEY,
10
- DISPLAY_AUTO_PRINT_PRODUCT_CONFIG_KEY, DISPLAY_ALLOW_PRINTER_CHANGE_CONFIG_KEY, DEVICE_ALERT_SOUND_ENABLED_KEY,
11
- DEVICE_ALERT_SOUND_URL_KEY, DEVICE_ORDER_VISIBILITY_COMPANY, DEVICE_ORDER_VISIBILITY_DEVICE, DEVICE_ORDER_VISIBILITY_KEY,
12
- DEVICE_RUNTIME_DEBUG_INFO_ENABLED_KEY, isPosAutoPrintEnabled, isPosCashRegisterOpen, isTruthyValue, parseConfigsObject,
13
- POS_AUTO_PRINT_ENABLED_CONFIG_KEY, POS_CASH_MANAGEMENT_MODE_CASH_REGISTER, POS_CASH_MANAGEMENT_MODE_CONFIG_KEY,
14
- POS_CASH_MANAGEMENT_MODE_DAILY, POS_CHECK_ORDER_MANAGEMENT_MODE_CONFIG_KEY, POS_CHECK_ORDER_MANAGEMENT_MODE_EXISTING_ONLY,
15
- POS_CHECK_ORDER_MANAGEMENT_MODE_MANAGE, POS_CHECK_ORDER_TYPE_CONFIG_KEY, POS_CHECK_ORDER_TYPE_NONE, POS_CHECK_ORDER_TYPE_TAB,
16
- POS_CHECK_ORDER_TYPE_TABLE, POS_CHECK_ORDER_TYPE_STAMP, POS_DELIVERY_ENABLED_CONFIG_KEY, POS_OPERATION_MODE_COUNTER,
17
- POS_OPERATION_MODE_CONFIG_KEY, POS_OPERATION_MODE_OPTIONS, POS_PRODUCT_SHOWCASE_CONFIG_KEY, POS_PRINT_MODE_FORM,
18
- POS_PRINT_MODE_ORDER, getPosOperationModeOption, isAndroidKioskEnabled, isAndroidLauncherEnabled, isPosDeliveryEnabled,
19
- resolvePosCheckOrderManagementMode, resolvePosCheckOrderType, resolvePosCheckOrderTypeForShop, resolveDeviceOrderVisibility,
20
- resolvePosCashManagementMode, resolvePosOperationMode, resolvePosPrintMode,
21
- } from '@controleonline/ui-common/src/react/config/deviceConfigBootstrap';
22
- import {
23
- filterDeviceConfigsByCompany, getCompanyPaymentDeviceOptions, getPaymentGatewayFromConfigs, getPaymentGatewayLabel,
24
- isPaymentCapableDeviceConfig, isPdvPrinterEnabled, normalizeDeviceId, normalizeEntityId, PAYMENT_TYPE_IDS_CONFIG_KEY,
25
- PAYMENT_GATEWAY_CIELO, PDV_PRINTER_ENABLED_CONFIG_KEY, ORDER_PAYMENT_DEVICE_CONFIG_KEY, POS_GATEWAY_CONFIG_KEY,
26
- } from '@controleonline/ui-common/src/react/utils/paymentDevices';
27
- import { normalizeBooleanConfig, SHOP_LOYALTY_COUPONS_ENABLED_CONFIG_KEY } from '@controleonline/ui-common/src/react/utils/shopConfig';
28
- import { getPrinterOptionValue, getDeviceTypeLabel, getPrinterLabel, getPrinterOptions } from '@controleonline/ui-common/src/react/utils/printerDevices';
29
- import { hex, DISPLAY_DEVICE_TYPE, PDV_DEVICE_TYPE, DISPLAY_DEVICE_LINK_CONFIG_KEY, DISPLAY_DEVICE_PRINTER_CONFIG_KEY,
30
- PDV_TAB_OPERATION, PDV_TAB_ORDERS, PDV_TAB_DEVICE, PDV_TAB_PAYMENT_TYPES, PDV_TAB_MOVEMENT, PDV_DETAIL_TABS, tt,
31
- } from './deviceDetailConstants';
32
- import { paymentIcon, formatApiError, getDisplayLabel, getProductShowcaseLabel, getIsOpen, confirm } from './deviceDetailHelpers';
33
- import { api } from '@controleonline/ui-common/src/api';
34
- import { buildDeviceAliasStoreUpdates } from '@controleonline/ui-common/src/react/utils/deviceAliasSync';
35
- import { createDeviceDetailRenderers } from './DeviceDetailRenderers';
1
+ import { appendScreenMetrics } from '@controleonline/ui-common/src/react/utils/screenMetrics';
2
+ import { useCallback, useEffect } from 'react';
3
+
4
+ import { DEVICE_ANDROID_KIOSK_ENABLED_CONFIG_KEY, POS_AUTO_PRINT_ENABLED_CONFIG_KEY, POS_CASH_MANAGEMENT_MODE_CONFIG_KEY, POS_CHECK_ORDER_MANAGEMENT_MODE_CONFIG_KEY, POS_CHECK_ORDER_MANAGEMENT_MODE_MANAGE, POS_CHECK_ORDER_TYPE_CONFIG_KEY, POS_CHECK_ORDER_TYPE_NONE, POS_CHECK_ORDER_TYPE_STAMP, POS_OPERATION_MODE_COUNTER, POS_OPERATION_MODE_CONFIG_KEY, POS_PRODUCT_SHOWCASE_CONFIG_KEY, resolvePosCheckOrderType, resolvePosCheckOrderTypeForShop } from '@controleonline/ui-common/src/react/config/deviceConfigBootstrap';
5
+ import { normalizeEntityId, PAYMENT_TYPE_IDS_CONFIG_KEY, PDV_PRINTER_ENABLED_CONFIG_KEY, ORDER_PAYMENT_DEVICE_CONFIG_KEY, POS_GATEWAY_CONFIG_KEY } from '@controleonline/ui-common/src/react/utils/paymentDevices';
36
6
 
7
+ import { PDV_TAB_MOVEMENT } from './deviceDetailConstants';
8
+ import { confirm } from './deviceDetailHelpers';
9
+
10
+ import { buildDeviceAliasStoreUpdates } from '@controleonline/ui-common/src/react/utils/deviceAliasSync';
37
11
 
38
12
  export default function useDeviceDetailActions(deps) {
39
13
  const {
40
- navigation, deviceId, deviceConfigStore, messageApi, websocketActions, runtimeCompanyConfigs, showSystemError, loyaltyCouponsEnabled, currentDevice, currentDeviceConfig, deviceString, deviceType,
14
+ runtimeDevice, runtimeDeviceConfig,
15
+ navigation, deviceId, deviceConfigStore, messageApi, websocketActions, runtimeCompanyConfigs, showSystemError, loyaltyCouponsEnabled, currentCompany, currentDevice, currentDeviceConfig, deviceString, deviceType,
41
16
  normalizedInitialConfigs, initialAlias, isDisplayDevice, isPdvDevice, actionsRef, stampAutoDisableSignatureRef, brandColors, products, setProducts, productShowcases, setProductShowcases, companyDeviceConfigs,
42
17
  setCompanyDeviceConfigs, inflowData, setInflowData, configs, setConfigs, loadingConfigData, setLoadingConfigData, loadingCompanyDeviceConfigs, setLoadingCompanyDeviceConfigs, loadingMovementData, setLoadingMovementData, actionLoading,
43
18
  setActionLoading, activePdvTab, setActivePdvTab, savingPaymentTarget, setSavingPaymentTarget, savingPdvSettings, setSavingPdvSettings, savingPaymentTypes, setSavingPaymentTypes, savingPosOperationMode, setSavingPosOperationMode, savingProductShowcase,