best-unit 2.0.15 → 2.0.17

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "best-unit",
3
3
  "private": false,
4
- "version": "2.0.15",
4
+ "version": "2.0.17",
5
5
  "type": "module",
6
6
  "main": "dist/best-unit.cjs",
7
7
  "module": "dist/best-unit.js",
package/src/api/index.ts CHANGED
@@ -111,6 +111,12 @@ export const createOfflineRecharge = async (data: any) => {
111
111
  submit_amount: data.submitAmount,
112
112
  submit_currency: data.submitCurrency,
113
113
  voucher_urls: data.voucherUrls,
114
+ metadata:
115
+ fundUnitParams.bizType === "ad"
116
+ ? {
117
+ transaction_reason: "OfflineRecharge",
118
+ }
119
+ : undefined,
114
120
  };
115
121
  return http().post("/offline/recharge/create", params, {});
116
122
  };
@@ -132,6 +138,12 @@ export const createOnlineRecharge = async (data: any) => {
132
138
  currency: data.currency,
133
139
  recharge_channel: data.rechargeChannel,
134
140
  return_url: window.location.href,
141
+ metadata:
142
+ fundUnitParams.bizType === "ad"
143
+ ? {
144
+ transaction_reason: "OnlineRecharge",
145
+ }
146
+ : undefined,
135
147
  };
136
148
  return http()
137
149
  .post("/online/recharge/create", params, {})
@@ -31,6 +31,7 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
31
31
  currency: "USD",
32
32
  details: [],
33
33
  });
34
+ const [loading, setLoading] = useState(true);
34
35
 
35
36
  const fetchBalance = async () => {
36
37
  try {
@@ -81,9 +82,10 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
81
82
  };
82
83
 
83
84
  setBalanceData(newBalanceData);
85
+ setLoading(false);
84
86
  } catch (err) {
85
87
  console.error("获取余额失败:", err);
86
- // 获取失败时保持默认的 $0 USD 显示
88
+ setLoading(false); // 即使失败也允许渲染(可按需做兜底)
87
89
  }
88
90
  };
89
91
 
@@ -152,6 +154,8 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
152
154
  },
153
155
  ];
154
156
 
157
+ if (loading) return null;
158
+
155
159
  return (
156
160
  <HoverPopover
157
161
  popover={