@huaqiu/dsh-auth 0.6.10 → 0.6.12

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/lib/client.js CHANGED
@@ -1768,23 +1768,6 @@ window.__ModuleLoader__.load({
1768
1768
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("polyline", { points: "9 18 15 12 9 6" })
1769
1769
  });
1770
1770
  }
1771
- /** AI usage metric glyph (lucide `sparkles`) — the token balance. */
1772
- function SparklesIcon() {
1773
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1774
- xmlns: "http://www.w3.org/2000/svg",
1775
- width: 14,
1776
- height: 14,
1777
- viewBox: "0 0 24 24",
1778
- fill: "none",
1779
- stroke: "#10b981",
1780
- strokeWidth: 2,
1781
- strokeLinecap: "round",
1782
- strokeLinejoin: "round",
1783
- "aria-hidden": true,
1784
- style: { flex: "0 0 auto" },
1785
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M19 15l.9 2.1L22 18l-2.1.9L19 21l-.9-2.1L16 18l2.1-.9L19 15z" })]
1786
- });
1787
- }
1788
1771
  /** Quota metric card: icon + label, mono count and a gradient progress bar. */
1789
1772
  function QuotaMetric({ label, icon, reading, gradient, palette }) {
1790
1773
  useT();
@@ -1879,38 +1862,6 @@ window.__ModuleLoader__.load({
1879
1862
  };
1880
1863
  }
1881
1864
  /**
1882
- * AI token reading from `/user-rest/api/ai/usage`.
1883
- *
1884
- * The headline number is the AVAILABLE (remaining) balance, not the consumed
1885
- * one — the same convention as the GEN/ERC cards beside it, which display
1886
- * `currentQuota` (the REMAINING quota: hq-edge exposes it as
1887
- * `availableQuota`/"Available Quota", hq-eda-ai as `remainingQuota`). Showing
1888
- * `usedPoints` here made the AI card the only surface in the product that
1889
- * reported consumption as the balance: an account that burned 77 of its 100
1890
- * points read "77 / 100 pts" where the user expects "23 / 100 pts".
1891
- *
1892
- * The balance is reported as `usedPoints` + `availablePoints`, so the total is
1893
- * their sum — there is no separate `totalPoints` field to read. Percent keeps
1894
- * one decimal: a fresh account has well over 99% of its balance left, and
1895
- * rounding 99.6% up to "100%" would read as an exhausted account.
1896
- */
1897
- function aiUsageReading(usage, t) {
1898
- if (!usage) return null;
1899
- const used = Math.max(0, usage.usedPoints);
1900
- const available = Math.max(0, usage.availablePoints);
1901
- const total = used + available;
1902
- const percent = total > 0 ? Math.min(100, Math.round(available / total * 1e3) / 10) : 0;
1903
- return {
1904
- value: t("subscription.aiUsageCount", {
1905
- available,
1906
- total
1907
- }),
1908
- title: t("subscription.aiUsagePercent", { percent }),
1909
- percent,
1910
- ok: true
1911
- };
1912
- }
1913
- /**
1914
1865
  * Profile header card (prototype): name + plan badge + phone line on the
1915
1866
  * left, an "online" pill on the right. No redundant avatar — the trigger
1916
1867
  * already shows it.
@@ -2268,29 +2219,19 @@ window.__ModuleLoader__.load({
2268
2219
  flexDirection: "column",
2269
2220
  gap: 8
2270
2221
  },
2271
- children: [
2272
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuotaMetric, {
2273
- label: t("subscription.gen"),
2274
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CpuIcon, {}),
2275
- reading: quotaReading(quota?.gen ?? null, t),
2276
- gradient: palette.genGradient,
2277
- palette
2278
- }),
2279
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuotaMetric, {
2280
- label: t("subscription.erc"),
2281
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WaveIcon, {}),
2282
- reading: quotaReading(quota?.erc ?? null, t),
2283
- gradient: palette.ercGradient,
2284
- palette
2285
- }),
2286
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuotaMetric, {
2287
- label: t("subscription.ai"),
2288
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SparklesIcon, {}),
2289
- reading: aiUsageReading(quota?.ai ?? null, t),
2290
- gradient: palette.aiGradient,
2291
- palette
2292
- })
2293
- ]
2222
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuotaMetric, {
2223
+ label: t("subscription.gen"),
2224
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CpuIcon, {}),
2225
+ reading: quotaReading(quota?.gen ?? null, t),
2226
+ gradient: palette.genGradient,
2227
+ palette
2228
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuotaMetric, {
2229
+ label: t("subscription.erc"),
2230
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WaveIcon, {}),
2231
+ reading: quotaReading(quota?.erc ?? null, t),
2232
+ gradient: palette.ercGradient,
2233
+ palette
2234
+ })]
2294
2235
  }),
2295
2236
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UpgradeButton, {
2296
2237
  subscribing,