@controleonline/ui-common 1.2.70 → 1.2.71
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/package.json +31 -28
- package/src/api/index.js +237 -37
- package/src/react/components/AddImportModal.js +1 -1
- 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.js +86 -31
- package/src/react/components/BottomNavigationBar.styles.js +118 -110
- package/src/react/components/DefaultProvider.native.js +68 -66
- package/src/react/components/DefaultProvider.web.js +44 -42
- 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/RemoteCheckoutService.js +28 -20
- package/src/react/components/RuntimeBottomNavigationBar.js +146 -119
- package/src/react/components/RuntimeInfoFooter.js +37 -9
- package/src/react/components/StateStore.js +258 -0
- package/src/react/components/WebsocketListener.native.js +11 -11
- package/src/react/config/deviceConfigBootstrap.js +66 -27
- package/src/react/css/orders.js +72 -0
- package/src/react/pages/SettingsPage/PaymentTypesByWalletTab.js +484 -454
- package/src/react/pages/SettingsPage/index.js +1266 -1167
- 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/fileUrl.js +182 -16
- 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/runtimeMenu.js +35 -3
- package/src/react/utils/shopConfig.js +50 -24
- package/src/react/utils/shopFranchises.js +56 -22
- package/src/react/utils/socketRuntimePipeline.js +14 -14
- package/src/store/configs/index.js +2 -2
- package/src/tests/react/api/loadSmokeIndex.test.js +75 -0
- package/src/tests/react/config/deviceConfigBootstrap.test.js +47 -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/utils/fileUrl.test.js +62 -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 +4 -6
- package/src/tests/react/utils/runtimeLanguage.test.js +2 -2
- package/src/tests/react/utils/runtimeMenu.test.js +23 -3
- package/src/tests/react/utils/shopConfig.test.js +74 -0
- package/src/tests/react/utils/shopFranchises.test.js +79 -12
- package/src/tests/react/utils/translate.test.mjs +166 -102
- package/src/utils/formatter.js +18 -0
- package/src/utils/integrationConfigs.js +80 -79
- package/src/utils/translate.js +125 -30
|
@@ -1,110 +1,118 @@
|
|
|
1
|
-
import {Platform, StyleSheet} from 'react-native';
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
return
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
1
|
+
import {Platform, StyleSheet} from 'react-native';
|
|
2
|
+
|
|
3
|
+
const resolveWebShadowColor = shadowColor => {
|
|
4
|
+
if (typeof shadowColor !== 'string') {
|
|
5
|
+
return 'rgba(0, 0, 0, 0.12)';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const normalized = shadowColor.trim();
|
|
9
|
+
if (!normalized) {
|
|
10
|
+
return 'rgba(0, 0, 0, 0.12)';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (/^#[0-9a-f]{3}$/i.test(normalized)) {
|
|
14
|
+
return `${normalized[0]}${normalized[1]}${normalized[1]}${normalized[2]}${normalized[2]}${normalized[3]}${normalized[3]}1f`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (/^#[0-9a-f]{6}$/i.test(normalized)) {
|
|
18
|
+
return `${normalized}1f`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (/^#[0-9a-f]{4}$/i.test(normalized) || /^#[0-9a-f]{8}$/i.test(normalized)) {
|
|
22
|
+
return normalized;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return normalized;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const createStyles = ({
|
|
29
|
+
activeBackground,
|
|
30
|
+
dockBackground,
|
|
31
|
+
dockBorder,
|
|
32
|
+
dockShadow,
|
|
33
|
+
activeBorder,
|
|
34
|
+
useModernWebChromeProps = false,
|
|
35
|
+
}) =>
|
|
36
|
+
StyleSheet.create({
|
|
37
|
+
host: {
|
|
38
|
+
position: Platform.OS === 'web' ? 'fixed' : 'absolute',
|
|
39
|
+
left: 0,
|
|
40
|
+
right: 0,
|
|
41
|
+
bottom: 0,
|
|
42
|
+
zIndex: 1000,
|
|
43
|
+
backgroundColor: 'transparent',
|
|
44
|
+
alignItems: 'stretch',
|
|
45
|
+
},
|
|
46
|
+
hostPointerEventsBoxNone: {
|
|
47
|
+
pointerEvents: 'box-none',
|
|
48
|
+
},
|
|
49
|
+
stack: {
|
|
50
|
+
width: '100%',
|
|
51
|
+
alignItems: 'stretch',
|
|
52
|
+
},
|
|
53
|
+
dock: {
|
|
54
|
+
flexDirection: 'row',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
justifyContent: 'space-between',
|
|
57
|
+
minHeight: 64,
|
|
58
|
+
paddingHorizontal: 8,
|
|
59
|
+
paddingTop: 8,
|
|
60
|
+
paddingBottom: 8,
|
|
61
|
+
borderWidth: 1,
|
|
62
|
+
borderBottomWidth: 0,
|
|
63
|
+
borderColor: dockBorder,
|
|
64
|
+
borderTopLeftRadius: 24,
|
|
65
|
+
borderTopRightRadius: 24,
|
|
66
|
+
borderBottomLeftRadius: 0,
|
|
67
|
+
borderBottomRightRadius: 0,
|
|
68
|
+
backgroundColor: dockBackground,
|
|
69
|
+
overflow: 'hidden',
|
|
70
|
+
...(Platform.OS === 'android'
|
|
71
|
+
? {elevation: 10}
|
|
72
|
+
: Platform.OS === 'web' && useModernWebChromeProps
|
|
73
|
+
? {
|
|
74
|
+
boxShadow: `0px -6px 14px ${resolveWebShadowColor(dockShadow)}`,
|
|
75
|
+
}
|
|
76
|
+
: {
|
|
77
|
+
shadowColor: dockShadow,
|
|
78
|
+
shadowOpacity: 0.12,
|
|
79
|
+
shadowOffset: {width: 0, height: -6},
|
|
80
|
+
shadowRadius: 14,
|
|
81
|
+
}),
|
|
82
|
+
},
|
|
83
|
+
item: {
|
|
84
|
+
flex: 1,
|
|
85
|
+
minHeight: 44,
|
|
86
|
+
alignItems: 'center',
|
|
87
|
+
justifyContent: 'center',
|
|
88
|
+
paddingVertical: 6,
|
|
89
|
+
paddingHorizontal: 4,
|
|
90
|
+
borderWidth: 1,
|
|
91
|
+
borderColor: 'transparent',
|
|
92
|
+
borderRadius: 18,
|
|
93
|
+
},
|
|
94
|
+
itemActive: {
|
|
95
|
+
backgroundColor: activeBackground,
|
|
96
|
+
borderColor: activeBorder,
|
|
97
|
+
},
|
|
98
|
+
itemPressed: {
|
|
99
|
+
transform: [{scale: 0.99}],
|
|
100
|
+
},
|
|
101
|
+
itemDisabled: {},
|
|
102
|
+
iconWrap: {
|
|
103
|
+
width: 24,
|
|
104
|
+
height: 24,
|
|
105
|
+
borderRadius: 999,
|
|
106
|
+
alignItems: 'center',
|
|
107
|
+
justifyContent: 'center',
|
|
108
|
+
marginBottom: 4,
|
|
109
|
+
backgroundColor: 'transparent',
|
|
110
|
+
},
|
|
111
|
+
itemLabel: {
|
|
112
|
+
fontSize: 12,
|
|
113
|
+
fontWeight: '600',
|
|
114
|
+
textAlign: 'center',
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export default createStyles;
|
|
@@ -21,9 +21,10 @@ import PrintService from '@controleonline/ui-common/src/react/components/PrintSe
|
|
|
21
21
|
import RemoteCheckoutService from '@controleonline/ui-common/src/react/components/RemoteCheckoutService';
|
|
22
22
|
import ProductCatalogCacheService from '@controleonline/ui-common/src/react/components/ProductCatalogCacheService';
|
|
23
23
|
import RuntimeInfoFooter from '@controleonline/ui-common/src/react/components/RuntimeInfoFooter';
|
|
24
|
-
import {isPublicRoute} from '
|
|
24
|
+
import {isPublicRoute} from '../router/publicRoutes';
|
|
25
25
|
import {api} from '@controleonline/ui-common/src/api';
|
|
26
|
-
import {
|
|
26
|
+
import {app_type} from '@appType';
|
|
27
|
+
import { env as APP_ENV } from '@env';
|
|
27
28
|
const {resolveConfiguredLanguage} = require('../utils/runtimeLanguage');
|
|
28
29
|
import {
|
|
29
30
|
applyPaletteToRuntimeColors,
|
|
@@ -46,9 +47,11 @@ import {
|
|
|
46
47
|
filterWalletPaymentTypesByAllowedIds,
|
|
47
48
|
resolveDevicePaymentTypeIds,
|
|
48
49
|
} from '@controleonline/ui-common/src/react/utils/paymentDevices';
|
|
49
|
-
import {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
import {
|
|
51
|
+
normalizeRuntimeMenuResponse,
|
|
52
|
+
} from '@controleonline/ui-common/src/react/utils/runtimeMenu';
|
|
53
|
+
import packageJson from '@package';
|
|
54
|
+
import providerStyles from './DefaultProvider.styles';
|
|
52
55
|
|
|
53
56
|
import {useStore} from '@store';
|
|
54
57
|
import stores from '@stores';
|
|
@@ -96,7 +99,7 @@ const resolveDeviceConfigPeopleIri = ({appType, currentCompany, user}) => {
|
|
|
96
99
|
};
|
|
97
100
|
|
|
98
101
|
export const DefaultProvider = ({children, onBootstrapReady}) => {
|
|
99
|
-
const appType = String(
|
|
102
|
+
const appType = String(app_type || '').toUpperCase();
|
|
100
103
|
const isShopClientApp = appType === 'SHOP';
|
|
101
104
|
const themeStore = useStore('theme');
|
|
102
105
|
const getters = themeStore.getters;
|
|
@@ -148,7 +151,7 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
|
|
|
148
151
|
const packageVersion = packageJson?.version || packageJson?.default?.version;
|
|
149
152
|
const appVersion = packageVersion || device?.appVersion;
|
|
150
153
|
const runtimeDeviceType = resolveOperationalDeviceType({
|
|
151
|
-
appType:
|
|
154
|
+
appType: app_type,
|
|
152
155
|
deviceInfo: device || {},
|
|
153
156
|
});
|
|
154
157
|
const deviceConfigPeopleIri = resolveDeviceConfigPeopleIri({
|
|
@@ -281,7 +284,7 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
|
|
|
281
284
|
let ld = null;
|
|
282
285
|
if (uniqueId) {
|
|
283
286
|
ld = buildLocalRuntimeDevice({
|
|
284
|
-
appType:
|
|
287
|
+
appType: app_type,
|
|
285
288
|
deviceInfo: {
|
|
286
289
|
id: uniqueId,
|
|
287
290
|
appName: appName,
|
|
@@ -368,7 +371,7 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
|
|
|
368
371
|
Array.isArray(items) && items.length > 0 ? items[0] : null;
|
|
369
372
|
const nextDevice = buildDeviceRegistrationPayload({
|
|
370
373
|
deviceInfo: device,
|
|
371
|
-
appType:
|
|
374
|
+
appType: app_type,
|
|
372
375
|
existingDevice,
|
|
373
376
|
});
|
|
374
377
|
|
|
@@ -700,7 +703,6 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
|
|
|
700
703
|
);
|
|
701
704
|
setTranslateReady(true);
|
|
702
705
|
global.refreshTranslationsUI?.();
|
|
703
|
-
global.t.discoveryAll().catch(() => {});
|
|
704
706
|
}, [
|
|
705
707
|
companies,
|
|
706
708
|
currentCompany,
|
|
@@ -720,20 +722,52 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
|
|
|
720
722
|
}, [isLogged, translateReady, hasCurrentCompany, onBootstrapReady]);
|
|
721
723
|
|
|
722
724
|
|
|
723
|
-
useEffect(() => {
|
|
724
|
-
if (
|
|
725
|
-
device &&
|
|
726
|
-
device.id &&
|
|
727
|
-
isLogged
|
|
728
|
-
) {
|
|
729
|
-
peopleActions.myCompanies();
|
|
730
|
-
}
|
|
731
|
-
}, [isLogged, device?.id]);
|
|
732
|
-
|
|
733
|
-
useEffect(() => {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
725
|
+
useEffect(() => {
|
|
726
|
+
if (
|
|
727
|
+
device &&
|
|
728
|
+
device.id &&
|
|
729
|
+
isLogged
|
|
730
|
+
) {
|
|
731
|
+
peopleActions.myCompanies();
|
|
732
|
+
}
|
|
733
|
+
}, [isLogged, device?.id]);
|
|
734
|
+
|
|
735
|
+
useEffect(() => {
|
|
736
|
+
if (!isLogged || !currentCompany?.id) {
|
|
737
|
+
actions.setMenus([]);
|
|
738
|
+
return undefined;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
let cancelled = false;
|
|
742
|
+
|
|
743
|
+
api
|
|
744
|
+
.fetch('menus-people', {
|
|
745
|
+
params: {
|
|
746
|
+
myCompany: currentCompany.id,
|
|
747
|
+
appType,
|
|
748
|
+
menuType: 'home',
|
|
749
|
+
},
|
|
750
|
+
})
|
|
751
|
+
.then(result => {
|
|
752
|
+
if (!cancelled) {
|
|
753
|
+
actions.setMenus(normalizeRuntimeMenuResponse(result, {appType}));
|
|
754
|
+
}
|
|
755
|
+
})
|
|
756
|
+
.catch(() => {
|
|
757
|
+
if (!cancelled) {
|
|
758
|
+
actions.setMenus(normalizeRuntimeMenuResponse(null, {appType}));
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
return () => {
|
|
763
|
+
cancelled = true;
|
|
764
|
+
};
|
|
765
|
+
}, [actions, appType, currentCompany?.id, isLogged]);
|
|
766
|
+
|
|
767
|
+
useEffect(() => {
|
|
768
|
+
const fetchColors = async () => {
|
|
769
|
+
const appDomain = resolveAppDomain(APP_ENV.DOMAIN);
|
|
770
|
+
const params = appDomain ? {'app-domain': appDomain} : undefined;
|
|
737
771
|
|
|
738
772
|
try {
|
|
739
773
|
const cssText = await api.fetch('themes-colors.css', {
|
|
@@ -748,46 +782,14 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
|
|
|
748
782
|
}
|
|
749
783
|
};
|
|
750
784
|
|
|
751
|
-
if (device?.id) {
|
|
752
|
-
fetchColors();
|
|
753
|
-
}
|
|
754
|
-
}, [actions, currentCompany?.id, defaultCompany?.id, device?.id]);
|
|
755
|
-
|
|
756
|
-
useEffect(() => {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
let cancelled = false;
|
|
763
|
-
|
|
764
|
-
api
|
|
765
|
-
.fetch('menus-people', {
|
|
766
|
-
params: {
|
|
767
|
-
myCompany: currentCompany.id,
|
|
768
|
-
appType,
|
|
769
|
-
menuType: 'home',
|
|
770
|
-
},
|
|
771
|
-
})
|
|
772
|
-
.then(result => {
|
|
773
|
-
if (!cancelled) {
|
|
774
|
-
actions.setMenus(normalizeRuntimeMenuResponse(result, {appType}));
|
|
775
|
-
}
|
|
776
|
-
})
|
|
777
|
-
.catch(() => {
|
|
778
|
-
if (!cancelled) {
|
|
779
|
-
actions.setMenus(normalizeRuntimeMenuResponse(null, {appType}));
|
|
780
|
-
}
|
|
781
|
-
});
|
|
782
|
-
|
|
783
|
-
return () => {
|
|
784
|
-
cancelled = true;
|
|
785
|
-
};
|
|
786
|
-
}, [actions, appType, currentCompany?.id, isLogged]);
|
|
787
|
-
|
|
788
|
-
useEffect(() => {
|
|
789
|
-
const companyThemeColors =
|
|
790
|
-
currentCompany?.theme?.colors || defaultCompany?.theme?.colors || {};
|
|
785
|
+
if (device?.id) {
|
|
786
|
+
fetchColors();
|
|
787
|
+
}
|
|
788
|
+
}, [actions, currentCompany?.id, defaultCompany?.id, device?.id]);
|
|
789
|
+
|
|
790
|
+
useEffect(() => {
|
|
791
|
+
const companyThemeColors =
|
|
792
|
+
currentCompany?.theme?.colors || defaultCompany?.theme?.colors || {};
|
|
791
793
|
const mergedThemeColors = {
|
|
792
794
|
...(baseThemeColors || {}),
|
|
793
795
|
...(companyThemeColors || {}),
|
|
@@ -822,8 +824,8 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
|
|
|
822
824
|
defaultCompany={defaultCompany}
|
|
823
825
|
device={device}
|
|
824
826
|
colors={colors}
|
|
825
|
-
/>
|
|
826
|
-
)}
|
|
827
|
+
/>
|
|
828
|
+
)}
|
|
827
829
|
</View>
|
|
828
830
|
{!isShopClientApp && (
|
|
829
831
|
<>
|
|
@@ -17,8 +17,9 @@ import ProductCatalogCacheService from '@controleonline/ui-common/src/react/comp
|
|
|
17
17
|
import RuntimeInfoFooter from '@controleonline/ui-common/src/react/components/RuntimeInfoFooter';
|
|
18
18
|
import { useStore } from '@store';
|
|
19
19
|
import { api } from '@controleonline/ui-common/src/api';
|
|
20
|
+
import {app_type} from '@appType';
|
|
20
21
|
import { env as APP_ENV } from '@env';
|
|
21
|
-
import { isPublicRoute } from '
|
|
22
|
+
import { isPublicRoute } from '../router/publicRoutes';
|
|
22
23
|
const { resolveConfiguredLanguage } = require('../utils/runtimeLanguage');
|
|
23
24
|
import {
|
|
24
25
|
applyPaletteToRuntimeColors,
|
|
@@ -42,7 +43,9 @@ import {
|
|
|
42
43
|
filterWalletPaymentTypesByAllowedIds,
|
|
43
44
|
resolveDevicePaymentTypeIds,
|
|
44
45
|
} from '@controleonline/ui-common/src/react/utils/paymentDevices';
|
|
45
|
-
import {
|
|
46
|
+
import {
|
|
47
|
+
normalizeRuntimeMenuResponse,
|
|
48
|
+
} from '@controleonline/ui-common/src/react/utils/runtimeMenu';
|
|
46
49
|
import stores from '@stores';
|
|
47
50
|
import packageJson from '@package';
|
|
48
51
|
import providerStyles from './DefaultProvider.styles';
|
|
@@ -142,7 +145,7 @@ const selectRuntimeDeviceConfig = ({
|
|
|
142
145
|
};
|
|
143
146
|
|
|
144
147
|
export const DefaultProvider = ({ children, onBootstrapReady }) => {
|
|
145
|
-
const appType = String(
|
|
148
|
+
const appType = String(app_type || '').toUpperCase();
|
|
146
149
|
const isShopClientApp = appType === 'SHOP';
|
|
147
150
|
const themeStore = useStore('theme');
|
|
148
151
|
const getters = themeStore.getters;
|
|
@@ -205,7 +208,7 @@ export const DefaultProvider = ({ children, onBootstrapReady }) => {
|
|
|
205
208
|
const packageVersion = packageJson?.version || packageJson?.default?.version;
|
|
206
209
|
const appVersion = packageVersion || device?.appVersion;
|
|
207
210
|
const runtimeDeviceType = resolveOperationalDeviceType({
|
|
208
|
-
appType:
|
|
211
|
+
appType: app_type,
|
|
209
212
|
deviceInfo: device || {},
|
|
210
213
|
});
|
|
211
214
|
const deviceConfigPeopleIri = resolveDeviceConfigPeopleIri({
|
|
@@ -360,7 +363,7 @@ export const DefaultProvider = ({ children, onBootstrapReady }) => {
|
|
|
360
363
|
'Web App';
|
|
361
364
|
|
|
362
365
|
return buildLocalRuntimeDevice({
|
|
363
|
-
appType:
|
|
366
|
+
appType: app_type,
|
|
364
367
|
deviceInfo: {
|
|
365
368
|
id: webDeviceId,
|
|
366
369
|
appName: nextAppName,
|
|
@@ -437,7 +440,7 @@ export const DefaultProvider = ({ children, onBootstrapReady }) => {
|
|
|
437
440
|
Array.isArray(items) && items.length > 0 ? items[0] : null;
|
|
438
441
|
const nextDevice = buildDeviceRegistrationPayload({
|
|
439
442
|
deviceInfo: device,
|
|
440
|
-
appType:
|
|
443
|
+
appType: app_type,
|
|
441
444
|
existingDevice,
|
|
442
445
|
});
|
|
443
446
|
|
|
@@ -769,7 +772,6 @@ export const DefaultProvider = ({ children, onBootstrapReady }) => {
|
|
|
769
772
|
);
|
|
770
773
|
setTranslateReady(true);
|
|
771
774
|
global.refreshTranslationsUI?.();
|
|
772
|
-
global.t.discoveryAll().catch(() => {});
|
|
773
775
|
}, [
|
|
774
776
|
companies,
|
|
775
777
|
currentCompany,
|
|
@@ -787,37 +789,16 @@ export const DefaultProvider = ({ children, onBootstrapReady }) => {
|
|
|
787
789
|
}
|
|
788
790
|
}, [isLogged, translateReady, hasCurrentCompany, onBootstrapReady]);
|
|
789
791
|
|
|
790
|
-
useEffect(() => {
|
|
791
|
-
if (device && device.id && isLogged) {
|
|
792
|
-
peopleActions.myCompanies();
|
|
793
|
-
}
|
|
794
|
-
}, [isLogged, device?.id]);
|
|
795
|
-
|
|
796
792
|
useEffect(() => {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
try {
|
|
802
|
-
const cssText = await api.fetch('themes-colors.css', {
|
|
803
|
-
responseType: 'text',
|
|
804
|
-
params,
|
|
805
|
-
});
|
|
806
|
-
const parsedColors = parseThemeCss(cssText);
|
|
807
|
-
setBaseThemeColors(parsedColors);
|
|
808
|
-
actions.setColors(parsedColors);
|
|
809
|
-
} catch {
|
|
810
|
-
setBaseThemeColors({});
|
|
811
|
-
}
|
|
812
|
-
};
|
|
813
|
-
|
|
814
|
-
fetchColors();
|
|
815
|
-
}, [actions, currentCompany?.id, defaultCompany?.id, device?.id]);
|
|
793
|
+
if (device && device.id && isLogged) {
|
|
794
|
+
peopleActions.myCompanies();
|
|
795
|
+
}
|
|
796
|
+
}, [isLogged, device?.id]);
|
|
816
797
|
|
|
817
798
|
useEffect(() => {
|
|
818
|
-
if (!isLogged || !currentCompany?.id
|
|
799
|
+
if (!isLogged || !currentCompany?.id) {
|
|
819
800
|
actions.setMenus([]);
|
|
820
|
-
return;
|
|
801
|
+
return undefined;
|
|
821
802
|
}
|
|
822
803
|
|
|
823
804
|
let cancelled = false;
|
|
@@ -846,6 +827,27 @@ export const DefaultProvider = ({ children, onBootstrapReady }) => {
|
|
|
846
827
|
};
|
|
847
828
|
}, [actions, appType, currentCompany?.id, isLogged]);
|
|
848
829
|
|
|
830
|
+
useEffect(() => {
|
|
831
|
+
const fetchColors = async () => {
|
|
832
|
+
const appDomain = resolveAppDomain(APP_ENV.DOMAIN);
|
|
833
|
+
const params = appDomain ? { 'app-domain': appDomain } : undefined;
|
|
834
|
+
|
|
835
|
+
try {
|
|
836
|
+
const cssText = await api.fetch('themes-colors.css', {
|
|
837
|
+
responseType: 'text',
|
|
838
|
+
params,
|
|
839
|
+
});
|
|
840
|
+
const parsedColors = parseThemeCss(cssText);
|
|
841
|
+
setBaseThemeColors(parsedColors);
|
|
842
|
+
actions.setColors(parsedColors);
|
|
843
|
+
} catch {
|
|
844
|
+
setBaseThemeColors({});
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
fetchColors();
|
|
849
|
+
}, [actions, currentCompany?.id, defaultCompany?.id, device?.id]);
|
|
850
|
+
|
|
849
851
|
useEffect(() => {
|
|
850
852
|
const companyThemeColors = isShopClientApp
|
|
851
853
|
? defaultCompany?.theme?.colors || {}
|
|
@@ -883,14 +885,14 @@ export const DefaultProvider = ({ children, onBootstrapReady }) => {
|
|
|
883
885
|
},
|
|
884
886
|
]}>
|
|
885
887
|
<View style={providerStyles.content}>{children}</View>
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
888
|
+
{!isShopClientApp && bottomNavigationCount === 0 && (
|
|
889
|
+
<RuntimeInfoFooter
|
|
890
|
+
appVersion={appVersion}
|
|
891
|
+
defaultCompany={defaultCompany}
|
|
892
|
+
device={device}
|
|
893
|
+
colors={colors}
|
|
894
|
+
/>
|
|
895
|
+
)}
|
|
894
896
|
</View>
|
|
895
897
|
{!isShopClientApp && device?.id && isLogged && (
|
|
896
898
|
<>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, {useCallback, useEffect, useRef} from 'react';
|
|
2
2
|
import {Platform} from 'react-native';
|
|
3
3
|
import * as Notifications from 'expo-notifications';
|
|
4
|
-
import {
|
|
4
|
+
import {app_type} from '@appType';
|
|
5
5
|
import {useStore} from '@store';
|
|
6
6
|
import {ensureManagerOrderNotificationPermission} from '@controleonline/ui-common/src/react/utils/managerOrderNotifications';
|
|
7
7
|
import {queueNotificationNavigation} from '@controleonline/ui-common/src/react/utils/notificationNavigation';
|
|
@@ -86,7 +86,7 @@ const DeliveryPushBridge = ({device, setDevice}) => {
|
|
|
86
86
|
const deviceActions = deviceStore.actions;
|
|
87
87
|
|
|
88
88
|
const {isLogged, sessionChecked} = authGetters;
|
|
89
|
-
const isDeliveryRuntime = isDeliveryRuntimeAppType(
|
|
89
|
+
const isDeliveryRuntime = isDeliveryRuntimeAppType(app_type);
|
|
90
90
|
|
|
91
91
|
const currentDeviceRef = useRef(device || {});
|
|
92
92
|
const pushTokenListenerRef = useRef(null);
|
|
@@ -9,7 +9,7 @@ import React, {useCallback, useEffect, useMemo, useRef} from 'react';
|
|
|
9
9
|
import {createAudioPlayer} from 'expo-audio';
|
|
10
10
|
import {NativeModules, Platform} from 'react-native';
|
|
11
11
|
import {useStore, useStores} from '@store';
|
|
12
|
-
import {
|
|
12
|
+
import {app_type} from '@appType';
|
|
13
13
|
import {api} from '@controleonline/ui-common/src/api';
|
|
14
14
|
import Formatter from '@controleonline/ui-common/src/utils/formatter';
|
|
15
15
|
import {
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
isTruthyValue,
|
|
19
19
|
parseConfigsObject,
|
|
20
20
|
} from '@controleonline/ui-common/src/react/config/deviceConfigBootstrap';
|
|
21
|
-
import {resolveOrderIdentity} from '
|
|
21
|
+
import {resolveOrderIdentity} from '../utils/orderIdentity';
|
|
22
22
|
import {
|
|
23
23
|
isManagerAppType,
|
|
24
24
|
resolveManagerFinancialNotificationPreferences,
|
|
@@ -188,7 +188,7 @@ const DeviceAlertSoundService = () => {
|
|
|
188
188
|
[user],
|
|
189
189
|
);
|
|
190
190
|
|
|
191
|
-
const isManagerRuntime = isManagerAppType(
|
|
191
|
+
const isManagerRuntime = isManagerAppType(app_type);
|
|
192
192
|
const currentCompanyId = normalizeEntityId(currentCompany?.id);
|
|
193
193
|
const managerPushEnabled =
|
|
194
194
|
isManagerRuntime && managerOrderNotificationPreferences.pushEnabled;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {useEffect, useMemo, useRef} from 'react';
|
|
2
2
|
import {AppState, BackHandler, NativeModules, Platform} from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import {app_type} from '@appType';
|
|
4
4
|
import {useStore} from '@store';
|
|
5
5
|
import {shouldEnableAndroidKioskMode} from '@controleonline/ui-common/src/react/config/deviceConfigBootstrap';
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ const KioskModeBridge = ({appState = AppState.currentState || 'active'}) => {
|
|
|
11
11
|
const {item: runtimeDeviceConfig} = deviceConfigStore.getters;
|
|
12
12
|
const lastRequestedStateRef = useRef(null);
|
|
13
13
|
const lastActiveAppStateRef = useRef(appState);
|
|
14
|
-
const appType = String(
|
|
14
|
+
const appType = String(app_type || '').trim().toUpperCase();
|
|
15
15
|
const kioskEnabled = useMemo(
|
|
16
16
|
() =>
|
|
17
17
|
shouldEnableAndroidKioskMode({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {useEffect, useMemo, useRef} from 'react';
|
|
2
2
|
import {AppState, NativeModules, Platform} from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import {app_type} from '@appType';
|
|
4
4
|
import {useStore} from '@store';
|
|
5
5
|
import {shouldEnableAndroidLauncherMode} from '@controleonline/ui-common/src/react/config/deviceConfigBootstrap';
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ const LauncherModeBridge = ({appState = AppState.currentState || 'active'}) => {
|
|
|
11
11
|
const {item: runtimeDeviceConfig} = deviceConfigStore.getters;
|
|
12
12
|
const lastRequestedStateRef = useRef(null);
|
|
13
13
|
const lastActiveAppStateRef = useRef(appState);
|
|
14
|
-
const appType = String(
|
|
14
|
+
const appType = String(app_type || '').trim().toUpperCase();
|
|
15
15
|
const launcherEnabled = useMemo(
|
|
16
16
|
() =>
|
|
17
17
|
shouldEnableAndroidLauncherMode({
|