@controleonline/ui-common 1.2.87 → 1.2.88
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/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 +3 -3
- 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/DeviceDetailScreen.js +23 -338
- package/src/react/pages/Devices/detail/createDeviceDetailContext.js +20 -0
- 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/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/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
package/src/utils/translate.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from "./translateDiscovery.js";
|
|
29
29
|
|
|
30
30
|
export default class Translate {
|
|
31
|
-
constructor(companies,
|
|
31
|
+
constructor(companies, mainCompany, currentCompany, stores, translateStore) {
|
|
32
32
|
this.translates = loadStorageObject(TRANSLATES_STORAGE_KEY);
|
|
33
33
|
|
|
34
34
|
this.language =
|
|
@@ -36,7 +36,7 @@ export default class Translate {
|
|
|
36
36
|
JSON.parse(localStorage.getItem("config") || "{}").language,
|
|
37
37
|
) || "pt-br";
|
|
38
38
|
|
|
39
|
-
this.
|
|
39
|
+
this.mainCompany = mainCompany;
|
|
40
40
|
this.currentCompany = currentCompany;
|
|
41
41
|
this.translateStore = translateStore || {};
|
|
42
42
|
this.translateActions = this.translateStore?.actions || {};
|
|
@@ -102,7 +102,7 @@ export default class Translate {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
getCompaniesToCache() {
|
|
105
|
-
return collectCompaniesToCache(this.
|
|
105
|
+
return collectCompaniesToCache(this.mainCompany, this.currentCompany);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// Always load current + main company so runtime resolution can apply
|
|
@@ -125,7 +125,7 @@ export default class Translate {
|
|
|
125
125
|
hasPendingTranslate(store, type, key) {
|
|
126
126
|
return readHasPendingTranslate(
|
|
127
127
|
this.translateStore,
|
|
128
|
-
this.
|
|
128
|
+
this.mainCompany?.id,
|
|
129
129
|
store,
|
|
130
130
|
type,
|
|
131
131
|
key,
|
|
@@ -197,7 +197,7 @@ export default class Translate {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
getPersistRequestToken(store, type, key) {
|
|
200
|
-
return `${this.language}:${this.normalizeId(this.
|
|
200
|
+
return `${this.language}:${this.normalizeId(this.mainCompany?.id)}:${store}:${type}:${key}`;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
cacheTranslateRecord(record, fallbackCompanyId = null, fallbackLanguage = this.language) {
|
|
@@ -225,7 +225,7 @@ export default class Translate {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
getMessageFromBuckets(store, type, key) {
|
|
228
|
-
const companyIds = [this.currentCompany?.id, this.
|
|
228
|
+
const companyIds = [this.currentCompany?.id, this.mainCompany?.id]
|
|
229
229
|
.map((value) => this.normalizeId(value))
|
|
230
230
|
.filter(Boolean);
|
|
231
231
|
|
|
@@ -247,14 +247,14 @@ export default class Translate {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
persistMissingTranslate(store, type, key, translate) {
|
|
250
|
-
if (!store || !type || !key || !this.
|
|
250
|
+
if (!store || !type || !key || !this.mainCompany?.id) return;
|
|
251
251
|
|
|
252
|
-
const
|
|
252
|
+
const mainCompanyId = this.normalizeId(this.mainCompany?.id);
|
|
253
253
|
// Queueing is a local pending state used to drive resolve/discovery.
|
|
254
|
-
// Do NOT require
|
|
254
|
+
// Do NOT require mainCompany to appear in this.companies: non-superadmin
|
|
255
255
|
// tenants often lack membership on the main company, but still must be able
|
|
256
256
|
// to resolve and cache the main catalog (read path). Backend gates writes.
|
|
257
|
-
if (!
|
|
257
|
+
if (!mainCompanyId) {
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
260
|
|
|
@@ -268,7 +268,7 @@ export default class Translate {
|
|
|
268
268
|
|
|
269
269
|
this.translateActions.queueMissingTranslate({
|
|
270
270
|
language: this.language,
|
|
271
|
-
companyId: this.
|
|
271
|
+
companyId: this.mainCompany.id,
|
|
272
272
|
store,
|
|
273
273
|
type,
|
|
274
274
|
key,
|
|
@@ -290,7 +290,7 @@ export default class Translate {
|
|
|
290
290
|
|
|
291
291
|
const request = Promise.resolve(
|
|
292
292
|
this.translateActions.save({
|
|
293
|
-
people: "/people/" +
|
|
293
|
+
people: "/people/" + mainCompanyId,
|
|
294
294
|
language: this.language,
|
|
295
295
|
store,
|
|
296
296
|
type,
|
|
@@ -302,7 +302,7 @@ export default class Translate {
|
|
|
302
302
|
.then((result) => {
|
|
303
303
|
const changed = this.cacheTranslateRecord(
|
|
304
304
|
result,
|
|
305
|
-
|
|
305
|
+
mainCompanyId,
|
|
306
306
|
this.language,
|
|
307
307
|
);
|
|
308
308
|
this.removePendingTranslate(store, type, key);
|
|
@@ -328,7 +328,7 @@ export default class Translate {
|
|
|
328
328
|
|
|
329
329
|
this.translateActions.removePendingTranslate({
|
|
330
330
|
language: this.language,
|
|
331
|
-
companyId: this.
|
|
331
|
+
companyId: this.mainCompany?.id,
|
|
332
332
|
store,
|
|
333
333
|
type,
|
|
334
334
|
key,
|
|
@@ -338,7 +338,7 @@ export default class Translate {
|
|
|
338
338
|
getQueuedTranslateGroups() {
|
|
339
339
|
return readQueuedGroups(
|
|
340
340
|
this.translateStore,
|
|
341
|
-
this.
|
|
341
|
+
this.mainCompany?.id,
|
|
342
342
|
this.language,
|
|
343
343
|
);
|
|
344
344
|
}
|
|
@@ -346,7 +346,7 @@ export default class Translate {
|
|
|
346
346
|
getQueuedTranslateGroupsForStore(store) {
|
|
347
347
|
return readQueuedGroupsForStore(
|
|
348
348
|
this.translateStore,
|
|
349
|
-
this.
|
|
349
|
+
this.mainCompany?.id,
|
|
350
350
|
store,
|
|
351
351
|
this.language,
|
|
352
352
|
);
|
|
@@ -38,7 +38,7 @@ export function getPendingStoreBucket(translateStore, companyId, store, language
|
|
|
38
38
|
|
|
39
39
|
export function hasPendingTranslate(
|
|
40
40
|
translateStore,
|
|
41
|
-
|
|
41
|
+
mainCompanyId,
|
|
42
42
|
store,
|
|
43
43
|
type,
|
|
44
44
|
key,
|
|
@@ -46,17 +46,17 @@ export function hasPendingTranslate(
|
|
|
46
46
|
) {
|
|
47
47
|
const storeBucket = getPendingStoreBucket(
|
|
48
48
|
translateStore,
|
|
49
|
-
|
|
49
|
+
mainCompanyId,
|
|
50
50
|
store,
|
|
51
51
|
language,
|
|
52
52
|
);
|
|
53
53
|
return Boolean(storeBucket?.[type]?.[key]);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export function getQueuedTranslateGroups(translateStore,
|
|
56
|
+
export function getQueuedTranslateGroups(translateStore, mainCompanyId, language) {
|
|
57
57
|
const companyBucket = getPendingCompanyBucket(
|
|
58
58
|
translateStore,
|
|
59
|
-
|
|
59
|
+
mainCompanyId,
|
|
60
60
|
language,
|
|
61
61
|
);
|
|
62
62
|
if (!companyBucket) {
|
|
@@ -80,13 +80,13 @@ export function getQueuedTranslateGroups(translateStore, defaultCompanyId, langu
|
|
|
80
80
|
|
|
81
81
|
export function getQueuedTranslateGroupsForStore(
|
|
82
82
|
translateStore,
|
|
83
|
-
|
|
83
|
+
mainCompanyId,
|
|
84
84
|
store,
|
|
85
85
|
language,
|
|
86
86
|
) {
|
|
87
87
|
return getQueuedTranslateGroups(
|
|
88
88
|
translateStore,
|
|
89
|
-
|
|
89
|
+
mainCompanyId,
|
|
90
90
|
language,
|
|
91
91
|
).filter((group) => group.store === store);
|
|
92
92
|
}
|
|
@@ -91,8 +91,8 @@ export function getStoreBucket(
|
|
|
91
91
|
return languageBucket[store] || null;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
export function collectCompaniesToCache(
|
|
95
|
-
const candidates = [
|
|
94
|
+
export function collectCompaniesToCache(mainCompany, currentCompany) {
|
|
95
|
+
const candidates = [mainCompany, currentCompany].filter(
|
|
96
96
|
(company) => company?.id,
|
|
97
97
|
);
|
|
98
98
|
|