@pisell/private-materials 6.12.258 → 6.12.259
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/HDLKiosk/runtime/application.js +12 -2
- package/es/components/HDLKiosk/runtime/triggers.js +52 -17
- package/es/components/bigSale/templates/HDLKiosk/BigSaleScaleRuntimeOwner.js +35 -7
- package/es/components/bigSale/templates/HDLKiosk/index.js +2 -1
- package/lib/components/HDLKiosk/runtime/application.js +12 -2
- package/lib/components/HDLKiosk/runtime/triggers.js +52 -17
- package/lib/components/bigSale/templates/HDLKiosk/BigSaleScaleRuntimeOwner.js +35 -7
- package/lib/components/bigSale/templates/HDLKiosk/index.js +2 -1
- package/package.json +5 -5
|
@@ -15,6 +15,7 @@ const hdlKioskApplication = hdlKioskDefinition.implement({
|
|
|
15
15
|
createEnvironment: ({ host, config }) => Object.freeze({
|
|
16
16
|
host,
|
|
17
17
|
config,
|
|
18
|
+
scaleEntry: { readPhase: () => "inactive" },
|
|
18
19
|
sessionActivity: { notify: (_sessionId) => void 0 },
|
|
19
20
|
scanner: createScannerSessionRouter({
|
|
20
21
|
host,
|
|
@@ -22,7 +23,7 @@ const hdlKioskApplication = hdlKioskDefinition.implement({
|
|
|
22
23
|
})
|
|
23
24
|
}),
|
|
24
25
|
disposeEnvironment: ({ scanner }) => scanner.dispose(),
|
|
25
|
-
triggerAdapters: ({ environment }) => createHDLKioskEntryTriggerAdapters(environment.host, environment.config, environment.scanner.triggerAdapter),
|
|
26
|
+
triggerAdapters: ({ environment }) => createHDLKioskEntryTriggerAdapters(environment.host, environment.config, environment.scanner.triggerAdapter, () => environment.scaleEntry.readPhase()),
|
|
26
27
|
admission: ({ workflowKey, cause, environment }) => evaluateHDLKioskAdmission({
|
|
27
28
|
entry: workflowKey,
|
|
28
29
|
enabledEntry: cause.trigger === "onScan" ? "barcode" : workflowKey,
|
|
@@ -64,7 +65,16 @@ const hdlKioskApplication = hdlKioskDefinition.implement({
|
|
|
64
65
|
}
|
|
65
66
|
},
|
|
66
67
|
maxActiveSessions: 1,
|
|
67
|
-
exposeRuntime: ({ runtime, environment }) =>
|
|
68
|
+
exposeRuntime: ({ runtime, environment }) => {
|
|
69
|
+
environment.scaleEntry.readPhase = () => {
|
|
70
|
+
const snapshot = runtime.getSnapshot();
|
|
71
|
+
if (snapshot.state !== "active") return "inactive";
|
|
72
|
+
if (snapshot.pendingStartCount > 0) return "starting";
|
|
73
|
+
if (snapshot.sessions.length > 0) return "flow";
|
|
74
|
+
return "entry";
|
|
75
|
+
};
|
|
76
|
+
return createHDLKioskExposedRuntime(runtime, environment);
|
|
77
|
+
}
|
|
68
78
|
});
|
|
69
79
|
//#endregion
|
|
70
80
|
export { hdlKioskApplication };
|
|
@@ -1,25 +1,60 @@
|
|
|
1
1
|
import { createScaleIngress } from "./devices/scaleIngress.js";
|
|
2
2
|
//#region src/components/HDLKiosk/runtime/triggers.ts
|
|
3
|
-
function createHDLKioskEntryTriggerAdapters(host, config, scannerTriggerAdapter) {
|
|
3
|
+
function createHDLKioskEntryTriggerAdapters(host, config, scannerTriggerAdapter, readScaleEntryPhase = () => "entry") {
|
|
4
4
|
const scaleIngress = createScaleIngress();
|
|
5
5
|
const onWeight = Object.freeze({
|
|
6
6
|
trigger: "onWeight",
|
|
7
|
-
activate: ({ emit }) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
activate: ({ emit }) => {
|
|
8
|
+
let lastIgnoredPhase;
|
|
9
|
+
return host.devices.subscribe((event) => {
|
|
10
|
+
if (event.type !== "weightChanged") return;
|
|
11
|
+
const phase = readScaleEntryPhase();
|
|
12
|
+
const log = (name, status, reason = "") => {
|
|
13
|
+
try {
|
|
14
|
+
var _event$weight$status;
|
|
15
|
+
host.telemetry.emit({
|
|
16
|
+
name,
|
|
17
|
+
traceId: `device:scale:${event.eventId}`,
|
|
18
|
+
occurredAt: Date.now(),
|
|
19
|
+
attributes: {
|
|
20
|
+
eventId: event.eventId,
|
|
21
|
+
changedAt: event.weight.changedAt,
|
|
22
|
+
grossWeight: event.weight.gross,
|
|
23
|
+
unit: event.weight.unit,
|
|
24
|
+
scaleStatus: (_event$weight$status = event.weight.status) !== null && _event$weight$status !== void 0 ? _event$weight$status : "unknown",
|
|
25
|
+
phase,
|
|
26
|
+
status,
|
|
27
|
+
reason,
|
|
28
|
+
minimumWeightKg: config.scaleTriggerMinimumWeightKg
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
} catch (_unused) {}
|
|
32
|
+
};
|
|
33
|
+
if (phase !== "entry") {
|
|
34
|
+
if (lastIgnoredPhase !== phase) log("hdlKiosk.scale.entryDecision", "ignored", phase);
|
|
35
|
+
lastIgnoredPhase = phase;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
lastIgnoredPhase = void 0;
|
|
39
|
+
const accepted = scaleIngress.accept(event, {
|
|
40
|
+
active: true,
|
|
41
|
+
supported: config.enabledEntries.includes("scale") && Boolean(config.primaryWeightedProductId) && host.capabilities.scale.available && host.capabilities.scale.weightChangeTrigger,
|
|
42
|
+
workflowLocked: false,
|
|
43
|
+
nodeAcceptsEvent: true,
|
|
44
|
+
paymentFrozen: false
|
|
45
|
+
});
|
|
46
|
+
if (accepted.status !== "accepted") {
|
|
47
|
+
log("hdlKiosk.scale.entryDecision", "rejected", accepted.reason);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
log("hdlKiosk.scale.entryDecision", "accepted");
|
|
51
|
+
emit({
|
|
52
|
+
channel: "weighing-product",
|
|
53
|
+
occurrenceId: accepted.event.eventId,
|
|
54
|
+
correlationId: `device:scale:${accepted.event.eventId}`
|
|
55
|
+
}).then((result) => log("hdlKiosk.scale.startFinished", result.status, result.status === "rejected" ? result.reason : ""), () => log("hdlKiosk.scale.startFinished", "failed", "unexpectedFailure"));
|
|
56
|
+
}, { sources: ["scale"] });
|
|
57
|
+
}
|
|
23
58
|
});
|
|
24
59
|
return Object.freeze([scannerTriggerAdapter, onWeight]);
|
|
25
60
|
}
|
|
@@ -44,8 +44,8 @@ function BigSaleScaleRuntimeOwner(props) {
|
|
|
44
44
|
occurredAt: Date.now()
|
|
45
45
|
}) }, /* @__PURE__ */ React.createElement(ActiveScaleRuntimeOwner, _objectSpread2(_objectSpread2({}, props), {}, { useNativeScale })));
|
|
46
46
|
}
|
|
47
|
-
function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeScale }) {
|
|
48
|
-
const
|
|
47
|
+
function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeScale, telemetry }) {
|
|
48
|
+
const lastEmittedWeightRef = useRef(void 0);
|
|
49
49
|
const lastConnectionStateRef = useRef();
|
|
50
50
|
const eventSequenceRef = useRef(0);
|
|
51
51
|
const [sample, setSample] = useState({
|
|
@@ -71,6 +71,7 @@ function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeSca
|
|
|
71
71
|
}, [active, bridge]);
|
|
72
72
|
useEffect(() => {
|
|
73
73
|
if (!active) return;
|
|
74
|
+
const previous = bridge.runtime.getSnapshot();
|
|
74
75
|
bridge.runtime.publish(bridge.ownerId, {
|
|
75
76
|
grossWeightKg: scale.grossWeight,
|
|
76
77
|
status: scale.status,
|
|
@@ -80,6 +81,29 @@ function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeSca
|
|
|
80
81
|
error: scale.error,
|
|
81
82
|
sampleSequence: sample.sequence
|
|
82
83
|
});
|
|
84
|
+
const current = bridge.runtime.getSnapshot();
|
|
85
|
+
if (previous.grossWeightKg !== current.grossWeightKg || previous.status !== current.status || previous.connectionState !== current.connectionState || previous.hasLiveSample !== current.hasLiveSample) try {
|
|
86
|
+
var _scale$rawData$weight, _scale$rawData2, _previous$grossWeight, _current$grossWeightK, _current$status, _current$connectionSt;
|
|
87
|
+
telemetry === null || telemetry === void 0 || telemetry.emit({
|
|
88
|
+
name: "hdlKiosk.scale.readingChanged",
|
|
89
|
+
traceId: `${bridge.ownerId}:sample:${sample.sequence}`,
|
|
90
|
+
occurredAt: Date.now(),
|
|
91
|
+
attributes: {
|
|
92
|
+
ownerId: bridge.ownerId,
|
|
93
|
+
sampleSequence: sample.sequence,
|
|
94
|
+
receivedAt: sample.receivedAt,
|
|
95
|
+
rawWeightGrams: String((_scale$rawData$weight = (_scale$rawData2 = scale.rawData) === null || _scale$rawData2 === void 0 ? void 0 : _scale$rawData2.weight) !== null && _scale$rawData$weight !== void 0 ? _scale$rawData$weight : ""),
|
|
96
|
+
previousGrossWeightKg: String((_previous$grossWeight = previous.grossWeightKg) !== null && _previous$grossWeight !== void 0 ? _previous$grossWeight : ""),
|
|
97
|
+
grossWeightKg: String((_current$grossWeightK = current.grossWeightKg) !== null && _current$grossWeightK !== void 0 ? _current$grossWeightK : ""),
|
|
98
|
+
status: (_current$status = current.status) !== null && _current$status !== void 0 ? _current$status : "unknown",
|
|
99
|
+
connectionState: (_current$connectionSt = current.connectionState) !== null && _current$connectionSt !== void 0 ? _current$connectionSt : "unknown",
|
|
100
|
+
isListening: current.isListening,
|
|
101
|
+
hasLiveSample: current.hasLiveSample,
|
|
102
|
+
hasError: Boolean(current.error),
|
|
103
|
+
minimumWeightKg
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
} catch (_unused) {}
|
|
83
107
|
}, [
|
|
84
108
|
active,
|
|
85
109
|
bridge,
|
|
@@ -89,7 +113,10 @@ function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeSca
|
|
|
89
113
|
scale.isListening,
|
|
90
114
|
scale.rawData,
|
|
91
115
|
scale.status,
|
|
92
|
-
sample.sequence
|
|
116
|
+
sample.sequence,
|
|
117
|
+
sample.receivedAt,
|
|
118
|
+
minimumWeightKg,
|
|
119
|
+
telemetry
|
|
93
120
|
]);
|
|
94
121
|
useEffect(() => {
|
|
95
122
|
if (!active) {
|
|
@@ -112,15 +139,15 @@ function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeSca
|
|
|
112
139
|
]);
|
|
113
140
|
useEffect(() => {
|
|
114
141
|
if (!active) return;
|
|
115
|
-
if (inspection.belowTriggerThreshold) {
|
|
116
|
-
|
|
142
|
+
if (inspection.belowTriggerThreshold || scale.status === "negative" || scale.status === "overload") {
|
|
143
|
+
lastEmittedWeightRef.current = void 0;
|
|
117
144
|
return;
|
|
118
145
|
}
|
|
119
|
-
if (consumedReadingRef.current) return;
|
|
120
146
|
if (!bridge.runtime.getSnapshot().hasLiveSample) return;
|
|
121
147
|
const grossWeight = inspection.validGrossWeightKg;
|
|
122
148
|
if (grossWeight === void 0) return;
|
|
123
|
-
|
|
149
|
+
if (lastEmittedWeightRef.current === grossWeight) return;
|
|
150
|
+
lastEmittedWeightRef.current = grossWeight;
|
|
124
151
|
eventSequenceRef.current += 1;
|
|
125
152
|
const occurredAt = sample.receivedAt || Date.now();
|
|
126
153
|
bridge.publishWeightChange({
|
|
@@ -139,6 +166,7 @@ function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeSca
|
|
|
139
166
|
inspection.belowTriggerThreshold,
|
|
140
167
|
inspection.validGrossWeightKg,
|
|
141
168
|
sample.receivedAt,
|
|
169
|
+
sample.sequence,
|
|
142
170
|
scale.status
|
|
143
171
|
]);
|
|
144
172
|
return null;
|
|
@@ -128,7 +128,8 @@ function HDLKioskBigSaleTemplate({ isActive = true, context, businessCode, local
|
|
|
128
128
|
active: isActive && (config.enabledEntries.includes("scale") || config.enabledEntries.includes("quick") || config.enabledEntries.includes("barcode")) && Boolean(config.primaryWeightedProductId),
|
|
129
129
|
bridge: scaleBridge,
|
|
130
130
|
nativeScaleTools,
|
|
131
|
-
minimumWeightKg: config.scaleTriggerMinimumWeightKg
|
|
131
|
+
minimumWeightKg: config.scaleTriggerMinimumWeightKg,
|
|
132
|
+
telemetry: host.telemetry
|
|
132
133
|
}), /* @__PURE__ */ React.createElement(HDLKiosk, {
|
|
133
134
|
host,
|
|
134
135
|
config,
|
|
@@ -15,6 +15,7 @@ const hdlKioskApplication = require_manifest.hdlKioskDefinition.implement({
|
|
|
15
15
|
createEnvironment: ({ host, config }) => Object.freeze({
|
|
16
16
|
host,
|
|
17
17
|
config,
|
|
18
|
+
scaleEntry: { readPhase: () => "inactive" },
|
|
18
19
|
sessionActivity: { notify: (_sessionId) => void 0 },
|
|
19
20
|
scanner: require_scannerSessionRouter.createScannerSessionRouter({
|
|
20
21
|
host,
|
|
@@ -22,7 +23,7 @@ const hdlKioskApplication = require_manifest.hdlKioskDefinition.implement({
|
|
|
22
23
|
})
|
|
23
24
|
}),
|
|
24
25
|
disposeEnvironment: ({ scanner }) => scanner.dispose(),
|
|
25
|
-
triggerAdapters: ({ environment }) => require_triggers.createHDLKioskEntryTriggerAdapters(environment.host, environment.config, environment.scanner.triggerAdapter),
|
|
26
|
+
triggerAdapters: ({ environment }) => require_triggers.createHDLKioskEntryTriggerAdapters(environment.host, environment.config, environment.scanner.triggerAdapter, () => environment.scaleEntry.readPhase()),
|
|
26
27
|
admission: ({ workflowKey, cause, environment }) => require_admissionPolicy.evaluateHDLKioskAdmission({
|
|
27
28
|
entry: workflowKey,
|
|
28
29
|
enabledEntry: cause.trigger === "onScan" ? "barcode" : workflowKey,
|
|
@@ -64,7 +65,16 @@ const hdlKioskApplication = require_manifest.hdlKioskDefinition.implement({
|
|
|
64
65
|
}
|
|
65
66
|
},
|
|
66
67
|
maxActiveSessions: 1,
|
|
67
|
-
exposeRuntime: ({ runtime, environment }) =>
|
|
68
|
+
exposeRuntime: ({ runtime, environment }) => {
|
|
69
|
+
environment.scaleEntry.readPhase = () => {
|
|
70
|
+
const snapshot = runtime.getSnapshot();
|
|
71
|
+
if (snapshot.state !== "active") return "inactive";
|
|
72
|
+
if (snapshot.pendingStartCount > 0) return "starting";
|
|
73
|
+
if (snapshot.sessions.length > 0) return "flow";
|
|
74
|
+
return "entry";
|
|
75
|
+
};
|
|
76
|
+
return require_exposedRuntime.createHDLKioskExposedRuntime(runtime, environment);
|
|
77
|
+
}
|
|
68
78
|
});
|
|
69
79
|
//#endregion
|
|
70
80
|
exports.hdlKioskApplication = hdlKioskApplication;
|
|
@@ -1,25 +1,60 @@
|
|
|
1
1
|
const require_scaleIngress = require("./devices/scaleIngress.js");
|
|
2
2
|
//#region src/components/HDLKiosk/runtime/triggers.ts
|
|
3
|
-
function createHDLKioskEntryTriggerAdapters(host, config, scannerTriggerAdapter) {
|
|
3
|
+
function createHDLKioskEntryTriggerAdapters(host, config, scannerTriggerAdapter, readScaleEntryPhase = () => "entry") {
|
|
4
4
|
const scaleIngress = require_scaleIngress.createScaleIngress();
|
|
5
5
|
const onWeight = Object.freeze({
|
|
6
6
|
trigger: "onWeight",
|
|
7
|
-
activate: ({ emit }) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
activate: ({ emit }) => {
|
|
8
|
+
let lastIgnoredPhase;
|
|
9
|
+
return host.devices.subscribe((event) => {
|
|
10
|
+
if (event.type !== "weightChanged") return;
|
|
11
|
+
const phase = readScaleEntryPhase();
|
|
12
|
+
const log = (name, status, reason = "") => {
|
|
13
|
+
try {
|
|
14
|
+
var _event$weight$status;
|
|
15
|
+
host.telemetry.emit({
|
|
16
|
+
name,
|
|
17
|
+
traceId: `device:scale:${event.eventId}`,
|
|
18
|
+
occurredAt: Date.now(),
|
|
19
|
+
attributes: {
|
|
20
|
+
eventId: event.eventId,
|
|
21
|
+
changedAt: event.weight.changedAt,
|
|
22
|
+
grossWeight: event.weight.gross,
|
|
23
|
+
unit: event.weight.unit,
|
|
24
|
+
scaleStatus: (_event$weight$status = event.weight.status) !== null && _event$weight$status !== void 0 ? _event$weight$status : "unknown",
|
|
25
|
+
phase,
|
|
26
|
+
status,
|
|
27
|
+
reason,
|
|
28
|
+
minimumWeightKg: config.scaleTriggerMinimumWeightKg
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
} catch (_unused) {}
|
|
32
|
+
};
|
|
33
|
+
if (phase !== "entry") {
|
|
34
|
+
if (lastIgnoredPhase !== phase) log("hdlKiosk.scale.entryDecision", "ignored", phase);
|
|
35
|
+
lastIgnoredPhase = phase;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
lastIgnoredPhase = void 0;
|
|
39
|
+
const accepted = scaleIngress.accept(event, {
|
|
40
|
+
active: true,
|
|
41
|
+
supported: config.enabledEntries.includes("scale") && Boolean(config.primaryWeightedProductId) && host.capabilities.scale.available && host.capabilities.scale.weightChangeTrigger,
|
|
42
|
+
workflowLocked: false,
|
|
43
|
+
nodeAcceptsEvent: true,
|
|
44
|
+
paymentFrozen: false
|
|
45
|
+
});
|
|
46
|
+
if (accepted.status !== "accepted") {
|
|
47
|
+
log("hdlKiosk.scale.entryDecision", "rejected", accepted.reason);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
log("hdlKiosk.scale.entryDecision", "accepted");
|
|
51
|
+
emit({
|
|
52
|
+
channel: "weighing-product",
|
|
53
|
+
occurrenceId: accepted.event.eventId,
|
|
54
|
+
correlationId: `device:scale:${accepted.event.eventId}`
|
|
55
|
+
}).then((result) => log("hdlKiosk.scale.startFinished", result.status, result.status === "rejected" ? result.reason : ""), () => log("hdlKiosk.scale.startFinished", "failed", "unexpectedFailure"));
|
|
56
|
+
}, { sources: ["scale"] });
|
|
57
|
+
}
|
|
23
58
|
});
|
|
24
59
|
return Object.freeze([scannerTriggerAdapter, onWeight]);
|
|
25
60
|
}
|
|
@@ -46,8 +46,8 @@ function BigSaleScaleRuntimeOwner(props) {
|
|
|
46
46
|
occurredAt: Date.now()
|
|
47
47
|
}) }, /* @__PURE__ */ react.default.createElement(ActiveScaleRuntimeOwner, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props), {}, { useNativeScale })));
|
|
48
48
|
}
|
|
49
|
-
function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeScale }) {
|
|
50
|
-
const
|
|
49
|
+
function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeScale, telemetry }) {
|
|
50
|
+
const lastEmittedWeightRef = (0, react.useRef)(void 0);
|
|
51
51
|
const lastConnectionStateRef = (0, react.useRef)();
|
|
52
52
|
const eventSequenceRef = (0, react.useRef)(0);
|
|
53
53
|
const [sample, setSample] = (0, react.useState)({
|
|
@@ -73,6 +73,7 @@ function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeSca
|
|
|
73
73
|
}, [active, bridge]);
|
|
74
74
|
(0, react.useEffect)(() => {
|
|
75
75
|
if (!active) return;
|
|
76
|
+
const previous = bridge.runtime.getSnapshot();
|
|
76
77
|
bridge.runtime.publish(bridge.ownerId, {
|
|
77
78
|
grossWeightKg: scale.grossWeight,
|
|
78
79
|
status: scale.status,
|
|
@@ -82,6 +83,29 @@ function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeSca
|
|
|
82
83
|
error: scale.error,
|
|
83
84
|
sampleSequence: sample.sequence
|
|
84
85
|
});
|
|
86
|
+
const current = bridge.runtime.getSnapshot();
|
|
87
|
+
if (previous.grossWeightKg !== current.grossWeightKg || previous.status !== current.status || previous.connectionState !== current.connectionState || previous.hasLiveSample !== current.hasLiveSample) try {
|
|
88
|
+
var _scale$rawData$weight, _scale$rawData2, _previous$grossWeight, _current$grossWeightK, _current$status, _current$connectionSt;
|
|
89
|
+
telemetry === null || telemetry === void 0 || telemetry.emit({
|
|
90
|
+
name: "hdlKiosk.scale.readingChanged",
|
|
91
|
+
traceId: `${bridge.ownerId}:sample:${sample.sequence}`,
|
|
92
|
+
occurredAt: Date.now(),
|
|
93
|
+
attributes: {
|
|
94
|
+
ownerId: bridge.ownerId,
|
|
95
|
+
sampleSequence: sample.sequence,
|
|
96
|
+
receivedAt: sample.receivedAt,
|
|
97
|
+
rawWeightGrams: String((_scale$rawData$weight = (_scale$rawData2 = scale.rawData) === null || _scale$rawData2 === void 0 ? void 0 : _scale$rawData2.weight) !== null && _scale$rawData$weight !== void 0 ? _scale$rawData$weight : ""),
|
|
98
|
+
previousGrossWeightKg: String((_previous$grossWeight = previous.grossWeightKg) !== null && _previous$grossWeight !== void 0 ? _previous$grossWeight : ""),
|
|
99
|
+
grossWeightKg: String((_current$grossWeightK = current.grossWeightKg) !== null && _current$grossWeightK !== void 0 ? _current$grossWeightK : ""),
|
|
100
|
+
status: (_current$status = current.status) !== null && _current$status !== void 0 ? _current$status : "unknown",
|
|
101
|
+
connectionState: (_current$connectionSt = current.connectionState) !== null && _current$connectionSt !== void 0 ? _current$connectionSt : "unknown",
|
|
102
|
+
isListening: current.isListening,
|
|
103
|
+
hasLiveSample: current.hasLiveSample,
|
|
104
|
+
hasError: Boolean(current.error),
|
|
105
|
+
minimumWeightKg
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
} catch (_unused) {}
|
|
85
109
|
}, [
|
|
86
110
|
active,
|
|
87
111
|
bridge,
|
|
@@ -91,7 +115,10 @@ function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeSca
|
|
|
91
115
|
scale.isListening,
|
|
92
116
|
scale.rawData,
|
|
93
117
|
scale.status,
|
|
94
|
-
sample.sequence
|
|
118
|
+
sample.sequence,
|
|
119
|
+
sample.receivedAt,
|
|
120
|
+
minimumWeightKg,
|
|
121
|
+
telemetry
|
|
95
122
|
]);
|
|
96
123
|
(0, react.useEffect)(() => {
|
|
97
124
|
if (!active) {
|
|
@@ -114,15 +141,15 @@ function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeSca
|
|
|
114
141
|
]);
|
|
115
142
|
(0, react.useEffect)(() => {
|
|
116
143
|
if (!active) return;
|
|
117
|
-
if (inspection.belowTriggerThreshold) {
|
|
118
|
-
|
|
144
|
+
if (inspection.belowTriggerThreshold || scale.status === "negative" || scale.status === "overload") {
|
|
145
|
+
lastEmittedWeightRef.current = void 0;
|
|
119
146
|
return;
|
|
120
147
|
}
|
|
121
|
-
if (consumedReadingRef.current) return;
|
|
122
148
|
if (!bridge.runtime.getSnapshot().hasLiveSample) return;
|
|
123
149
|
const grossWeight = inspection.validGrossWeightKg;
|
|
124
150
|
if (grossWeight === void 0) return;
|
|
125
|
-
|
|
151
|
+
if (lastEmittedWeightRef.current === grossWeight) return;
|
|
152
|
+
lastEmittedWeightRef.current = grossWeight;
|
|
126
153
|
eventSequenceRef.current += 1;
|
|
127
154
|
const occurredAt = sample.receivedAt || Date.now();
|
|
128
155
|
bridge.publishWeightChange({
|
|
@@ -141,6 +168,7 @@ function ActiveScaleRuntimeOwner({ active, bridge, minimumWeightKg, useNativeSca
|
|
|
141
168
|
inspection.belowTriggerThreshold,
|
|
142
169
|
inspection.validGrossWeightKg,
|
|
143
170
|
sample.receivedAt,
|
|
171
|
+
sample.sequence,
|
|
144
172
|
scale.status
|
|
145
173
|
]);
|
|
146
174
|
return null;
|
|
@@ -130,7 +130,8 @@ function HDLKioskBigSaleTemplate({ isActive = true, context, businessCode, local
|
|
|
130
130
|
active: isActive && (config.enabledEntries.includes("scale") || config.enabledEntries.includes("quick") || config.enabledEntries.includes("barcode")) && Boolean(config.primaryWeightedProductId),
|
|
131
131
|
bridge: scaleBridge,
|
|
132
132
|
nativeScaleTools,
|
|
133
|
-
minimumWeightKg: config.scaleTriggerMinimumWeightKg
|
|
133
|
+
minimumWeightKg: config.scaleTriggerMinimumWeightKg,
|
|
134
|
+
telemetry: host.telemetry
|
|
134
135
|
}), /* @__PURE__ */ react.default.createElement(require_index.default, {
|
|
135
136
|
host,
|
|
136
137
|
config,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.259",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"react-zoom-pan-pinch": "^3.7.0",
|
|
71
71
|
"styled-components": "^6.0.0-rc.3",
|
|
72
72
|
"use-sync-external-store": "^1.6.0",
|
|
73
|
-
"@pisell/utils": "3.0.7",
|
|
74
|
-
"@pisell/pi-payment-sdk": "0.0.3",
|
|
75
|
-
"@pisell/materials": "6.12.74",
|
|
76
73
|
"@pisell/icon": "0.0.11",
|
|
77
|
-
"@pisell/
|
|
74
|
+
"@pisell/materials": "6.12.74",
|
|
75
|
+
"@pisell/pi-payment-sdk": "0.0.3",
|
|
76
|
+
"@pisell/date-picker": "3.0.12",
|
|
77
|
+
"@pisell/utils": "3.0.7"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"react": "^18.0.0",
|