@propknot/shared-ui 1.0.21 → 1.0.23
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 +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1594,13 +1594,15 @@ var CustomThemeProvider = ({ children }) => {
|
|
|
1594
1594
|
if (!event.origin.startsWith("http://localhost:")) return;
|
|
1595
1595
|
const { type, theme } = event.data;
|
|
1596
1596
|
if (type === "THEME_CHANGE" && theme && ["light", "dark"].includes(theme)) {
|
|
1597
|
-
console.log("[ThemeContext] Setting theme to:", theme);
|
|
1598
1597
|
setCurrentTheme(theme);
|
|
1599
|
-
|
|
1600
|
-
console.log("[ThemeContext] Rejected theme change:", theme, "Valid:", ["light", "dark"].includes(theme));
|
|
1598
|
+
localStorage.setItem("embedded-theme", theme);
|
|
1601
1599
|
}
|
|
1602
1600
|
};
|
|
1603
1601
|
window.addEventListener("message", handleMessage);
|
|
1602
|
+
const storedTheme = localStorage.getItem("embedded-theme");
|
|
1603
|
+
if (storedTheme && ["light", "dark"].includes(storedTheme)) {
|
|
1604
|
+
setCurrentTheme(storedTheme);
|
|
1605
|
+
}
|
|
1604
1606
|
if (window.parent !== window) {
|
|
1605
1607
|
window.parent.postMessage({ type: "REQUEST_THEME" }, "*");
|
|
1606
1608
|
}
|