@decentnetwork/beagle 0.1.94 → 0.1.95

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.
@@ -1,4 +1,4 @@
1
- window.__DK_UI_VERSION="0.1.94";
1
+ window.__DK_UI_VERSION="0.1.95";
2
2
  "use strict";
3
3
  (() => {
4
4
  // packages/beagle-ui/dist/beagle-ui.js
@@ -539,6 +539,10 @@ window.__DK_UI_VERSION="0.1.94";
539
539
  setFromDeepLink(true);
540
540
  }
541
541
  }, [prefillAddr]);
542
+ const dismissDeepLink = () => {
543
+ setFromDeepLink(false);
544
+ onPrefillConsumed && onPrefillConsumed();
545
+ };
542
546
  const submitAddr = () => {
543
547
  const v = addr.trim();
544
548
  if (!v || addState && addState.kind === "sending")
@@ -551,9 +555,11 @@ window.__DK_UI_VERSION="0.1.94";
551
555
  onPrefillConsumed && onPrefillConsumed();
552
556
  setAddState({ kind: "ok", msg: T.addSent });
553
557
  } else {
558
+ dismissDeepLink();
554
559
  setAddState({ kind: "err", msg: r && r.error ? `${T.addFailed}: ${r.error}` : T.addFailed });
555
560
  }
556
561
  }).catch((e) => {
562
+ dismissDeepLink();
557
563
  setAddState({ kind: "err", msg: `${T.addFailed}: ${e && e.message || e}` });
558
564
  }).finally(() => {
559
565
  setTimeout(() => setAddState((s) => s && s.kind !== "sending" ? null : s), 6e3);
@@ -579,8 +585,11 @@ window.__DK_UI_VERSION="0.1.94";
579
585
  background: "color-mix(in oklab, var(--accent), transparent 88%)",
580
586
  border: "1px solid var(--accent)",
581
587
  borderRadius: 8,
582
- padding: "7px 10px"
583
- } }, T.deepLinkConfirm || "\u901A\u8FC7\u94FE\u63A5\u6DFB\u52A0\u8FD9\u4F4D\u597D\u53CB? \u70B9\u300C\u6DFB\u52A0\u300D\u53D1\u9001\u597D\u53CB\u8BF7\u6C42 / Add this contact from the link? Tap Add to send a friend request."), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 7 } }, /* @__PURE__ */ React.createElement(
588
+ padding: "7px 10px",
589
+ display: "flex",
590
+ alignItems: "flex-start",
591
+ gap: 8
592
+ } }, /* @__PURE__ */ React.createElement("span", { style: { flex: 1 } }, T.deepLinkConfirm || "\u901A\u8FC7\u94FE\u63A5\u6DFB\u52A0\u8FD9\u4F4D\u597D\u53CB? \u70B9\u300C\u6DFB\u52A0\u300D\u53D1\u9001\u597D\u53CB\u8BF7\u6C42 / Add this contact from the link? Tap Add to send a friend request."), /* @__PURE__ */ React.createElement(Btn, { size: "sm", icon: "x", title: T.cancel || "Dismiss", onClick: dismissDeepLink, style: { flexShrink: 0 } })), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 7 } }, /* @__PURE__ */ React.createElement(
584
593
  "input",
585
594
  {
586
595
  value: addr,
@@ -5167,10 +5176,16 @@ ${peer.address}`
5167
5176
  window.addEventListener("hashchange", onHash);
5168
5177
  return () => window.removeEventListener("hashchange", onHash);
5169
5178
  }, []);
5179
+ const jumpedFor = React.useRef("");
5170
5180
  React.useEffect(() => {
5171
- if (!pendingAddr)
5181
+ if (!pendingAddr) {
5182
+ jumpedFor.current = "";
5172
5183
  return;
5173
- setTab("chat");
5184
+ }
5185
+ if (jumpedFor.current !== pendingAddr) {
5186
+ jumpedFor.current = pendingAddr;
5187
+ setTab("chat");
5188
+ }
5174
5189
  if (!peers || !peers.length)
5175
5190
  return;
5176
5191
  const hit = peers.find((p) => p.address && p.address === pendingAddr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/beagle",
3
- "version": "0.1.94",
3
+ "version": "0.1.95",
4
4
  "description": "Beagle — P2P chat, file transfer and calls for regular users, on the Decent Network. No admin privilege required.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",