@bud-fe/h5-native-bridge 1.0.6 → 1.0.7

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.
@@ -3142,11 +3142,18 @@ var __publicField$2 = (obj, key, value) => {
3142
3142
  __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
3143
3143
  return value;
3144
3144
  };
3145
+ var TriggerSource = /* @__PURE__ */ ((TriggerSource2) => {
3146
+ TriggerSource2["LOGIN"] = "LOGIN";
3147
+ TriggerSource2["DAILY_OPEN"] = "DAILY_OPEN";
3148
+ TriggerSource2["MORNING_MEETING"] = "MORNING_MEETING";
3149
+ TriggerSource2["VISIT"] = "VISIT";
3150
+ return TriggerSource2;
3151
+ })(TriggerSource || {});
3145
3152
  class AuthenticationPlugin {
3146
3153
  constructor() {
3147
3154
  __publicField$2(this, "context");
3148
3155
  __publicField$2(this, "name", "authentication");
3149
- __publicField$2(this, "version", "1.0.0");
3156
+ __publicField$2(this, "version", "1.1.0");
3150
3157
  }
3151
3158
  install(context) {
3152
3159
  this.context = context;
@@ -3157,14 +3164,15 @@ class AuthenticationPlugin {
3157
3164
  }
3158
3165
  /**
3159
3166
  * 执行实人认证
3160
- * @param options - 认证选项,包含成功、失败和完成的回调函数
3167
+ * @param options - 认证选项,包含触发来源和回调函数
3168
+ * @property options.triggerSource - 触发来源(必填),必须是TriggerSource枚举中的值
3161
3169
  * @property options.success - 认证成功时的回调函数,接收认证结果
3162
3170
  * @property options.fail - 认证失败时的回调函数,接收错误信息
3163
3171
  * @property options.complete - 认证完成时的回调函数(无论成功或失败)
3164
3172
  * @returns Promise<AuthenticationResult> - 返回认证结果的Promise对象
3165
- * @throws {BridgeError} - 如果插件未正确初始化,抛出BridgeError异常
3173
+ * @throws {BridgeError} - 如果插件未初始化或参数不合法,抛出BridgeError异常
3166
3174
  */
3167
- exclusiveLiveCheck(options = {}) {
3175
+ exclusiveLiveCheck(options) {
3168
3176
  return new Promise((resolve, reject) => {
3169
3177
  if (!this.context) {
3170
3178
  throw createBridgeError(
@@ -3172,6 +3180,19 @@ class AuthenticationPlugin {
3172
3180
  "插件未正确初始化"
3173
3181
  );
3174
3182
  }
3183
+ if (!options.triggerSource) {
3184
+ throw createBridgeError(
3185
+ BridgeErrorCode.INVALID_ACTION,
3186
+ "缺少必填参数:triggerSource"
3187
+ );
3188
+ }
3189
+ const validSources = Object.values(TriggerSource);
3190
+ if (!validSources.includes(options.triggerSource)) {
3191
+ throw createBridgeError(
3192
+ BridgeErrorCode.INVALID_ACTION,
3193
+ `triggerSource参数值不合法,合法值为:${validSources.join(" / ")}`
3194
+ );
3195
+ }
3175
3196
  const callbacks = {
3176
3197
  success: (res) => {
3177
3198
  resolve(res);
@@ -3186,7 +3207,9 @@ class AuthenticationPlugin {
3186
3207
  (_a = this.context) == null ? void 0 : _a.bridge.callNative(
3187
3208
  {
3188
3209
  action: "exclusiveLiveCheck",
3189
- params: {}
3210
+ params: {
3211
+ triggerSource: options.triggerSource
3212
+ }
3190
3213
  },
3191
3214
  callbacks
3192
3215
  );