@ai-matrx/vault 0.1.41 → 0.1.43

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.js CHANGED
@@ -1447,6 +1447,7 @@ function useCanScan() {
1447
1447
  }, []);
1448
1448
  return ok;
1449
1449
  }
1450
+ var SETUP_KEY_PLACEHOLDER = "Setup key or otpauth link";
1450
1451
  var CAMERA_NOTES = {
1451
1452
  blocked: "Camera blocked. Paste the key or choose a QR image.",
1452
1453
  missing: "No camera. Paste the key or choose a QR image.",
@@ -1507,7 +1508,7 @@ function QrScanInline({ onResult, onClose }) {
1507
1508
  if (error) {
1508
1509
  return /* @__PURE__ */ jsxs6("p", { className: "flex items-center gap-2 px-1 pt-1 text-xs text-muted-foreground", role: "status", "data-camera-note": "", children: [
1509
1510
  /* @__PURE__ */ jsx7(CameraGlyph, { className: "size-3.5 shrink-0", "aria-hidden": true }),
1510
- /* @__PURE__ */ jsx7("span", { className: "min-w-0 flex-1 truncate", children: error }),
1511
+ /* @__PURE__ */ jsx7("span", { className: "min-w-0 flex-1 break-words", children: error }),
1511
1512
  /* @__PURE__ */ jsx7(Button5, { variant: "quiet", onClick: onClose, children: "Dismiss" })
1512
1513
  ] });
1513
1514
  }
@@ -1522,7 +1523,7 @@ function QrScanInline({ onResult, onClose }) {
1522
1523
  ] })
1523
1524
  ] });
1524
1525
  }
1525
- function OtpSetupRow({ value, onChange, label = "Authenticator", placeholder = "Paste setup key or otpauth link", disabled = false, autoFocus = false, onImage, onRecognized, status, autoStartCamera = false }) {
1526
+ function OtpSetupRow({ value, onChange, label = "Authenticator", placeholder = SETUP_KEY_PLACEHOLDER, disabled = false, autoFocus = false, onImage, onRecognized, status, autoStartCamera = false }) {
1526
1527
  const file = useRef6(null);
1527
1528
  const canScan = useCanScan();
1528
1529
  const [scanning, setScanning] = useState8(false);
@@ -1782,7 +1783,7 @@ function TotpEditRow({ value, onChange, hasExisting, item, port, onEnrolled, onR
1782
1783
  setStatus(null);
1783
1784
  onChange(v);
1784
1785
  },
1785
- placeholder: hasExisting ? "Paste a new key to replace" : "Paste setup key or otpauth link",
1786
+ placeholder: hasExisting ? "Paste a new key to replace" : SETUP_KEY_PLACEHOLDER,
1786
1787
  status,
1787
1788
  ...uploadImage ? { onImage: (f) => void uploadImage(f) } : {},
1788
1789
  ...onRecognized ? { onRecognized } : {}
@@ -2764,7 +2765,6 @@ function positiveKnob(resolved, key) {
2764
2765
  }
2765
2766
 
2766
2767
  // src/organizations.ts
2767
- import { shortUuid } from "@ai-matrx/design-system/record-id-format";
2768
2768
  function orderOrganizations(orgs, items, recentItemIds) {
2769
2769
  const counts = /* @__PURE__ */ new Map();
2770
2770
  for (const i of items) if (i.owner.organizationId) counts.set(i.owner.organizationId, (counts.get(i.owner.organizationId) ?? 0) + 1);
@@ -2778,9 +2778,22 @@ function orderOrganizations(orgs, items, recentItemIds) {
2778
2778
  return [...orgs].sort((a, b) => group(a) - group(b) || (recent.get(a.id) ?? 0) - (recent.get(b.id) ?? 0) || a.name.localeCompare(b.name, void 0, { sensitivity: "base" }) || a.id.localeCompare(b.id));
2779
2779
  }
2780
2780
  function organizationHints(orgs) {
2781
- const seen = /* @__PURE__ */ new Map();
2782
- for (const o of orgs) seen.set(o.name.trim().toLowerCase(), (seen.get(o.name.trim().toLowerCase()) ?? 0) + 1);
2783
- return new Map(orgs.filter((o) => (seen.get(o.name.trim().toLowerCase()) ?? 0) > 1).map((o) => [o.id, shortUuid(o.id)]));
2781
+ const groups = /* @__PURE__ */ new Map();
2782
+ for (const o of orgs) {
2783
+ const key = o.name.trim().toLowerCase();
2784
+ groups.set(key, [...groups.get(key) ?? [], o]);
2785
+ }
2786
+ const hints = /* @__PURE__ */ new Map();
2787
+ for (const group of groups.values()) {
2788
+ if (group.length < 2) continue;
2789
+ const longest = Math.max(...group.map((o) => o.id.length));
2790
+ const fragment = (o, n2) => o.id.slice(0, n2);
2791
+ let n = 8;
2792
+ while (n < longest && new Set(group.map((o) => fragment(o, n))).size < group.length) n += 1;
2793
+ const useSuffix = new Set(group.map((o) => fragment(o, n))).size < group.length;
2794
+ for (const o of group) hints.set(o.id, useSuffix ? o.id.slice(-8) : fragment(o, n));
2795
+ }
2796
+ return hints;
2784
2797
  }
2785
2798
 
2786
2799
  // src/shown-until-move.ts