microboard-ui-temp 0.1.94 → 0.1.96

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 CHANGED
@@ -440614,6 +440614,16 @@ var ActionButtons = () => {
440614
440614
 
440615
440615
  // src/features/UserPanel/Buttons/ShareBtn/ShareBtn.tsx
440616
440616
  var import_react374 = __toESM(require_react(), 1);
440617
+
440618
+ // src/shared/lib/IframeModule.ts
440619
+ function redirectParentPage(url3, parentUrl) {
440620
+ window.parent.postMessage({
440621
+ type: "open-new-window",
440622
+ url: url3
440623
+ }, parentUrl);
440624
+ }
440625
+
440626
+ // src/features/UserPanel/Buttons/ShareBtn/ShareBtn.tsx
440617
440627
  var ShareBtn = () => {
440618
440628
  const { setIds } = useContextMenuContext();
440619
440629
  const { openModal: openModal2 } = useUiModalContext();
@@ -440623,6 +440633,11 @@ var ShareBtn = () => {
440623
440633
  const boardId = board.getBoardId();
440624
440634
  const boardInfo = boardsList.getBoardInfo(boardId);
440625
440635
  const handleShare = (ev) => {
440636
+ if (isIframe2()) {
440637
+ const currentPage = window.location.href;
440638
+ redirectParentPage(currentPage, currentPage.includes("dev") ? "https://dev-landing.microboard.io/" : "https://microboard.io/");
440639
+ return;
440640
+ }
440626
440641
  ev.preventDefault();
440627
440642
  ev.stopPropagation();
440628
440643
  setIds(boardId);
@@ -442142,6 +442157,14 @@ var UserPanel = () => {
442142
442157
  const { app, board } = useAppContext();
442143
442158
  const account = useAccount2();
442144
442159
  const insideOfMicroboard = document.referrer.includes("https://microboard.io/") || document.referrer.includes("https://microboard.ru/");
442160
+ const onLoginOrRegistrationClick = (url3) => {
442161
+ if (isIframe2()) {
442162
+ const origin = window.location.origin;
442163
+ redirectParentPage(origin + url3, origin.includes("dev") ? "https://dev-landing.microboard.io/" : "http://localhost:3001/");
442164
+ } else {
442165
+ navigate(url3);
442166
+ }
442167
+ };
442145
442168
  if (!account.isLoggedIn) {
442146
442169
  return /* @__PURE__ */ import_react395.default.createElement(UiPanel, {
442147
442170
  padding: 0,
@@ -442153,22 +442176,22 @@ var UserPanel = () => {
442153
442176
  }, isMicroboardIframe() && insideOfMicroboard ? /* @__PURE__ */ import_react395.default.createElement(import_react395.default.Fragment, null, /* @__PURE__ */ import_react395.default.createElement(UiLink, {
442154
442177
  variant: "secondary",
442155
442178
  className: UserPanel_module_default.logInBtn,
442156
- href: `/auth/sign-in`,
442179
+ onClick: () => onLoginOrRegistrationClick(`/auth/sign-in`),
442157
442180
  target: "_parent",
442158
442181
  size: "sm"
442159
442182
  }, t11("auth.login")), /* @__PURE__ */ import_react395.default.createElement(UiLink, {
442160
442183
  className: clsx_default(UserPanel_module_default.signUpBtn, UserPanel_module_default.smallMobileHide),
442161
- href: `/auth/sign-up`,
442184
+ onClick: () => onLoginOrRegistrationClick(`/auth/sign-up`),
442162
442185
  size: "sm",
442163
442186
  target: "_parent"
442164
442187
  }, t11("auth.signUpForFree")), /* @__PURE__ */ import_react395.default.createElement(ShareBtn, null)) : /* @__PURE__ */ import_react395.default.createElement(import_react395.default.Fragment, null, /* @__PURE__ */ import_react395.default.createElement(UiButton, {
442165
442188
  variant: "secondary",
442166
442189
  className: UserPanel_module_default.logInBtn,
442167
- onClick: () => navigate("/auth/sign-in"),
442190
+ onClick: () => onLoginOrRegistrationClick("/auth/sign-in"),
442168
442191
  size: "sm"
442169
442192
  }, t11("auth.login")), /* @__PURE__ */ import_react395.default.createElement(UiButton, {
442170
442193
  className: UserPanel_module_default.signUpBtn,
442171
- onClick: () => navigate("/auth/sign-up"),
442194
+ onClick: () => onLoginOrRegistrationClick("/auth/sign-up"),
442172
442195
  size: "sm"
442173
442196
  }, t11("auth.signUpForFree")), /* @__PURE__ */ import_react395.default.createElement(ShareBtn, null)))));
442174
442197
  }
package/dist/spa.js CHANGED
@@ -440614,6 +440614,16 @@ var ActionButtons = () => {
440614
440614
 
440615
440615
  // src/features/UserPanel/Buttons/ShareBtn/ShareBtn.tsx
440616
440616
  var import_react374 = __toESM(require_react(), 1);
440617
+
440618
+ // src/shared/lib/IframeModule.ts
440619
+ function redirectParentPage(url3, parentUrl) {
440620
+ window.parent.postMessage({
440621
+ type: "open-new-window",
440622
+ url: url3
440623
+ }, parentUrl);
440624
+ }
440625
+
440626
+ // src/features/UserPanel/Buttons/ShareBtn/ShareBtn.tsx
440617
440627
  var ShareBtn = () => {
440618
440628
  const { setIds } = useContextMenuContext();
440619
440629
  const { openModal: openModal2 } = useUiModalContext();
@@ -440623,6 +440633,11 @@ var ShareBtn = () => {
440623
440633
  const boardId = board.getBoardId();
440624
440634
  const boardInfo = boardsList.getBoardInfo(boardId);
440625
440635
  const handleShare = (ev) => {
440636
+ if (isIframe2()) {
440637
+ const currentPage = window.location.href;
440638
+ redirectParentPage(currentPage, currentPage.includes("dev") ? "https://dev-landing.microboard.io/" : "https://microboard.io/");
440639
+ return;
440640
+ }
440626
440641
  ev.preventDefault();
440627
440642
  ev.stopPropagation();
440628
440643
  setIds(boardId);
@@ -442142,6 +442157,14 @@ var UserPanel = () => {
442142
442157
  const { app, board } = useAppContext();
442143
442158
  const account = useAccount2();
442144
442159
  const insideOfMicroboard = document.referrer.includes("https://microboard.io/") || document.referrer.includes("https://microboard.ru/");
442160
+ const onLoginOrRegistrationClick = (url3) => {
442161
+ if (isIframe2()) {
442162
+ const origin = window.location.origin;
442163
+ redirectParentPage(origin + url3, origin.includes("dev") ? "https://dev-landing.microboard.io/" : "http://localhost:3001/");
442164
+ } else {
442165
+ navigate(url3);
442166
+ }
442167
+ };
442145
442168
  if (!account.isLoggedIn) {
442146
442169
  return /* @__PURE__ */ import_react395.default.createElement(UiPanel, {
442147
442170
  padding: 0,
@@ -442153,22 +442176,22 @@ var UserPanel = () => {
442153
442176
  }, isMicroboardIframe() && insideOfMicroboard ? /* @__PURE__ */ import_react395.default.createElement(import_react395.default.Fragment, null, /* @__PURE__ */ import_react395.default.createElement(UiLink, {
442154
442177
  variant: "secondary",
442155
442178
  className: UserPanel_module_default.logInBtn,
442156
- href: `/auth/sign-in`,
442179
+ onClick: () => onLoginOrRegistrationClick(`/auth/sign-in`),
442157
442180
  target: "_parent",
442158
442181
  size: "sm"
442159
442182
  }, t11("auth.login")), /* @__PURE__ */ import_react395.default.createElement(UiLink, {
442160
442183
  className: clsx_default(UserPanel_module_default.signUpBtn, UserPanel_module_default.smallMobileHide),
442161
- href: `/auth/sign-up`,
442184
+ onClick: () => onLoginOrRegistrationClick(`/auth/sign-up`),
442162
442185
  size: "sm",
442163
442186
  target: "_parent"
442164
442187
  }, t11("auth.signUpForFree")), /* @__PURE__ */ import_react395.default.createElement(ShareBtn, null)) : /* @__PURE__ */ import_react395.default.createElement(import_react395.default.Fragment, null, /* @__PURE__ */ import_react395.default.createElement(UiButton, {
442165
442188
  variant: "secondary",
442166
442189
  className: UserPanel_module_default.logInBtn,
442167
- onClick: () => navigate("/auth/sign-in"),
442190
+ onClick: () => onLoginOrRegistrationClick("/auth/sign-in"),
442168
442191
  size: "sm"
442169
442192
  }, t11("auth.login")), /* @__PURE__ */ import_react395.default.createElement(UiButton, {
442170
442193
  className: UserPanel_module_default.signUpBtn,
442171
- onClick: () => navigate("/auth/sign-up"),
442194
+ onClick: () => onLoginOrRegistrationClick("/auth/sign-up"),
442172
442195
  size: "sm"
442173
442196
  }, t11("auth.signUpForFree")), /* @__PURE__ */ import_react395.default.createElement(ShareBtn, null)))));
442174
442197
  }
@@ -0,0 +1,12 @@
1
+ import { App } from "../../App";
2
+ export declare class IframeModule {
3
+ private static instance;
4
+ private app;
5
+ constructor(app: App, origins?: string[]);
6
+ private setEventListeners;
7
+ static getInstance(app: App, origins?: string[]): IframeModule;
8
+ private handleCustomMessages;
9
+ private sendSnapshotCreated;
10
+ private sendSnapshotError;
11
+ }
12
+ export declare function redirectParentPage(url: string, parentUrl: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-ui-temp",
3
- "version": "0.1.94",
3
+ "version": "0.1.96",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",