@se-studio/core-ui 1.0.47 → 1.0.48
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/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../src/components/Preview.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../src/components/Preview.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAqC3B,CAAC"}
|
|
@@ -2,17 +2,31 @@
|
|
|
2
2
|
import { ContentfulLivePreview } from '@contentful/live-preview';
|
|
3
3
|
import { useRouter } from 'next/navigation';
|
|
4
4
|
import { useEffect, useLayoutEffect } from 'react';
|
|
5
|
+
const isContentful = () => {
|
|
6
|
+
if (typeof window === 'undefined')
|
|
7
|
+
return false;
|
|
8
|
+
// Primary check: ancestorOrigins
|
|
9
|
+
if (window.location.ancestorOrigins && window.location.ancestorOrigins.length > 0) {
|
|
10
|
+
return Array.from(window.location.ancestorOrigins).some((origin) => origin.includes('.contentful.com'));
|
|
11
|
+
}
|
|
12
|
+
// Fallback: document.referrer inside iframe
|
|
13
|
+
return window.top !== window.self && document.referrer?.includes('.contentful.com');
|
|
14
|
+
};
|
|
5
15
|
export const Preview = () => {
|
|
6
16
|
const router = useRouter();
|
|
7
17
|
useLayoutEffect(() => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
if (isContentful()) {
|
|
19
|
+
ContentfulLivePreview.init({
|
|
20
|
+
locale: 'en-US',
|
|
21
|
+
debugMode: true,
|
|
22
|
+
enableLiveUpdates: true,
|
|
23
|
+
enableInspectorMode: true,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
14
26
|
}, []);
|
|
15
27
|
useEffect(() => {
|
|
28
|
+
if (!isContentful())
|
|
29
|
+
return;
|
|
16
30
|
const checkLivePreview = (event) => {
|
|
17
31
|
if (typeof event.data !== 'object' ||
|
|
18
32
|
!event.data ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.js","sourceRoot":"","sources":["../../src/components/Preview.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAa,GAAG,EAAE;IACpC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"Preview.js","sourceRoot":"","sources":["../../src/components/Preview.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IAEhD,iCAAiC;IACjC,IAAI,MAAM,CAAC,QAAQ,CAAC,eAAe,IAAI,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClF,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CACjE,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CACnC,CAAC;IACJ,CAAC;IAED,4CAA4C;IAC5C,OAAO,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,IAAI,IAAI,QAAQ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@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/core-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.48",
|
|
4
4
|
"description": "Shared React UI component library with Tailwind CSS v4 for SE Studio applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"html-entities": "^2.6.0",
|
|
61
61
|
"mustache": "4.2.0",
|
|
62
62
|
"tailwind-merge": "^3.4.0",
|
|
63
|
-
"@se-studio/contentful-rest-api": "1.0.
|
|
64
|
-
"@se-studio/core-data-types": "1.0.
|
|
63
|
+
"@se-studio/contentful-rest-api": "1.0.48",
|
|
64
|
+
"@se-studio/core-data-types": "1.0.48"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@biomejs/biome": "^2.3.10",
|