fastman2 3.0.0-alpha.1 → 3.0.0-alpha.2

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/jsbridgeman.js CHANGED
@@ -1,992 +1 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else if(typeof exports === 'object')
7
- exports["fastman"] = factory();
8
- else
9
- root["fastman"] = factory();
10
- })(this, function() {
11
- return /******/ (function(modules) { // webpackBootstrap
12
- /******/ // The module cache
13
- /******/ var installedModules = {};
14
- /******/
15
- /******/ // The require function
16
- /******/ function __webpack_require__(moduleId) {
17
- /******/
18
- /******/ // Check if module is in cache
19
- /******/ if(installedModules[moduleId]) {
20
- /******/ return installedModules[moduleId].exports;
21
- /******/ }
22
- /******/ // Create a new module (and put it into the cache)
23
- /******/ var module = installedModules[moduleId] = {
24
- /******/ i: moduleId,
25
- /******/ l: false,
26
- /******/ exports: {}
27
- /******/ };
28
- /******/
29
- /******/ // Execute the module function
30
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
- /******/
32
- /******/ // Flag the module as loaded
33
- /******/ module.l = true;
34
- /******/
35
- /******/ // Return the exports of the module
36
- /******/ return module.exports;
37
- /******/ }
38
- /******/
39
- /******/
40
- /******/ // expose the modules object (__webpack_modules__)
41
- /******/ __webpack_require__.m = modules;
42
- /******/
43
- /******/ // expose the module cache
44
- /******/ __webpack_require__.c = installedModules;
45
- /******/
46
- /******/ // identity function for calling harmony imports with the correct context
47
- /******/ __webpack_require__.i = function(value) { return value; };
48
- /******/
49
- /******/ // define getter function for harmony exports
50
- /******/ __webpack_require__.d = function(exports, name, getter) {
51
- /******/ if(!__webpack_require__.o(exports, name)) {
52
- /******/ Object.defineProperty(exports, name, {
53
- /******/ configurable: false,
54
- /******/ enumerable: true,
55
- /******/ get: getter
56
- /******/ });
57
- /******/ }
58
- /******/ };
59
- /******/
60
- /******/ // getDefaultExport function for compatibility with non-harmony modules
61
- /******/ __webpack_require__.n = function(module) {
62
- /******/ var getter = module && module.__esModule ?
63
- /******/ function getDefault() { return module['default']; } :
64
- /******/ function getModuleExports() { return module; };
65
- /******/ __webpack_require__.d(getter, 'a', getter);
66
- /******/ return getter;
67
- /******/ };
68
- /******/
69
- /******/ // Object.prototype.hasOwnProperty.call
70
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
71
- /******/
72
- /******/ // __webpack_public_path__
73
- /******/ __webpack_require__.p = "";
74
- /******/
75
- /******/ // Load entry module and return exports
76
- /******/ return __webpack_require__(__webpack_require__.s = 19);
77
- /******/ })
78
- /************************************************************************/
79
- /******/ ({
80
-
81
- /***/ 1:
82
- /***/ (function(module, exports, __webpack_require__) {
83
-
84
- "use strict";
85
-
86
-
87
- Object.defineProperty(exports, "__esModule", {
88
- value: true
89
- });
90
- /**
91
- * Created by dfzq on 2017/4/13.
92
- */
93
- /**
94
- * 获取绝对路径
95
- * @param url
96
- */
97
- var getAbsoluteUrl = function getAbsoluteUrl(url) {
98
- var link = document.createElement('a');
99
- link.setAttribute('href', url);
100
- var absoluteUrl = link.href;
101
- link = null;
102
- return absoluteUrl;
103
- };
104
-
105
- /**
106
- * 属性继承
107
- * @type {*}
108
- * @private
109
- */
110
- var _extends = Object.assign || function (target) {
111
- for (var i = 1; i < arguments.length; i++) {
112
- var source = arguments[i];
113
- for (var key in source) {
114
- // 源对象中是否存在对象键值
115
- if (Object.prototype.hasOwnProperty.call(source, key)) {
116
- target[key] = source[key];
117
- }
118
- }
119
- }
120
- return target;
121
- };
122
-
123
- /**
124
- * 判断是否为空
125
- * @param str {string} 需要判断的值
126
- * @returns {boolean}
127
- */
128
- var isEmpty = function isEmpty(str) {
129
- return !(str != null && (!!str.length ? true : str.length > 0));
130
- };
131
-
132
- // 真实姓名掩码
133
- var maskName = function maskName(params) {
134
- if (!params) {
135
- return params;
136
- } else if (params.length == 1) {
137
- return params;
138
- } else {
139
- var endName = params.substring(params.length - 1, params.length);
140
- return (params.length >= 3 ? "**" : "*") + endName;
141
- }
142
- };
143
-
144
- exports.getAbsoluteUrl = getAbsoluteUrl;
145
- exports._extends = _extends;
146
- exports.isEmpty = isEmpty;
147
- exports.maskName = maskName;
148
-
149
- /***/ }),
150
-
151
- /***/ 10:
152
- /***/ (function(module, exports, __webpack_require__) {
153
-
154
- "use strict";
155
-
156
-
157
- Object.defineProperty(exports, "__esModule", {
158
- value: true
159
- });
160
- /**
161
- * Created by dfzq on 2017/7/31.
162
- */
163
-
164
- /**
165
- * 末尾补.0
166
- * @param num 原始值
167
- * @param n 位数最大的值
168
- * @returns {*}
169
- */
170
- var padZero = function padZero(num, n) {
171
- var len = num.split('.').length;
172
- while (len < n) {
173
- num = num + '.0';
174
- len++;
175
- }
176
- return num;
177
- };
178
-
179
- /**
180
- * 获取APP版本号
181
- * @param _
182
- * @returns {*}
183
- */
184
- var getVersion = function getVersion(_) {
185
- var groups = navigator.userAgent.toLowerCase().match(/DFYJ\/([\d.]+)/i);
186
- if (!groups) {
187
- return undefined;
188
- } else {
189
- return groups[1];
190
- }
191
- };
192
-
193
- /**
194
- * 比较手机系统版本,arg1 > arg2, return 1; arg1 == arg2, return 0; arg1 < arg2, return -1
195
- * @param compareVersion
196
- * @returns {number}
197
- */
198
- var _compareVersion = function _compareVersion(a, b) {
199
- // 补.0操作
200
- var _as = a.split('.');
201
- var _bs = b.split('.');
202
- var max = Math.max(_as.length, _bs.length);
203
- a = padZero(a, max);
204
- b = padZero(b, max);
205
-
206
- var as = a.split('.');
207
- var bs = b.split('.');
208
- if (a === b) return 0;
209
-
210
- for (var i = 0; i < as.length; i++) {
211
- var x = parseInt(as[i]);
212
- if (!bs[i]) return 1;
213
- var y = parseInt(bs[i]);
214
- if (x < y) return -1;
215
- if (x > y) return 1;
216
- }
217
- return -1;
218
- };
219
-
220
- /**
221
- * 比较APP版本,比compareVersion大则返回1,否则返回-1;相等返回0;
222
- * @param compareVersion
223
- * @returns {number}
224
- */
225
- var compareVersion = function compareVersion(_compareVersion2) {
226
- // 获取当前版本号
227
- var currentVersion = getVersion();
228
- if (!currentVersion) {
229
- return 1;
230
- } else {
231
- return _compareVersion(currentVersion, _compareVersion2);
232
- }
233
- };
234
-
235
- exports.getVersion = getVersion;
236
- exports.compareVersion = compareVersion;
237
- exports._compareVersion = _compareVersion;
238
-
239
- /***/ }),
240
-
241
- /***/ 19:
242
- /***/ (function(module, exports, __webpack_require__) {
243
-
244
- "use strict";
245
-
246
-
247
- Object.defineProperty(exports, "__esModule", {
248
- value: true
249
- });
250
- exports.onApiRequest = exports.pageWillAppear = exports.onRequest = exports.onDynamicLink = exports.subscribeNotify = exports.onNotify = exports.onPushView = exports.onNavigationBar = exports.onRefresh = exports.onBack = exports.ready = exports.wrapNotOkPayload = exports.wrapOkPayload = undefined;
251
-
252
- var _extends2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /**
253
- * Created by dfzq on 2017/4/13.
254
- * 修改历史 - 2020-5-2:
255
- * 1. onRequest指令增加回调函数的时间戳以防止重患问题的发生
256
- * 2. 使用客户端返回的 type 作为回调事件
257
- *
258
- */
259
-
260
-
261
- var _util = __webpack_require__(1);
262
-
263
- var _log = __webpack_require__(9);
264
-
265
- var _version = __webpack_require__(10);
266
-
267
- // 区分设备系统
268
- var ua = navigator.userAgent;
269
- var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
270
- var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
271
- var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
272
- var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
273
- var isFromApp = !!ua.toLowerCase().match(/DFYJ/i);
274
-
275
- // 是否来自于鸿蒙
276
- var isFromHarmonyOS = !!ua.toLowerCase().match(/ArkWeb/i);
277
-
278
- // 初始化桥接对象
279
- var init = function init(bridge) {
280
- bridge.init(function (message, responseCallback) {
281
- if (responseCallback) responseCallback(data);
282
- });
283
-
284
- return bridge;
285
- };
286
-
287
- /**
288
- * 初始化桥接对象
289
- * v2.2.0 - 已兼容鸿蒙
290
- *
291
- * connectWebViewJavascriptBridge
292
- * @param callback
293
- */
294
- var ready = function ready(callback) {
295
- var __cb___ = function __cb___(__bridge___) {
296
- (0, _log.log)("[ready] <-");
297
- callback(__bridge___);
298
- };
299
-
300
- (0, _log.log)("[ready] ->");
301
- if (isFromApp) {
302
- if (ipad || iphone || ipod) {
303
- // 新版本兼容IOS
304
- if (window.WebViewJavascriptBridge) {
305
- return __cb___(WebViewJavascriptBridge);
306
- }
307
- if (window.WVJBCallbacks) {
308
- return window.WVJBCallbacks.push(__cb___);
309
- }
310
- window.WVJBCallbacks = [__cb___];
311
- var WVJBIframe = document.createElement('iframe');
312
- WVJBIframe.style.display = 'none';
313
- WVJBIframe.src = 'https://__bridge_loaded__';
314
- document.documentElement.appendChild(WVJBIframe);
315
- setTimeout(function () {
316
- document.documentElement.removeChild(WVJBIframe);
317
- }, 0);
318
- } else if (android) {
319
- // 旧版本兼容Android
320
- if (window.WebViewJavascriptBridge) {
321
- __cb___(init(WebViewJavascriptBridge));
322
- } else {
323
- document.addEventListener('WebViewJavascriptBridgeReady', function () {
324
- // 以异步形式加载
325
- __cb___(init(WebViewJavascriptBridge));
326
- }, false);
327
- }
328
- } else {
329
- __cb___();
330
- }
331
- } else {
332
- __cb___();
333
- }
334
- };
335
-
336
- // 空函数
337
- var noop = function noop() {};
338
-
339
- /**
340
- * 成功消息体的包装
341
- * @param payload 成功对象
342
- */
343
- // const wrapOkPayload = (payload = {}) => ({
344
- // error: false,
345
- // info: 'ok',
346
- // payload: payload,
347
- // })
348
- var wrapOkPayload = function wrapOkPayload() {
349
- var payload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
350
- return payload;
351
- };
352
-
353
- /**
354
- * 失败消息体的包装
355
- * @param info 错误描述
356
- */
357
- var wrapNotOkPayload = function wrapNotOkPayload() {
358
- var code = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
359
- var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'error';
360
- return {
361
- // error: true,
362
- code: code,
363
- info: info
364
- };
365
- };
366
-
367
- /**
368
- * APP WebView后退,后退到栈的最外层
369
- * v2.2.0 - 已兼容鸿蒙
370
- *
371
- * @param options
372
- */
373
- var onBack = function onBack(options) {
374
- // 默认配置
375
- var _options = {
376
- complete: noop
377
- };
378
- // 复制
379
- _options = (0, _util._extends)({}, _options, options);
380
-
381
- (0, _log.log)('onBack->' + JSON.stringify(_options));
382
- if (isFromHarmonyOS) {
383
- window.LightSDK.native.back({
384
- number: _options.step
385
- }, function (resp) {
386
- (0, _log.log)('onBack <- ' + JSON.stringify(resp));
387
- });
388
- } else {
389
- WebViewJavascriptBridge.callHandler('back', _options, function (response) {
390
- (0, _log.log)('onBack <-' + JSON.stringify(response));
391
- _options.complete(response);
392
- });
393
- }
394
- };
395
-
396
- /**
397
- * APP WebView刷新
398
- * v2.2.0 - 已兼容鸿蒙
399
- *
400
- * @param options
401
- */
402
- var onRefresh = function onRefresh(options) {
403
- var _options = {
404
- complete: noop
405
- };
406
- _options = (0, _util._extends)({}, _options, options);
407
-
408
- (0, _log.log)('onRefresh->' + JSON.stringify(_options));
409
- if (isFromHarmonyOS) {
410
- location.reload();
411
- } else {
412
- WebViewJavascriptBridge.callHandler('refresh', _options, function (response) {
413
- (0, _log.log)('onRefresh<-' + JSON.stringify(response));
414
- _options.complete(response);
415
- });
416
- }
417
- };
418
-
419
- /**
420
- * 设置原生导航条
421
- * v2.2.0 - 已兼容鸿蒙
422
- *
423
- * @param options
424
- * {
425
- * "title": "xxxxx",
426
- * "type": "0" // 0-默认 1-切换类
427
- * }
428
- */
429
- var onNavigationBar = function onNavigationBar(options) {
430
- var _options = {
431
- complete: noop
432
- };
433
- _options = (0, _util._extends)({}, _options, options);
434
-
435
- (0, _log.log)('onNavigationBar->' + JSON.stringify(_options));
436
- if (isFromHarmonyOS) {
437
- // 设置导航标题
438
- if (window.LightSDK.native.setTitle && !!_options.title) {
439
- (0, _log.log)('[Harmony setTitle] -> ' + JSON.stringify(_options));
440
- window.LightSDK.native.setTitle({
441
- "title": _options.title
442
- }, function (resp) {
443
- (0, _log.log)('[Harmony setTitle] <- ' + JSON.stringify(resp));
444
- });
445
- } else {
446
- console.error("[Harmony setTitle] LightSDK or setTitle is not available");
447
- }
448
- // 清空右侧按钮
449
- if (window.LightSDK.native.removeButton) {
450
- (0, _log.log)('[Harmony removeButton] -> ');
451
- window.LightSDK.native.removeButton({
452
- "position": "right"
453
- }, function (resp) {
454
- (0, _log.log)('[Harmony removeButton] <- ' + JSON.stringify(resp));
455
- });
456
- }
457
- // 设置右侧按钮
458
- if (window.LightSDK.native.addButton && (!!_options.rightButtonTitle || !!_options.rightButtonIcon)) {
459
- (0, _log.log)('[Harmony addButton] -> ');
460
- // 两者不可兼得
461
- if (!!_options.rightButtonIcon) {
462
- _options.rightButtonIcon = "base64://" + _options.rightButtonIcon;
463
- _options.rightButtonTitle = "";
464
- }
465
- if (!!_options.rightButtonTitle) {
466
- _options.rightButtonIcon = "";
467
- }
468
- window.LightSDK.native.addButton({
469
- "title": _options.rightButtonTitle,
470
- "icon": _options.rightButtonIcon,
471
- "position": "right",
472
- "action": _options.onRightButtonPress
473
- }, function (resp) {
474
- (0, _log.log)('[Harmony addButton] <- ' + JSON.stringify(resp));
475
- });
476
- }
477
- } else {
478
- WebViewJavascriptBridge.callHandler('navigationBar', _options, function (response) {
479
- (0, _log.log)('onNavigationBar<-' + JSON.stringify(response));
480
- _options.complete(response);
481
- });
482
- }
483
- };
484
-
485
- /**
486
- * 打开一个新的webview
487
- * v2.2.0 - 已兼容鸿蒙
488
- *
489
- * @param options
490
- * {
491
- * "title": "xxxxx", // 导航名称,如果html设置title,以html为主
492
- * "uri": "xxxxxxx", // webview请求的路由地址,目前只支持http协议,今后可支持shema协议
493
- * "locktype": 0, // 0-不需要手势密码;1-手势密码锁屏;2-资金账号锁屏;
494
- * }
495
- */
496
- var onPushView = function onPushView(options) {
497
- var _options = {
498
- title: '',
499
- isFullScreen: false,
500
- isStatusBarLight: true,
501
- ver: 'v1'
502
- };
503
- _options = (0, _util._extends)({}, _options, options);
504
- if (_options.isFullScreen == true) {
505
- _options.ver = 'v2';
506
- }
507
-
508
- if (!!_options.uri) {
509
- if (_options.uri.indexOf('http') != -1 || _options.uri.indexOf('https') != -1) {} else {
510
- _options.uri = (0, _util.getAbsoluteUrl)(_options.uri);
511
- }
512
- }
513
-
514
- if (isFromHarmonyOS) {
515
- _options.url = _options.uri;
516
- (0, _log.log)('onPushView->' + JSON.stringify(_options));
517
- window.LightSDK.native.callNative("winner_base.router", _options, function (response) {
518
- (0, _log.log)('onPushView <-' + JSON.stringify(response));
519
- });
520
- } else {
521
- (0, _log.log)('onPushView->' + JSON.stringify(_options));
522
- WebViewJavascriptBridge.callHandler('pushView', _options, function (response) {
523
- (0, _log.log)('onPushView <-' + JSON.stringify(response));
524
- });
525
- }
526
- };
527
-
528
- /**
529
- * 原生页面将要出现时触发的事件
530
- * v2.2.0 - 已兼容鸿蒙
531
- * @param callback
532
- */
533
- var pageWillAppear = function pageWillAppear(callback) {
534
- if (typeof callback == 'function') if (isFromHarmonyOS) {
535
- window.LightSDK.event.on("viewappear", function () {
536
- (0, _log.log)('pageWillAppear 被回调');
537
- if (typeof callback == 'function') {
538
- callback();
539
- }
540
- });
541
- } else {
542
- WebViewJavascriptBridge.registerHandler("pageWillAppear", callback);
543
- }
544
- };
545
-
546
- /**
547
- * H5发送通知给客户端
548
- * TODO 未兼容鸿蒙
549
- *
550
- * @param options
551
- */
552
- var onNotify = function onNotify(options) {
553
- var _options = {
554
- type: 'javascriptNotify'
555
- };
556
- _options = (0, _util._extends)({}, _options, options);
557
-
558
- (0, _log.log)('onNotify->' + JSON.stringify(_options));
559
- if (isFromHarmonyOS) {
560
- // TODO Harmony 暂未实现
561
- // if(HmJsBridge.willAppear) {
562
- // HmJsBridge.notify(_options);
563
- // }
564
- console.warn('onNotify Harmony 暂未实现');
565
- } else {
566
- WebViewJavascriptBridge.callHandler('notify', _options, function (response) {
567
- (0, _log.log)('onNotify<-' + JSON.stringify(response));
568
- });
569
- }
570
- };
571
-
572
- /**
573
- * H5注册通知,由客户端进行通知
574
- * TODO 未兼容鸿蒙
575
- *
576
- * @param type 事件类型名称
577
- * @param callback 回调处理
578
- */
579
- var notifyQueue = {};
580
- var subscribeNotify = function subscribeNotify(type, callback) {
581
- if (typeof callback == 'function') {
582
- //回调函数存在队列中
583
- var _type = type;
584
- // sae_video: v3思迪视频见证订阅事件名
585
- // result_video: v5思迪视频见证订阅事件名(2025-05-30Added)
586
- if (_type == 'sae_video' || _type == 'result_video') {
587
- _type = 'notify';
588
- }
589
- notifyQueue[_type] = callback;
590
-
591
- (0, _log.log)('subscribeNotify->' + type);
592
- if (isFromHarmonyOS) {
593
- // if(HmJsBridge.subscribeNotify) {
594
- // HmJsBridge.subscribeNotify(_type, data => {
595
- // log('subscribeNotify<-' + JSON.stringify(data))
596
- // // //获取data.type才是H5定义的type
597
- // if (Object.prototype.toString.call(data).toLocaleLowerCase() == '[object String]'.toLocaleLowerCase()) {
598
- // data = JSON.parse(data);
599
- // }
600
- // if (notifyQueue[_type]) {
601
- // notifyQueue[_type](data);
602
- // }
603
- // });
604
- // }
605
- console.warn('subscribeNotify Harmony 暂未实现');
606
- } else {
607
- WebViewJavascriptBridge.registerHandler(_type, function (data) {
608
- (0, _log.log)('subscribeNotify<-' + JSON.stringify(data));
609
- // 获取data.type才是H5定义的type
610
- if (Object.prototype.toString.call(data).toLocaleLowerCase() == '[object String]'.toLocaleLowerCase()) {
611
- data = JSON.parse(data);
612
- }
613
- // 2025-05-30Added:针对5.0视频见证的输出对象payload对安卓端进行Object转换的兼容处理
614
- if (type == 'result_video' && data.payload) {
615
- if (Object.prototype.toString.call(data.payload).toLocaleLowerCase() == '[object String]'.toLocaleLowerCase()) {
616
- data.payload = JSON.parse(data.payload);
617
- }
618
- // 兼容代码:处理iOS和安卓端返回结构不同的兼容
619
- if (ipad || iphone || ipod) {
620
- data.payload = _extends2({}, data.payload.params);
621
- }
622
- // 如有驳回样本结果返回,则生成扁平化数组reject_reasons
623
- var rejectReasons = [];
624
- if (data.payload.result && data.payload.result.length) {
625
- // //var rejectReasonSample = [{fields: ["wt_witness_video_reject"], reasons: ["无法接收您的声音或画面,请您确认设备权限后重新连接;目前您的网络环境不太好,请您切换流量和无线网,确定网络环境正常后重新连接"], step: "witness_video", reasontitle: ["无法接收您的声音或画面,请您确认设备权限后重新连接;目前您的网络环境不太好,请您切换流量和无线网,确定网络环境正常后重新连接"]}];
626
- var rejectReasonSample = data.payload.result;
627
- rejectReasonSample.forEach(function (fieldElement) {
628
- if (fieldElement.reasons && Object.prototype.toString.call(fieldElement.reasons) == "[object Array]") {
629
- rejectReasons = rejectReasons.concat(fieldElement.reasons);
630
- }
631
- });
632
- }
633
- data.payload.reject_reasons = rejectReasons.reduce(function (acc, item) {
634
- return acc.concat(item.split(";"));
635
- }, []);
636
- }
637
- if (notifyQueue[_type]) {
638
- if (android) {
639
- // 解决安卓端request=1会调用type=notify的问题
640
- if (data.type == 'sae_video' || data.type == 'result_video') {
641
- (0, _log.log)('安卓notify被调用.');
642
- notifyQueue['notify'](data);
643
- } else if (data.type == _type) {
644
- (0, _log.log)('\u5B89\u5353' + data.type + '\u88AB\u8C03\u7528!');
645
- notifyQueue[_type](data);
646
- }
647
- } else {
648
- (0, _log.log)('iOS notify被调用;');
649
- notifyQueue[_type](data);
650
- }
651
- }
652
- });
653
- }
654
- }
655
- };
656
-
657
- /**
658
- * 调用Schema Url
659
- * v2.2.0 - 已兼容鸿蒙
660
- *
661
- * @param options
662
- */
663
- var onDynamicLink = function onDynamicLink(options) {
664
- var _options = {
665
- url: ''
666
- };
667
- _options = (0, _util._extends)({}, _options, options);
668
-
669
- (0, _log.log)('onDynamicLink->' + JSON.stringify(_options));
670
- if (isFromHarmonyOS) {
671
- location.href = _options.url;
672
- } else {
673
- var $versionCompare = (0, _version.compareVersion)('5.22.2');
674
- // 小于5.22.2版本不再支持拉起视频见证,提示升级
675
- if ($versionCompare < 0 && _options.url.indexOf('dl/videoreview') != -1) {
676
- alert("您当前的APP版本过低,请升级至V5.22.2以上版本后,再进行使用");
677
- return;
678
- }
679
- WebViewJavascriptBridge.callHandler('dynamicLink', _options, function (response) {
680
- (0, _log.log)('onDynamicLink<-' + JSON.stringify(response));
681
- });
682
- }
683
- };
684
-
685
- // 存储Request指令订阅Handlers
686
- var requestHandlerMap = {};
687
- // 是否注册了Request指令订阅Handlers
688
- var requestHandlerRegisterFlag = false;
689
- // 生成从minNum到maxNum的随机数,防 callback 重患
690
- var randomNum = function randomNum(minNum, maxNum) {
691
- switch (arguments.length) {
692
- case 1:
693
- return parseInt(Math.random() * minNum + 1, 10);
694
- break;
695
- case 2:
696
- return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
697
- //或者 Math.floor(Math.random()*( maxNum - minNum + 1 ) + minNum );
698
- break;
699
- default:
700
- return 0;
701
- break;
702
- }
703
- };
704
- var callbackIds = [];
705
- var generateCallbackId = function generateCallbackId() {
706
- var callbackId = randomNum(1000, 9999);
707
- if (callbackIds.indexOf(callbackId) !== -1) {
708
- return generateCallbackId(callbackId);
709
- } else {
710
- callbackIds.push(callbackId);
711
- }
712
- return callbackId;
713
- };
714
-
715
- /**
716
- * 调用Request指令(通常作用在一些原生和客户端之间比较特殊的操作)
717
- * 未兼容鸿蒙
718
- *
719
- * @param operationType 操作指令(见文档)
720
- * @param payloadOptions 消息体结构
721
- */
722
- var onRequest = function onRequest(operationType, payloadOptions, okCallBack, notOkCallBack) {
723
- var _options = {
724
- type: !operationType ? '1' : operationType,
725
- payload: !payloadOptions ? {} : payloadOptions,
726
- callbackId: generateCallbackId()
727
- // 兼容老方案
728
- };requestHandlerMap[operationType + '-ok'] = typeof okCallBack === 'function' ? okCallBack : noop;
729
- requestHandlerMap[operationType + '-notok'] = typeof notOkCallBack === 'function' ? notOkCallBack : noop;
730
- // 2020-5-2:修复 callback 在队列中重复的致命缺陷
731
- requestHandlerMap[operationType + '_' + _options.callbackId + '-ok'] = typeof okCallBack === 'function' ? okCallBack : noop;
732
- requestHandlerMap[operationType + '_' + _options.callbackId + '-notok'] = typeof notOkCallBack === 'function' ? notOkCallBack : noop;
733
-
734
- // 鸿蒙处理
735
- if (isFromHarmonyOS) {
736
- // TODO 待实现鸿蒙
737
- // if(HmJsBridge.request) {
738
- // HmJsBridge.request(_options, function(response){
739
- // if (typeof response == 'string') {
740
- // response = JSON.parse(response);
741
- // }
742
-
743
- // // log('onRequest<-' + JSON.stringify(response))
744
- // if (response.error || response.error === 'true') {
745
- // if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-notok'] === 'function') {
746
- // requestHandlerMap[response.type + '_' + response.callbackId + '-notok'](wrapNotOkPayload(-1, response.info))
747
- // }
748
- // else if (typeof requestHandlerMap[response.type + '-notok'] === 'function') {
749
- // requestHandlerMap[response.type + '-notok'](wrapNotOkPayload(-1, response.info))
750
- // }
751
- // } else {
752
- // if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-ok'] === 'function') {
753
- // // 防止安卓指令调用成功同步进入的控制
754
- // if ((ipad || iphone || ipod) || response.payload) {
755
- // requestHandlerMap[response.type + '_' + response.callbackId + '-ok'](wrapOkPayload(response.payload))
756
- // }
757
- // }
758
- // else if (typeof requestHandlerMap[response.type + '-ok'] === 'function') {
759
- // // 防止安卓指令调用成功同步进入的控制
760
- // if ((ipad || iphone || ipod) || response.payload) {
761
- // requestHandlerMap[response.type + '-ok'](wrapOkPayload(response.payload))
762
- // }
763
- // }
764
- // }
765
- // });
766
- // }
767
- return;
768
- }
769
-
770
- // IOS同步回调处理
771
- // log('onRequest->' + JSON.stringify(_options))
772
- WebViewJavascriptBridge.callHandler('request', _options, function (response) {
773
-
774
- if (typeof response == 'string') {
775
- response = JSON.parse(response);
776
- }
777
-
778
- // log('onRequest<-' + JSON.stringify(response))
779
- if (response.error || response.error === 'true') {
780
- if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-notok'] === 'function') {
781
- requestHandlerMap[response.type + '_' + response.callbackId + '-notok'](wrapNotOkPayload(-1, response.info));
782
- } else if (typeof requestHandlerMap[response.type + '-notok'] === 'function') {
783
- requestHandlerMap[response.type + '-notok'](wrapNotOkPayload(-1, response.info));
784
- }
785
- } else {
786
- if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-ok'] === 'function') {
787
- // 防止安卓指令调用成功同步进入的控制
788
- if (ipad || iphone || ipod || response.payload) {
789
- requestHandlerMap[response.type + '_' + response.callbackId + '-ok'](wrapOkPayload(response.payload));
790
- }
791
- } else if (typeof requestHandlerMap[response.type + '-ok'] === 'function') {
792
- // 防止安卓指令调用成功同步进入的控制
793
- if (ipad || iphone || ipod || response.payload) {
794
- requestHandlerMap[response.type + '-ok'](wrapOkPayload(response.payload));
795
- }
796
- }
797
- }
798
- });
799
-
800
- if (!requestHandlerRegisterFlag) {
801
- // Android异步回调处理
802
- WebViewJavascriptBridge.registerHandler('request', function (response) {
803
-
804
- if (typeof response == 'string') {
805
- response = JSON.parse(response);
806
- }
807
-
808
- if (response.error || response.error === 'true') {
809
- if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-notok'] === 'function') {
810
- requestHandlerMap[response.type + '_' + response.callbackId + '-notok'](wrapNotOkPayload(-1, response.info));
811
- } else if (typeof requestHandlerMap[response.type + '-notok'] === 'function') {
812
- requestHandlerMap[response.type + '-notok'](wrapNotOkPayload(-1, response.info));
813
- }
814
- } else {
815
- if (response.callbackId && typeof requestHandlerMap[response.type + '_' + response.callbackId + '-ok'] === 'function') {
816
- requestHandlerMap[response.type + '_' + response.callbackId + '-ok'](wrapOkPayload(response.payload));
817
- } else if (typeof requestHandlerMap[response.type + '-ok'] === 'function') {
818
- requestHandlerMap[response.type + '-ok'](wrapOkPayload(response.payload));
819
- }
820
- }
821
- });
822
- requestHandlerRegisterFlag = true;
823
- }
824
- };
825
-
826
- /**
827
- * 提供给第三方调用中台接口的函数
828
- * @param functionNo 中台功能号
829
- * @param payloadOptions 中台消息体
830
- * @param okCallBack 成功回调函数
831
- * @param notOkCallBack 失败回调函数
832
- */
833
- var onApiRequest = function onApiRequest(functionNo, payloadOptions, okCallBack, notOkCallBack) {
834
-
835
- if ((0, _util.isEmpty)(functionNo)) {
836
- throw new Error('functionNo is required ...');
837
- } else {
838
- var _options = {
839
- funcId: functionNo,
840
- payload: !payloadOptions ? {} : payloadOptions
841
- };
842
- }
843
-
844
- (0, _log.log)('onApiRequest->' + JSON.stringify(_options));
845
- if (isFromHarmonyOS) {
846
- console.warn('onApiRequest Harmony 暂未实现');
847
- return;
848
- }
849
- WebViewJavascriptBridge.callHandler('apiRequest', _options, function (response) {
850
- (0, _log.log)('onApiRequest<-' + JSON.stringify(response));
851
-
852
- if (typeof response == 'string') {
853
- response = JSON.parse(response);
854
- }
855
-
856
- // 2017-12-26:对脚本逻辑做兼容,IOS认为业务异常和系统异常response.error都是true,ANDROID认为业务异常和业务成功时response.error是false,而系统异常response.error是true
857
-
858
- // IOS认为业务异常和系统异常response.error都是true,业务成功response.error是false
859
- if (ipad || iphone || ipod) {
860
-
861
- if (response.error || response.error === 'true') {
862
- // 接口业务异常
863
- if (response.payload) {
864
- if (typeof notOkCallBack === 'function') {
865
- notOkCallBack(wrapNotOkPayload(response.payload.code, response.payload.info));
866
- }
867
- }
868
- // 客户端自身应用级别错误(ios不给payload字段)
869
- else {
870
- if (typeof notOkCallBack === 'function') {
871
- notOkCallBack(wrapNotOkPayload(-1, response.info));
872
- }
873
- }
874
- } else {
875
- if (typeof okCallBack === 'function') {
876
- var re = {};
877
- if (response.payload) {
878
- if (typeof response.payload.data == 'string') {
879
- re = JSON.parse(response.payload.data);
880
- } else {
881
- re = response.payload.data;
882
- }
883
- }
884
-
885
- okCallBack(wrapOkPayload(re));
886
- }
887
- }
888
- }
889
- // ANDROID认为业务异常和业务成功时response.error是false,而系统异常response.error是true
890
- else {
891
-
892
- if (response.error || response.error === 'true') {
893
- if (typeof notOkCallBack === 'function') {
894
- notOkCallBack(wrapNotOkPayload(-1, response.info));
895
- }
896
- } else {
897
- var _re = {};
898
- if (typeof response.payload.data == 'string') {
899
- _re = JSON.parse(response.payload.data);
900
- } else {
901
- _re = response.payload.data ? response.payload.data : {};
902
- }
903
-
904
- // 业务异常
905
- if (response.payload.code != '0') {
906
- if (typeof notOkCallBack === 'function') {
907
- notOkCallBack(wrapNotOkPayload(response.payload.code, response.payload.info));
908
- }
909
- }
910
- // 业务成功
911
- else {
912
- if (typeof okCallBack === 'function') {
913
- okCallBack(wrapOkPayload(_re));
914
- }
915
- }
916
- }
917
- }
918
- });
919
- };
920
-
921
- exports.wrapOkPayload = wrapOkPayload;
922
- exports.wrapNotOkPayload = wrapNotOkPayload;
923
- exports.ready = ready;
924
- exports.onBack = onBack;
925
- exports.onRefresh = onRefresh;
926
- exports.onNavigationBar = onNavigationBar;
927
- exports.onPushView = onPushView;
928
- exports.onNotify = onNotify;
929
- exports.subscribeNotify = subscribeNotify;
930
- exports.onDynamicLink = onDynamicLink;
931
- exports.onRequest = onRequest;
932
- exports.pageWillAppear = pageWillAppear;
933
- exports.onApiRequest = onApiRequest;
934
-
935
- /***/ }),
936
-
937
- /***/ 9:
938
- /***/ (function(module, exports, __webpack_require__) {
939
-
940
- "use strict";
941
-
942
-
943
- Object.defineProperty(exports, "__esModule", {
944
- value: true
945
- });
946
- /*
947
- * @Author: shenzhiwei
948
- * @Date: 2020-07-07 15:24:48
949
- * @Company: orientsec.com.cn
950
- * @Description: 日志工具类
951
- */
952
- // 私有函数:日志时间戳
953
- var _getNowTime = function _getNowTime() {
954
- var date = new Date();
955
- var _date = date.getDate();
956
- var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
957
- var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
958
- var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
959
- var milliSeconds = date.getMilliseconds();
960
- var currentTime = hour + ":" + minute + ":" + second + "." + milliSeconds;
961
- return currentTime;
962
- };
963
-
964
- /**
965
- * 普通日志输出(带醒目样式效果)
966
- * @param {*} info 日志内容
967
- */
968
- var log = function log(info) {
969
- if (info) {
970
- info = _getNowTime() + "[赢家]: " + info;
971
- console.log("%c " + info, "padding: 0.5px 8px 0.5px 1px; border-radius: 2px; background: black; color: yellow");
972
- }
973
- };
974
-
975
- /**
976
- * 错误日志输出(带醒目样式效果)
977
- * @param {*} info 日志内容
978
- */
979
- var errorlog = function errorlog(info) {
980
- if (info) {
981
- info = _getNowTime() + "[赢家]: " + info;
982
- console.log("%c " + info, "padding: 0.5px 8px 0.5px 1px; border-radius: 2px; background: red; color: white");
983
- }
984
- };
985
-
986
- exports.log = log;
987
- exports.errorlog = errorlog;
988
-
989
- /***/ })
990
-
991
- /******/ });
992
- });
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fastman=e():t.fastman=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=19)}({1:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){var e=document.createElement("a");e.setAttribute("href",t);var n=e.href;return e=null,n},i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},r=function(t){return!(null!=t&&(t.length||t.length>0))},a=function(t){if(t){if(1==t.length)return t;var e=t.substring(t.length-1,t.length);return(t.length>=3?"**":"*")+e}return t};e.getAbsoluteUrl=o,e._extends=i,e.isEmpty=r,e.maskName=a},10:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(t,e){for(var n=t.split(".").length;n<e;)t+=".0",n++;return t},i=function(t){var e=navigator.userAgent.toLowerCase().match(/DFYJ\/([\d.]+)/i);return e?e[1]:void 0},r=function(t,e){var n=t.split("."),i=e.split("."),r=Math.max(n.length,i.length);t=o(t,r),e=o(e,r);var a=t.split("."),l=e.split(".");if(t===e)return 0;for(var c=0;c<a.length;c++){var u=parseInt(a[c]);if(!l[c])return 1;var s=parseInt(l[c]);if(u<s)return-1;if(u>s)return 1}return-1},a=function(t){var e=i();return e?r(e,t):1};e.getVersion=i,e.compareVersion=a,e._compareVersion=r},19:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.onApiRequest=e.pageWillAppear=e.onRequest=e.onDynamicLink=e.subscribeNotify=e.onNotify=e.onPushView=e.onNavigationBar=e.onRefresh=e.onBack=e.ready=e.wrapNotOkPayload=e.wrapOkPayload=void 0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},i=n(1),r=n(9),a=n(10),l=navigator.userAgent,c=l.match(/(Android);?[\s\/]+([\d.]+)?/),u=l.match(/(iPad).*OS\s([\d_]+)/),s=l.match(/(iPod)(.*OS\s([\d_]+))?/),f=!u&&l.match(/(iPhone\sOS)\s([\d_]+)/),d=!!l.toLowerCase().match(/DFYJ/i),p=!!l.toLowerCase().match(/ArkWeb/i),y=function(t){return t.init(function(t,e){e&&e(data)}),t},g=function(t){var e=function(e){(0,r.log)("[ready] <-"),t(e)};if((0,r.log)("[ready] ->"),d)if(u||f||s){if(window.WebViewJavascriptBridge)return e(WebViewJavascriptBridge);if(window.WVJBCallbacks)return window.WVJBCallbacks.push(e);window.WVJBCallbacks=[e];var n=document.createElement("iframe");n.style.display="none",n.src="https://__bridge_loaded__",document.documentElement.appendChild(n),setTimeout(function(){document.documentElement.removeChild(n)},0)}else c?window.WebViewJavascriptBridge?e(y(WebViewJavascriptBridge)):document.addEventListener("WebViewJavascriptBridgeReady",function(){e(y(WebViewJavascriptBridge))},!1):e();else e()},v=function(){},h=function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}},b=function(){return{code:arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,info:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"error"}},w=function(t){var e={complete:v};e=(0,i._extends)({},e,t),(0,r.log)("onBack->"+JSON.stringify(e)),p?window.LightSDK.native.back({number:e.step},function(t){(0,r.log)("onBack <- "+JSON.stringify(t))}):WebViewJavascriptBridge.callHandler("back",e,function(t){(0,r.log)("onBack <-"+JSON.stringify(t)),e.complete(t)})},m=function(t){var e={complete:v};e=(0,i._extends)({},e,t),(0,r.log)("onRefresh->"+JSON.stringify(e)),p?location.reload():WebViewJavascriptBridge.callHandler("refresh",e,function(t){(0,r.log)("onRefresh<-"+JSON.stringify(t)),e.complete(t)})},O=function(t){var e={complete:v};e=(0,i._extends)({},e,t),(0,r.log)("onNavigationBar->"+JSON.stringify(e)),p?(window.LightSDK.native.setTitle&&e.title&&((0,r.log)("[Harmony setTitle] -> "+JSON.stringify(e)),window.LightSDK.native.setTitle({title:e.title},function(t){(0,r.log)("[Harmony setTitle] <- "+JSON.stringify(t))})),window.LightSDK.native.removeButton&&((0,r.log)("[Harmony removeButton] -> "),window.LightSDK.native.removeButton({position:"right"},function(t){(0,r.log)("[Harmony removeButton] <- "+JSON.stringify(t))})),window.LightSDK.native.addButton&&(e.rightButtonTitle||e.rightButtonIcon)&&((0,r.log)("[Harmony addButton] -> "),e.rightButtonIcon&&(e.rightButtonIcon="base64://"+e.rightButtonIcon,e.rightButtonTitle=""),e.rightButtonTitle&&(e.rightButtonIcon=""),window.LightSDK.native.addButton({title:e.rightButtonTitle,icon:e.rightButtonIcon,position:"right",action:e.onRightButtonPress},function(t){(0,r.log)("[Harmony addButton] <- "+JSON.stringify(t))}))):WebViewJavascriptBridge.callHandler("navigationBar",e,function(t){(0,r.log)("onNavigationBar<-"+JSON.stringify(t)),e.complete(t)})},k=function(t){var e={title:"",isFullScreen:!1,isStatusBarLight:!0,ver:"v1"};e=(0,i._extends)({},e,t),1==e.isFullScreen&&(e.ver="v2"),e.uri&&(-1!=e.uri.indexOf("http")||-1!=e.uri.indexOf("https")||(e.uri=(0,i.getAbsoluteUrl)(e.uri))),p?(e.url=e.uri,(0,r.log)("onPushView->"+JSON.stringify(e)),window.LightSDK.native.callNative("winner_base.router",e,function(t){(0,r.log)("onPushView <-"+JSON.stringify(t))})):((0,r.log)("onPushView->"+JSON.stringify(e)),WebViewJavascriptBridge.callHandler("pushView",e,function(t){(0,r.log)("onPushView <-"+JSON.stringify(t))}))},S=function(t){"function"==typeof t&&(p?window.LightSDK.event.on("viewappear",function(){(0,r.log)("pageWillAppear 被回调"),"function"==typeof t&&t()}):WebViewJavascriptBridge.registerHandler("pageWillAppear",t))},J=function(t){var e={type:"javascriptNotify"};e=(0,i._extends)({},e,t),(0,r.log)("onNotify->"+JSON.stringify(e)),p||WebViewJavascriptBridge.callHandler("notify",e,function(t){(0,r.log)("onNotify<-"+JSON.stringify(t))})},B={},N=function(t,e){if("function"==typeof e){var n=t;"sae_video"!=n&&"result_video"!=n||(n="notify"),B[n]=e,(0,r.log)("subscribeNotify->"+t),p||WebViewJavascriptBridge.registerHandler(n,function(e){if((0,r.log)("subscribeNotify<-"+JSON.stringify(e)),Object.prototype.toString.call(e).toLocaleLowerCase()=="[object String]".toLocaleLowerCase()&&(e=JSON.parse(e)),"result_video"==t&&e.payload){Object.prototype.toString.call(e.payload).toLocaleLowerCase()=="[object String]".toLocaleLowerCase()&&(e.payload=JSON.parse(e.payload)),(u||f||s)&&(e.payload=o({},e.payload.params));var i=[];if(e.payload.result&&e.payload.result.length){e.payload.result.forEach(function(t){t.reasons&&"[object Array]"==Object.prototype.toString.call(t.reasons)&&(i=i.concat(t.reasons))})}e.payload.reject_reasons=i.reduce(function(t,e){return t.concat(e.split(";"))},[])}B[n]&&(c?"sae_video"==e.type||"result_video"==e.type?((0,r.log)("安卓notify被调用."),B.notify(e)):e.type==n&&((0,r.log)("安卓"+e.type+"被调用!"),B[n](e)):((0,r.log)("iOS notify被调用;"),B[n](e)))})}},_=function(t){var e={url:""};if(e=(0,i._extends)({},e,t),(0,r.log)("onDynamicLink->"+JSON.stringify(e)),p)location.href=e.url;else{if((0,a.compareVersion)("5.22.2")<0&&-1!=e.url.indexOf("dl/videoreview"))return void alert("您当前的APP版本过低,请升级至V5.22.2以上版本后,再进行使用");WebViewJavascriptBridge.callHandler("dynamicLink",e,function(t){(0,r.log)("onDynamicLink<-"+JSON.stringify(t))})}},V={},L=!1,I=function(t,e){switch(arguments.length){case 1:return parseInt(Math.random()*t+1,10);case 2:return parseInt(Math.random()*(e-t+1)+t,10);default:return 0}},W=[],P=function t(){var e=I(1e3,9999);return-1!==W.indexOf(e)?t(e):(W.push(e),e)},j=function(t,e,n,o){var i={type:t||"1",payload:e||{},callbackId:P()};V[t+"-ok"]="function"==typeof n?n:v,V[t+"-notok"]="function"==typeof o?o:v,V[t+"_"+i.callbackId+"-ok"]="function"==typeof n?n:v,V[t+"_"+i.callbackId+"-notok"]="function"==typeof o?o:v,p||(WebViewJavascriptBridge.callHandler("request",i,function(t){"string"==typeof t&&(t=JSON.parse(t)),t.error||"true"===t.error?t.callbackId&&"function"==typeof V[t.type+"_"+t.callbackId+"-notok"]?V[t.type+"_"+t.callbackId+"-notok"](b(-1,t.info)):"function"==typeof V[t.type+"-notok"]&&V[t.type+"-notok"](b(-1,t.info)):t.callbackId&&"function"==typeof V[t.type+"_"+t.callbackId+"-ok"]?(u||f||s||t.payload)&&V[t.type+"_"+t.callbackId+"-ok"](h(t.payload)):"function"==typeof V[t.type+"-ok"]&&(u||f||s||t.payload)&&V[t.type+"-ok"](h(t.payload))}),L||(WebViewJavascriptBridge.registerHandler("request",function(t){"string"==typeof t&&(t=JSON.parse(t)),t.error||"true"===t.error?t.callbackId&&"function"==typeof V[t.type+"_"+t.callbackId+"-notok"]?V[t.type+"_"+t.callbackId+"-notok"](b(-1,t.info)):"function"==typeof V[t.type+"-notok"]&&V[t.type+"-notok"](b(-1,t.info)):t.callbackId&&"function"==typeof V[t.type+"_"+t.callbackId+"-ok"]?V[t.type+"_"+t.callbackId+"-ok"](h(t.payload)):"function"==typeof V[t.type+"-ok"]&&V[t.type+"-ok"](h(t.payload))}),L=!0))},x=function(t,e,n,o){if((0,i.isEmpty)(t))throw new Error("functionNo is required ...");var a={funcId:t,payload:e||{}};(0,r.log)("onApiRequest->"+JSON.stringify(a)),p||WebViewJavascriptBridge.callHandler("apiRequest",a,function(t){if((0,r.log)("onApiRequest<-"+JSON.stringify(t)),"string"==typeof t&&(t=JSON.parse(t)),u||f||s){if(t.error||"true"===t.error)t.payload?"function"==typeof o&&o(b(t.payload.code,t.payload.info)):"function"==typeof o&&o(b(-1,t.info));else if("function"==typeof n){var e={};t.payload&&(e="string"==typeof t.payload.data?JSON.parse(t.payload.data):t.payload.data),n(h(e))}}else if(t.error||"true"===t.error)"function"==typeof o&&o(b(-1,t.info));else{var i={};i="string"==typeof t.payload.data?JSON.parse(t.payload.data):t.payload.data?t.payload.data:{},"0"!=t.payload.code?"function"==typeof o&&o(b(t.payload.code,t.payload.info)):"function"==typeof n&&n(h(i))}})};e.wrapOkPayload=h,e.wrapNotOkPayload=b,e.ready=g,e.onBack=w,e.onRefresh=m,e.onNavigationBar=O,e.onPushView=k,e.onNotify=J,e.subscribeNotify=N,e.onDynamicLink=_,e.onRequest=j,e.pageWillAppear=S,e.onApiRequest=x},9:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){var t=new Date;t.getDate();return(t.getHours()<10?"0"+t.getHours():t.getHours())+":"+(t.getMinutes()<10?"0"+t.getMinutes():t.getMinutes())+":"+(t.getSeconds()<10?"0"+t.getSeconds():t.getSeconds())+"."+t.getMilliseconds()},i=function(t){t&&(t=o()+"[赢家]: "+t)},r=function(t){t&&(t=o()+"[赢家]: "+t)};e.log=i,e.errorlog=r}})});