@yangzhenchen/dsh-balance 0.4.4 → 0.4.6

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.
Files changed (2) hide show
  1. package/lib/client.js +14 -1
  2. package/package.json +2 -2
package/lib/client.js CHANGED
@@ -784,6 +784,18 @@ window.__ModuleLoader__.load({
784
784
  };
785
785
  }
786
786
  /**
787
+ * Read the account state out of a `watch` frame. DSH 0.2.2-rc.3 wraps the
788
+ * update as `{ type, state }`; earlier releases sent the state itself.
789
+ * @param frame - one frame from `remote.account.watch`.
790
+ * @returns `signed-out`, `credential-stored`, or undefined.
791
+ */
792
+ function accountStatus(frame) {
793
+ const update = frame === null || typeof frame !== "object" ? void 0 : frame.value;
794
+ if (update === null || typeof update !== "object") return void 0;
795
+ const state = update.state !== null && typeof update.state === "object" ? update.state : update;
796
+ return typeof state.status === "string" ? state.status : void 0;
797
+ }
798
+ /**
787
799
  * The bottom-pinned balance row.
788
800
  * @param props - slot props plus this plugin's context and translator.
789
801
  * @returns the row, or nothing on the collapsed rail.
@@ -865,7 +877,7 @@ window.__ModuleLoader__.load({
865
877
  try {
866
878
  for await (const frame of stream) {
867
879
  if (disposed) break;
868
- const status = frame?.value?.status;
880
+ const status = accountStatus(frame);
869
881
  setSignedIn(status === "credential-stored");
870
882
  if (status === "credential-stored") read();
871
883
  try {
@@ -1620,6 +1632,7 @@ window.__ModuleLoader__.load({
1620
1632
  formatCountdown,
1621
1633
  switchClock,
1622
1634
  tariffHeadline,
1635
+ accountStatus,
1623
1636
  UsagePanel
1624
1637
  };
1625
1638
  return module.exports;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yangzhenchen/dsh-balance",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -56,6 +56,6 @@
56
56
  "url": "https://github.com/yang-zhenchen/dsh-balance/issues"
57
57
  },
58
58
  "peerDependencies": {
59
- "@deepseek-ai/cordis": "~4.0.5"
59
+ "@deepseek-ai/cordis": "^4.0.5"
60
60
  }
61
61
  }