@calimero-network/mero-react 10.1.2 → 10.2.0

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.d.cts CHANGED
@@ -459,13 +459,13 @@ interface LoginModalProps {
459
459
  * the modal is open. Nothing to wire; the modal must be inside a
460
460
  * `MeroProvider`.
461
461
  * - **`false`**: no Cloud tab and no tabs at all — the node dialog as it was.
462
- * - **omitted inside a Calimero Desktop window**: as `false` — the window is
463
- * already bound to the desktop's node. Pass a `cloud` object to override.
464
- * The modal reads no enrolment callback, leaving it to whichever component
465
- * does.
466
462
  * - **An object**: the caller's own enrolment, used verbatim; the modal reads
467
463
  * none itself. The values are `useAccountEnrolment`'s, as `ConnectButton`
468
464
  * passes them.
465
+ *
466
+ * Inside a Calimero Desktop window every form is as `false` — the window is
467
+ * already bound to the desktop's node, so there is no relay and no passkey to
468
+ * go through. `cloudOnDesktop` turns that off.
469
469
  */
470
470
  cloud?: false | {
471
471
  /** Start enrolment — normally `useAccountEnrolment().goToWallet`. */
@@ -477,6 +477,12 @@ interface LoginModalProps {
477
477
  /** Whether `walletUrl` is an override rather than the hosted wallet. */
478
478
  customWallet?: boolean;
479
479
  };
480
+ /**
481
+ * Show the Cloud tab inside a Calimero Desktop window too. Default false:
482
+ * the desktop logs in to its own node, so `cloud` — omitted or an object —
483
+ * is ignored there (see `isDesktopWindow`).
484
+ */
485
+ cloudOnDesktop?: boolean;
480
486
  /**
481
487
  * The tab selected when the modal opens. Ignored with `cloud={false}`.
482
488
  *
@@ -492,7 +498,7 @@ type LoginModalTab = 'node' | 'cloud';
492
498
  /**
493
499
  * LoginModal - Connection modal component
494
500
  */
495
- declare function LoginModal({ onConnect, onClose, isOpen, theme, localNodePorts, cloud, initialTab: initialTabProp, }: LoginModalProps): React.ReactPortal | null;
501
+ declare function LoginModal({ onConnect, onClose, isOpen, theme, localNodePorts, cloud, cloudOnDesktop, initialTab: initialTabProp, }: LoginModalProps): React.ReactPortal | null;
496
502
 
497
503
  interface AccountSignInPanelProps {
498
504
  /** Start enrolment — normally `useAccountEnrolment().goToWallet`. */
@@ -1062,7 +1068,9 @@ interface UseAccountEnrolmentOptions {
1062
1068
  /**
1063
1069
  * When false, the hook reads no callback and completes nothing, so a
1064
1070
  * component that has the account path switched off leaves the fragment for
1065
- * whichever component does handle it. Default true.
1071
+ * whichever component does handle it. Default true, except inside a
1072
+ * Calimero Desktop window (see `isDesktopWindow`), whose app is already
1073
+ * bound to the desktop's node and has no wallet callback to complete.
1066
1074
  */
1067
1075
  enabled?: boolean;
1068
1076
  }
package/dist/index.d.ts CHANGED
@@ -459,13 +459,13 @@ interface LoginModalProps {
459
459
  * the modal is open. Nothing to wire; the modal must be inside a
460
460
  * `MeroProvider`.
461
461
  * - **`false`**: no Cloud tab and no tabs at all — the node dialog as it was.
462
- * - **omitted inside a Calimero Desktop window**: as `false` — the window is
463
- * already bound to the desktop's node. Pass a `cloud` object to override.
464
- * The modal reads no enrolment callback, leaving it to whichever component
465
- * does.
466
462
  * - **An object**: the caller's own enrolment, used verbatim; the modal reads
467
463
  * none itself. The values are `useAccountEnrolment`'s, as `ConnectButton`
468
464
  * passes them.
465
+ *
466
+ * Inside a Calimero Desktop window every form is as `false` — the window is
467
+ * already bound to the desktop's node, so there is no relay and no passkey to
468
+ * go through. `cloudOnDesktop` turns that off.
469
469
  */
470
470
  cloud?: false | {
471
471
  /** Start enrolment — normally `useAccountEnrolment().goToWallet`. */
@@ -477,6 +477,12 @@ interface LoginModalProps {
477
477
  /** Whether `walletUrl` is an override rather than the hosted wallet. */
478
478
  customWallet?: boolean;
479
479
  };
480
+ /**
481
+ * Show the Cloud tab inside a Calimero Desktop window too. Default false:
482
+ * the desktop logs in to its own node, so `cloud` — omitted or an object —
483
+ * is ignored there (see `isDesktopWindow`).
484
+ */
485
+ cloudOnDesktop?: boolean;
480
486
  /**
481
487
  * The tab selected when the modal opens. Ignored with `cloud={false}`.
482
488
  *
@@ -492,7 +498,7 @@ type LoginModalTab = 'node' | 'cloud';
492
498
  /**
493
499
  * LoginModal - Connection modal component
494
500
  */
495
- declare function LoginModal({ onConnect, onClose, isOpen, theme, localNodePorts, cloud, initialTab: initialTabProp, }: LoginModalProps): React.ReactPortal | null;
501
+ declare function LoginModal({ onConnect, onClose, isOpen, theme, localNodePorts, cloud, cloudOnDesktop, initialTab: initialTabProp, }: LoginModalProps): React.ReactPortal | null;
496
502
 
497
503
  interface AccountSignInPanelProps {
498
504
  /** Start enrolment — normally `useAccountEnrolment().goToWallet`. */
@@ -1062,7 +1068,9 @@ interface UseAccountEnrolmentOptions {
1062
1068
  /**
1063
1069
  * When false, the hook reads no callback and completes nothing, so a
1064
1070
  * component that has the account path switched off leaves the fragment for
1065
- * whichever component does handle it. Default true.
1071
+ * whichever component does handle it. Default true, except inside a
1072
+ * Calimero Desktop window (see `isDesktopWindow`), whose app is already
1073
+ * bound to the desktop's node and has no wallet callback to complete.
1066
1074
  */
1067
1075
  enabled?: boolean;
1068
1076
  }
package/dist/index.js CHANGED
@@ -949,7 +949,7 @@ function isReturningFromWallet(location = typeof window === "undefined" ? void 0
949
949
  }
950
950
  function useAccountEnrolment({
951
951
  walletUrl: walletOverride,
952
- enabled = true
952
+ enabled = !isDesktopWindow()
953
953
  } = {}) {
954
954
  const { connectWithAccount, cloudBaseUrl } = useMero();
955
955
  const [note, setNote] = useState(null);
@@ -1327,9 +1327,11 @@ function LoginModal({
1327
1327
  theme,
1328
1328
  localNodePorts = DEFAULT_LOCAL_NODE_PORTS,
1329
1329
  cloud,
1330
+ cloudOnDesktop = false,
1330
1331
  initialTab: initialTabProp
1331
1332
  }) {
1332
- const ownCloud = cloud === void 0 && !isDesktopWindow();
1333
+ const cloudAllowed = cloudOnDesktop || !isDesktopWindow();
1334
+ const ownCloud = cloud === void 0 && cloudAllowed;
1333
1335
  const own = useAccountEnrolment({ enabled: ownCloud });
1334
1336
  const cloudTab = useMemo(
1335
1337
  () => ownCloud ? {
@@ -1339,8 +1341,8 @@ function LoginModal({
1339
1341
  note: own.note,
1340
1342
  walletUrl: own.walletUrl,
1341
1343
  customWallet: own.customWallet
1342
- } : cloud || null,
1343
- [cloud, ownCloud, own.goToWallet, own.note, own.walletUrl, own.customWallet]
1344
+ } : cloudAllowed && cloud || null,
1345
+ [cloud, cloudAllowed, ownCloud, own.goToWallet, own.note, own.walletUrl, own.customWallet]
1344
1346
  );
1345
1347
  const initialTab = initialTabProp ?? (ownCloud && own.returning ? "cloud" : "node");
1346
1348
  const [tab, setTab] = useState(initialTab);
@@ -1874,6 +1876,7 @@ function ConnectButton({
1874
1876
  walletUrl: enrolment.walletUrl,
1875
1877
  customWallet: enrolment.customWallet
1876
1878
  } : false,
1879
+ cloudOnDesktop: cloud,
1877
1880
  initialTab: cloud && enrolment.returning ? "cloud" : "node"
1878
1881
  }
1879
1882
  )