@deneb-ui/ui 2.0.29 → 2.0.31

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.
@@ -10,7 +10,7 @@ export declare const PREVIEW_FOCUS_MESSAGE = "FIVORA_PREVIEW_FOCUS_PAGE";
10
10
  export declare const LEGACY_PREVIEW_FOCUS_MESSAGE: string;
11
11
  export declare const PREVIEW_FIELD_ATTRIBUTE = "data-preview-field-path";
12
12
  export { STYLE_PATCH_MESSAGE, DENEB_STYLE_PATCH_MESSAGE } from '@deneb-ui/core';
13
- export type GenericRecord = Record<string, unknown>;
13
+ export type GenericRecord = Record<string, any>;
14
14
  export type SiteData = {
15
15
  project?: {
16
16
  id?: string | null;
@@ -31,7 +31,7 @@ export type SiteData = {
31
31
  };
32
32
  export declare const SiteDataContext: React.Context<SiteData>;
33
33
  export declare function isRecord(value: unknown): value is GenericRecord;
34
- export declare function mergeSiteData(current: unknown, incoming: unknown): unknown;
34
+ export declare function mergeSiteData(current: unknown, incoming: unknown, depth?: number, seen?: WeakSet<object>): unknown;
35
35
  export declare function normalizeOrigin(value?: string | null, baseOrigin?: string | null): string | null;
36
36
  /**
37
37
  * Match the injected preview focus bridge: after in-iframe navigations,
@@ -47,11 +47,16 @@ exports.SiteDataContext = (0, react_1.createContext)({});
47
47
  function isRecord(value) {
48
48
  return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
49
49
  }
50
- function mergeSiteData(current, incoming) {
50
+ function mergeSiteData(current, incoming, depth = 0, seen = new WeakSet()) {
51
+ if (depth > 50)
52
+ return incoming;
51
53
  if (Array.isArray(incoming))
52
54
  return incoming;
53
55
  if (!isRecord(incoming))
54
56
  return incoming;
57
+ if (seen.has(incoming))
58
+ return incoming;
59
+ seen.add(incoming);
55
60
  const base = isRecord(current) ? current : {};
56
61
  const next = { ...base };
57
62
  for (const key of Object.keys(incoming)) {
@@ -61,7 +66,7 @@ function mergeSiteData(current, incoming) {
61
66
  next[key] = incoming[key];
62
67
  continue;
63
68
  }
64
- next[key] = mergeSiteData(base[key], incoming[key]);
69
+ next[key] = mergeSiteData(base[key], incoming[key], depth + 1, seen);
65
70
  }
66
71
  return next;
67
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deneb-ui/ui",
3
- "version": "2.0.29",
3
+ "version": "2.0.31",
4
4
  "description": "Visual-first React component library for editable commerce storefronts. Built for Next.js and Fivora.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -49,7 +49,7 @@
49
49
  ],
50
50
  "license": "MIT",
51
51
  "dependencies": {
52
- "@deneb-ui/core": "^2.0.29"
52
+ "@deneb-ui/core": "^2.0.31"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "react": "^18.0.0 || ^19.0.0",