@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.
- package/.github/workflows/integration-source-gate.yml +68 -0
- package/.github/workflows/manager-worker.yml +7 -156
- package/.github/workflows/publish-npm.yml +73 -27
- package/.github/workflows/pull-request-checks.yml +7 -5
- package/docs/technical/Device-Detail-Alias-UI-Sync.md +141 -0
- package/package.json +13 -8
- package/src/api/localDB.js +86 -131
- package/src/react/components/BottomNavigationBar.js +178 -174
- package/src/react/components/BottomNavigationBar.styles.js +139 -118
- package/src/react/components/DefaultProvider.native.js +427 -421
- package/src/react/components/DefaultProvider.web.js +131 -125
- package/src/react/components/RemoteCheckoutService.js +3 -3
- package/src/react/components/RuntimeFooterMarqueeText.js +88 -36
- package/src/react/components/RuntimeInfoFooter.js +76 -43
- package/src/react/components/RuntimeInfoFooter.styles.js +22 -14
- package/src/react/config/deviceConfigBootstrap.js +71 -233
- package/src/react/config/deviceConfigValues.js +238 -0
- package/src/react/pages/Devices/detail/DeviceChargePermissionSection.js +32 -0
- package/src/react/pages/Devices/detail/DeviceDetailAlertsCommandsSection.js +4 -22
- package/src/react/pages/Devices/detail/DeviceDetailMovementSections.js +6 -2
- package/src/react/pages/Devices/detail/DeviceDetailOrdersPrintSection.js +4 -0
- package/src/react/pages/Devices/detail/DeviceDetailPdvConfigSection.js +7 -0
- package/src/react/pages/Devices/detail/DeviceDetailScreen.js +24 -335
- package/src/react/pages/Devices/detail/createDeviceDetailContext.js +20 -0
- package/src/react/pages/Devices/detail/deviceDetailHelpers.js +2 -11
- package/src/react/pages/Devices/detail/useDeviceDetailActions.js +11 -36
- package/src/react/pages/Devices/detail/useDeviceDetailLoaders.js +129 -37
- package/src/react/pages/Devices/detail/useDeviceDetailSaves.js +11 -38
- package/src/react/pages/Devices/detail/useDeviceDetailStateA.js +9 -28
- package/src/react/pages/IntegrationConfigFields.js +1 -0
- package/src/react/pages/IntegrationConfigPage.js +101 -45
- package/src/react/pages/IntegrationConfigPage.utils.js +21 -13
- package/src/react/pages/fetchPeopleConfigs.js +21 -0
- package/src/react/pages/integrationsCatalog.js +15 -110
- package/src/react/services/Cielo/Cielo.js +9 -9
- package/src/react/services/Getnet/Getnet.web.js +25 -0
- package/src/react/utils/companyAuthority.js +36 -0
- package/src/react/utils/confirmAction.js +12 -0
- package/src/react/utils/fileUrl.js +14 -5
- package/src/react/utils/paymentDevices.js +375 -270
- package/src/react/utils/printerDevices.js +2 -2
- package/src/react/utils/runtimeFooter.js +178 -224
- package/src/react/utils/runtimeFooterText.js +160 -0
- package/src/react/utils/runtimeLanguage.js +5 -5
- package/src/react/utils/runtimeZoom.js +29 -5
- package/src/react/utils/shopFranchises.js +167 -12
- package/src/react/utils/storeColumns.js +235 -217
- package/src/react/utils/systemErrorMessage.js +2 -1
- package/src/store/integration/index.js +43 -0
- package/src/tests/browser/manager/device-detail-apply-config-defined.spec.js +31 -0
- package/src/tests/browser/manager/device-detail-composition.spec.js +295 -0
- package/src/tests/browser/manager/device-detail-copy-config.spec.js +11 -1
- package/src/tests/browser/manager/device-detail-pdv-current-company.spec.js +273 -0
- package/src/tests/browser/manager/runtime-footer-rotation.spec.js +397 -0
- package/src/tests/react/components/DefaultProviderAuthority.test.js +28 -0
- package/src/tests/react/components/RuntimeFooterMarqueeText.build.test.js +29 -0
- package/src/tests/react/config/deviceConfigBootstrap.test.js +24 -1
- package/src/tests/react/pages/DeviceChargePermissionSection.test.js +42 -0
- package/src/tests/react/pages/applyCurrentDeviceConfig.test.js +85 -0
- package/src/tests/react/pages/deviceDetailComposition.test.js +65 -0
- package/src/tests/react/pages/deviceDetailHookDependencies.test.mjs +31 -0
- package/src/tests/react/pages/deviceDetailLoaderDependencies.test.mjs +28 -0
- package/src/tests/react/pages/receitaFederalIntegrationContract.test.mjs +27 -6
- package/src/tests/react/services/Cielo.test.js +2 -2
- package/src/tests/react/utils/companyAuthority.test.js +53 -0
- package/src/tests/react/utils/formatter.test.mjs +6 -0
- package/src/tests/react/utils/paymentDevices.test.js +72 -0
- package/src/tests/react/utils/runtimeFooter.test.js +35 -0
- package/src/tests/react/utils/runtimeFooterText.test.js +88 -0
- package/src/tests/react/utils/runtimeLanguage.test.js +4 -4
- package/src/tests/react/utils/runtimeZoom.test.js +20 -0
- package/src/tests/react/utils/shopFranchises.test.js +32 -13
- package/src/tests/react/utils/translate.test.mjs +6 -6
- package/src/utils/formatter.js +7 -3
- package/src/utils/translate.js +16 -16
- package/src/utils/translatePending.js +6 -6
- package/src/utils/translateStorage.js +2 -2
|
@@ -33,9 +33,11 @@ import {
|
|
|
33
33
|
} from '@controleonline/../../src/styles/branding';
|
|
34
34
|
import { colors as runtimeColors } from '@controleonline/../../src/styles/colors';
|
|
35
35
|
import {
|
|
36
|
+
buildDefaultDeviceConfigs,
|
|
36
37
|
buildProviderManagedDeviceConfigs,
|
|
37
38
|
parseConfigsObject,
|
|
38
39
|
} from '@controleonline/ui-common/src/react/config/deviceConfigBootstrap';
|
|
40
|
+
import {canAdministerCompany} from '@controleonline/ui-common/src/react/utils/companyAuthority';
|
|
39
41
|
import {
|
|
40
42
|
buildDeviceRegistrationPayload,
|
|
41
43
|
buildLocalRuntimeDevice,
|
|
@@ -45,7 +47,9 @@ import {
|
|
|
45
47
|
} from '@controleonline/ui-common/src/react/utils/deviceRuntime';
|
|
46
48
|
import {
|
|
47
49
|
filterWalletPaymentTypesByAllowedIds,
|
|
50
|
+
getPaymentGateway,
|
|
48
51
|
resolveDevicePaymentTypeIds,
|
|
52
|
+
selectPosWalletPaymentTypes,
|
|
49
53
|
} from '@controleonline/ui-common/src/react/utils/paymentDevices';
|
|
50
54
|
import {
|
|
51
55
|
normalizeRuntimeMenuResponse,
|
|
@@ -101,21 +105,6 @@ const resolveDeviceConfigPeopleIri = ({appType, currentCompany, user}) => {
|
|
|
101
105
|
|
|
102
106
|
return '';
|
|
103
107
|
};
|
|
104
|
-
const isTenantAdministrativeAuthority = company => {
|
|
105
|
-
const userFlags = company?.user || {};
|
|
106
|
-
return !!(
|
|
107
|
-
userFlags.owner_enabled ||
|
|
108
|
-
userFlags.director_enabled ||
|
|
109
|
-
userFlags.manager_enabled ||
|
|
110
|
-
userFlags.admin_enabled ||
|
|
111
|
-
company?.owner_enabled ||
|
|
112
|
-
company?.director_enabled ||
|
|
113
|
-
company?.manager_enabled
|
|
114
|
-
);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
108
|
const normalizeRuntimeIp = value => String(value || '').trim();
|
|
120
109
|
|
|
121
110
|
const getRuntimeIpFromResponse = response =>
|
|
@@ -173,30 +162,30 @@ export const DefaultProvider = ({
|
|
|
173
162
|
const appType = String(app_type || '').toUpperCase();
|
|
174
163
|
const isShopClientApp = appType === 'SHOP';
|
|
175
164
|
const themeStore = useStore('theme');
|
|
176
|
-
const getters = themeStore.getters;
|
|
177
|
-
const actions = themeStore.actions;
|
|
178
|
-
|
|
179
|
-
const authStore = useStore('auth');
|
|
180
|
-
const authGetters = authStore.getters;
|
|
181
|
-
|
|
182
|
-
const peopleStore = useStore('people');
|
|
183
|
-
const peopleGetters = peopleStore.getters;
|
|
184
|
-
const peopleActions = peopleStore.actions;
|
|
185
|
-
|
|
186
|
-
const deviceStore = useStore('device');
|
|
187
|
-
const deviceActions = deviceStore.actions;
|
|
188
|
-
|
|
189
|
-
const device_configStore = useStore('device_config');
|
|
190
|
-
const deviceConfigsGetters = device_configStore.getters;
|
|
191
|
-
const deviceConfigsActions = device_configStore.actions;
|
|
192
|
-
|
|
193
|
-
const configsStore = useStore('configs');
|
|
194
|
-
const configActions = configsStore.actions;
|
|
195
|
-
const configsGetters = configsStore.getters;
|
|
196
|
-
|
|
197
|
-
const printerStore = useStore('printer');
|
|
198
|
-
const printerActions = printerStore.actions;
|
|
199
|
-
|
|
165
|
+
const getters = themeStore.getters;
|
|
166
|
+
const actions = themeStore.actions;
|
|
167
|
+
|
|
168
|
+
const authStore = useStore('auth');
|
|
169
|
+
const authGetters = authStore.getters;
|
|
170
|
+
|
|
171
|
+
const peopleStore = useStore('people');
|
|
172
|
+
const peopleGetters = peopleStore.getters;
|
|
173
|
+
const peopleActions = peopleStore.actions;
|
|
174
|
+
|
|
175
|
+
const deviceStore = useStore('device');
|
|
176
|
+
const deviceActions = deviceStore.actions;
|
|
177
|
+
|
|
178
|
+
const device_configStore = useStore('device_config');
|
|
179
|
+
const deviceConfigsGetters = device_configStore.getters;
|
|
180
|
+
const deviceConfigsActions = device_configStore.actions;
|
|
181
|
+
|
|
182
|
+
const configsStore = useStore('configs');
|
|
183
|
+
const configActions = configsStore.actions;
|
|
184
|
+
const configsGetters = configsStore.getters;
|
|
185
|
+
|
|
186
|
+
const printerStore = useStore('printer');
|
|
187
|
+
const printerActions = printerStore.actions;
|
|
188
|
+
|
|
200
189
|
const walletPaymentTypeStore = useStore('walletPaymentType');
|
|
201
190
|
const paymentTypeActions = walletPaymentTypeStore.actions;
|
|
202
191
|
|
|
@@ -205,12 +194,12 @@ export const DefaultProvider = ({
|
|
|
205
194
|
|
|
206
195
|
const { items: companyConfigs } = configsGetters;
|
|
207
196
|
const { colors, menus } = getters;
|
|
208
|
-
const { currentCompany,
|
|
197
|
+
const { currentCompany, mainCompany, companies } = peopleGetters;
|
|
209
198
|
const { item: device_config } = deviceConfigsGetters;
|
|
210
199
|
const { isLogged, user } = authGetters;
|
|
211
200
|
const hasCurrentCompany =
|
|
212
201
|
!!currentCompany && Object.entries(currentCompany).length > 0;
|
|
213
|
-
|
|
202
|
+
|
|
214
203
|
const [translateReady, setTranslateReady] = useState(false);
|
|
215
204
|
const [activeTranslateBootstrapKey, setActiveTranslateBootstrapKey] =
|
|
216
205
|
useState('');
|
|
@@ -258,7 +247,7 @@ export const DefaultProvider = ({
|
|
|
258
247
|
);
|
|
259
248
|
const configuredTranslationLanguage = resolveConfiguredLanguage({
|
|
260
249
|
currentCompany,
|
|
261
|
-
|
|
250
|
+
mainCompany,
|
|
262
251
|
currentConfig: currentTranslationConfig,
|
|
263
252
|
sessionData: currentTranslationSession,
|
|
264
253
|
});
|
|
@@ -266,7 +255,7 @@ export const DefaultProvider = ({
|
|
|
266
255
|
? buildTranslationBootstrapKey({
|
|
267
256
|
language: configuredTranslationLanguage,
|
|
268
257
|
currentCompanyId: normalizeEntityId(currentCompany?.id),
|
|
269
|
-
|
|
258
|
+
mainCompanyId: normalizeEntityId(mainCompany?.id),
|
|
270
259
|
})
|
|
271
260
|
: '';
|
|
272
261
|
const requiresTranslateBootstrap = Boolean(
|
|
@@ -307,7 +296,7 @@ export const DefaultProvider = ({
|
|
|
307
296
|
: {
|
|
308
297
|
appVersion,
|
|
309
298
|
colors,
|
|
310
|
-
|
|
299
|
+
mainCompany,
|
|
311
300
|
device,
|
|
312
301
|
},
|
|
313
302
|
bottomChrome: {
|
|
@@ -319,22 +308,22 @@ export const DefaultProvider = ({
|
|
|
319
308
|
appVersion,
|
|
320
309
|
bottomNavigationCount,
|
|
321
310
|
colors,
|
|
322
|
-
|
|
311
|
+
mainCompany,
|
|
323
312
|
device,
|
|
324
313
|
isShopClientApp,
|
|
325
314
|
menus,
|
|
326
315
|
registerBottomNavigation,
|
|
327
316
|
],
|
|
328
317
|
);
|
|
329
|
-
|
|
318
|
+
|
|
330
319
|
useEffect(() => {
|
|
331
320
|
global.refreshTranslationsUI = () => {
|
|
332
321
|
setTranslateVersion(version => version + 1);
|
|
333
322
|
};
|
|
334
|
-
|
|
335
|
-
return () => {
|
|
336
|
-
if (global.refreshTranslationsUI) {
|
|
337
|
-
delete global.refreshTranslationsUI;
|
|
323
|
+
|
|
324
|
+
return () => {
|
|
325
|
+
if (global.refreshTranslationsUI) {
|
|
326
|
+
delete global.refreshTranslationsUI;
|
|
338
327
|
}
|
|
339
328
|
};
|
|
340
329
|
}, []);
|
|
@@ -429,42 +418,43 @@ export const DefaultProvider = ({
|
|
|
429
418
|
});
|
|
430
419
|
};
|
|
431
420
|
|
|
421
|
+
// Sync web device identity once per signature. Calling setItem on every
|
|
422
|
+
// effect pass (even when unchanged) re-entered the store after logout→login
|
|
423
|
+
// and produced React #185 (app-community#827).
|
|
424
|
+
const lastWebDeviceSyncRef = useRef('');
|
|
432
425
|
useEffect(() => {
|
|
433
|
-
if (!isLogged && !isShopClientApp
|
|
426
|
+
if (!isLogged && !isShopClientApp) {
|
|
434
427
|
return;
|
|
435
428
|
}
|
|
436
429
|
|
|
437
430
|
const nextDevice = buildWebDevice();
|
|
438
431
|
if (!nextDevice) {
|
|
439
|
-
if (device && device.id) {
|
|
440
|
-
deviceActions.setItem(device);
|
|
441
|
-
}
|
|
442
432
|
return;
|
|
443
433
|
}
|
|
444
434
|
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
if (
|
|
455
|
-
setDevice(nextDevice);
|
|
456
|
-
localStorage.setItem('device', JSON.stringify(nextDevice));
|
|
457
|
-
deviceActions.setItem(nextDevice);
|
|
458
|
-
localStorage.removeItem('master-device');
|
|
435
|
+
const signature = JSON.stringify({
|
|
436
|
+
id: nextDevice.id,
|
|
437
|
+
appVersion: nextDevice.appVersion,
|
|
438
|
+
appName: nextDevice.appName,
|
|
439
|
+
type: nextDevice.type,
|
|
440
|
+
metadata: nextDevice.metadata || {},
|
|
441
|
+
externalIp: nextDevice.externalIp || null,
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
if (lastWebDeviceSyncRef.current === signature) {
|
|
459
445
|
return;
|
|
460
446
|
}
|
|
461
447
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
448
|
+
lastWebDeviceSyncRef.current = signature;
|
|
449
|
+
setDevice(nextDevice);
|
|
450
|
+
localStorage.setItem('device', JSON.stringify(nextDevice));
|
|
451
|
+
deviceActions.setItem(nextDevice);
|
|
452
|
+
localStorage.removeItem('master-device');
|
|
453
|
+
}, [deviceActions, isLogged, isShopClientApp, packageVersion, user?.id, webRuntimeIp]);
|
|
454
|
+
|
|
465
455
|
useEffect(() => {
|
|
466
456
|
if (isShopClientApp || device?.id) {
|
|
467
|
-
peopleActions.
|
|
457
|
+
peopleActions.mainCompany().catch(() => {});
|
|
468
458
|
}
|
|
469
459
|
}, [device?.id, isShopClientApp, peopleActions]);
|
|
470
460
|
|
|
@@ -473,6 +463,15 @@ export const DefaultProvider = ({
|
|
|
473
463
|
return;
|
|
474
464
|
}
|
|
475
465
|
|
|
466
|
+
// Device registration changes tenant context and is not valid without an
|
|
467
|
+
// active company or administrative authority for that company.
|
|
468
|
+
if (
|
|
469
|
+
!currentCompany?.id ||
|
|
470
|
+
!canAdministerCompany({company: currentCompany, mainCompany, user})
|
|
471
|
+
) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
|
|
476
475
|
let cancelled = false;
|
|
477
476
|
|
|
478
477
|
const syncDeviceRegistration = async () => {
|
|
@@ -553,9 +552,12 @@ export const DefaultProvider = ({
|
|
|
553
552
|
device?.model,
|
|
554
553
|
device?.systemVersion,
|
|
555
554
|
isLogged,
|
|
555
|
+
currentCompany,
|
|
556
|
+
mainCompany,
|
|
556
557
|
runtimeDeviceType,
|
|
558
|
+
user,
|
|
557
559
|
]);
|
|
558
|
-
|
|
560
|
+
|
|
559
561
|
useEffect(() => {
|
|
560
562
|
if (isShopClientApp || !isLogged || !currentCompany?.id) {
|
|
561
563
|
return;
|
|
@@ -565,7 +567,7 @@ export const DefaultProvider = ({
|
|
|
565
567
|
.ensureCompanyPrintersLoaded({people: currentCompany.id})
|
|
566
568
|
.catch(() => {});
|
|
567
569
|
}, [currentCompany?.id, isLogged, isShopClientApp, printerActions]);
|
|
568
|
-
|
|
570
|
+
|
|
569
571
|
useEffect(() => {
|
|
570
572
|
const paymentConfigSource = isShopClientApp
|
|
571
573
|
? Object.keys(companyConfigs || {}).length > 0
|
|
@@ -580,6 +582,10 @@ export const DefaultProvider = ({
|
|
|
580
582
|
return;
|
|
581
583
|
}
|
|
582
584
|
|
|
585
|
+
if (!isShopClientApp && !mainConfigsDiscovered) {
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
|
|
583
589
|
const paymentTypeSignature = resolveDevicePaymentTypeIds(paymentConfigSource)
|
|
584
590
|
.sort()
|
|
585
591
|
.join(',');
|
|
@@ -625,16 +631,13 @@ export const DefaultProvider = ({
|
|
|
625
631
|
: Array.isArray(response)
|
|
626
632
|
? response
|
|
627
633
|
: [];
|
|
628
|
-
const allowedPaymentTypeIds = resolveDevicePaymentTypeIds(
|
|
629
|
-
paymentConfigSource,
|
|
630
|
-
walletPaymentTypes,
|
|
631
|
-
);
|
|
632
|
-
|
|
633
634
|
paymentTypeActions.setItems(
|
|
634
|
-
|
|
635
|
+
selectPosWalletPaymentTypes({
|
|
635
636
|
walletPaymentTypes,
|
|
636
|
-
|
|
637
|
-
|
|
637
|
+
deviceConfigs: paymentConfigSource,
|
|
638
|
+
companyConfigs,
|
|
639
|
+
gateway: getPaymentGateway(device_config || paymentConfigSource),
|
|
640
|
+
}),
|
|
638
641
|
);
|
|
639
642
|
walletPaymentTypeLoadedKeyRef.current = requestKey;
|
|
640
643
|
})
|
|
@@ -663,7 +666,7 @@ export const DefaultProvider = ({
|
|
|
663
666
|
isShopClientApp,
|
|
664
667
|
paymentTypeActions,
|
|
665
668
|
]);
|
|
666
|
-
|
|
669
|
+
|
|
667
670
|
useEffect(() => {
|
|
668
671
|
if (!device?.id || !isLogged || !deviceConfigPeopleIri) {
|
|
669
672
|
return;
|
|
@@ -721,7 +724,14 @@ export const DefaultProvider = ({
|
|
|
721
724
|
return;
|
|
722
725
|
}
|
|
723
726
|
|
|
724
|
-
const
|
|
727
|
+
const isNewPdvConfig =
|
|
728
|
+
runtimeDeviceType === 'PDV' &&
|
|
729
|
+
!device_config?.id &&
|
|
730
|
+
!device_config?.['@id'];
|
|
731
|
+
const buildDeviceConfigs = isNewPdvConfig
|
|
732
|
+
? buildDefaultDeviceConfigs
|
|
733
|
+
: buildProviderManagedDeviceConfigs;
|
|
734
|
+
const {nextConfigs, needsUpdate} = buildDeviceConfigs({
|
|
725
735
|
configs: device_config?.configs,
|
|
726
736
|
appVersion,
|
|
727
737
|
deviceInfo: device,
|
|
@@ -732,24 +742,20 @@ export const DefaultProvider = ({
|
|
|
732
742
|
return;
|
|
733
743
|
}
|
|
734
744
|
|
|
735
|
-
//
|
|
736
|
-
//
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
.catch(() => { })
|
|
750
|
-
.finally(() => {
|
|
751
|
-
setDeviceRuntimeConfigSynced(true);
|
|
752
|
-
});
|
|
745
|
+
// app-community#821: never auto-persist device_config from global bootstrap.
|
|
746
|
+
// Provider-managed fields (config-version, pos-gateway, screen metrics) stay
|
|
747
|
+
// in memory only. POST/PUT to /device_configs* is reserved for explicit
|
|
748
|
+
// device settings UI — avoids 403 from DeviceFinancialConfigAuthorizationSubscriber
|
|
749
|
+
// on pages like order-history (PDV/MANAGER types are fully protected).
|
|
750
|
+
const currentItem = device_config || {};
|
|
751
|
+
deviceConfigsActions.setItem({
|
|
752
|
+
...currentItem,
|
|
753
|
+
configs: nextConfigs,
|
|
754
|
+
device: currentItem.device || device.id,
|
|
755
|
+
people: currentItem.people || deviceConfigPeopleIri,
|
|
756
|
+
type: currentItem.type || runtimeDeviceType,
|
|
757
|
+
});
|
|
758
|
+
setDeviceRuntimeConfigSynced(true);
|
|
753
759
|
}, [
|
|
754
760
|
appVersion,
|
|
755
761
|
device?.id,
|
|
@@ -758,11 +764,11 @@ export const DefaultProvider = ({
|
|
|
758
764
|
deviceConfigFetched,
|
|
759
765
|
deviceConfigPeopleIri,
|
|
760
766
|
deviceRuntimeConfigSynced,
|
|
761
|
-
currentCompany,
|
|
762
767
|
deviceConfigsActions,
|
|
763
|
-
device_config
|
|
768
|
+
device_config,
|
|
764
769
|
isLogged,
|
|
765
770
|
runtimeDeviceType,
|
|
771
|
+
user,
|
|
766
772
|
]);
|
|
767
773
|
|
|
768
774
|
useEffect(() => {
|
|
@@ -792,7 +798,7 @@ export const DefaultProvider = ({
|
|
|
792
798
|
setMainConfigsDiscovered(true);
|
|
793
799
|
});
|
|
794
800
|
}, [configActions, currentCompany?.id, device?.id, isLogged, mainConfigsDiscovered]);
|
|
795
|
-
|
|
801
|
+
|
|
796
802
|
useEffect(() => {
|
|
797
803
|
if (
|
|
798
804
|
isLogged &&
|
|
@@ -803,7 +809,7 @@ export const DefaultProvider = ({
|
|
|
803
809
|
configActions.setItems(currentCompany.configs);
|
|
804
810
|
}
|
|
805
811
|
}, [currentCompany, isLogged, mainConfigsDiscovered]);
|
|
806
|
-
|
|
812
|
+
|
|
807
813
|
useEffect(() => {
|
|
808
814
|
if (!currentRouteName || isPublicRouteActive) {
|
|
809
815
|
return;
|
|
@@ -826,7 +832,7 @@ export const DefaultProvider = ({
|
|
|
826
832
|
) {
|
|
827
833
|
global.t.companies = companies;
|
|
828
834
|
global.t.currentCompany = currentCompany;
|
|
829
|
-
global.t.
|
|
835
|
+
global.t.mainCompany = mainCompany;
|
|
830
836
|
setActiveTranslateBootstrapKey(expectedTranslateBootstrapKey);
|
|
831
837
|
setTranslateReady(true);
|
|
832
838
|
|
|
@@ -849,7 +855,7 @@ export const DefaultProvider = ({
|
|
|
849
855
|
translateBootstrapKeyRef.current = expectedTranslateBootstrapKey;
|
|
850
856
|
global.t = new Translate(
|
|
851
857
|
companies,
|
|
852
|
-
|
|
858
|
+
mainCompany,
|
|
853
859
|
currentCompany,
|
|
854
860
|
Object.keys(stores),
|
|
855
861
|
translateStore,
|
|
@@ -862,7 +868,7 @@ export const DefaultProvider = ({
|
|
|
862
868
|
configuredTranslationLanguage,
|
|
863
869
|
currentCompany,
|
|
864
870
|
currentRouteName,
|
|
865
|
-
|
|
871
|
+
mainCompany,
|
|
866
872
|
deviceConfigFetched,
|
|
867
873
|
expectedTranslateBootstrapKey,
|
|
868
874
|
hasCurrentCompany,
|
|
@@ -886,7 +892,7 @@ export const DefaultProvider = ({
|
|
|
886
892
|
isTranslateBootstrapReady,
|
|
887
893
|
onBootstrapReady,
|
|
888
894
|
]);
|
|
889
|
-
|
|
895
|
+
|
|
890
896
|
useEffect(() => {
|
|
891
897
|
if (device && device.id && isLogged) {
|
|
892
898
|
peopleActions.myCompanies();
|
|
@@ -940,32 +946,32 @@ export const DefaultProvider = ({
|
|
|
940
946
|
};
|
|
941
947
|
|
|
942
948
|
fetchColors();
|
|
943
|
-
}, [actions, currentCompany?.id,
|
|
949
|
+
}, [actions, currentCompany?.id, mainCompany?.id, device?.id]);
|
|
944
950
|
|
|
945
951
|
useEffect(() => {
|
|
946
952
|
const companyThemeColors = isShopClientApp
|
|
947
|
-
?
|
|
948
|
-
: currentCompany?.theme?.colors ||
|
|
953
|
+
? mainCompany?.theme?.colors || {}
|
|
954
|
+
: currentCompany?.theme?.colors || mainCompany?.theme?.colors || {};
|
|
949
955
|
const mergedThemeColors = {
|
|
950
956
|
...(baseThemeColors || {}),
|
|
951
957
|
...(companyThemeColors || {}),
|
|
952
958
|
};
|
|
953
|
-
|
|
954
|
-
const palette = resolveThemePalette(mergedThemeColors, runtimeColors);
|
|
955
|
-
applyPaletteToRuntimeColors(palette, runtimeColors);
|
|
956
|
-
applyThemeCssVariables({
|
|
957
|
-
themeColors: mergedThemeColors,
|
|
958
|
-
palette,
|
|
959
|
-
});
|
|
960
|
-
|
|
961
|
-
actions.setColors(mergedThemeColors);
|
|
959
|
+
|
|
960
|
+
const palette = resolveThemePalette(mergedThemeColors, runtimeColors);
|
|
961
|
+
applyPaletteToRuntimeColors(palette, runtimeColors);
|
|
962
|
+
applyThemeCssVariables({
|
|
963
|
+
themeColors: mergedThemeColors,
|
|
964
|
+
palette,
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
actions.setColors(mergedThemeColors);
|
|
962
968
|
}, [
|
|
963
969
|
actions,
|
|
964
970
|
baseThemeColors,
|
|
965
971
|
currentCompany?.id,
|
|
966
972
|
currentCompany?.theme?.colors,
|
|
967
|
-
|
|
968
|
-
|
|
973
|
+
mainCompany?.id,
|
|
974
|
+
mainCompany?.theme?.colors,
|
|
969
975
|
isShopClientApp,
|
|
970
976
|
]);
|
|
971
977
|
|
|
@@ -986,7 +992,7 @@ export const DefaultProvider = ({
|
|
|
986
992
|
{!isShopClientApp && showRuntimeFooter && bottomNavigationCount === 0 && (
|
|
987
993
|
<RuntimeInfoFooter
|
|
988
994
|
appVersion={appVersion}
|
|
989
|
-
|
|
995
|
+
mainCompany={mainCompany}
|
|
990
996
|
device={device}
|
|
991
997
|
colors={colors}
|
|
992
998
|
/>
|
|
@@ -88,7 +88,7 @@ const Checkout = () => {
|
|
|
88
88
|
const invoiceActions = invoiceStore.actions;
|
|
89
89
|
const peopleStore = useStore('people');
|
|
90
90
|
const peopleGetters = peopleStore.getters;
|
|
91
|
-
const {currentCompany,
|
|
91
|
+
const {currentCompany, mainCompany} = peopleGetters;
|
|
92
92
|
const websocketStore = useStore('websocket');
|
|
93
93
|
const websocketActions = websocketStore.actions;
|
|
94
94
|
const {messages, message} = invoiceGetters;
|
|
@@ -120,7 +120,7 @@ const Checkout = () => {
|
|
|
120
120
|
|
|
121
121
|
const createInvoice = useCallback(async (selectedPayment, total, orderItem) => {
|
|
122
122
|
const paidStatusIri = await resolvePosPaidInvoiceStatusIri(
|
|
123
|
-
|
|
123
|
+
mainCompany?.configs['pos-paid-status'],
|
|
124
124
|
);
|
|
125
125
|
|
|
126
126
|
if (!paidStatusIri) {
|
|
@@ -143,7 +143,7 @@ const Checkout = () => {
|
|
|
143
143
|
return await invoiceActions.save(payload);
|
|
144
144
|
}, [
|
|
145
145
|
currentCompany?.id,
|
|
146
|
-
|
|
146
|
+
mainCompany?.configs,
|
|
147
147
|
invoiceActions,
|
|
148
148
|
]);
|
|
149
149
|
|