hm-tracking-sdk 0.2.2 → 0.2.4

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.
@@ -4369,12 +4369,11 @@ function isTelegramEnv() {
4369
4369
  const r = window.Telegram.WebApp;
4370
4370
  if (!r.initDataUnsafe || typeof r.initDataUnsafe != "object")
4371
4371
  return !1;
4372
- const f = r.initDataUnsafe.user && typeof r.initDataUnsafe.user == "object", d = "initData" in r;
4373
- if (f || d) {
4374
- const m = r.platform;
4375
- return !(m != null && typeof m == "string" && ["fake", "mock", "test"].includes(m.toLowerCase()));
4376
- }
4377
- return !1;
4372
+ const f = r.initDataUnsafe.user && typeof r.initDataUnsafe.user == "object" && typeof r.initDataUnsafe.user.id == "number" && r.initDataUnsafe.user.id > 0, d = "initData" in r && typeof r.initData == "string" && r.initData.length > 0;
4373
+ if (!f && !d)
4374
+ return !1;
4375
+ const m = r.platform;
4376
+ return !(m != null && typeof m == "string" && ["fake", "mock", "test"].includes(m.toLowerCase()) || Object.keys(r.initDataUnsafe || {}).length === 0 && !d);
4378
4377
  } catch {
4379
4378
  return !1;
4380
4379
  }
@@ -36206,10 +36205,13 @@ class HmTrackingSDK {
36206
36205
  const d = f.data;
36207
36206
  return Array.isArray(d) ? { payModeList: d } : { payModeList: Array.isArray(d == null ? void 0 : d.payModeList) ? d.payModeList : [] };
36208
36207
  }
36208
+ /**
36209
+ * 查询支付结果
36210
+ * 注意:服务端返回的内容可能是加密的,需要调用方自行解密
36211
+ * @returns 返回完整的 API 响应对象(可能包含加密数据)
36212
+ */
36209
36213
  async merchantPayQueryResult(f) {
36210
- const d = await this.api.merchantPayQueryResult(f);
36211
- if (d.code !== 1) throw new Error(d.msg || "查询支付结果失败");
36212
- return d.data;
36214
+ return await this.api.merchantPayQueryResult(f);
36213
36215
  }
36214
36216
  /**
36215
36217
  * 通用支付完成回调