@deneb-ui/ui 2.0.110 → 2.0.111

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 (2) hide show
  1. package/dist/utils/urls.js +16 -1
  2. package/package.json +2 -2
@@ -133,11 +133,26 @@ function isSafeExternalLink(url) {
133
133
  * `window.location` navigation only.
134
134
  */
135
135
  function withBasePath(value) {
136
- const url = value?.trim() ?? '';
136
+ let url = value?.trim() ?? '';
137
137
  if (!url || /^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i.test(url))
138
138
  return url;
139
+ // Deduplicate any repeated generated-sites prefix segments
140
+ const generatedSitesMatch = url.match(/^(\/uploads\/generated-sites\/(?:template-preview|preview|live|candidate)\/[^/]+)/i);
141
+ if (generatedSitesMatch) {
142
+ const root = generatedSitesMatch[1];
143
+ let rest = url.slice(root.length);
144
+ while (rest.toLowerCase().startsWith(root.toLowerCase())) {
145
+ rest = rest.slice(root.length);
146
+ }
147
+ url = `${root}${rest}`;
148
+ }
139
149
  const basePath = (typeof process !== 'undefined' ? process.env?.NEXT_PUBLIC_SITE_BASE_PATH ?? '' : '').replace(/\/$/, '');
150
+ if (!basePath)
151
+ return url.startsWith('/') ? url : `/${url}`;
140
152
  const path = url.startsWith('/') ? url : `/${url}`;
153
+ if (path === basePath || path.startsWith(`${basePath}/`) || path.startsWith(`${basePath}?`)) {
154
+ return path;
155
+ }
141
156
  return `${basePath}${path}`;
142
157
  }
143
158
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deneb-ui/ui",
3
- "version": "2.0.110",
3
+ "version": "2.0.111",
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",
@@ -50,7 +50,7 @@
50
50
  ],
51
51
  "license": "MIT",
52
52
  "dependencies": {
53
- "@deneb-ui/core": "^2.0.110"
53
+ "@deneb-ui/core": "^2.0.111"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "react": "^18.0.0 || ^19.0.0",