@bud-fe/h5-native-bridge 1.0.5 → 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.
@@ -1945,7 +1945,7 @@ class ToastPlugin {
1945
1945
  "插件未正确初始化"
1946
1946
  );
1947
1947
  }
1948
- if (options.type !== void 0 && typeof options.type !== "string" || options.type !== void 0 && !["none", "success", "fail", "exception"].includes(options.type)) {
1948
+ if (options.type !== void 0 && typeof options.type !== "string" || options.type !== void 0 && !["none", "success", "fail", "exception", "normal"].includes(options.type)) {
1949
1949
  throw createBridgeError(
1950
1950
  BridgeErrorCode.INVALID_ACTION,
1951
1951
  "type参数格式不正确"
@@ -1969,7 +1969,13 @@ class ToastPlugin {
1969
1969
  "duration参数格式不正确"
1970
1970
  );
1971
1971
  }
1972
- const { type, content, duration } = options;
1972
+ if (options.position !== void 0 && typeof options.position !== "string" || options.position !== void 0 && !["top", "bottom", "center"].includes(options.position)) {
1973
+ throw createBridgeError(
1974
+ BridgeErrorCode.INVALID_ACTION,
1975
+ "position参数格式不正确"
1976
+ );
1977
+ }
1978
+ const { type, content, duration, position } = options;
1973
1979
  const callbacks = {
1974
1980
  success: (obj) => {
1975
1981
  resolve(obj);
@@ -1994,7 +2000,8 @@ class ToastPlugin {
1994
2000
  params: {
1995
2001
  type: type || "none",
1996
2002
  content,
1997
- duration: duration || 2e3
2003
+ duration: duration || 2e3,
2004
+ position: position || "center"
1998
2005
  }
1999
2006
  },
2000
2007
  callbacks
@@ -3135,11 +3142,18 @@ var __publicField$2 = (obj, key, value) => {
3135
3142
  __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
3136
3143
  return value;
3137
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 || {});
3138
3152
  class AuthenticationPlugin {
3139
3153
  constructor() {
3140
3154
  __publicField$2(this, "context");
3141
3155
  __publicField$2(this, "name", "authentication");
3142
- __publicField$2(this, "version", "1.0.0");
3156
+ __publicField$2(this, "version", "1.1.0");
3143
3157
  }
3144
3158
  install(context) {
3145
3159
  this.context = context;
@@ -3150,14 +3164,15 @@ class AuthenticationPlugin {
3150
3164
  }
3151
3165
  /**
3152
3166
  * 执行实人认证
3153
- * @param options - 认证选项,包含成功、失败和完成的回调函数
3167
+ * @param options - 认证选项,包含触发来源和回调函数
3168
+ * @property options.triggerSource - 触发来源(必填),必须是TriggerSource枚举中的值
3154
3169
  * @property options.success - 认证成功时的回调函数,接收认证结果
3155
3170
  * @property options.fail - 认证失败时的回调函数,接收错误信息
3156
3171
  * @property options.complete - 认证完成时的回调函数(无论成功或失败)
3157
3172
  * @returns Promise<AuthenticationResult> - 返回认证结果的Promise对象
3158
- * @throws {BridgeError} - 如果插件未正确初始化,抛出BridgeError异常
3173
+ * @throws {BridgeError} - 如果插件未初始化或参数不合法,抛出BridgeError异常
3159
3174
  */
3160
- exclusiveLiveCheck(options = {}) {
3175
+ exclusiveLiveCheck(options) {
3161
3176
  return new Promise((resolve, reject) => {
3162
3177
  if (!this.context) {
3163
3178
  throw createBridgeError(
@@ -3165,6 +3180,19 @@ class AuthenticationPlugin {
3165
3180
  "插件未正确初始化"
3166
3181
  );
3167
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
+ }
3168
3196
  const callbacks = {
3169
3197
  success: (res) => {
3170
3198
  resolve(res);
@@ -3179,7 +3207,9 @@ class AuthenticationPlugin {
3179
3207
  (_a = this.context) == null ? void 0 : _a.bridge.callNative(
3180
3208
  {
3181
3209
  action: "exclusiveLiveCheck",
3182
- params: {}
3210
+ params: {
3211
+ triggerSource: options.triggerSource
3212
+ }
3183
3213
  },
3184
3214
  callbacks
3185
3215
  );