@calimero-network/mero-react 10.1.2 → 10.2.1
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.cjs +11 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -462,8 +462,9 @@ function MeroProvider({
|
|
|
462
462
|
let active = true;
|
|
463
463
|
const stop = new AbortController();
|
|
464
464
|
(async () => {
|
|
465
|
-
|
|
466
|
-
if (
|
|
465
|
+
const hasRelay = Boolean(client && relayUrl);
|
|
466
|
+
if (!hasRelay && !packageName) return;
|
|
467
|
+
if (awaitingKey && relayUrl) {
|
|
467
468
|
const nodeKey = await meroJs.learnRelayNodeKey(relayUrl, { signal: stop.signal });
|
|
468
469
|
if (!active) return;
|
|
469
470
|
setMero(nodeKey ? meroJs.buildDelegatedClient(routed, contextId) ?? client : client);
|
|
@@ -484,6 +485,7 @@ function MeroProvider({
|
|
|
484
485
|
if (!active) return;
|
|
485
486
|
}
|
|
486
487
|
}
|
|
488
|
+
if (!hasRelay) return;
|
|
487
489
|
try {
|
|
488
490
|
const contexts = await meroJs.listDelegatedContexts(delegated);
|
|
489
491
|
if (!active) return;
|
|
@@ -949,7 +951,7 @@ function isReturningFromWallet(location = typeof window === "undefined" ? void 0
|
|
|
949
951
|
}
|
|
950
952
|
function useAccountEnrolment({
|
|
951
953
|
walletUrl: walletOverride,
|
|
952
|
-
enabled =
|
|
954
|
+
enabled = !isDesktopWindow()
|
|
953
955
|
} = {}) {
|
|
954
956
|
const { connectWithAccount, cloudBaseUrl } = useMero();
|
|
955
957
|
const [note, setNote] = react.useState(null);
|
|
@@ -1327,9 +1329,11 @@ function LoginModal({
|
|
|
1327
1329
|
theme,
|
|
1328
1330
|
localNodePorts = meroJs.DEFAULT_LOCAL_NODE_PORTS,
|
|
1329
1331
|
cloud,
|
|
1332
|
+
cloudOnDesktop = false,
|
|
1330
1333
|
initialTab: initialTabProp
|
|
1331
1334
|
}) {
|
|
1332
|
-
const
|
|
1335
|
+
const cloudAllowed = cloudOnDesktop || !isDesktopWindow();
|
|
1336
|
+
const ownCloud = cloud === void 0 && cloudAllowed;
|
|
1333
1337
|
const own = useAccountEnrolment({ enabled: ownCloud });
|
|
1334
1338
|
const cloudTab = react.useMemo(
|
|
1335
1339
|
() => ownCloud ? {
|
|
@@ -1339,8 +1343,8 @@ function LoginModal({
|
|
|
1339
1343
|
note: own.note,
|
|
1340
1344
|
walletUrl: own.walletUrl,
|
|
1341
1345
|
customWallet: own.customWallet
|
|
1342
|
-
} : cloud || null,
|
|
1343
|
-
[cloud, ownCloud, own.goToWallet, own.note, own.walletUrl, own.customWallet]
|
|
1346
|
+
} : cloudAllowed && cloud || null,
|
|
1347
|
+
[cloud, cloudAllowed, ownCloud, own.goToWallet, own.note, own.walletUrl, own.customWallet]
|
|
1344
1348
|
);
|
|
1345
1349
|
const initialTab = initialTabProp ?? (ownCloud && own.returning ? "cloud" : "node");
|
|
1346
1350
|
const [tab, setTab] = react.useState(initialTab);
|
|
@@ -1874,6 +1878,7 @@ function ConnectButton({
|
|
|
1874
1878
|
walletUrl: enrolment.walletUrl,
|
|
1875
1879
|
customWallet: enrolment.customWallet
|
|
1876
1880
|
} : false,
|
|
1881
|
+
cloudOnDesktop: cloud,
|
|
1877
1882
|
initialTab: cloud && enrolment.returning ? "cloud" : "node"
|
|
1878
1883
|
}
|
|
1879
1884
|
)
|