@controleonline/ui-common 1.2.70 → 1.2.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/.github/actions/workers/manager/action.yml +147 -0
  2. package/.github/actions/workers/qa/action.yml +44 -0
  3. package/.github/actions/workers/security/action.yml +44 -0
  4. package/.github/actions/workers/technical-documenter/action.yml +51 -0
  5. package/.github/workflows/manager-worker.yml +168 -0
  6. package/.github/workflows/publish-npm.yml +45 -0
  7. package/.gitmodules +3 -0
  8. package/AGENTS.md +6 -0
  9. package/README.md +14 -0
  10. package/package.json +32 -28
  11. package/src/api/fetch.js +1 -1
  12. package/src/api/index.js +328 -58
  13. package/src/react/components/AddImportModal.js +95 -111
  14. package/src/react/components/AnimatedModal.js +171 -0
  15. package/src/react/components/AnimatedModal.styles.js +21 -0
  16. package/src/react/components/AppTypeSwitcher.js +164 -0
  17. package/src/react/components/AppTypeSwitcher.styles.js +109 -0
  18. package/src/react/components/BackgroundRuntimeBridge.js +5 -4
  19. package/src/react/components/BottomNavigationBar.config.js +211 -231
  20. package/src/react/components/BottomNavigationBar.js +86 -31
  21. package/src/react/components/BottomNavigationBar.styles.js +118 -110
  22. package/src/react/components/CategoryForm.js +52 -35
  23. package/src/react/components/DefaultProvider.native.js +194 -156
  24. package/src/react/components/DefaultProvider.web.js +188 -112
  25. package/src/react/components/DeliveryPushBridge.native.js +2 -2
  26. package/src/react/components/DeviceAlertSoundService.js +3 -3
  27. package/src/react/components/KioskModeBridge.js +2 -2
  28. package/src/react/components/LauncherModeBridge.js +2 -2
  29. package/src/react/components/ManagerPushBridge.native.js +2 -2
  30. package/src/react/components/NetworkPrinterPreviewModal.js +249 -0
  31. package/src/react/components/NetworkPrinterPreviewModal.styles.js +159 -0
  32. package/src/react/components/RemoteCheckoutService.js +28 -20
  33. package/src/react/components/RuntimeBottomNavigationBar.js +146 -119
  34. package/src/react/components/RuntimeInfoFooter.js +137 -45
  35. package/src/react/components/RuntimeInfoFooter.styles.js +3 -0
  36. package/src/react/components/StateStore.js +258 -0
  37. package/src/react/components/UnifiedPaymentBar.js +7 -4
  38. package/src/react/components/UserAvatar.js +160 -0
  39. package/src/react/components/WebsocketListener.native.js +11 -11
  40. package/src/react/components/integrations/IntegrationHero/index.js +48 -0
  41. package/src/react/components/integrations/IntegrationHero/styles.js +57 -0
  42. package/src/react/components/integrations/IntegrationTabs/index.js +89 -0
  43. package/src/react/components/integrations/IntegrationTabs/styles.js +44 -0
  44. package/src/react/config/deviceConfigBootstrap.js +71 -30
  45. package/src/react/css/orders.js +72 -0
  46. package/src/react/pages/Connections.js +229 -0
  47. package/src/react/pages/Connections.styles.js +222 -0
  48. package/src/react/pages/DeviceDetailPage.js +2814 -0
  49. package/src/react/pages/DeviceDetailPage.styles.js +308 -0
  50. package/src/react/pages/Devices/currentDevice.js +194 -0
  51. package/src/react/pages/Devices/deviceTypes/DeviceGroupCard.js +257 -0
  52. package/src/react/pages/Devices/deviceTypes/all.js +23 -0
  53. package/src/react/pages/Devices/deviceTypes/device.js +25 -0
  54. package/src/react/pages/Devices/deviceTypes/deviceListHelpers.js +178 -0
  55. package/src/react/pages/Devices/deviceTypes/display.js +26 -0
  56. package/src/react/pages/Devices/deviceTypes/index.js +145 -0
  57. package/src/react/pages/Devices/deviceTypes/ipCamera.js +35 -0
  58. package/src/react/pages/Devices/deviceTypes/pdv.js +88 -0
  59. package/src/react/pages/Devices/deviceTypes/printer.js +37 -0
  60. package/src/react/pages/Devices/deviceTypes/shared.js +453 -0
  61. package/src/react/pages/Devices/deviceTypes/useDeviceNetworkConnectivity.js +145 -0
  62. package/src/react/pages/Devices.js +183 -0
  63. package/src/react/pages/Devices.styles.js +353 -0
  64. package/src/react/pages/Food99IntegrationPage/components/Food99CatalogTab.js +219 -0
  65. package/src/react/pages/Food99IntegrationPage/components/Food99OverviewTab.js +134 -0
  66. package/src/react/pages/Food99IntegrationPage/components/Food99PreviewModal.js +173 -0
  67. package/src/react/pages/Food99IntegrationPage/components/Food99ProductCard.js +1 -0
  68. package/src/react/pages/Food99IntegrationPage/components/Food99QuickWalletModal.js +181 -0
  69. package/src/react/pages/Food99IntegrationPage/components/Food99SettingsTab.js +306 -0
  70. package/src/react/pages/Food99IntegrationPage/components/Food99StoreTab.js +417 -0
  71. package/src/react/pages/Food99IntegrationPage/index.js +1530 -0
  72. package/src/react/pages/Food99IntegrationPage/styles.js +792 -0
  73. package/src/react/pages/Food99IntegrationPage/utils.js +155 -0
  74. package/src/react/pages/Food99IntegrationPage.js +1 -0
  75. package/src/react/pages/Food99IntegrationPage.styles.js +1 -0
  76. package/src/react/pages/GenericLogPage.js +42 -167
  77. package/src/react/pages/IFoodIntegrationPage/components/IFoodCatalogTab.js +8 -0
  78. package/src/react/pages/IFoodIntegrationPage/components/IFoodOperationsTab.js +420 -0
  79. package/src/react/pages/IFoodIntegrationPage/components/IFoodOverviewTab.js +118 -0
  80. package/src/react/pages/IFoodIntegrationPage/components/IFoodPreviewModal.js +103 -0
  81. package/src/react/pages/IFoodIntegrationPage/components/IFoodProductCard.js +1 -0
  82. package/src/react/pages/IFoodIntegrationPage/components/IFoodStoreTab.js +150 -0
  83. package/src/react/pages/IFoodIntegrationPage/index.js +1298 -0
  84. package/src/react/pages/IFoodIntegrationPage/styles.js +764 -0
  85. package/src/react/pages/IFoodIntegrationPage/utils.js +91 -0
  86. package/src/react/pages/IFoodIntegrationPage.js +1 -0
  87. package/src/react/pages/IFoodIntegrationPage.styles.js +1 -0
  88. package/src/react/pages/Imports.js +214 -166
  89. package/src/react/pages/IntegrationConfigPage.js +744 -0
  90. package/src/react/pages/IntegrationConfigPage.styles.js +269 -0
  91. package/src/react/pages/Integrations.js +299 -0
  92. package/src/react/pages/Integrations.styles.js +130 -0
  93. package/src/react/pages/ManagerOrderNotificationsPage.js +642 -0
  94. package/src/react/pages/MarketplaceIntegrationPage/components/MarketplaceProductCard.js +205 -0
  95. package/src/react/pages/MarketplaceIntegrationPage/components/RemoteMarketplaceMenuTab.js +335 -0
  96. package/src/react/pages/MarketplaceIntegrationPage/index.js +60 -0
  97. package/src/react/pages/MarketplaceIntegrationPage/utils.js +137 -0
  98. package/src/react/pages/MercadoLivreIntegrationPage.js +538 -0
  99. package/src/react/pages/PrinterDeviceDetailPage.js +1916 -0
  100. package/src/react/pages/PrinterDeviceDetailPage.styles.js +223 -0
  101. package/src/react/pages/PrinterDeviceFormPage.js +521 -0
  102. package/src/react/pages/PrinterDeviceFormPage.styles.js +159 -0
  103. package/src/react/pages/SettingsPage/PaymentTypesByWalletTab.js +484 -454
  104. package/src/react/pages/SettingsPage/index.js +1266 -1167
  105. package/src/react/pages/WhatsAppConnectionPage.js +459 -0
  106. package/src/react/pages/WhatsAppConnectionPage.styles.js +284 -0
  107. package/src/react/pages/integrationsCatalog.js +399 -0
  108. package/src/react/print/providers/local.js +1 -1
  109. package/src/react/router/publicRoutes.js +25 -0
  110. package/src/react/services/Cielo/Checkout.js +39 -0
  111. package/src/react/services/Cielo/Cielo.js +193 -0
  112. package/src/react/services/Cielo/Print.js +7 -0
  113. package/src/react/services/InfinitePay/Checkout.js +33 -0
  114. package/src/react/services/InfinitePay/InfinitePay.js +24 -0
  115. package/src/react/{utils → services}/paymentGatewayExecution.js +91 -91
  116. package/src/react/styles/global.js +115 -0
  117. package/src/react/utils/categoryContexts.js +46 -0
  118. package/src/react/utils/entityDisplay.js +222 -217
  119. package/src/react/utils/fileUrl.js +201 -16
  120. package/src/react/utils/integrationPage.js +16 -0
  121. package/src/react/utils/menuNavigation.js +31 -0
  122. package/src/react/utils/orderIdentity.js +277 -0
  123. package/src/react/utils/remotePayment.js +115 -61
  124. package/src/react/utils/runtimeFooter.js +40 -22
  125. package/src/react/utils/runtimeLanguage.js +50 -9
  126. package/src/react/utils/runtimeMenu.js +190 -98
  127. package/src/react/utils/runtimeZoom.js +43 -0
  128. package/src/react/utils/shopConfig.js +72 -34
  129. package/src/react/utils/shopFranchises.js +182 -23
  130. package/src/react/utils/socketRuntimePipeline.js +14 -14
  131. package/src/react/utils/storeColumns.js +23 -4
  132. package/src/react/utils/userAvatar.js +104 -0
  133. package/src/store/categories/index.js +48 -20
  134. package/src/store/configs/index.js +2 -2
  135. package/src/store/device_config/index.js +62 -21
  136. package/src/store/entity_log/index.js +22 -1
  137. package/src/store/imports/customActions.js +51 -0
  138. package/src/store/imports/index.js +89 -88
  139. package/src/store/status/index.js +11 -11
  140. package/src/store/themes/index.js +22 -0
  141. package/src/store/timezones/index.js +3 -1
  142. package/src/tests/browser/manager/connections.spec.js +143 -0
  143. package/src/tests/browser/manager/devices-current.spec.js +343 -0
  144. package/src/tests/browser/manager/mercado-livre-integration.spec.js +268 -0
  145. package/src/tests/react/api/deviceHeaders.test.js +114 -0
  146. package/src/tests/react/api/loadSmokeIndex.test.js +75 -0
  147. package/src/tests/react/components/AddImportModal.test.js +166 -0
  148. package/src/tests/react/components/BottomNavigationBar.config.test.js +20 -0
  149. package/src/tests/react/components/UserAvatar.test.js +52 -0
  150. package/src/tests/react/config/deviceConfigBootstrap.test.js +47 -0
  151. package/src/tests/react/pages/DevicePickerStyles.test.js +47 -0
  152. package/src/tests/react/pages/Devices/deviceListHelpers.test.js +39 -0
  153. package/src/tests/react/pages/DevicesCurrentDevice.test.js +198 -0
  154. package/src/tests/react/pages/connectionsHelpers.test.js +34 -0
  155. package/src/tests/react/pages/mercadoLivreIntegrationPageContract.test.mjs +16 -0
  156. package/src/tests/react/print/localPrintProvider.test.js +1 -1
  157. package/src/tests/react/services/Cielo.test.js +190 -0
  158. package/src/tests/react/store/categoriesOrdering.test.js +26 -0
  159. package/src/tests/react/utils/appDomain.test.js +62 -0
  160. package/src/tests/react/utils/entityDisplay.test.js +2 -2
  161. package/src/tests/react/utils/fileUrl.test.js +62 -0
  162. package/src/tests/react/utils/formatter.test.mjs +33 -0
  163. package/src/tests/react/utils/importStatus.test.js +2 -2
  164. package/src/tests/react/utils/orderIdentity.test.js +139 -0
  165. package/src/tests/react/utils/remotePayment.test.js +62 -0
  166. package/src/tests/react/utils/runtimeFooter.test.js +32 -9
  167. package/src/tests/react/utils/runtimeLanguage.test.js +80 -10
  168. package/src/tests/react/utils/runtimeMenu.test.js +195 -111
  169. package/src/tests/react/utils/runtimeZoom.test.js +38 -0
  170. package/src/tests/react/utils/shopConfig.test.js +75 -0
  171. package/src/tests/react/utils/shopFranchises.test.js +122 -12
  172. package/src/tests/react/utils/translate.discovery.test.mjs +170 -0
  173. package/src/tests/react/utils/translate.test.helpers.mjs +152 -0
  174. package/src/tests/react/utils/translate.test.mjs +252 -396
  175. package/src/tests/react/utils/userAvatar.test.js +63 -0
  176. package/src/utils/appDomain.js +15 -4
  177. package/src/utils/formatter.js +122 -16
  178. package/src/utils/integrationConfigs.js +1 -0
  179. package/src/utils/translate.js +277 -398
  180. package/src/utils/translateDiscovery.js +96 -0
  181. package/src/utils/translateNormalize.js +33 -0
  182. package/src/utils/translatePending.js +92 -0
  183. package/src/utils/translateStorage.js +142 -0
  184. package/.github/agents/developer.agent.md +0 -30
  185. package/.github/agents/devops.agent.md +0 -30
  186. package/.github/agents/qa.agent.md +0 -30
  187. package/.github/agents/security.agent.md +0 -30
  188. package/.github/workflows/npmjs.yml +0 -35
@@ -19,18 +19,22 @@ import DeliveryPushBridge from '@controleonline/ui-common/src/react/components/D
19
19
  import ManagerPushBridge from '@controleonline/ui-common/src/react/components/ManagerPushBridge';
20
20
  import PrintService from '@controleonline/ui-common/src/react/components/PrintService';
21
21
  import RemoteCheckoutService from '@controleonline/ui-common/src/react/components/RemoteCheckoutService';
22
- import ProductCatalogCacheService from '@controleonline/ui-common/src/react/components/ProductCatalogCacheService';
23
- import RuntimeInfoFooter from '@controleonline/ui-common/src/react/components/RuntimeInfoFooter';
24
- import {isPublicRoute} from '@controleonline/ui-login/src/react/router/publicRoutes';
25
- import {api} from '@controleonline/ui-common/src/api';
26
- import {env as APP_ENV} from '@env';
27
- const {resolveConfiguredLanguage} = require('../utils/runtimeLanguage');
22
+ import ProductCatalogCacheService from '@controleonline/ui-common/src/react/components/ProductCatalogCacheService';
23
+ import RuntimeInfoFooter from '@controleonline/ui-common/src/react/components/RuntimeInfoFooter';
24
+ import {isPublicRoute} from '../router/publicRoutes';
25
+ import {api} from '@controleonline/ui-common/src/api';
26
+ import {app_type} from '@appType';
27
+ import {env as APP_ENV} from '@env';
28
+ const {
29
+ buildTranslationBootstrapKey,
30
+ isTranslationBootstrapReady,
31
+ resolveConfiguredLanguage,
32
+ } = require('../utils/runtimeLanguage');
28
33
  import {
29
34
  applyPaletteToRuntimeColors,
30
35
  applyThemeCssVariables,
31
36
  resolveThemePalette,
32
37
  } from '@controleonline/../../src/styles/branding';
33
- import {resolveAppDomain} from '@controleonline/ui-common/src/utils/appDomain';
34
38
  import {colors as runtimeColors} from '@controleonline/../../src/styles/colors';
35
39
  import {
36
40
  buildProviderManagedDeviceConfigs,
@@ -46,9 +50,14 @@ import {
46
50
  filterWalletPaymentTypesByAllowedIds,
47
51
  resolveDevicePaymentTypeIds,
48
52
  } 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';
53
+ import {
54
+ normalizeRuntimeMenuResponse,
55
+ } from '@controleonline/ui-common/src/react/utils/runtimeMenu';
56
+ import {
57
+ buildRuntimeZoomStyle,
58
+ } from '@controleonline/ui-common/src/react/utils/runtimeZoom';
59
+ import packageJson from '@package';
60
+ import providerStyles from './DefaultProvider.styles';
52
61
 
53
62
  import {useStore} from '@store';
54
63
  import stores from '@stores';
@@ -95,8 +104,12 @@ const resolveDeviceConfigPeopleIri = ({appType, currentCompany, user}) => {
95
104
  return '';
96
105
  };
97
106
 
98
- export const DefaultProvider = ({children, onBootstrapReady}) => {
99
- const appType = String(APP_ENV.APP_TYPE || '').toUpperCase();
107
+ export const DefaultProvider = ({
108
+ children,
109
+ currentRouteName = '',
110
+ onBootstrapReady,
111
+ }) => {
112
+ const appType = String(app_type || '').toUpperCase();
100
113
  const isShopClientApp = appType === 'SHOP';
101
114
  const themeStore = useStore('theme');
102
115
  const getters = themeStore.getters;
@@ -130,12 +143,13 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
130
143
  const {isLogged, sessionChecked, user} = authGetters;
131
144
  const hasCurrentCompany =
132
145
  !!currentCompany && Object.entries(currentCompany).length > 0;
133
- const [translateReady, setTranslateReady] = useState(true);
146
+ const [translateReady, setTranslateReady] = useState(false);
147
+ const [activeTranslateBootstrapKey, setActiveTranslateBootstrapKey] =
148
+ useState('');
134
149
  const [deviceConfigFetched, setDeviceConfigFetched] = useState(false);
135
150
  const [mainConfigsDiscovered, setMainConfigsDiscovered] = useState(false);
136
151
  const [deviceRuntimeConfigSynced, setDeviceRuntimeConfigSynced] =
137
152
  useState(false);
138
- const [currentRouteName, setCurrentRouteName] = useState('');
139
153
  const [appState, setAppState] = useState(AppState.currentState || 'active');
140
154
  const [, setTranslateVersion] = useState(0);
141
155
  const [baseThemeColors, setBaseThemeColors] = useState({});
@@ -148,15 +162,51 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
148
162
  const packageVersion = packageJson?.version || packageJson?.default?.version;
149
163
  const appVersion = packageVersion || device?.appVersion;
150
164
  const runtimeDeviceType = resolveOperationalDeviceType({
151
- appType: APP_ENV.APP_TYPE,
165
+ appType: app_type,
152
166
  deviceInfo: device || {},
153
167
  });
168
+ const runtimeUiScaleStyle = useMemo(
169
+ () => buildRuntimeZoomStyle(APP_ENV?.ZOOM),
170
+ [],
171
+ );
154
172
  const deviceConfigPeopleIri = resolveDeviceConfigPeopleIri({
155
173
  appType,
156
174
  currentCompany,
157
175
  user,
158
176
  });
159
177
  const isPublicRouteActive = isPublicRoute(currentRouteName);
178
+ const currentTranslationConfig = JSON.parse(
179
+ localStorage.getItem('config') || '{}',
180
+ );
181
+ const currentTranslationSession = JSON.parse(
182
+ localStorage.getItem('session') || '{}',
183
+ );
184
+ const configuredTranslationLanguage = resolveConfiguredLanguage({
185
+ currentCompany,
186
+ defaultCompany,
187
+ currentConfig: currentTranslationConfig,
188
+ sessionData: currentTranslationSession,
189
+ });
190
+ const expectedTranslateBootstrapKey = isLogged && hasCurrentCompany
191
+ ? buildTranslationBootstrapKey({
192
+ language: configuredTranslationLanguage,
193
+ currentCompanyId: normalizeEntityId(currentCompany?.id),
194
+ defaultCompanyId: normalizeEntityId(defaultCompany?.id),
195
+ })
196
+ : '';
197
+ const requiresTranslateBootstrap = Boolean(
198
+ isLogged &&
199
+ hasCurrentCompany &&
200
+ currentRouteName &&
201
+ !isPublicRouteActive,
202
+ );
203
+ const isTranslateBootstrapReady = isTranslationBootstrapReady({
204
+ activeKey: activeTranslateBootstrapKey,
205
+ expectedKey: expectedTranslateBootstrapKey,
206
+ required: requiresTranslateBootstrap,
207
+ ready: translateReady,
208
+ translator: global.t,
209
+ });
160
210
  const shouldRunForegroundRealtimeServices =
161
211
  Platform.OS !== 'android' || appState === 'active';
162
212
  const registerBottomNavigation = useCallback(() => {
@@ -223,30 +273,13 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
223
273
  };
224
274
  }, []);
225
275
 
226
- useEffect(() => {
227
- global.setRuntimeRouteName = routeName => {
228
- const normalizedRouteName = String(routeName || '').trim();
229
-
230
- setCurrentRouteName(previousRouteName =>
231
- previousRouteName === normalizedRouteName
232
- ? previousRouteName
233
- : normalizedRouteName,
234
- );
235
- };
236
-
237
- return () => {
238
- if (global.setRuntimeRouteName) {
239
- delete global.setRuntimeRouteName;
240
- }
241
- };
242
- }, []);
243
-
244
276
  useEffect(() => {
245
277
  if (isLogged && !isPublicRouteActive) {
246
278
  return;
247
279
  }
248
280
 
249
281
  setTranslateReady(true);
282
+ setActiveTranslateBootstrapKey('');
250
283
  translateBootstrapKeyRef.current = '';
251
284
  translateActions.setMessages({});
252
285
  translateActions.setPendingMessages?.({});
@@ -254,7 +287,7 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
254
287
  if (global.t) {
255
288
  delete global.t;
256
289
  }
257
- }, [isLogged, isPublicRouteActive]);
290
+ }, [isLogged, isPublicRouteActive, translateActions]);
258
291
 
259
292
  useEffect(() => {
260
293
  const subscription = AppState.addEventListener('change', nextState => {
@@ -281,7 +314,7 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
281
314
  let ld = null;
282
315
  if (uniqueId) {
283
316
  ld = buildLocalRuntimeDevice({
284
- appType: APP_ENV.APP_TYPE,
317
+ appType: app_type,
285
318
  deviceInfo: {
286
319
  id: uniqueId,
287
320
  appName: appName,
@@ -368,7 +401,7 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
368
401
  Array.isArray(items) && items.length > 0 ? items[0] : null;
369
402
  const nextDevice = buildDeviceRegistrationPayload({
370
403
  deviceInfo: device,
371
- appType: APP_ENV.APP_TYPE,
404
+ appType: app_type,
372
405
  existingDevice,
373
406
  });
374
407
 
@@ -639,58 +672,49 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
639
672
  }
640
673
  }, [currentCompany, isLogged, mainConfigsDiscovered]);
641
674
 
642
- useEffect(() => {
643
- if (
644
- !currentRouteName ||
645
- isPublicRouteActive
646
- ) {
647
- return;
648
- }
649
-
650
- if (
651
- !isLogged ||
652
- !currentCompany ||
653
- Object.entries(currentCompany).length === 0 ||
654
- !deviceConfigFetched
655
- ) {
656
- return;
657
- }
658
-
659
- const currentConfig = JSON.parse(localStorage.getItem('config') || '{}');
660
- const sessionData = JSON.parse(localStorage.getItem('session') || '{}');
661
- const currentCompanyId = normalizeEntityId(currentCompany?.id);
662
- const defaultCompanyId = normalizeEntityId(defaultCompany?.id);
663
- const configuredLanguage = resolveConfiguredLanguage({
664
- currentCompany,
665
- defaultCompany,
666
- currentConfig,
667
- sessionData,
668
- });
669
- const nextTranslateBootstrapKey = [
670
- configuredLanguage,
671
- currentCompanyId,
672
- defaultCompanyId,
673
- ].join('::');
674
-
675
- if (translateBootstrapKeyRef.current === nextTranslateBootstrapKey) {
676
- if (global.t) {
677
- global.t.companies = companies;
678
- global.t.currentCompany = currentCompany;
679
- global.t.defaultCompany = defaultCompany;
680
- }
681
-
682
- return;
683
- }
684
-
685
- if (currentConfig.language !== configuredLanguage) {
686
- const nextConfig = {...currentConfig, language: configuredLanguage};
687
- localStorage.setItem(
688
- 'config',
689
- JSON.stringify(nextConfig),
690
- );
691
- }
692
-
693
- translateBootstrapKeyRef.current = nextTranslateBootstrapKey;
675
+ useEffect(() => {
676
+ if (!currentRouteName || isPublicRouteActive) {
677
+ return;
678
+ }
679
+
680
+ if (
681
+ !isLogged ||
682
+ !hasCurrentCompany ||
683
+ !deviceConfigFetched ||
684
+ !expectedTranslateBootstrapKey
685
+ ) {
686
+ return;
687
+ }
688
+
689
+ const currentConfig = JSON.parse(localStorage.getItem('config') || '{}');
690
+
691
+ if (
692
+ translateBootstrapKeyRef.current === expectedTranslateBootstrapKey &&
693
+ global.t
694
+ ) {
695
+ global.t.companies = companies;
696
+ global.t.currentCompany = currentCompany;
697
+ global.t.defaultCompany = defaultCompany;
698
+ setActiveTranslateBootstrapKey(expectedTranslateBootstrapKey);
699
+ setTranslateReady(true);
700
+
701
+ return;
702
+ }
703
+
704
+ setTranslateReady(false);
705
+
706
+ if (currentConfig.language !== configuredTranslationLanguage) {
707
+ const nextConfig = {
708
+ ...currentConfig,
709
+ language: configuredTranslationLanguage,
710
+ };
711
+ localStorage.setItem(
712
+ 'config',
713
+ JSON.stringify(nextConfig),
714
+ );
715
+ }
716
+
717
+ translateBootstrapKeyRef.current = expectedTranslateBootstrapKey;
694
718
  global.t = new Translate(
695
719
  companies,
696
720
  defaultCompany,
@@ -698,69 +722,59 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
698
722
  Object.keys(stores),
699
723
  translateStore,
700
724
  );
725
+ setActiveTranslateBootstrapKey(expectedTranslateBootstrapKey);
701
726
  setTranslateReady(true);
702
727
  global.refreshTranslationsUI?.();
703
- global.t.discoveryAll().catch(() => {});
704
728
  }, [
705
729
  companies,
730
+ configuredTranslationLanguage,
706
731
  currentCompany,
707
732
  currentRouteName,
708
733
  defaultCompany,
709
734
  deviceConfigFetched,
735
+ expectedTranslateBootstrapKey,
736
+ hasCurrentCompany,
710
737
  isLogged,
711
738
  isPublicRouteActive,
712
- translateActions,
739
+ translateStore,
713
740
  ]);
714
741
 
715
742
 
716
- useEffect(() => {
717
- if (!isLogged || translateReady || !hasCurrentCompany) {
718
- onBootstrapReady?.();
719
- }
720
- }, [isLogged, translateReady, hasCurrentCompany, onBootstrapReady]);
721
-
722
-
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;
737
-
738
- try {
739
- const cssText = await api.fetch('themes-colors.css', {
740
- responseType: 'text',
741
- params,
742
- });
743
- const parsedColors = parseThemeCss(cssText);
744
- setBaseThemeColors(parsedColors);
745
- actions.setColors(parsedColors);
746
- } catch {
747
- setBaseThemeColors({});
748
- }
749
- };
750
-
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
- }
743
+ useEffect(() => {
744
+ if (
745
+ !isLogged ||
746
+ !hasCurrentCompany ||
747
+ (currentRouteName && isTranslateBootstrapReady)
748
+ ) {
749
+ onBootstrapReady?.();
750
+ }
751
+ }, [
752
+ currentRouteName,
753
+ hasCurrentCompany,
754
+ isLogged,
755
+ isTranslateBootstrapReady,
756
+ onBootstrapReady,
757
+ ]);
761
758
 
762
- let cancelled = false;
763
759
 
760
+ useEffect(() => {
761
+ if (
762
+ device &&
763
+ device.id &&
764
+ isLogged
765
+ ) {
766
+ peopleActions.myCompanies();
767
+ }
768
+ }, [isLogged, device?.id]);
769
+
770
+ useEffect(() => {
771
+ if (!isLogged || !currentCompany?.id) {
772
+ actions.setMenus([]);
773
+ return undefined;
774
+ }
775
+
776
+ let cancelled = false;
777
+
764
778
  api
765
779
  .fetch('menus-people', {
766
780
  params: {
@@ -769,25 +783,44 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
769
783
  menuType: 'home',
770
784
  },
771
785
  })
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;
786
+ .then(result => {
787
+ if (!cancelled) {
788
+ actions.setMenus(normalizeRuntimeMenuResponse(result, {appType}));
789
+ }
790
+ })
791
+ .catch(() => {
792
+ if (!cancelled) {
793
+ actions.setMenus(normalizeRuntimeMenuResponse(null, {appType}));
794
+ }
795
+ });
796
+
797
+ return () => {
798
+ cancelled = true;
799
+ };
800
+ }, [actions, appType, currentCompany?.id, isLogged]);
801
+
802
+ useEffect(() => {
803
+ const fetchColors = async () => {
804
+ try {
805
+ const cssText = await api.fetch('themes-colors.css', {
806
+ responseType: 'text',
807
+ });
808
+ const parsedColors = parseThemeCss(cssText);
809
+ setBaseThemeColors(parsedColors);
810
+ actions.setColors(parsedColors);
811
+ } catch {
812
+ setBaseThemeColors({});
813
+ }
785
814
  };
786
- }, [actions, appType, currentCompany?.id, isLogged]);
787
815
 
788
- useEffect(() => {
789
- const companyThemeColors =
790
- currentCompany?.theme?.colors || defaultCompany?.theme?.colors || {};
816
+ if (device?.id) {
817
+ fetchColors();
818
+ }
819
+ }, [actions, currentCompany?.id, defaultCompany?.id, device?.id]);
820
+
821
+ useEffect(() => {
822
+ const companyThemeColors =
823
+ currentCompany?.theme?.colors || defaultCompany?.theme?.colors || {};
791
824
  const mergedThemeColors = {
792
825
  ...(baseThemeColors || {}),
793
826
  ...(companyThemeColors || {}),
@@ -802,6 +835,11 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
802
835
 
803
836
  actions.setColors(mergedThemeColors);
804
837
  }, [actions, baseThemeColors, currentCompany?.id, currentCompany?.theme?.colors]);
838
+
839
+ if (requiresTranslateBootstrap && !isTranslateBootstrapReady) {
840
+ return <View style={providerStyles.loadingContainer} />;
841
+ }
842
+
805
843
  return (
806
844
  <>
807
845
  {runtimeBridges}
@@ -815,15 +853,15 @@ export const DefaultProvider = ({children, onBootstrapReady}) => {
815
853
  backgroundColor: colors?.background || runtimeColors.background,
816
854
  },
817
855
  ]}>
818
- <View style={providerStyles.content}>{children}</View>
856
+ <View style={[providerStyles.content, runtimeUiScaleStyle]}>{children}</View>
819
857
  {!isShopClientApp && bottomNavigationCount === 0 && (
820
858
  <RuntimeInfoFooter
821
859
  appVersion={appVersion}
822
860
  defaultCompany={defaultCompany}
823
861
  device={device}
824
862
  colors={colors}
825
- />
826
- )}
863
+ />
864
+ )}
827
865
  </View>
828
866
  {!isShopClientApp && (
829
867
  <>