@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.
Files changed (61) hide show
  1. package/package.json +31 -28
  2. package/src/api/index.js +237 -37
  3. package/src/react/components/AddImportModal.js +1 -1
  4. package/src/react/components/AnimatedModal.js +171 -0
  5. package/src/react/components/AnimatedModal.styles.js +21 -0
  6. package/src/react/components/AppTypeSwitcher.js +164 -0
  7. package/src/react/components/AppTypeSwitcher.styles.js +109 -0
  8. package/src/react/components/BackgroundRuntimeBridge.js +5 -4
  9. package/src/react/components/BottomNavigationBar.js +86 -31
  10. package/src/react/components/BottomNavigationBar.styles.js +118 -110
  11. package/src/react/components/DefaultProvider.native.js +68 -66
  12. package/src/react/components/DefaultProvider.web.js +44 -42
  13. package/src/react/components/DeliveryPushBridge.native.js +2 -2
  14. package/src/react/components/DeviceAlertSoundService.js +3 -3
  15. package/src/react/components/KioskModeBridge.js +2 -2
  16. package/src/react/components/LauncherModeBridge.js +2 -2
  17. package/src/react/components/ManagerPushBridge.native.js +2 -2
  18. package/src/react/components/RemoteCheckoutService.js +28 -20
  19. package/src/react/components/RuntimeBottomNavigationBar.js +146 -119
  20. package/src/react/components/RuntimeInfoFooter.js +37 -9
  21. package/src/react/components/StateStore.js +258 -0
  22. package/src/react/components/WebsocketListener.native.js +11 -11
  23. package/src/react/config/deviceConfigBootstrap.js +66 -27
  24. package/src/react/css/orders.js +72 -0
  25. package/src/react/pages/SettingsPage/PaymentTypesByWalletTab.js +484 -454
  26. package/src/react/pages/SettingsPage/index.js +1266 -1167
  27. package/src/react/print/providers/local.js +1 -1
  28. package/src/react/router/publicRoutes.js +25 -0
  29. package/src/react/services/Cielo/Checkout.js +39 -0
  30. package/src/react/services/Cielo/Cielo.js +193 -0
  31. package/src/react/services/Cielo/Print.js +7 -0
  32. package/src/react/services/InfinitePay/Checkout.js +33 -0
  33. package/src/react/services/InfinitePay/InfinitePay.js +24 -0
  34. package/src/react/{utils → services}/paymentGatewayExecution.js +91 -91
  35. package/src/react/styles/global.js +115 -0
  36. package/src/react/utils/fileUrl.js +182 -16
  37. package/src/react/utils/menuNavigation.js +31 -0
  38. package/src/react/utils/orderIdentity.js +277 -0
  39. package/src/react/utils/remotePayment.js +115 -61
  40. package/src/react/utils/runtimeMenu.js +35 -3
  41. package/src/react/utils/shopConfig.js +50 -24
  42. package/src/react/utils/shopFranchises.js +56 -22
  43. package/src/react/utils/socketRuntimePipeline.js +14 -14
  44. package/src/store/configs/index.js +2 -2
  45. package/src/tests/react/api/loadSmokeIndex.test.js +75 -0
  46. package/src/tests/react/config/deviceConfigBootstrap.test.js +47 -0
  47. package/src/tests/react/print/localPrintProvider.test.js +1 -1
  48. package/src/tests/react/services/Cielo.test.js +190 -0
  49. package/src/tests/react/utils/fileUrl.test.js +62 -0
  50. package/src/tests/react/utils/importStatus.test.js +2 -2
  51. package/src/tests/react/utils/orderIdentity.test.js +139 -0
  52. package/src/tests/react/utils/remotePayment.test.js +62 -0
  53. package/src/tests/react/utils/runtimeFooter.test.js +4 -6
  54. package/src/tests/react/utils/runtimeLanguage.test.js +2 -2
  55. package/src/tests/react/utils/runtimeMenu.test.js +23 -3
  56. package/src/tests/react/utils/shopConfig.test.js +74 -0
  57. package/src/tests/react/utils/shopFranchises.test.js +79 -12
  58. package/src/tests/react/utils/translate.test.mjs +166 -102
  59. package/src/utils/formatter.js +18 -0
  60. package/src/utils/integrationConfigs.js +80 -79
  61. package/src/utils/translate.js +125 -30
@@ -1,110 +1,118 @@
1
- import {Platform, StyleSheet} from 'react-native';
2
-
3
- const withAlpha = (color, alphaHex) => {
4
- const raw = String(color || '').trim().replace('#', '');
5
- if (/^[0-9a-fA-F]{6}$/.test(raw)) {
6
- return `#${raw}${alphaHex}`;
7
- }
8
-
9
- if (/^[0-9a-fA-F]{8}$/.test(raw)) {
10
- return `#${raw.slice(0, 6)}${alphaHex}`;
11
- }
12
-
13
- return color || '#1B5587';
14
- };
15
-
16
- const createStyles = ({
17
- primaryColor,
18
- dockBackground,
19
- borderColor,
20
- inactiveText,
21
- activeBg,
22
- activeBorder,
23
- }) =>
24
- StyleSheet.create({
25
- host: {
26
- position: Platform.OS === 'web' ? 'fixed' : 'absolute',
27
- left: 0,
28
- right: 0,
29
- bottom: 0,
30
- zIndex: 1000,
31
- backgroundColor: 'transparent',
32
- alignItems: 'stretch',
33
- },
34
- stack: {
35
- width: '100%',
36
- alignItems: 'stretch',
37
- },
38
- dock: {
39
- flexDirection: 'row',
40
- alignItems: 'center',
41
- justifyContent: 'space-between',
42
- minHeight: 64,
43
- paddingHorizontal: 8,
44
- paddingTop: 8,
45
- paddingBottom: 8,
46
- borderWidth: 1,
47
- borderBottomWidth: 0,
48
- borderColor,
49
- borderTopLeftRadius: 24,
50
- borderTopRightRadius: 24,
51
- borderBottomLeftRadius: 0,
52
- borderBottomRightRadius: 0,
53
- backgroundColor: dockBackground,
54
- overflow: 'hidden',
55
- ...(Platform.OS === 'android'
56
- ? {elevation: 10}
57
- : {
58
- shadowColor: '#0F172A',
59
- shadowOpacity: 0.12,
60
- shadowOffset: {width: 0, height: -6},
61
- shadowRadius: 14,
62
- }),
63
- },
64
- item: {
65
- flex: 1,
66
- minHeight: 44,
67
- alignItems: 'center',
68
- justifyContent: 'center',
69
- paddingVertical: 6,
70
- paddingHorizontal: 4,
71
- borderWidth: 1,
72
- borderColor: 'transparent',
73
- borderRadius: 18,
74
- },
75
- itemActive: {
76
- backgroundColor: activeBg,
77
- borderColor: activeBorder,
78
- },
79
- itemPressed: {
80
- opacity: 0.92,
81
- transform: [{scale: 0.99}],
82
- },
83
- itemDisabled: {
84
- opacity: 0.45,
85
- },
86
- iconWrap: {
87
- width: 24,
88
- height: 24,
89
- borderRadius: 999,
90
- alignItems: 'center',
91
- justifyContent: 'center',
92
- marginBottom: 4,
93
- backgroundColor: 'transparent',
94
- },
95
- iconWrapActive: {
96
- backgroundColor: withAlpha(primaryColor, '18'),
97
- },
98
- itemLabel: {
99
- fontSize: 12,
100
- fontWeight: '600',
101
- color: inactiveText,
102
- textAlign: 'center',
103
- },
104
- itemLabelActive: {
105
- color: primaryColor,
106
- fontWeight: '800',
107
- },
108
- });
109
-
110
- export default createStyles;
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 '@controleonline/ui-login/src/react/router/publicRoutes';
24
+ import {isPublicRoute} from '../router/publicRoutes';
25
25
  import {api} from '@controleonline/ui-common/src/api';
26
- import {env as APP_ENV} from '@env';
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 {normalizeRuntimeMenuResponse} from '@controleonline/ui-common/src/react/utils/runtimeMenu';
50
- import packageJson from '@package';
51
- import providerStyles from './DefaultProvider.styles';
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(APP_ENV.APP_TYPE || '').toUpperCase();
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: APP_ENV.APP_TYPE,
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: APP_ENV.APP_TYPE,
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: APP_ENV.APP_TYPE,
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
- const fetchColors = async () => {
735
- const appDomain = resolveAppDomain(APP_ENV.DOMAIN);
736
- const params = appDomain ? {'app-domain': appDomain} : undefined;
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
- if (!isLogged || !currentCompany?.id || !appType) {
758
- actions.setMenus([]);
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 '@controleonline/ui-login/src/react/router/publicRoutes';
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 {normalizeRuntimeMenuResponse} from '@controleonline/ui-common/src/react/utils/runtimeMenu';
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(APP_ENV.APP_TYPE || '').toUpperCase();
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: APP_ENV.APP_TYPE,
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: APP_ENV.APP_TYPE,
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: APP_ENV.APP_TYPE,
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
- const fetchColors = async () => {
798
- const appDomain = resolveAppDomain(APP_ENV.DOMAIN);
799
- const params = appDomain ? { 'app-domain': appDomain } : undefined;
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 || !appType) {
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
- {!isShopClientApp && bottomNavigationCount === 0 && (
887
- <RuntimeInfoFooter
888
- appVersion={appVersion}
889
- defaultCompany={defaultCompany}
890
- device={device}
891
- colors={colors}
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 {env as APP_ENV} from '@env';
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(APP_ENV?.APP_TYPE);
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 {env as APP_ENV} from '@env';
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 '@controleonline/ui-orders/src/react/utils/orderIdentity';
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(APP_ENV?.APP_TYPE);
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 {env as APP_ENV} from '@env';
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(APP_ENV.APP_TYPE || '').trim().toUpperCase();
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 {env as APP_ENV} from '@env';
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(APP_ENV.APP_TYPE || '').trim().toUpperCase();
14
+ const appType = String(app_type || '').trim().toUpperCase();
15
15
  const launcherEnabled = useMemo(
16
16
  () =>
17
17
  shouldEnableAndroidLauncherMode({