@camstack/ui-library 1.2.231 → 1.2.232

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/dist/index.cjs CHANGED
@@ -36870,6 +36870,22 @@ var LIVE_NOISE_SET = new Set(LIVE_NOISE_CATEGORIES);
36870
36870
  /** Categories visible in the events tab by default. The "All" badge
36871
36871
  * reflects this set, not the raw enum. */
36872
36872
  var DEFAULT_EVENT_CATEGORIES = Object.freeze(ALL_EVENT_CATEGORIES.filter((c) => !LIVE_NOISE_SET.has(c)));
36873
+ /**
36874
+ * "Detection session started by …" — the motion the orchestrator dispatched the
36875
+ * session on (D672): an attached sensor by its name (or its device id when the
36876
+ * name was not known), otherwise the motion source. An attach with no trigger
36877
+ * (an occupancy burst, a standing always-on camera, an older orchestrator)
36878
+ * says only that a session started.
36879
+ */
36880
+ function describeSessionStart(source, triggeredBy, sensorName) {
36881
+ const suffix = " — phase active";
36882
+ if (typeof triggeredBy === "object" && triggeredBy !== null && "kind" in triggeredBy && triggeredBy.kind === "sensor") {
36883
+ const id = "deviceId" in triggeredBy ? triggeredBy.deviceId : void 0;
36884
+ return `Detection session started by ${typeof sensorName === "string" && sensorName.length > 0 ? sensorName : `sensor #${String(id ?? "?")}`} motion${suffix}`;
36885
+ }
36886
+ if (source !== null) return `Detection session started by ${source} motion${suffix}`;
36887
+ return `Detection session started${suffix}`;
36888
+ }
36873
36889
  function summarizeEvent(category, data) {
36874
36890
  if (category === _camstack_types.EventCategory.DetectionPhaseTransition) {
36875
36891
  const to = data["to"];
@@ -36877,6 +36893,9 @@ function summarizeEvent(category, data) {
36877
36893
  const source = typeof data["source"] === "string" ? data["source"] : null;
36878
36894
  const cooldownMs = typeof data["cooldownMs"] === "number" ? data["cooldownMs"] : null;
36879
36895
  const suffix = source ? ` (${source}${cooldownMs ? `, ${Math.round(cooldownMs / 1e3)}s cooldown` : ""})` : "";
36896
+ const cause = data["cause"];
36897
+ if (cause === "attach") return describeSessionStart(source, data["triggeredBy"], data["sensorName"]);
36898
+ if (cause === "detach") return "Detection session ended — phase watching";
36880
36899
  if (to === "active") return `Motion detected — phase active${suffix}`;
36881
36900
  if (to === "watching") return `Cooldown expired — phase watching${suffix}`;
36882
36901
  return `Phase: ${String(from)} → ${String(to)}${suffix}`;
package/dist/index.js CHANGED
@@ -36846,6 +36846,22 @@ var LIVE_NOISE_SET = new Set(LIVE_NOISE_CATEGORIES);
36846
36846
  /** Categories visible in the events tab by default. The "All" badge
36847
36847
  * reflects this set, not the raw enum. */
36848
36848
  var DEFAULT_EVENT_CATEGORIES = Object.freeze(ALL_EVENT_CATEGORIES.filter((c) => !LIVE_NOISE_SET.has(c)));
36849
+ /**
36850
+ * "Detection session started by …" — the motion the orchestrator dispatched the
36851
+ * session on (D672): an attached sensor by its name (or its device id when the
36852
+ * name was not known), otherwise the motion source. An attach with no trigger
36853
+ * (an occupancy burst, a standing always-on camera, an older orchestrator)
36854
+ * says only that a session started.
36855
+ */
36856
+ function describeSessionStart(source, triggeredBy, sensorName) {
36857
+ const suffix = " — phase active";
36858
+ if (typeof triggeredBy === "object" && triggeredBy !== null && "kind" in triggeredBy && triggeredBy.kind === "sensor") {
36859
+ const id = "deviceId" in triggeredBy ? triggeredBy.deviceId : void 0;
36860
+ return `Detection session started by ${typeof sensorName === "string" && sensorName.length > 0 ? sensorName : `sensor #${String(id ?? "?")}`} motion${suffix}`;
36861
+ }
36862
+ if (source !== null) return `Detection session started by ${source} motion${suffix}`;
36863
+ return `Detection session started${suffix}`;
36864
+ }
36849
36865
  function summarizeEvent(category, data) {
36850
36866
  if (category === EventCategory.DetectionPhaseTransition) {
36851
36867
  const to = data["to"];
@@ -36853,6 +36869,9 @@ function summarizeEvent(category, data) {
36853
36869
  const source = typeof data["source"] === "string" ? data["source"] : null;
36854
36870
  const cooldownMs = typeof data["cooldownMs"] === "number" ? data["cooldownMs"] : null;
36855
36871
  const suffix = source ? ` (${source}${cooldownMs ? `, ${Math.round(cooldownMs / 1e3)}s cooldown` : ""})` : "";
36872
+ const cause = data["cause"];
36873
+ if (cause === "attach") return describeSessionStart(source, data["triggeredBy"], data["sensorName"]);
36874
+ if (cause === "detach") return "Detection session ended — phase watching";
36856
36875
  if (to === "active") return `Motion detected — phase active${suffix}`;
36857
36876
  if (to === "watching") return `Cooldown expired — phase watching${suffix}`;
36858
36877
  return `Phase: ${String(from)} → ${String(to)}${suffix}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/ui-library",
3
- "version": "1.2.231",
3
+ "version": "1.2.232",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",