@controleonline/ui-common 1.2.80 → 1.2.81
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/AGENTS.md +8 -0
- package/package.json +9 -3
- package/src/api/fetch.js +7 -7
- package/src/react/components/AddImportModal.js +6 -2
- package/src/react/components/BackgroundRuntimeBridge.js +201 -215
- package/src/react/components/ConfirmModal.js +44 -9
- package/src/react/components/ConfirmModal.styles.js +55 -41
- package/src/react/components/CopyDeviceConfigModal.js +193 -0
- package/src/react/components/CopyDeviceConfigModal.styles.js +123 -0
- package/src/react/components/DefaultProvider.native.js +22 -0
- package/src/react/components/DefaultProvider.web.js +25 -1
- package/src/react/components/EntityLogBranch.js +482 -0
- package/src/react/components/EntityLogCards.js +369 -0
- package/src/react/components/EntityLogContent.js +113 -794
- package/src/react/components/LinkedOrderProductsTab.js +3 -3
- package/src/react/components/PrintService.js +130 -409
- package/src/react/components/RemoteCheckoutService.js +2 -2
- package/src/react/components/RuntimeBottomNavigationBar.js +141 -146
- package/src/react/components/RuntimeFooterMarqueeText.js +137 -0
- package/src/react/components/RuntimeInfoFooter.js +12 -15
- package/src/react/components/SystemErrorToast.js +49 -29
- package/src/react/components/SystemErrorToast.styles.js +43 -38
- package/src/react/components/UserAvatar.js +120 -28
- package/src/react/config/deviceConfigBootstrap.js +330 -304
- package/src/react/hooks/usePrintSpoolEffects.js +161 -0
- package/src/react/pages/DeviceDetailPage.js +6 -2882
- package/src/react/pages/Devices/detail/DeviceDetailAlertsCommandsSection.js +233 -0
- package/src/react/pages/Devices/detail/DeviceDetailHeader.js +138 -0
- package/src/react/pages/Devices/detail/DeviceDetailMovementSections.js +167 -0
- package/src/react/pages/Devices/detail/DeviceDetailOrdersPrintSection.js +216 -0
- package/src/react/pages/Devices/detail/DeviceDetailPaymentSection.js +40 -0
- package/src/react/pages/Devices/detail/DeviceDetailPdvConfigSection.js +390 -0
- package/src/react/pages/Devices/detail/DeviceDetailRenderers.js +135 -0
- package/src/react/pages/Devices/detail/DeviceDetailScreen.js +493 -0
- package/src/react/pages/Devices/detail/OptionButtonChip.js +65 -0
- package/src/react/pages/Devices/detail/deviceDetailConstants.js +36 -0
- package/src/react/pages/Devices/detail/deviceDetailHelpers.js +70 -0
- package/src/react/pages/Devices/detail/useDeviceDetailActions.js +483 -0
- package/src/react/pages/Devices/detail/useDeviceDetailCopyConfig.js +87 -0
- package/src/react/pages/Devices/detail/useDeviceDetailLoaders.js +327 -0
- package/src/react/pages/Devices/detail/useDeviceDetailSaves.js +429 -0
- package/src/react/pages/Devices/detail/useDeviceDetailStateA.js +484 -0
- package/src/react/pages/Devices/detail/useDeviceDetailStateB.js +71 -0
- package/src/react/pages/Devices/deviceTypes/index.js +2 -0
- package/src/react/pages/Devices/deviceTypes/pdv.js +11 -0
- package/src/react/pages/Imports.js +3 -2
- package/src/react/pages/IntegrationConfigFields.js +126 -0
- package/src/react/pages/IntegrationConfigPage.js +122 -591
- package/src/react/pages/IntegrationConfigPage.utils.js +95 -0
- package/src/react/print/usePrintButtonController.js +9 -1
- package/src/react/services/Getnet/Checkout.js +81 -0
- package/src/react/services/Getnet/Getnet.js +77 -0
- package/src/react/services/paymentGatewayExecution.js +20 -0
- package/src/react/utils/bottomNavigationToolbar.js +161 -0
- package/src/react/utils/commercialDocumentOrders.js +18 -6
- package/src/react/utils/copyDeviceConfigs.js +198 -0
- package/src/react/utils/fileUrl.js +43 -0
- package/src/react/utils/importStatus.js +19 -10
- package/src/react/utils/logSettings.js +7 -7
- package/src/react/utils/maintenanceSettings.js +16 -0
- package/src/react/utils/paymentDevices.js +6 -0
- package/src/react/utils/printManagedPrinter.js +45 -0
- package/src/react/utils/printRouting.js +63 -0
- package/src/react/utils/printSpoolUtils.js +119 -0
- package/src/react/utils/printerDevices.js +368 -368
- package/src/react/utils/runtimeFooter.js +10 -19
- package/src/react/utils/shopFranchises.js +186 -65
- package/src/react/utils/systemErrorMessage.js +71 -67
- package/src/store/device_config/customActions.js +119 -30
- package/src/tests/browser/manager/bottom-navigation-role-toolbar.spec.js +353 -0
- package/src/tests/browser/manager/device-detail-alias-save.spec.js +345 -0
- package/src/tests/browser/manager/device-detail-copy-config.spec.js +365 -0
- package/src/tests/browser/manager/runtime-footer-marquee.spec.js +262 -0
- package/src/tests/browser/manager/theme-confirm-toast.spec.js +236 -0
- package/src/tests/react/components/RuntimeFooterMarqueeText.test.js +171 -0
- package/src/tests/react/components/UserAvatar.test.js +6 -2
- package/src/tests/react/components/themeAwareModals.test.mjs +60 -0
- package/src/tests/react/config/deviceConfigBootstrap.test.js +104 -66
- package/src/tests/react/pages/deviceDetailDelete.test.js +78 -0
- package/src/tests/react/pages/receitaFederalIntegrationContract.test.mjs +48 -0
- package/src/tests/react/utils/bottomNavigationToolbar.test.js +222 -0
- package/src/tests/react/utils/copyDeviceConfigs.test.mjs +127 -0
- package/src/tests/react/utils/fileUrl.test.js +38 -0
- package/src/tests/react/utils/importStatus.test.js +26 -9
- package/src/tests/react/utils/passwordPolicy.test.js +27 -0
- package/src/tests/react/utils/printRouting.test.mjs +86 -0
- package/src/tests/react/utils/printSpoolUtils.test.mjs +52 -0
- package/src/tests/react/utils/runtimeFooter.test.js +7 -0
- package/src/tests/react/utils/shopFranchises.test.js +121 -115
- package/src/tests/react/utils/systemErrorMessage.test.js +32 -59
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
isPdvPrinterEnabled,
|
|
5
5
|
normalizeDeviceId,
|
|
6
6
|
} from '@controleonline/ui-common/src/react/utils/paymentDevices';
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
export const PRINT_DEVICE_TYPE = 'PRINT';
|
|
9
9
|
export const PRINTER_DEVICE_TYPE = 'PRINTER';
|
|
10
10
|
export const IP_CAMERA_DEVICE_TYPE = 'IP_CAMERA';
|
|
11
11
|
export const DISPLAY_DEVICE_TYPE = 'DISPLAY';
|
|
12
12
|
export const PDV_DEVICE_TYPE = 'PDV';
|
|
13
|
-
|
|
14
|
-
export const NETWORK_PRINTER_MANAGER_DEVICE_CONFIG_KEY =
|
|
15
|
-
'print-network-manager-device';
|
|
16
|
-
export const NETWORK_PRINTER_PORT_CONFIG_KEY = 'print-network-port';
|
|
13
|
+
|
|
14
|
+
export const NETWORK_PRINTER_MANAGER_DEVICE_CONFIG_KEY =
|
|
15
|
+
'print-network-manager-device';
|
|
16
|
+
export const NETWORK_PRINTER_PORT_CONFIG_KEY = 'print-network-port';
|
|
17
17
|
export const NETWORK_PRINTER_COLUMNS_CONFIG_KEY = 'print-network-columns';
|
|
18
18
|
export const NETWORK_PRINTER_TRANSPORT_CONFIG_KEY =
|
|
19
19
|
'print-network-transport';
|
|
@@ -25,69 +25,69 @@ export const DEFAULT_NETWORK_PRINTER_TRANSPORT = 'tcp-raw';
|
|
|
25
25
|
export const DEFAULT_NETWORK_PRINTER_CODE_PAGE = 'cp850';
|
|
26
26
|
export const DEFAULT_NETWORK_PRINTER_MANUFACTURER = 'Bematech';
|
|
27
27
|
export const DEFAULT_NETWORK_PRINTER_MODEL = 'MP-2800 TH';
|
|
28
|
-
|
|
29
|
-
const safeTrim = value => String(value || '').trim();
|
|
30
|
-
|
|
31
|
-
const parseMetadataObject = metadata => {
|
|
32
|
-
if (!metadata) {
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (typeof metadata === 'string') {
|
|
37
|
-
try {
|
|
38
|
-
const parsed = JSON.parse(metadata);
|
|
39
|
-
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
28
|
+
|
|
29
|
+
const safeTrim = value => String(value || '').trim();
|
|
30
|
+
|
|
31
|
+
const parseMetadataObject = metadata => {
|
|
32
|
+
if (!metadata) {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (typeof metadata === 'string') {
|
|
37
|
+
try {
|
|
38
|
+
const parsed = JSON.parse(metadata);
|
|
39
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
40
40
|
} catch {
|
|
41
41
|
return {};
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
return typeof metadata === 'object' ? {...metadata} : {};
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const normalizePositiveIntegerString = (value, fallback) => {
|
|
49
|
-
const normalized = safeTrim(value).replace(/\D+/g, '');
|
|
50
|
-
if (!normalized) {
|
|
51
|
-
return fallback;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const numericValue = Number(normalized);
|
|
55
|
-
return Number.isFinite(numericValue) && numericValue > 0
|
|
56
|
-
? String(numericValue)
|
|
57
|
-
: fallback;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const normalizeDeviceType = value => safeTrim(value).toUpperCase();
|
|
61
|
-
export const getDeviceConfigType = deviceConfig =>
|
|
62
|
-
normalizeDeviceType(deviceConfig?.type || deviceConfig?.device?.type);
|
|
63
|
-
export const buildDeviceConfigIri = deviceConfig => {
|
|
64
|
-
const directIri = safeTrim(deviceConfig?.['@id']);
|
|
65
|
-
if (directIri) {
|
|
66
|
-
return directIri;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const configId = safeTrim(deviceConfig?.id);
|
|
70
|
-
return configId ? `/device_configs/${configId}` : '';
|
|
71
|
-
};
|
|
72
|
-
export const getPrinterOptionValue = printer =>
|
|
73
|
-
safeTrim(printer?.configIri) ||
|
|
74
|
-
safeTrim(printer?.selectionValue) ||
|
|
75
|
-
safeTrim(printer?.device);
|
|
76
|
-
export const findPrinterOptionByValue = (printerOptions = [], value = '') => {
|
|
77
|
-
const normalizedValue = safeTrim(value);
|
|
78
|
-
if (!normalizedValue) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const options = Array.isArray(printerOptions) ? printerOptions : [];
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
options.find(option => getPrinterOptionValue(option) === normalizedValue) ||
|
|
86
|
-
options.find(option => normalizeDeviceId(option?.device) === normalizedValue) ||
|
|
87
|
-
null
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
44
|
+
|
|
45
|
+
return typeof metadata === 'object' ? {...metadata} : {};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const normalizePositiveIntegerString = (value, fallback) => {
|
|
49
|
+
const normalized = safeTrim(value).replace(/\D+/g, '');
|
|
50
|
+
if (!normalized) {
|
|
51
|
+
return fallback;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const numericValue = Number(normalized);
|
|
55
|
+
return Number.isFinite(numericValue) && numericValue > 0
|
|
56
|
+
? String(numericValue)
|
|
57
|
+
: fallback;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const normalizeDeviceType = value => safeTrim(value).toUpperCase();
|
|
61
|
+
export const getDeviceConfigType = deviceConfig =>
|
|
62
|
+
normalizeDeviceType(deviceConfig?.type || deviceConfig?.device?.type);
|
|
63
|
+
export const buildDeviceConfigIri = deviceConfig => {
|
|
64
|
+
const directIri = safeTrim(deviceConfig?.['@id']);
|
|
65
|
+
if (directIri) {
|
|
66
|
+
return directIri;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const configId = safeTrim(deviceConfig?.id);
|
|
70
|
+
return configId ? `/device_configs/${configId}` : '';
|
|
71
|
+
};
|
|
72
|
+
export const getPrinterOptionValue = printer =>
|
|
73
|
+
safeTrim(printer?.configIri) ||
|
|
74
|
+
safeTrim(printer?.selectionValue) ||
|
|
75
|
+
safeTrim(printer?.device);
|
|
76
|
+
export const findPrinterOptionByValue = (printerOptions = [], value = '') => {
|
|
77
|
+
const normalizedValue = safeTrim(value);
|
|
78
|
+
if (!normalizedValue) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const options = Array.isArray(printerOptions) ? printerOptions : [];
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
options.find(option => getPrinterOptionValue(option) === normalizedValue) ||
|
|
86
|
+
options.find(option => normalizeDeviceId(option?.device) === normalizedValue) ||
|
|
87
|
+
null
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
91
|
export const isNetworkPrinterDeviceType = type =>
|
|
92
92
|
[PRINT_DEVICE_TYPE, PRINTER_DEVICE_TYPE].includes(normalizeDeviceType(type));
|
|
93
93
|
|
|
@@ -95,7 +95,7 @@ export const isManagedNetworkDeviceType = type =>
|
|
|
95
95
|
[PRINT_DEVICE_TYPE, PRINTER_DEVICE_TYPE, IP_CAMERA_DEVICE_TYPE].includes(
|
|
96
96
|
normalizeDeviceType(type),
|
|
97
97
|
);
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
export const isPrintCapableDeviceType = type =>
|
|
100
100
|
[PRINT_DEVICE_TYPE, PRINTER_DEVICE_TYPE, PDV_DEVICE_TYPE].includes(
|
|
101
101
|
normalizeDeviceType(type),
|
|
@@ -130,307 +130,307 @@ export const getDeviceTypeLabel = type => {
|
|
|
130
130
|
|
|
131
131
|
return normalizedType || 'DEVICE';
|
|
132
132
|
};
|
|
133
|
-
|
|
134
|
-
export const getPrinterLabel = printer =>
|
|
135
|
-
safeTrim(printer?.alias) ||
|
|
136
|
-
safeTrim(printer?.name) ||
|
|
137
|
-
safeTrim(printer?.device) ||
|
|
138
|
-
'Impressora sem nome';
|
|
139
|
-
|
|
140
|
-
export const normalizePrinterHost = value => safeTrim(value);
|
|
141
|
-
export const normalizePrinterPort = value =>
|
|
142
|
-
normalizePositiveIntegerString(value, DEFAULT_NETWORK_PRINTER_PORT);
|
|
143
|
-
export const normalizePrinterColumns = value =>
|
|
144
|
-
normalizePositiveIntegerString(value, DEFAULT_NETWORK_PRINTER_COLUMNS);
|
|
145
|
-
|
|
146
|
-
export const getPrinterHost = printer => {
|
|
147
|
-
const parsedMetadata = getPrinterMetadata(printer?.metadata);
|
|
148
|
-
return (
|
|
149
|
-
normalizePrinterHost(printer?.device) ||
|
|
150
|
-
normalizePrinterHost(parsedMetadata?.printer?.host)
|
|
151
|
-
);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export const getPrinterMetadata = metadata => parseMetadataObject(metadata);
|
|
155
|
-
|
|
156
|
-
export const getPrinterMetadataField = (metadata, field) => {
|
|
157
|
-
const parsedMetadata = getPrinterMetadata(metadata);
|
|
158
|
-
const printerField = safeTrim(parsedMetadata?.printer?.[field]);
|
|
159
|
-
if (printerField) {
|
|
160
|
-
return printerField;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (field === 'manufacturer') {
|
|
164
|
-
return safeTrim(parsedMetadata?.system?.manufacturer);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (field === 'model') {
|
|
168
|
-
return safeTrim(parsedMetadata?.system?.model);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (field === 'version') {
|
|
172
|
-
return safeTrim(parsedMetadata?.system?.version);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return '';
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
export const buildNetworkPrinterMetadata = ({
|
|
179
|
-
existingMetadata = {},
|
|
180
|
-
host,
|
|
181
|
-
manufacturer,
|
|
182
|
-
model,
|
|
183
|
-
version,
|
|
184
|
-
transport = DEFAULT_NETWORK_PRINTER_TRANSPORT,
|
|
185
|
-
}) => {
|
|
186
|
-
const parsedMetadata = getPrinterMetadata(existingMetadata);
|
|
187
|
-
const normalizedManufacturer =
|
|
188
|
-
safeTrim(manufacturer) ||
|
|
189
|
-
getPrinterMetadataField(parsedMetadata, 'manufacturer') ||
|
|
190
|
-
null;
|
|
191
|
-
const normalizedModel =
|
|
192
|
-
safeTrim(model) ||
|
|
193
|
-
getPrinterMetadataField(parsedMetadata, 'model') ||
|
|
194
|
-
null;
|
|
195
|
-
const normalizedVersion =
|
|
196
|
-
safeTrim(version) ||
|
|
197
|
-
getPrinterMetadataField(parsedMetadata, 'version') ||
|
|
198
|
-
null;
|
|
199
|
-
const normalizedHost =
|
|
200
|
-
normalizePrinterHost(host) ||
|
|
201
|
-
safeTrim(parsedMetadata?.printer?.host) ||
|
|
202
|
-
null;
|
|
203
|
-
const normalizedTransport =
|
|
204
|
-
safeTrim(transport) ||
|
|
205
|
-
safeTrim(parsedMetadata?.printer?.transport) ||
|
|
206
|
-
DEFAULT_NETWORK_PRINTER_TRANSPORT;
|
|
207
|
-
|
|
208
|
-
return {
|
|
209
|
-
...parsedMetadata,
|
|
210
|
-
runtime: safeTrim(parsedMetadata?.runtime) || 'network',
|
|
211
|
-
printer: {
|
|
212
|
-
...(parsedMetadata?.printer || {}),
|
|
213
|
-
host: normalizedHost,
|
|
214
|
-
manufacturer: normalizedManufacturer,
|
|
215
|
-
model: normalizedModel,
|
|
216
|
-
version: normalizedVersion,
|
|
217
|
-
transport: normalizedTransport,
|
|
218
|
-
},
|
|
219
|
-
system: {
|
|
220
|
-
...(parsedMetadata?.system || {}),
|
|
221
|
-
name: safeTrim(parsedMetadata?.system?.name) || 'network-printer',
|
|
222
|
-
version: normalizedVersion,
|
|
223
|
-
manufacturer: normalizedManufacturer,
|
|
224
|
-
model: normalizedModel,
|
|
225
|
-
hardwareType: 'printer',
|
|
226
|
-
},
|
|
227
|
-
};
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
export const getPrinterManagerDeviceOptions = ({
|
|
231
|
-
deviceConfigs = [],
|
|
232
|
-
companyId,
|
|
233
|
-
excludeDeviceId = null,
|
|
234
|
-
}) =>
|
|
235
|
-
filterDeviceConfigsByCompany(deviceConfigs, companyId)
|
|
236
|
-
.filter(deviceConfig => {
|
|
237
|
-
const deviceId = normalizeDeviceId(deviceConfig?.device?.device);
|
|
238
|
-
const deviceType = getDeviceConfigType(deviceConfig);
|
|
239
|
-
return (
|
|
240
|
-
deviceId &&
|
|
241
|
-
deviceId !== normalizeDeviceId(excludeDeviceId) &&
|
|
242
|
-
[PDV_DEVICE_TYPE, DISPLAY_DEVICE_TYPE].includes(deviceType)
|
|
243
|
-
);
|
|
244
|
-
})
|
|
245
|
-
.map(deviceConfig => {
|
|
246
|
-
const deviceId = normalizeDeviceId(deviceConfig?.device?.device);
|
|
247
|
-
const deviceType = getDeviceConfigType(deviceConfig);
|
|
248
|
-
const alias =
|
|
249
|
-
safeTrim(deviceConfig?.device?.alias) ||
|
|
250
|
-
deviceId ||
|
|
251
|
-
`Device #${deviceConfig?.id || '--'}`;
|
|
252
|
-
|
|
253
|
-
return {
|
|
254
|
-
alias,
|
|
255
|
-
deviceId,
|
|
256
|
-
deviceType,
|
|
257
|
-
label: `${alias} (${deviceType})`,
|
|
258
|
-
};
|
|
259
|
-
})
|
|
260
|
-
.sort((left, right) => left.label.localeCompare(right.label));
|
|
261
|
-
|
|
262
|
-
export const getPrinterOptions = ({
|
|
263
|
-
printers = [],
|
|
264
|
-
deviceConfigs = [],
|
|
265
|
-
companyId = null,
|
|
266
|
-
}) => {
|
|
267
|
-
const printerMap = new Map();
|
|
268
|
-
|
|
269
|
-
const assignPrinter = (mapKey, printer, currentValue = {}) => {
|
|
270
|
-
const deviceId = normalizeDeviceId(printer?.device || printer?.deviceId);
|
|
271
|
-
if (!deviceId) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
const nextMetadata = getPrinterMetadata(printer?.metadata);
|
|
276
|
-
const currentConfigs = parseConfigsObject(currentValue?.configs);
|
|
277
|
-
const nextConfigs = parseConfigsObject(printer?.configs);
|
|
278
|
-
|
|
279
|
-
printerMap.set(mapKey, {
|
|
280
|
-
...currentValue,
|
|
281
|
-
...printer,
|
|
282
|
-
device: deviceId,
|
|
283
|
-
alias:
|
|
284
|
-
safeTrim(printer?.alias) ||
|
|
285
|
-
safeTrim(currentValue?.alias) ||
|
|
286
|
-
safeTrim(printer?.name) ||
|
|
287
|
-
safeTrim(currentValue?.name) ||
|
|
288
|
-
deviceId,
|
|
289
|
-
type:
|
|
290
|
-
normalizeDeviceType(printer?.type || printer?.deviceType) ||
|
|
291
|
-
normalizeDeviceType(currentValue?.type || currentValue?.deviceType),
|
|
292
|
-
configId: safeTrim(printer?.configId || currentValue?.configId),
|
|
293
|
-
configIri: safeTrim(printer?.configIri || currentValue?.configIri),
|
|
294
|
-
config: printer?.config || currentValue?.config,
|
|
295
|
-
metadata:
|
|
296
|
-
Object.keys(nextMetadata).length > 0
|
|
297
|
-
? nextMetadata
|
|
298
|
-
: getPrinterMetadata(currentValue?.metadata),
|
|
299
|
-
configs:
|
|
300
|
-
Object.keys(nextConfigs).length > 0 ? nextConfigs : currentConfigs,
|
|
301
|
-
});
|
|
302
|
-
};
|
|
303
|
-
|
|
133
|
+
|
|
134
|
+
export const getPrinterLabel = printer =>
|
|
135
|
+
safeTrim(printer?.alias) ||
|
|
136
|
+
safeTrim(printer?.name) ||
|
|
137
|
+
safeTrim(printer?.device) ||
|
|
138
|
+
'Impressora sem nome';
|
|
139
|
+
|
|
140
|
+
export const normalizePrinterHost = value => safeTrim(value);
|
|
141
|
+
export const normalizePrinterPort = value =>
|
|
142
|
+
normalizePositiveIntegerString(value, DEFAULT_NETWORK_PRINTER_PORT);
|
|
143
|
+
export const normalizePrinterColumns = value =>
|
|
144
|
+
normalizePositiveIntegerString(value, DEFAULT_NETWORK_PRINTER_COLUMNS);
|
|
145
|
+
|
|
146
|
+
export const getPrinterHost = printer => {
|
|
147
|
+
const parsedMetadata = getPrinterMetadata(printer?.metadata);
|
|
148
|
+
return (
|
|
149
|
+
normalizePrinterHost(printer?.device) ||
|
|
150
|
+
normalizePrinterHost(parsedMetadata?.printer?.host)
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const getPrinterMetadata = metadata => parseMetadataObject(metadata);
|
|
155
|
+
|
|
156
|
+
export const getPrinterMetadataField = (metadata, field) => {
|
|
157
|
+
const parsedMetadata = getPrinterMetadata(metadata);
|
|
158
|
+
const printerField = safeTrim(parsedMetadata?.printer?.[field]);
|
|
159
|
+
if (printerField) {
|
|
160
|
+
return printerField;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (field === 'manufacturer') {
|
|
164
|
+
return safeTrim(parsedMetadata?.system?.manufacturer);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (field === 'model') {
|
|
168
|
+
return safeTrim(parsedMetadata?.system?.model);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (field === 'version') {
|
|
172
|
+
return safeTrim(parsedMetadata?.system?.version);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return '';
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export const buildNetworkPrinterMetadata = ({
|
|
179
|
+
existingMetadata = {},
|
|
180
|
+
host,
|
|
181
|
+
manufacturer,
|
|
182
|
+
model,
|
|
183
|
+
version,
|
|
184
|
+
transport = DEFAULT_NETWORK_PRINTER_TRANSPORT,
|
|
185
|
+
}) => {
|
|
186
|
+
const parsedMetadata = getPrinterMetadata(existingMetadata);
|
|
187
|
+
const normalizedManufacturer =
|
|
188
|
+
safeTrim(manufacturer) ||
|
|
189
|
+
getPrinterMetadataField(parsedMetadata, 'manufacturer') ||
|
|
190
|
+
null;
|
|
191
|
+
const normalizedModel =
|
|
192
|
+
safeTrim(model) ||
|
|
193
|
+
getPrinterMetadataField(parsedMetadata, 'model') ||
|
|
194
|
+
null;
|
|
195
|
+
const normalizedVersion =
|
|
196
|
+
safeTrim(version) ||
|
|
197
|
+
getPrinterMetadataField(parsedMetadata, 'version') ||
|
|
198
|
+
null;
|
|
199
|
+
const normalizedHost =
|
|
200
|
+
normalizePrinterHost(host) ||
|
|
201
|
+
safeTrim(parsedMetadata?.printer?.host) ||
|
|
202
|
+
null;
|
|
203
|
+
const normalizedTransport =
|
|
204
|
+
safeTrim(transport) ||
|
|
205
|
+
safeTrim(parsedMetadata?.printer?.transport) ||
|
|
206
|
+
DEFAULT_NETWORK_PRINTER_TRANSPORT;
|
|
207
|
+
|
|
208
|
+
return {
|
|
209
|
+
...parsedMetadata,
|
|
210
|
+
runtime: safeTrim(parsedMetadata?.runtime) || 'network',
|
|
211
|
+
printer: {
|
|
212
|
+
...(parsedMetadata?.printer || {}),
|
|
213
|
+
host: normalizedHost,
|
|
214
|
+
manufacturer: normalizedManufacturer,
|
|
215
|
+
model: normalizedModel,
|
|
216
|
+
version: normalizedVersion,
|
|
217
|
+
transport: normalizedTransport,
|
|
218
|
+
},
|
|
219
|
+
system: {
|
|
220
|
+
...(parsedMetadata?.system || {}),
|
|
221
|
+
name: safeTrim(parsedMetadata?.system?.name) || 'network-printer',
|
|
222
|
+
version: normalizedVersion,
|
|
223
|
+
manufacturer: normalizedManufacturer,
|
|
224
|
+
model: normalizedModel,
|
|
225
|
+
hardwareType: 'printer',
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export const getPrinterManagerDeviceOptions = ({
|
|
231
|
+
deviceConfigs = [],
|
|
232
|
+
companyId,
|
|
233
|
+
excludeDeviceId = null,
|
|
234
|
+
}) =>
|
|
235
|
+
filterDeviceConfigsByCompany(deviceConfigs, companyId)
|
|
236
|
+
.filter(deviceConfig => {
|
|
237
|
+
const deviceId = normalizeDeviceId(deviceConfig?.device?.device);
|
|
238
|
+
const deviceType = getDeviceConfigType(deviceConfig);
|
|
239
|
+
return (
|
|
240
|
+
deviceId &&
|
|
241
|
+
deviceId !== normalizeDeviceId(excludeDeviceId) &&
|
|
242
|
+
[PDV_DEVICE_TYPE, DISPLAY_DEVICE_TYPE].includes(deviceType)
|
|
243
|
+
);
|
|
244
|
+
})
|
|
245
|
+
.map(deviceConfig => {
|
|
246
|
+
const deviceId = normalizeDeviceId(deviceConfig?.device?.device);
|
|
247
|
+
const deviceType = getDeviceConfigType(deviceConfig);
|
|
248
|
+
const alias =
|
|
249
|
+
safeTrim(deviceConfig?.device?.alias) ||
|
|
250
|
+
deviceId ||
|
|
251
|
+
`Device #${deviceConfig?.id || '--'}`;
|
|
252
|
+
|
|
253
|
+
return {
|
|
254
|
+
alias,
|
|
255
|
+
deviceId,
|
|
256
|
+
deviceType,
|
|
257
|
+
label: `${alias} (${deviceType})`,
|
|
258
|
+
};
|
|
259
|
+
})
|
|
260
|
+
.sort((left, right) => left.label.localeCompare(right.label));
|
|
261
|
+
|
|
262
|
+
export const getPrinterOptions = ({
|
|
263
|
+
printers = [],
|
|
264
|
+
deviceConfigs = [],
|
|
265
|
+
companyId = null,
|
|
266
|
+
}) => {
|
|
267
|
+
const printerMap = new Map();
|
|
268
|
+
|
|
269
|
+
const assignPrinter = (mapKey, printer, currentValue = {}) => {
|
|
270
|
+
const deviceId = normalizeDeviceId(printer?.device || printer?.deviceId);
|
|
271
|
+
if (!deviceId) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const nextMetadata = getPrinterMetadata(printer?.metadata);
|
|
276
|
+
const currentConfigs = parseConfigsObject(currentValue?.configs);
|
|
277
|
+
const nextConfigs = parseConfigsObject(printer?.configs);
|
|
278
|
+
|
|
279
|
+
printerMap.set(mapKey, {
|
|
280
|
+
...currentValue,
|
|
281
|
+
...printer,
|
|
282
|
+
device: deviceId,
|
|
283
|
+
alias:
|
|
284
|
+
safeTrim(printer?.alias) ||
|
|
285
|
+
safeTrim(currentValue?.alias) ||
|
|
286
|
+
safeTrim(printer?.name) ||
|
|
287
|
+
safeTrim(currentValue?.name) ||
|
|
288
|
+
deviceId,
|
|
289
|
+
type:
|
|
290
|
+
normalizeDeviceType(printer?.type || printer?.deviceType) ||
|
|
291
|
+
normalizeDeviceType(currentValue?.type || currentValue?.deviceType),
|
|
292
|
+
configId: safeTrim(printer?.configId || currentValue?.configId),
|
|
293
|
+
configIri: safeTrim(printer?.configIri || currentValue?.configIri),
|
|
294
|
+
config: printer?.config || currentValue?.config,
|
|
295
|
+
metadata:
|
|
296
|
+
Object.keys(nextMetadata).length > 0
|
|
297
|
+
? nextMetadata
|
|
298
|
+
: getPrinterMetadata(currentValue?.metadata),
|
|
299
|
+
configs:
|
|
300
|
+
Object.keys(nextConfigs).length > 0 ? nextConfigs : currentConfigs,
|
|
301
|
+
});
|
|
302
|
+
};
|
|
303
|
+
|
|
304
304
|
filterDeviceConfigsByCompany(deviceConfigs, companyId)
|
|
305
305
|
.filter(isPrintCapableDeviceConfig)
|
|
306
306
|
.forEach(deviceConfig => {
|
|
307
|
-
const deviceId = normalizeDeviceId(
|
|
308
|
-
deviceConfig?.device?.device || deviceConfig?.device?.id,
|
|
309
|
-
);
|
|
310
|
-
const configIri = buildDeviceConfigIri(deviceConfig);
|
|
311
|
-
const mapKey =
|
|
312
|
-
configIri ||
|
|
313
|
-
`${deviceId}::${getDeviceConfigType(deviceConfig) || 'DEVICE'}`;
|
|
314
|
-
|
|
315
|
-
assignPrinter(mapKey, {
|
|
316
|
-
...(deviceConfig?.device || {}),
|
|
317
|
-
type: getDeviceConfigType(deviceConfig),
|
|
318
|
-
configId: safeTrim(deviceConfig?.id),
|
|
319
|
-
configIri,
|
|
320
|
-
config: deviceConfig,
|
|
321
|
-
configs: parseConfigsObject(deviceConfig?.configs),
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
(Array.isArray(printers) ? printers : []).forEach(printer => {
|
|
326
|
-
const deviceId = normalizeDeviceId(printer?.device || printer?.deviceId);
|
|
327
|
-
if (!deviceId) {
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
const matchingEntries = Array.from(printerMap.entries()).filter(
|
|
332
|
-
([, option]) => normalizeDeviceId(option?.device) === deviceId,
|
|
333
|
-
);
|
|
334
|
-
|
|
335
|
-
if (matchingEntries.length > 0) {
|
|
336
|
-
matchingEntries.forEach(([mapKey, currentValue]) => {
|
|
337
|
-
assignPrinter(mapKey, printer, currentValue);
|
|
338
|
-
});
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
const fallbackType = normalizeDeviceType(printer?.type || printer?.deviceType);
|
|
343
|
-
const fallbackKey = fallbackType ? `${deviceId}::${fallbackType}` : deviceId;
|
|
344
|
-
assignPrinter(fallbackKey, printer, printerMap.get(fallbackKey) || {});
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
return Array.from(printerMap.values()).sort((left, right) =>
|
|
348
|
-
`${getPrinterLabel(left)} ${getDeviceTypeLabel(left?.type)}`.localeCompare(
|
|
349
|
-
`${getPrinterLabel(right)} ${getDeviceTypeLabel(right?.type)}`,
|
|
350
|
-
),
|
|
351
|
-
);
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
export const getManagedPrinterDevices = ({
|
|
355
|
-
deviceConfigs = [],
|
|
356
|
-
companyId = null,
|
|
357
|
-
managerDeviceId = null,
|
|
358
|
-
}) => {
|
|
359
|
-
const scopedDeviceConfigs = filterDeviceConfigsByCompany(
|
|
360
|
-
deviceConfigs,
|
|
361
|
-
companyId,
|
|
362
|
-
);
|
|
363
|
-
const normalizedManagerDeviceId = normalizeDeviceId(managerDeviceId);
|
|
364
|
-
const managedPrinterMap = new Map();
|
|
365
|
-
|
|
366
|
-
const assignManagedPrinter = printer => {
|
|
367
|
-
const printerDeviceId = normalizeDeviceId(printer?.device);
|
|
368
|
-
const printerOptionValue =
|
|
369
|
-
getPrinterOptionValue(printer) ||
|
|
370
|
-
(printerDeviceId
|
|
371
|
-
? `${printerDeviceId}::${normalizeDeviceType(printer?.type) || 'DEVICE'}`
|
|
372
|
-
: '');
|
|
373
|
-
|
|
374
|
-
if (!printerDeviceId || !printerOptionValue) {
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
managedPrinterMap.set(printerOptionValue, {
|
|
379
|
-
...(managedPrinterMap.get(printerOptionValue) || {}),
|
|
380
|
-
...printer,
|
|
381
|
-
device: printerDeviceId,
|
|
382
|
-
configs: parseConfigsObject(printer?.configs),
|
|
383
|
-
});
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
scopedDeviceConfigs
|
|
387
|
-
.filter(deviceConfig => {
|
|
388
|
-
if (!isPrinterDeviceType(getDeviceConfigType(deviceConfig))) {
|
|
389
|
-
return false;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
const configs = parseConfigsObject(deviceConfig?.configs);
|
|
393
|
-
return (
|
|
394
|
-
normalizeDeviceId(configs?.[NETWORK_PRINTER_MANAGER_DEVICE_CONFIG_KEY]) ===
|
|
395
|
-
normalizedManagerDeviceId
|
|
396
|
-
);
|
|
397
|
-
})
|
|
398
|
-
.forEach(deviceConfig => {
|
|
399
|
-
assignManagedPrinter({
|
|
400
|
-
...(deviceConfig?.device || {}),
|
|
401
|
-
type: getDeviceConfigType(deviceConfig),
|
|
402
|
-
configId: safeTrim(deviceConfig?.id),
|
|
403
|
-
configIri: buildDeviceConfigIri(deviceConfig),
|
|
404
|
-
config: deviceConfig,
|
|
405
|
-
configs: parseConfigsObject(deviceConfig?.configs),
|
|
406
|
-
});
|
|
407
|
-
});
|
|
408
|
-
|
|
307
|
+
const deviceId = normalizeDeviceId(
|
|
308
|
+
deviceConfig?.device?.device || deviceConfig?.device?.id,
|
|
309
|
+
);
|
|
310
|
+
const configIri = buildDeviceConfigIri(deviceConfig);
|
|
311
|
+
const mapKey =
|
|
312
|
+
configIri ||
|
|
313
|
+
`${deviceId}::${getDeviceConfigType(deviceConfig) || 'DEVICE'}`;
|
|
314
|
+
|
|
315
|
+
assignPrinter(mapKey, {
|
|
316
|
+
...(deviceConfig?.device || {}),
|
|
317
|
+
type: getDeviceConfigType(deviceConfig),
|
|
318
|
+
configId: safeTrim(deviceConfig?.id),
|
|
319
|
+
configIri,
|
|
320
|
+
config: deviceConfig,
|
|
321
|
+
configs: parseConfigsObject(deviceConfig?.configs),
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
(Array.isArray(printers) ? printers : []).forEach(printer => {
|
|
326
|
+
const deviceId = normalizeDeviceId(printer?.device || printer?.deviceId);
|
|
327
|
+
if (!deviceId) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const matchingEntries = Array.from(printerMap.entries()).filter(
|
|
332
|
+
([, option]) => normalizeDeviceId(option?.device) === deviceId,
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
if (matchingEntries.length > 0) {
|
|
336
|
+
matchingEntries.forEach(([mapKey, currentValue]) => {
|
|
337
|
+
assignPrinter(mapKey, printer, currentValue);
|
|
338
|
+
});
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
const fallbackType = normalizeDeviceType(printer?.type || printer?.deviceType);
|
|
343
|
+
const fallbackKey = fallbackType ? `${deviceId}::${fallbackType}` : deviceId;
|
|
344
|
+
assignPrinter(fallbackKey, printer, printerMap.get(fallbackKey) || {});
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
return Array.from(printerMap.values()).sort((left, right) =>
|
|
348
|
+
`${getPrinterLabel(left)} ${getDeviceTypeLabel(left?.type)}`.localeCompare(
|
|
349
|
+
`${getPrinterLabel(right)} ${getDeviceTypeLabel(right?.type)}`,
|
|
350
|
+
),
|
|
351
|
+
);
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
export const getManagedPrinterDevices = ({
|
|
355
|
+
deviceConfigs = [],
|
|
356
|
+
companyId = null,
|
|
357
|
+
managerDeviceId = null,
|
|
358
|
+
}) => {
|
|
359
|
+
const scopedDeviceConfigs = filterDeviceConfigsByCompany(
|
|
360
|
+
deviceConfigs,
|
|
361
|
+
companyId,
|
|
362
|
+
);
|
|
363
|
+
const normalizedManagerDeviceId = normalizeDeviceId(managerDeviceId);
|
|
364
|
+
const managedPrinterMap = new Map();
|
|
365
|
+
|
|
366
|
+
const assignManagedPrinter = printer => {
|
|
367
|
+
const printerDeviceId = normalizeDeviceId(printer?.device);
|
|
368
|
+
const printerOptionValue =
|
|
369
|
+
getPrinterOptionValue(printer) ||
|
|
370
|
+
(printerDeviceId
|
|
371
|
+
? `${printerDeviceId}::${normalizeDeviceType(printer?.type) || 'DEVICE'}`
|
|
372
|
+
: '');
|
|
373
|
+
|
|
374
|
+
if (!printerDeviceId || !printerOptionValue) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
managedPrinterMap.set(printerOptionValue, {
|
|
379
|
+
...(managedPrinterMap.get(printerOptionValue) || {}),
|
|
380
|
+
...printer,
|
|
381
|
+
device: printerDeviceId,
|
|
382
|
+
configs: parseConfigsObject(printer?.configs),
|
|
383
|
+
});
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
scopedDeviceConfigs
|
|
387
|
+
.filter(deviceConfig => {
|
|
388
|
+
if (!isPrinterDeviceType(getDeviceConfigType(deviceConfig))) {
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const configs = parseConfigsObject(deviceConfig?.configs);
|
|
393
|
+
return (
|
|
394
|
+
normalizeDeviceId(configs?.[NETWORK_PRINTER_MANAGER_DEVICE_CONFIG_KEY]) ===
|
|
395
|
+
normalizedManagerDeviceId
|
|
396
|
+
);
|
|
397
|
+
})
|
|
398
|
+
.forEach(deviceConfig => {
|
|
399
|
+
assignManagedPrinter({
|
|
400
|
+
...(deviceConfig?.device || {}),
|
|
401
|
+
type: getDeviceConfigType(deviceConfig),
|
|
402
|
+
configId: safeTrim(deviceConfig?.id),
|
|
403
|
+
configIri: buildDeviceConfigIri(deviceConfig),
|
|
404
|
+
config: deviceConfig,
|
|
405
|
+
configs: parseConfigsObject(deviceConfig?.configs),
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
|
|
409
409
|
scopedDeviceConfigs
|
|
410
410
|
.filter(
|
|
411
411
|
deviceConfig =>
|
|
412
412
|
getDeviceConfigType(deviceConfig) === DISPLAY_DEVICE_TYPE &&
|
|
413
413
|
normalizeDeviceId(deviceConfig?.device?.device) === normalizedManagerDeviceId,
|
|
414
|
-
)
|
|
415
|
-
.forEach(displayDeviceConfig => {
|
|
416
|
-
const displayConfigs = parseConfigsObject(displayDeviceConfig?.configs);
|
|
417
|
-
const attachedPrinterReference = normalizeDeviceId(displayConfigs?.printer);
|
|
418
|
-
|
|
419
|
-
if (!attachedPrinterReference) {
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
const printerDeviceConfig = scopedDeviceConfigs.find(
|
|
424
|
-
deviceConfig =>
|
|
425
|
-
buildDeviceConfigIri(deviceConfig) === attachedPrinterReference &&
|
|
426
|
-
isPrinterDeviceType(getDeviceConfigType(deviceConfig)),
|
|
427
|
-
) || scopedDeviceConfigs.find(
|
|
428
|
-
deviceConfig =>
|
|
429
|
-
normalizeDeviceId(deviceConfig?.device?.device) ===
|
|
430
|
-
attachedPrinterReference &&
|
|
431
|
-
isPrinterDeviceType(getDeviceConfigType(deviceConfig)),
|
|
432
|
-
);
|
|
433
|
-
|
|
414
|
+
)
|
|
415
|
+
.forEach(displayDeviceConfig => {
|
|
416
|
+
const displayConfigs = parseConfigsObject(displayDeviceConfig?.configs);
|
|
417
|
+
const attachedPrinterReference = normalizeDeviceId(displayConfigs?.printer);
|
|
418
|
+
|
|
419
|
+
if (!attachedPrinterReference) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const printerDeviceConfig = scopedDeviceConfigs.find(
|
|
424
|
+
deviceConfig =>
|
|
425
|
+
buildDeviceConfigIri(deviceConfig) === attachedPrinterReference &&
|
|
426
|
+
isPrinterDeviceType(getDeviceConfigType(deviceConfig)),
|
|
427
|
+
) || scopedDeviceConfigs.find(
|
|
428
|
+
deviceConfig =>
|
|
429
|
+
normalizeDeviceId(deviceConfig?.device?.device) ===
|
|
430
|
+
attachedPrinterReference &&
|
|
431
|
+
isPrinterDeviceType(getDeviceConfigType(deviceConfig)),
|
|
432
|
+
);
|
|
433
|
+
|
|
434
434
|
if (!printerDeviceConfig) {
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
@@ -453,13 +453,13 @@ export const getManagedPrinterDevices = ({
|
|
|
453
453
|
...(printerDeviceConfig?.device || {}),
|
|
454
454
|
type: getDeviceConfigType(printerDeviceConfig),
|
|
455
455
|
configId: safeTrim(printerDeviceConfig?.id),
|
|
456
|
-
configIri: buildDeviceConfigIri(printerDeviceConfig),
|
|
457
|
-
config: printerDeviceConfig,
|
|
458
|
-
configs: parseConfigsObject(printerDeviceConfig?.configs),
|
|
459
|
-
});
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
return Array.from(managedPrinterMap.values()).sort((left, right) =>
|
|
463
|
-
getPrinterLabel(left).localeCompare(getPrinterLabel(right)),
|
|
464
|
-
);
|
|
465
|
-
};
|
|
456
|
+
configIri: buildDeviceConfigIri(printerDeviceConfig),
|
|
457
|
+
config: printerDeviceConfig,
|
|
458
|
+
configs: parseConfigsObject(printerDeviceConfig?.configs),
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
return Array.from(managedPrinterMap.values()).sort((left, right) =>
|
|
463
|
+
getPrinterLabel(left).localeCompare(getPrinterLabel(right)),
|
|
464
|
+
);
|
|
465
|
+
};
|