@open-mercato/core 0.6.6-develop.6299.1.29224e2d86 → 0.6.6-develop.6300.1.08ff40c897

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.
@@ -1,4 +1,4 @@
1
- [build:core] found 3425 entry points
1
+ [build:core] found 3424 entry points
2
2
  [build:core] built successfully
3
3
  [build:core:generated] found 186 entry points
4
4
  [build:core:generated] built successfully
@@ -74,6 +74,11 @@ import { BulkActionsBar } from "./components/BulkActionsBar.js";
74
74
  import { ChangeStageDialog } from "./components/ChangeStageDialog.js";
75
75
  import { ChangeOwnerDialog } from "./components/ChangeOwnerDialog.js";
76
76
  import { buildCrudExportUrl, deleteCrud } from "@open-mercato/ui/backend/utils/crud";
77
+ import {
78
+ readVersionedPreference,
79
+ writeVersionedPreference,
80
+ clearVersionedPreference
81
+ } from "@open-mercato/shared/lib/browser/versionedPreference";
77
82
  import { runBulkDelete, groupBulkDeleteFailures } from "@open-mercato/ui/backend/utils/bulkDelete";
78
83
  import {
79
84
  fetchAssignableStaffMembers
@@ -87,33 +92,32 @@ const MIN_LANE_WIDTH = 240;
87
92
  const MAX_LANE_WIDTH = 576;
88
93
  const LANE_GAP = 14;
89
94
  const LANE_WIDTHS_STORAGE_KEY_PREFIX = "kanban-lane-widths-v2";
95
+ const LANE_WIDTHS_STORAGE_VERSION = 1;
96
+ function isNumberRecord(value) {
97
+ return !!value && typeof value === "object" && !Array.isArray(value) && Object.values(value).every((v) => typeof v === "number");
98
+ }
90
99
  function loadLaneWidths(scopeKey) {
91
- if (typeof window === "undefined") return {};
92
- try {
93
- const raw = window.localStorage.getItem(`${LANE_WIDTHS_STORAGE_KEY_PREFIX}:${scopeKey}`);
94
- if (!raw) return {};
95
- const parsed = JSON.parse(raw);
96
- if (!parsed || typeof parsed !== "object") return {};
97
- const out = {};
98
- for (const [k, v] of Object.entries(parsed)) {
99
- if (typeof v === "number" && Number.isFinite(v) && v >= MIN_LANE_WIDTH && v <= MAX_LANE_WIDTH) {
100
- out[k] = v;
101
- }
100
+ const raw = readVersionedPreference(
101
+ `${LANE_WIDTHS_STORAGE_KEY_PREFIX}:${scopeKey}`,
102
+ LANE_WIDTHS_STORAGE_VERSION,
103
+ isNumberRecord,
104
+ {},
105
+ { legacyIsValid: isNumberRecord }
106
+ );
107
+ const out = {};
108
+ for (const [k, v] of Object.entries(raw)) {
109
+ if (Number.isFinite(v) && v >= MIN_LANE_WIDTH && v <= MAX_LANE_WIDTH) {
110
+ out[k] = v;
102
111
  }
103
- return out;
104
- } catch {
105
- return {};
106
112
  }
113
+ return out;
107
114
  }
108
115
  function saveLaneWidths(scopeKey, widths) {
109
- if (typeof window === "undefined") return;
110
- try {
111
- if (Object.keys(widths).length === 0) {
112
- window.localStorage.removeItem(`${LANE_WIDTHS_STORAGE_KEY_PREFIX}:${scopeKey}`);
113
- } else {
114
- window.localStorage.setItem(`${LANE_WIDTHS_STORAGE_KEY_PREFIX}:${scopeKey}`, JSON.stringify(widths));
115
- }
116
- } catch {
116
+ const key = `${LANE_WIDTHS_STORAGE_KEY_PREFIX}:${scopeKey}`;
117
+ if (Object.keys(widths).length === 0) {
118
+ clearVersionedPreference(key);
119
+ } else {
120
+ writeVersionedPreference(key, LANE_WIDTHS_STORAGE_VERSION, widths);
117
121
  }
118
122
  }
119
123
  function normalizeAmount(value) {