@open-mercato/ui 0.6.5-develop.4384.1.ce2ec6eaaa → 0.6.5-develop.4393.1.de282b5dfd

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.
Files changed (31) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/dist/backend/CrudForm.js +27 -7
  3. package/dist/backend/CrudForm.js.map +3 -3
  4. package/dist/backend/DataTable.js +11 -4
  5. package/dist/backend/DataTable.js.map +2 -2
  6. package/dist/backend/icons/lucideRegistry.generated.js +4 -0
  7. package/dist/backend/icons/lucideRegistry.generated.js.map +2 -2
  8. package/dist/backend/messages/EmailThreadsPanel.js +212 -0
  9. package/dist/backend/messages/EmailThreadsPanel.js.map +7 -0
  10. package/dist/backend/messages/index.js +4 -0
  11. package/dist/backend/messages/index.js.map +2 -2
  12. package/dist/backend/messages/mergeOptimisticEmailThreads.js +55 -0
  13. package/dist/backend/messages/mergeOptimisticEmailThreads.js.map +7 -0
  14. package/dist/backend/notifications/NotificationDispatcher.js +1 -0
  15. package/dist/backend/notifications/NotificationDispatcher.js.map +2 -2
  16. package/dist/backend/notifications/useNotificationsPoll.js +7 -0
  17. package/dist/backend/notifications/useNotificationsPoll.js.map +2 -2
  18. package/dist/backend/notifications/useNotificationsSse.js +8 -0
  19. package/dist/backend/notifications/useNotificationsSse.js.map +2 -2
  20. package/package.json +3 -3
  21. package/src/backend/CrudForm.tsx +33 -7
  22. package/src/backend/DataTable.tsx +34 -4
  23. package/src/backend/__tests__/CrudForm.unsavedNavigation.test.tsx +51 -2
  24. package/src/backend/icons/lucideRegistry.generated.tsx +4 -0
  25. package/src/backend/messages/EmailThreadsPanel.tsx +351 -0
  26. package/src/backend/messages/__tests__/mergeOptimisticEmailThreads.test.ts +126 -0
  27. package/src/backend/messages/index.ts +12 -0
  28. package/src/backend/messages/mergeOptimisticEmailThreads.ts +84 -0
  29. package/src/backend/notifications/NotificationDispatcher.ts +2 -0
  30. package/src/backend/notifications/useNotificationsPoll.ts +5 -0
  31. package/src/backend/notifications/useNotificationsSse.ts +6 -0
@@ -1,3 +1,3 @@
1
- Generated lucide registry with 137 icons -> /home/runner/work/open-mercato/open-mercato/packages/ui/src/backend/icons/lucideRegistry.generated.tsx
2
- [build:ui] found 375 entry points
1
+ Generated lucide registry with 139 icons -> /home/runner/work/open-mercato/open-mercato/packages/ui/src/backend/icons/lucideRegistry.generated.tsx
2
+ [build:ui] found 377 entry points
3
3
  [build:ui] built successfully
@@ -203,6 +203,26 @@ function serializeIssuePath(path) {
203
203
  }).filter((segment) => segment !== null);
204
204
  return segments.length > 0 ? segments.join(".") : null;
205
205
  }
206
+ function normalizeDirtySnapshotValue(value) {
207
+ if (value === void 0 || value === null || value === "") return void 0;
208
+ if (Array.isArray(value)) {
209
+ const normalized2 = value.map((entry) => normalizeDirtySnapshotValue(entry)).filter((entry) => entry !== void 0);
210
+ return normalized2.length ? normalized2 : void 0;
211
+ }
212
+ if (typeof value !== "object") return value;
213
+ const prototype = Object.getPrototypeOf(value);
214
+ if (prototype !== Object.prototype && prototype !== null) return value;
215
+ const normalized = {};
216
+ const record = value;
217
+ for (const key of Object.keys(record).sort()) {
218
+ const nextValue = normalizeDirtySnapshotValue(record[key]);
219
+ if (nextValue !== void 0) normalized[key] = nextValue;
220
+ }
221
+ return Object.keys(normalized).length ? normalized : void 0;
222
+ }
223
+ function createDirtySnapshot(source) {
224
+ return JSON.stringify(normalizeDirtySnapshotValue(source) ?? {});
225
+ }
206
226
  const FIELDSET_ICON_COMPONENTS = {
207
227
  layers: Layers,
208
228
  tag: Tag,
@@ -443,7 +463,7 @@ function CrudForm({
443
463
  setHasUnsavedChanges(false);
444
464
  return;
445
465
  }
446
- const currentSnapshot = JSON.stringify(values);
466
+ const currentSnapshot = createDirtySnapshot(values);
447
467
  const dirty = currentSnapshot !== snapshot;
448
468
  isDirtyRef.current = dirty;
449
469
  setHasUnsavedChanges(dirty);
@@ -484,7 +504,7 @@ function CrudForm({
484
504
  }, [clearSubmitNavigationBypass]);
485
505
  const clearDirtyState = React.useCallback((snapshotSource) => {
486
506
  const source = snapshotSource ?? valuesRef.current;
487
- dirtyBaselineSnapshotRef.current = JSON.stringify(source);
507
+ dirtyBaselineSnapshotRef.current = createDirtySnapshot(source);
488
508
  isDirtyRef.current = false;
489
509
  setHasUnsavedChanges(false);
490
510
  }, []);
@@ -523,7 +543,7 @@ function CrudForm({
523
543
  if (!target) return;
524
544
  if (shouldBypassUnsavedChangesGuardRef.current?.(target)) return;
525
545
  const baselineSnapshot = dirtyBaselineSnapshotRef.current;
526
- if (baselineSnapshot && JSON.stringify(valuesRef.current) === baselineSnapshot) {
546
+ if (baselineSnapshot && createDirtySnapshot(valuesRef.current) === baselineSnapshot) {
527
547
  isDirtyRef.current = false;
528
548
  setHasUnsavedChanges(false);
529
549
  return;
@@ -552,7 +572,7 @@ function CrudForm({
552
572
  return original(data, unused, url);
553
573
  }
554
574
  const baselineSnapshot = dirtyBaselineSnapshotRef.current;
555
- if (baselineSnapshot && JSON.stringify(valuesRef.current) === baselineSnapshot) {
575
+ if (baselineSnapshot && createDirtySnapshot(valuesRef.current) === baselineSnapshot) {
556
576
  isDirtyRef.current = false;
557
577
  setHasUnsavedChanges(false);
558
578
  return original(data, unused, url);
@@ -1679,7 +1699,7 @@ function CrudForm({
1679
1699
  return mergedValues;
1680
1700
  });
1681
1701
  if (mergedValues) {
1682
- dirtyBaselineSnapshotRef.current = JSON.stringify(mergedValues);
1702
+ dirtyBaselineSnapshotRef.current = createDirtySnapshot(mergedValues);
1683
1703
  }
1684
1704
  if (!extendedInjectionEventsEnabled || !mergedValues) return;
1685
1705
  let cancelled = false;
@@ -1692,7 +1712,7 @@ function CrudForm({
1692
1712
  );
1693
1713
  const transformed = result.data;
1694
1714
  if (cancelled || !transformed) return;
1695
- dirtyBaselineSnapshotRef.current = JSON.stringify(transformed);
1715
+ dirtyBaselineSnapshotRef.current = createDirtySnapshot(transformed);
1696
1716
  setValues(transformed);
1697
1717
  } catch (err) {
1698
1718
  console.error("[CrudForm] Error in transformDisplayData:", err);
@@ -1744,7 +1764,7 @@ function CrudForm({
1744
1764
  return mergedValues;
1745
1765
  });
1746
1766
  if (mergedValues) {
1747
- dirtyBaselineSnapshotRef.current = JSON.stringify(mergedValues);
1767
+ dirtyBaselineSnapshotRef.current = createDirtySnapshot(mergedValues);
1748
1768
  }
1749
1769
  }, [isLoading, initialValuesHasId, cfDefinitions, customEntity]);
1750
1770
  const markFormAsClean = React.useCallback((snapshotSource) => {