@pisell/private-materials 6.12.258 → 6.12.260

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.
@@ -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 }) => createHDLKioskExposedRuntime(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 }) => host.devices.subscribe((event) => {
8
- if (event.type !== "weightChanged") return;
9
- const accepted = scaleIngress.accept(event, {
10
- active: true,
11
- supported: config.enabledEntries.includes("scale") && Boolean(config.primaryWeightedProductId) && host.capabilities.scale.available && host.capabilities.scale.weightChangeTrigger,
12
- workflowLocked: false,
13
- nodeAcceptsEvent: true,
14
- paymentFrozen: false
15
- });
16
- if (accepted.status !== "accepted") return;
17
- emit({
18
- channel: "weighing-product",
19
- occurrenceId: accepted.event.eventId,
20
- correlationId: `device:scale:${accepted.event.eventId}`
21
- });
22
- }, { sources: ["scale"] })
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 consumedReadingRef = useRef(false);
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
- consumedReadingRef.current = false;
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
- consumedReadingRef.current = true;
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,
@@ -10,10 +10,10 @@ import { request } from "../../utils/index.js";
10
10
  import { useSalesSdk } from "../salesSdk/hooks/useSalesSdk.js";
11
11
  import { useSalesSdkCart } from "../salesSdk/hooks/useSalesSdkCart.js";
12
12
  import { useSalesSdkCustomer } from "../salesSdk/hooks/useSalesSdkCustomer.js";
13
+ import locales_default from "./locales.js";
13
14
  import { useSalesSdkBookingContext } from "../salesSdk/context/SalesSdkBookingContext.js";
14
15
  import { useSalesSdkSummary } from "../salesSdk/hooks/useSalesSdkSummary.js";
15
16
  import "../salesSdk/index.js";
16
- import locales_default from "./locales.js";
17
17
  import locales_default$1 from "./components/LineItem/locales.js";
18
18
  import { SaleOrderActionBoundary } from "./actions/index.js";
19
19
  import { SaleDetailTemplateRenderer } from "./tmpl/index.js";
@@ -3,8 +3,8 @@ import useLocale from "../../../../hooks/useLocale.js";
3
3
  import { resolveLocalizedText } from "../../../salesSdk/utils/resolveLocalizedText.js";
4
4
  import { formatTempOrderSettlementAmount, isVirtualSettlementTempOrder } from "../../../multiCurrencySettlement/index.js";
5
5
  import SubTotal from "../../../../components/subTotal/index.js";
6
- import { resolveEffectiveSaleDetailAmountDue, resolveSaleDetailTempOrder } from "../../utils.js";
7
6
  import locales_default from "../../locales.js";
7
+ import { resolveEffectiveSaleDetailAmountDue, resolveSaleDetailTempOrder } from "../../utils.js";
8
8
  import React, { useMemo, useState } from "react";
9
9
  import { Skeleton } from "antd";
10
10
  import { locales } from "@pisell/utils";
@@ -3,8 +3,11 @@ import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122
3
3
  import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
4
4
  import { getClientName } from "../../../clientName/utils.js";
5
5
  import CompensatedPisellContainer from "../../../../pro/compensatedPisellContainer/index.js";
6
+ import useLocale from "../../../../hooks/useLocale.js";
7
+ import useInitLocalesOnce from "../../../../hooks/useInitLocalesOnce.js";
6
8
  import ClientCard from "../../../clientCard/index.js";
7
9
  import ClientSearch from "../../../clinetSearch/index.js";
10
+ import locales_default from "../../locales.js";
8
11
  import { extractContactsInfo, getCustomerId, isWalkInCustomer, normalizeCustomer } from "./utils.js";
9
12
  import { getFranchiseeCustomerInfo } from "./serve.js";
10
13
  import React, { forwardRef, memo, useImperativeHandle, useMemo, useRef, useState } from "react";
@@ -27,6 +30,8 @@ function getValidFranchiseeCustomerId(record) {
27
30
  const ClientSelector = memo(forwardRef(({ className, value, list = [], loading = false, loadingMore = false, resultLoading, hasMore = false, pagination, isShowAvatar, showClientCard = true, readOnly = false, clientCardProps, bookingConfig, beforeSwitchModalOpen, variant, onSearch, onLoadMore, onChangePage, onSelect, onAddToFirst, onClientChange, resolveContactsInfo, onContactsInfoChange, onOpenCustomerDetail }, ref) => {
28
31
  var _context$appHelper, _context$appHelper$ge;
29
32
  const context = useEngineContext();
33
+ const locale = useLocale();
34
+ useInitLocalesOnce(locales_default, locale);
30
35
  const clientSearchRef = useRef(null);
31
36
  const [searchModalVisible, setSearchModalVisible] = useState(false);
32
37
  const [switchModalVisible, setSwitchModalVisible] = useState(false);
@@ -366,6 +371,7 @@ const ClientSelector = memo(forwardRef(({ className, value, list = [], loading =
366
371
  handleCancelSwitch,
367
372
  handleConfirmSwitch,
368
373
  isSelectingClient,
374
+ locale,
369
375
  switchModalFooterButtonStyle,
370
376
  switchModalFooterStyle
371
377
  ]);
@@ -401,6 +407,8 @@ const ClientSelector = memo(forwardRef(({ className, value, list = [], loading =
401
407
  handleConfirmSwitch,
402
408
  isPhoneVariant,
403
409
  isSelectingClient,
410
+ locale,
411
+ pendingCustomer,
404
412
  switchModalFooter,
405
413
  switchModalVisible
406
414
  ]);
@@ -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 }) => require_exposedRuntime.createHDLKioskExposedRuntime(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 }) => host.devices.subscribe((event) => {
8
- if (event.type !== "weightChanged") return;
9
- const accepted = scaleIngress.accept(event, {
10
- active: true,
11
- supported: config.enabledEntries.includes("scale") && Boolean(config.primaryWeightedProductId) && host.capabilities.scale.available && host.capabilities.scale.weightChangeTrigger,
12
- workflowLocked: false,
13
- nodeAcceptsEvent: true,
14
- paymentFrozen: false
15
- });
16
- if (accepted.status !== "accepted") return;
17
- emit({
18
- channel: "weighing-product",
19
- occurrenceId: accepted.event.eventId,
20
- correlationId: `device:scale:${accepted.event.eventId}`
21
- });
22
- }, { sources: ["scale"] })
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 consumedReadingRef = (0, react.useRef)(false);
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
- consumedReadingRef.current = false;
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
- consumedReadingRef.current = true;
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,
@@ -11,9 +11,9 @@ const require_index$2 = require("../../utils/index.js");
11
11
  const require_useSalesSdk = require("../salesSdk/hooks/useSalesSdk.js");
12
12
  const require_useSalesSdkCart = require("../salesSdk/hooks/useSalesSdkCart.js");
13
13
  const require_useSalesSdkCustomer = require("../salesSdk/hooks/useSalesSdkCustomer.js");
14
+ const require_locales = require("./locales.js");
14
15
  const require_SalesSdkBookingContext = require("../salesSdk/context/SalesSdkBookingContext.js");
15
16
  const require_useSalesSdkSummary = require("../salesSdk/hooks/useSalesSdkSummary.js");
16
- const require_locales = require("./locales.js");
17
17
  const require_locales$1 = require("./components/LineItem/locales.js");
18
18
  const require_index$3 = require("./actions/index.js");
19
19
  const require_index$4 = require("./tmpl/index.js");
@@ -4,8 +4,8 @@ const require_useLocale = require("../../../../hooks/useLocale.js");
4
4
  const require_resolveLocalizedText = require("../../../salesSdk/utils/resolveLocalizedText.js");
5
5
  const require_index = require("../../../multiCurrencySettlement/index.js");
6
6
  const require_index$1 = require("../../../../components/subTotal/index.js");
7
- const require_utils = require("../../utils.js");
8
7
  const require_locales = require("../../locales.js");
8
+ const require_utils = require("../../utils.js");
9
9
  let react = require("react");
10
10
  react = require_runtime.__toESM(react);
11
11
  let antd = require("antd");
@@ -4,8 +4,11 @@ const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtim
4
4
  const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
5
5
  const require_utils = require("../../../clientName/utils.js");
6
6
  const require_index = require("../../../../pro/compensatedPisellContainer/index.js");
7
+ const require_useLocale = require("../../../../hooks/useLocale.js");
8
+ const require_useInitLocalesOnce = require("../../../../hooks/useInitLocalesOnce.js");
7
9
  const require_index$1 = require("../../../clientCard/index.js");
8
10
  const require_index$2 = require("../../../clinetSearch/index.js");
11
+ const require_locales = require("../../locales.js");
9
12
  const require_utils$1 = require("./utils.js");
10
13
  const require_serve = require("./serve.js");
11
14
  let react = require("react");
@@ -30,6 +33,8 @@ function getValidFranchiseeCustomerId(record) {
30
33
  const ClientSelector = (0, react.memo)((0, react.forwardRef)(({ className, value, list = [], loading = false, loadingMore = false, resultLoading, hasMore = false, pagination, isShowAvatar, showClientCard = true, readOnly = false, clientCardProps, bookingConfig, beforeSwitchModalOpen, variant, onSearch, onLoadMore, onChangePage, onSelect, onAddToFirst, onClientChange, resolveContactsInfo, onContactsInfoChange, onOpenCustomerDetail }, ref) => {
31
34
  var _context$appHelper, _context$appHelper$ge;
32
35
  const context = require_useEngineContext.default();
36
+ const locale = require_useLocale.default();
37
+ require_useInitLocalesOnce.default(require_locales.default, locale);
33
38
  const clientSearchRef = (0, react.useRef)(null);
34
39
  const [searchModalVisible, setSearchModalVisible] = (0, react.useState)(false);
35
40
  const [switchModalVisible, setSwitchModalVisible] = (0, react.useState)(false);
@@ -369,6 +374,7 @@ const ClientSelector = (0, react.memo)((0, react.forwardRef)(({ className, value
369
374
  handleCancelSwitch,
370
375
  handleConfirmSwitch,
371
376
  isSelectingClient,
377
+ locale,
372
378
  switchModalFooterButtonStyle,
373
379
  switchModalFooterStyle
374
380
  ]);
@@ -404,6 +410,8 @@ const ClientSelector = (0, react.memo)((0, react.forwardRef)(({ className, value
404
410
  handleConfirmSwitch,
405
411
  isPhoneVariant,
406
412
  isSelectingClient,
413
+ locale,
414
+ pendingCustomer,
407
415
  switchModalFooter,
408
416
  switchModalVisible
409
417
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.258",
3
+ "version": "6.12.260",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -73,8 +73,8 @@
73
73
  "@pisell/utils": "3.0.7",
74
74
  "@pisell/pi-payment-sdk": "0.0.3",
75
75
  "@pisell/materials": "6.12.74",
76
- "@pisell/icon": "0.0.11",
77
- "@pisell/date-picker": "3.0.12"
76
+ "@pisell/date-picker": "3.0.12",
77
+ "@pisell/icon": "0.0.11"
78
78
  },
79
79
  "peerDependencies": {
80
80
  "react": "^18.0.0",