syttunnel 0.0.67 → 0.1.0

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.
Files changed (73) hide show
  1. package/core/basic/appCommon.d.ts +75 -0
  2. package/core/{appFetch → basic/appFetch}/InterceptorManager.d.ts +0 -0
  3. package/core/{appFetch → basic/appFetch}/appFetch.d.ts +0 -0
  4. package/core/{appFetch → basic/appFetch}/defaults.d.ts +0 -0
  5. package/core/{appFetch → basic/appFetch}/dispatchRequest.d.ts +0 -0
  6. package/core/{appFetch → basic/appFetch}/index.d.ts +0 -0
  7. package/core/{appFetch → basic/appFetch}/mergeConfig.d.ts +0 -0
  8. package/core/{appFetch → basic/appFetch}/sytFetch.d.ts +0 -0
  9. package/core/{appFetch → basic/appFetch}/transform.d.ts +0 -0
  10. package/core/{appFetch → basic/appFetch}/types.d.ts +0 -0
  11. package/core/{appFetch → basic/appFetch}/utils.d.ts +0 -0
  12. package/core/{appNavigator.d.ts → basic/appNavigator.d.ts} +7 -44
  13. package/core/basic/appPay.d.ts +22 -0
  14. package/core/basic/appUser.d.ts +18 -0
  15. package/core/{bridge.d.ts → basic/bridge.d.ts} +9 -3
  16. package/core/basic/eventsName.d.ts +8 -0
  17. package/core/{tools.d.ts → basic/tools.d.ts} +0 -0
  18. package/core/{utils.d.ts → basic/utils.d.ts} +0 -0
  19. package/core/extension/appCommon.d.ts +28 -0
  20. package/core/extension/appNavigator.d.ts +32 -0
  21. package/core/{appPay.d.ts → extension/appPay.d.ts} +27 -26
  22. package/core/{appUser.d.ts → extension/appUser.d.ts} +19 -19
  23. package/core/extension/eventsName.d.ts +9 -0
  24. package/index.d.ts +9 -5
  25. package/indexsf.d.ts +14 -0
  26. package/package.json +3 -16
  27. package/syttunnel.js +839 -0
  28. package/core/FunctionCallBack.d.ts +0 -10
  29. package/core/FunctionCallBack.js +0 -15
  30. package/core/FunctionCallBack.js.map +0 -1
  31. package/core/appCommon.d.ts +0 -113
  32. package/core/appCommon.js +0 -441
  33. package/core/appCommon.js.map +0 -1
  34. package/core/appEvent.d.ts +0 -36
  35. package/core/appEvent.js +0 -41
  36. package/core/appEvent.js.map +0 -1
  37. package/core/appFetch/InterceptorManager.js +0 -29
  38. package/core/appFetch/InterceptorManager.js.map +0 -1
  39. package/core/appFetch/appFetch.js +0 -95
  40. package/core/appFetch/appFetch.js.map +0 -1
  41. package/core/appFetch/defaults.js +0 -13
  42. package/core/appFetch/defaults.js.map +0 -1
  43. package/core/appFetch/dispatchRequest.js +0 -136
  44. package/core/appFetch/dispatchRequest.js.map +0 -1
  45. package/core/appFetch/index.js +0 -19
  46. package/core/appFetch/index.js.map +0 -1
  47. package/core/appFetch/mergeConfig.js +0 -54
  48. package/core/appFetch/mergeConfig.js.map +0 -1
  49. package/core/appFetch/sytFetch.js +0 -75
  50. package/core/appFetch/sytFetch.js.map +0 -1
  51. package/core/appFetch/transform.js +0 -16
  52. package/core/appFetch/transform.js.map +0 -1
  53. package/core/appFetch/types.js +0 -3
  54. package/core/appFetch/types.js.map +0 -1
  55. package/core/appFetch/utils.js +0 -37
  56. package/core/appFetch/utils.js.map +0 -1
  57. package/core/appNavigator.js +0 -125
  58. package/core/appNavigator.js.map +0 -1
  59. package/core/appPay.js +0 -195
  60. package/core/appPay.js.map +0 -1
  61. package/core/appUser.js +0 -147
  62. package/core/appUser.js.map +0 -1
  63. package/core/bridge.js +0 -73
  64. package/core/bridge.js.map +0 -1
  65. package/core/tools.js +0 -15
  66. package/core/tools.js.map +0 -1
  67. package/core/types.d.ts +0 -25
  68. package/core/types.js +0 -22
  69. package/core/types.js.map +0 -1
  70. package/core/utils.js +0 -34
  71. package/core/utils.js.map +0 -1
  72. package/index.js +0 -17
  73. package/index.js.map +0 -1
package/syttunnel.js ADDED
@@ -0,0 +1,839 @@
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["sytTunnel"] = factory();
8
+ else
9
+ root["sytTunnel"] = factory();
10
+ })(typeof self !== 'undefined' ? self : this, function() {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ([
14
+ /* 0 */
15
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
16
+
17
+
18
+ var __importDefault = (this && this.__importDefault) || function (mod) {
19
+ return (mod && mod.__esModule) ? mod : { "default": mod };
20
+ };
21
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
22
+ exports.appNavigator = exports.appCommon = exports.appPay = exports.appUser = exports.appFetch = void 0;
23
+ var appFetch_1 = __importDefault(__webpack_require__(1));
24
+ exports.appFetch = appFetch_1.default;
25
+ var appCommon_1 = __webpack_require__(12);
26
+ var appNavigator_1 = __webpack_require__(13);
27
+ var appPay_1 = __webpack_require__(14);
28
+ var appUser_1 = __webpack_require__(15);
29
+ var appCommon = new appCommon_1.AppCommon();
30
+ exports.appCommon = appCommon;
31
+ var appNavigator = new appNavigator_1.AppNavigator();
32
+ exports.appNavigator = appNavigator;
33
+ var appPay = new appPay_1.AppPay();
34
+ exports.appPay = appPay;
35
+ var appUser = new appUser_1.AppUser();
36
+ exports.appUser = appUser;
37
+
38
+
39
+ /***/ }),
40
+ /* 1 */
41
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
42
+
43
+
44
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
45
+ if (k2 === undefined) k2 = k;
46
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
47
+ }) : (function(o, m, k, k2) {
48
+ if (k2 === undefined) k2 = k;
49
+ o[k2] = m[k];
50
+ }));
51
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
52
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
53
+ };
54
+ var __importDefault = (this && this.__importDefault) || function (mod) {
55
+ return (mod && mod.__esModule) ? mod : { "default": mod };
56
+ };
57
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
58
+ var appFetch_1 = __importDefault(__webpack_require__(2));
59
+ __exportStar(__webpack_require__(11), exports);
60
+ exports.default = appFetch_1.default;
61
+
62
+
63
+ /***/ }),
64
+ /* 2 */
65
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
66
+
67
+
68
+ var __importDefault = (this && this.__importDefault) || function (mod) {
69
+ return (mod && mod.__esModule) ? mod : { "default": mod };
70
+ };
71
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
72
+ exports.AppFetch = void 0;
73
+ var InterceptorManager_1 = __importDefault(__webpack_require__(3));
74
+ var dispatchRequest_1 = __webpack_require__(4);
75
+ var utils_1 = __webpack_require__(9);
76
+ var defaults_1 = __importDefault(__webpack_require__(10));
77
+ var AppFetch = /** @class */ (function () {
78
+ function AppFetch(initConfig) {
79
+ this.defaults = initConfig;
80
+ this.interceptors = {
81
+ request: new InterceptorManager_1.default(),
82
+ response: new InterceptorManager_1.default(),
83
+ };
84
+ }
85
+ AppFetch.prototype.request = function (url, config) {
86
+ if (typeof url === "string") {
87
+ if (!config) {
88
+ config = {};
89
+ }
90
+ config.url = url;
91
+ }
92
+ else {
93
+ config = url;
94
+ }
95
+ config = utils_1.mergeConfig(this.defaults, config);
96
+ var chain = [
97
+ { resolved: dispatchRequest_1.dispatchRequest, rejected: undefined },
98
+ ];
99
+ this.interceptors.request.forEach(function (interceptor) {
100
+ chain.unshift(interceptor);
101
+ });
102
+ this.interceptors.response.forEach(function (interceptor) {
103
+ chain.push(interceptor);
104
+ });
105
+ var promise = Promise.resolve(config);
106
+ while (chain.length) {
107
+ var _a = chain.shift(), resolved = _a.resolved, rejected = _a.rejected;
108
+ promise = promise.then(resolved, rejected);
109
+ }
110
+ return promise;
111
+ };
112
+ AppFetch.prototype.get = function (url, config) {
113
+ return this._requestMethodWhithoutData("get", url, config);
114
+ };
115
+ AppFetch.prototype.delete = function (url, config) {
116
+ return this._requestMethodWhithoutData("delete", url, config);
117
+ };
118
+ AppFetch.prototype.head = function (url, config) {
119
+ return this._requestMethodWhithoutData("head", url, config);
120
+ };
121
+ AppFetch.prototype.options = function (url, config) {
122
+ return this._requestMethodWhithoutData("options", url, config);
123
+ };
124
+ AppFetch.prototype.post = function (url, data, config) {
125
+ return this._requestMethodWhithData("post", url, data, config);
126
+ };
127
+ AppFetch.prototype.put = function (url, data, config) {
128
+ return this._requestMethodWhithData("put", url, data, config);
129
+ };
130
+ AppFetch.prototype.patch = function (url, data, config) {
131
+ return this._requestMethodWhithData("patch", url, data, config);
132
+ };
133
+ AppFetch.prototype._requestMethodWhithoutData = function (method, url, config) {
134
+ return this.request(Object.assign(config || {}, {
135
+ method: method,
136
+ url: url,
137
+ }));
138
+ };
139
+ AppFetch.prototype._requestMethodWhithData = function (method, url, data, config) {
140
+ return this.request(Object.assign(config || {}, {
141
+ method: method,
142
+ url: url,
143
+ data: data,
144
+ }));
145
+ };
146
+ return AppFetch;
147
+ }());
148
+ exports.AppFetch = AppFetch;
149
+ var createInstance = function (config) {
150
+ var context = new AppFetch(config);
151
+ var instance = AppFetch.prototype.request.bind(context);
152
+ utils_1.extend(instance, context);
153
+ return instance;
154
+ };
155
+ var appFetch = createInstance(defaults_1.default);
156
+ appFetch.create = function (config) {
157
+ return createInstance(utils_1.mergeConfig(defaults_1.default, config));
158
+ };
159
+ appFetch.AppFetch = AppFetch;
160
+ exports.default = appFetch;
161
+
162
+
163
+ /***/ }),
164
+ /* 3 */
165
+ /***/ ((__unused_webpack_module, exports) => {
166
+
167
+
168
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
169
+ var InterceptorManager = /** @class */ (function () {
170
+ function InterceptorManager() {
171
+ this.interceptors = [];
172
+ }
173
+ InterceptorManager.prototype.use = function (resolved, rejected) {
174
+ this.interceptors.push({
175
+ resolved: resolved,
176
+ rejected: rejected,
177
+ });
178
+ return this.interceptors.length - 1;
179
+ };
180
+ InterceptorManager.prototype.eject = function (id) {
181
+ if (this.interceptors[id]) {
182
+ this.interceptors[id] = null;
183
+ }
184
+ };
185
+ InterceptorManager.prototype.forEach = function (fn) {
186
+ this.interceptors.forEach(function (interceptor) {
187
+ if (interceptor !== null) {
188
+ fn(interceptor);
189
+ }
190
+ });
191
+ };
192
+ return InterceptorManager;
193
+ }());
194
+ exports.default = InterceptorManager;
195
+
196
+
197
+ /***/ }),
198
+ /* 4 */
199
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
200
+
201
+
202
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
203
+ exports.deepMerge = exports.isURLSearchParams = exports.isPlainObject = exports.isObject = exports.isDate = exports.buildURL = exports.combineURL = exports.isAbsoluteURL = exports.transformURL = exports.dispatchRequest = void 0;
204
+ var sytFetch_1 = __webpack_require__(5);
205
+ var transform_1 = __webpack_require__(8);
206
+ var dispatchRequest = function (config) {
207
+ var newConfig = processConfig(config);
208
+ return sytFetch_1.sytFetch(newConfig);
209
+ };
210
+ exports.dispatchRequest = dispatchRequest;
211
+ var processConfig = function (config) {
212
+ config.url = exports.transformURL(config);
213
+ config.data = transform_1.transform(config.data, config.headers);
214
+ return config;
215
+ };
216
+ var transformURL = function (config) {
217
+ var params = config.params, baseURL = config.baseURL;
218
+ var url = config.url;
219
+ if (baseURL && !exports.isAbsoluteURL(url)) {
220
+ url = exports.combineURL(baseURL, url);
221
+ }
222
+ return exports.buildURL(url, params);
223
+ };
224
+ exports.transformURL = transformURL;
225
+ var isAbsoluteURL = function (url) {
226
+ return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
227
+ };
228
+ exports.isAbsoluteURL = isAbsoluteURL;
229
+ var combineURL = function (baseURL, relativeURL) {
230
+ return relativeURL
231
+ ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "")
232
+ : baseURL;
233
+ };
234
+ exports.combineURL = combineURL;
235
+ var buildURL = function (url, params, paramsSerializer) {
236
+ if (!params) {
237
+ return url;
238
+ }
239
+ var serializedParams;
240
+ if (paramsSerializer) {
241
+ serializedParams = paramsSerializer(params);
242
+ }
243
+ else if (exports.isURLSearchParams(params)) {
244
+ serializedParams = params.toString();
245
+ }
246
+ else {
247
+ var parts_1 = [];
248
+ Object.keys(params).forEach(function (key) {
249
+ var val = params[key];
250
+ if (val === null || typeof val === "undefined") {
251
+ return;
252
+ }
253
+ var values = [];
254
+ if (Array.isArray(val)) {
255
+ values = val;
256
+ key += "[]";
257
+ }
258
+ else {
259
+ values = [val];
260
+ }
261
+ values.forEach(function (val) {
262
+ if (exports.isDate(val)) {
263
+ val = val.toISOString();
264
+ }
265
+ else if (exports.isPlainObject(val)) {
266
+ val = JSON.stringify(val);
267
+ }
268
+ parts_1.push(encode(key) + "=" + encode(val));
269
+ });
270
+ });
271
+ serializedParams = parts_1.join("&");
272
+ }
273
+ if (serializedParams) {
274
+ var markIndex = url.indexOf("#");
275
+ if (markIndex !== -1) {
276
+ url = url.slice(0, markIndex);
277
+ }
278
+ url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
279
+ }
280
+ return url;
281
+ };
282
+ exports.buildURL = buildURL;
283
+ var encode = function (val) {
284
+ return encodeURIComponent(val)
285
+ .replace(/%40/g, "@")
286
+ .replace(/%3A/gi, ":")
287
+ .replace(/%24/g, "$")
288
+ .replace(/%2C/gi, ",")
289
+ .replace(/%20/g, "+") // 约定将 空格 号转为 +
290
+ .replace(/%5B/gi, "[")
291
+ .replace(/%5D/gi, "]");
292
+ };
293
+ var isDate = function (val) {
294
+ return Object.prototype.toString.call(val) === "[object Date]";
295
+ };
296
+ exports.isDate = isDate;
297
+ var isObject = function (val) {
298
+ return val !== null && typeof val === "object";
299
+ };
300
+ exports.isObject = isObject;
301
+ var isPlainObject = function (val) {
302
+ return toString.call(val) === "[object Object]";
303
+ };
304
+ exports.isPlainObject = isPlainObject;
305
+ var isURLSearchParams = function (val) {
306
+ return typeof val !== undefined && val instanceof URLSearchParams;
307
+ };
308
+ exports.isURLSearchParams = isURLSearchParams;
309
+ var deepMerge = function () {
310
+ var objs = [];
311
+ for (var _i = 0; _i < arguments.length; _i++) {
312
+ objs[_i] = arguments[_i];
313
+ }
314
+ var result = Object.create(null);
315
+ objs.forEach(function (obj) {
316
+ if (obj) {
317
+ Object.keys(obj).forEach(function (key) {
318
+ var val = obj[key];
319
+ if (exports.isPlainObject(val)) {
320
+ if (exports.isPlainObject(result[key])) {
321
+ result[key] = exports.deepMerge(result[key], val);
322
+ }
323
+ else {
324
+ result[key] = exports.deepMerge(val);
325
+ }
326
+ }
327
+ else {
328
+ result[key] = val;
329
+ }
330
+ });
331
+ }
332
+ });
333
+ return result;
334
+ };
335
+ exports.deepMerge = deepMerge;
336
+
337
+
338
+ /***/ }),
339
+ /* 5 */
340
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
341
+
342
+
343
+ var __importDefault = (this && this.__importDefault) || function (mod) {
344
+ return (mod && mod.__esModule) ? mod : { "default": mod };
345
+ };
346
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
347
+ exports.sytFetch = void 0;
348
+ var bridge_1 = __importDefault(__webpack_require__(6));
349
+ var sytFetch = function (config) {
350
+ var _a = config.data, data = _a === void 0 ? null : _a, url = config.url, _b = config.method, method = _b === void 0 ? "get" : _b, headers = config.headers, timeout = config.timeout, withCredentials = config.withCredentials;
351
+ var request = {
352
+ url: url,
353
+ method: method,
354
+ body: data,
355
+ headers: headers,
356
+ timeout: timeout,
357
+ withCredentials: withCredentials,
358
+ };
359
+ var appFunc = {
360
+ method: "sytFetch",
361
+ params: data,
362
+ };
363
+ return new Promise(function (resolve, reject) {
364
+ bridge_1.default
365
+ .postMessage(appFunc)
366
+ .then(function (result) {
367
+ var resData = result.data;
368
+ if (!data) {
369
+ reject({
370
+ errCode: "-1",
371
+ errMessage: "没有返回data数据",
372
+ });
373
+ return;
374
+ }
375
+ var err = resData.err;
376
+ if (err) {
377
+ var errCode = err.name || "-1";
378
+ var errMessage = err.message || "";
379
+ reject({ errCode: errCode, errMessage: errMessage });
380
+ return;
381
+ }
382
+ var res = resData.res;
383
+ var headers = resData.headers;
384
+ var status = resData.status;
385
+ var statusText = resData.statusText;
386
+ var response = {
387
+ status: status,
388
+ statusText: statusText,
389
+ data: res,
390
+ config: config,
391
+ headers: headers,
392
+ };
393
+ resolve(response);
394
+ })
395
+ .catch(function (err) {
396
+ reject(err);
397
+ });
398
+ });
399
+ };
400
+ exports.sytFetch = sytFetch;
401
+
402
+
403
+ /***/ }),
404
+ /* 6 */
405
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
406
+
407
+
408
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
409
+ var tools_1 = __webpack_require__(7);
410
+ var FuncCallBack = /** @class */ (function () {
411
+ function FuncCallBack(uId, suc, fal) {
412
+ this.uId = uId;
413
+ this.success = suc;
414
+ this.failure = fal;
415
+ }
416
+ return FuncCallBack;
417
+ }());
418
+ var Bridge = /** @class */ (function () {
419
+ function Bridge() {
420
+ if (tools_1.isSfAppIOS()) {
421
+ window.addEventListener("message", this.onMessage);
422
+ }
423
+ else if (tools_1.isSfAppAndroid()) {
424
+ document.addEventListener("message", this.onMessage);
425
+ }
426
+ this.onMessage = this.onMessage.bind(this);
427
+ }
428
+ Bridge.prototype.onMessage = function (msg) {
429
+ var message = typeof msg.data === "string" ? JSON.parse(msg.data) : msg.data;
430
+ var method = message.method;
431
+ var value = message.value;
432
+ var uniqueId = message.uniqueId;
433
+ var errCode = message.errCode;
434
+ var errMessage = message.errMessage;
435
+ if (!method || !uniqueId) {
436
+ return;
437
+ }
438
+ var obj = Bridge.cbArr.find(function (item) { return item.uId === uniqueId; });
439
+ var success = obj === null || obj === void 0 ? void 0 : obj.success;
440
+ var failure = obj === null || obj === void 0 ? void 0 : obj.failure;
441
+ if ((errCode || errMessage) && failure) {
442
+ var error = {
443
+ errCode: errCode,
444
+ errMessage: errMessage,
445
+ };
446
+ failure(error);
447
+ var delIndex_1 = Bridge.cbArr.findIndex(function (item) { return item.uId === uniqueId; });
448
+ if (delIndex_1 > -1) {
449
+ Bridge.cbArr.splice(delIndex_1, 1);
450
+ }
451
+ return;
452
+ }
453
+ if (value != null && success) {
454
+ success(value);
455
+ }
456
+ var delIndex = Bridge.cbArr.findIndex(function (item) { return item.uId === uniqueId; });
457
+ if (delIndex > -1) {
458
+ Bridge.cbArr.splice(delIndex, 1);
459
+ }
460
+ };
461
+ Bridge.prototype.postMessage = function (params) {
462
+ return new Promise(function (resolve, reject) {
463
+ bridge.dealPostMessage(params, function (result) {
464
+ if (result) {
465
+ resolve(result);
466
+ }
467
+ else {
468
+ reject(new Error("返回的数据错误"));
469
+ }
470
+ }, function (err) {
471
+ reject(err);
472
+ });
473
+ });
474
+ };
475
+ Bridge.prototype.dealPostMessage = function (params, success, failure) {
476
+ if (window.ReactNativeWebView) {
477
+ var uniqueId = params.method + Bridge.funCallCount.toString() + Date.now().toString();
478
+ var funcCbObj = new FuncCallBack(uniqueId, success, failure);
479
+ Bridge.cbArr.push(funcCbObj);
480
+ Bridge.funCallCount++;
481
+ var postParams = {
482
+ method: params.method,
483
+ params: params.params,
484
+ uniqueId: uniqueId,
485
+ };
486
+ window.ReactNativeWebView.postMessage(JSON.stringify(postParams));
487
+ }
488
+ };
489
+ Bridge.cbArr = [];
490
+ Bridge.funCallCount = 0;
491
+ return Bridge;
492
+ }());
493
+ var bridge = new Bridge();
494
+ exports.default = bridge;
495
+
496
+
497
+ /***/ }),
498
+ /* 7 */
499
+ /***/ ((__unused_webpack_module, exports) => {
500
+
501
+
502
+ // interface SytWindow extends Window {
503
+ // ReactNativeWebView: any;
504
+ // }
505
+ // export declare var window: SytWindow;
506
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
507
+ exports.isSfAppAndroid = exports.isSfAppIOS = exports.userAgent = void 0;
508
+ exports.userAgent = window.navigator.userAgent;
509
+ var isSfAppIOS = function () { return !!exports.userAgent.includes("SFEXPRESSAPP-iOS-ML"); };
510
+ exports.isSfAppIOS = isSfAppIOS;
511
+ var isSfAppAndroid = function () {
512
+ return !!exports.userAgent.includes("SFEXPRESSAPP-Android-ML");
513
+ };
514
+ exports.isSfAppAndroid = isSfAppAndroid;
515
+
516
+
517
+ /***/ }),
518
+ /* 8 */
519
+ /***/ ((__unused_webpack_module, exports) => {
520
+
521
+
522
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
523
+ exports.transform = void 0;
524
+ var transform = function (data, headers, fns) {
525
+ if (!fns)
526
+ return data;
527
+ if (!Array.isArray(fns)) {
528
+ fns = [fns];
529
+ }
530
+ fns.forEach(function (fn) {
531
+ data = fn(data, headers);
532
+ });
533
+ return data;
534
+ };
535
+ exports.transform = transform;
536
+
537
+
538
+ /***/ }),
539
+ /* 9 */
540
+ /***/ ((__unused_webpack_module, exports) => {
541
+
542
+
543
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
544
+ exports.mergeConfig = exports.extend = void 0;
545
+ var extend = function (to, from) {
546
+ for (var key in from) {
547
+ to[key] = from[key];
548
+ }
549
+ return to;
550
+ };
551
+ exports.extend = extend;
552
+ var strats = Object.create(null);
553
+ var mergeConfig = function (config1, config2) {
554
+ if (!config2) {
555
+ config2 = {};
556
+ }
557
+ var config = Object.create(null);
558
+ function defaultStrat(val1, val2) {
559
+ return typeof val2 !== "undefined" ? val2 : val1;
560
+ }
561
+ for (var key in config2) {
562
+ if (Object.prototype.hasOwnProperty.call(config2, key)) {
563
+ mergeField(key);
564
+ }
565
+ }
566
+ for (var key in config1) {
567
+ if (!Object.prototype.hasOwnProperty.call(config2, key)) {
568
+ mergeField(key);
569
+ }
570
+ }
571
+ function mergeField(key) {
572
+ var strat = strats[key] || defaultStrat;
573
+ config[key] = strat(config1[key], config2[key]);
574
+ }
575
+ return config;
576
+ };
577
+ exports.mergeConfig = mergeConfig;
578
+
579
+
580
+ /***/ }),
581
+ /* 10 */
582
+ /***/ ((__unused_webpack_module, exports) => {
583
+
584
+
585
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
586
+ var defaults = {
587
+ method: "get",
588
+ timeout: 0,
589
+ headers: {
590
+ common: {
591
+ Accept: "application/json, text/plain, */*",
592
+ },
593
+ },
594
+ };
595
+ exports.default = defaults;
596
+
597
+
598
+ /***/ }),
599
+ /* 11 */
600
+ /***/ ((__unused_webpack_module, exports) => {
601
+
602
+
603
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
604
+
605
+
606
+ /***/ }),
607
+ /* 12 */
608
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
609
+
610
+
611
+ var __importDefault = (this && this.__importDefault) || function (mod) {
612
+ return (mod && mod.__esModule) ? mod : { "default": mod };
613
+ };
614
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
615
+ exports.AppCommon = void 0;
616
+ var bridge_1 = __importDefault(__webpack_require__(6));
617
+ var AppCommon = /** @class */ (function () {
618
+ function AppCommon() {
619
+ }
620
+ AppCommon.prototype.openScan = function (params) {
621
+ var appFunc = {
622
+ method: "startScanCode",
623
+ params: params,
624
+ };
625
+ return bridge_1.default.postMessage(appFunc);
626
+ };
627
+ AppCommon.prototype.shareMsgToWXAPI = function (params) {
628
+ var appFunc = {
629
+ method: "shareMessageToWXReq",
630
+ params: params,
631
+ };
632
+ return bridge_1.default.postMessage(appFunc);
633
+ };
634
+ AppCommon.prototype.getLocation = function (params) {
635
+ var appFunc = {
636
+ method: "currentLocation",
637
+ params: params,
638
+ };
639
+ return bridge_1.default.postMessage(appFunc);
640
+ };
641
+ AppCommon.prototype.getAppVersion = function () {
642
+ var appFunc = {
643
+ method: "appVersion",
644
+ };
645
+ return bridge_1.default.postMessage(appFunc);
646
+ };
647
+ AppCommon.prototype.onSelectContacts = function () {
648
+ var appFunc = {
649
+ method: "selectContacts",
650
+ };
651
+ return bridge_1.default.postMessage(appFunc);
652
+ };
653
+ AppCommon.prototype.onSaveImageToLocal = function (params) {
654
+ var appFunc = {
655
+ method: "saveImageToLocal",
656
+ params: params,
657
+ };
658
+ return bridge_1.default.postMessage(appFunc);
659
+ };
660
+ AppCommon.prototype.getEnvironment = function () {
661
+ var appFunc = {
662
+ method: "getEnvironment",
663
+ };
664
+ return bridge_1.default.postMessage(appFunc);
665
+ };
666
+ return AppCommon;
667
+ }());
668
+ exports.AppCommon = AppCommon;
669
+
670
+
671
+ /***/ }),
672
+ /* 13 */
673
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
674
+
675
+
676
+ var __importDefault = (this && this.__importDefault) || function (mod) {
677
+ return (mod && mod.__esModule) ? mod : { "default": mod };
678
+ };
679
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
680
+ exports.AppNavigator = void 0;
681
+ var bridge_1 = __importDefault(__webpack_require__(6));
682
+ var AppNavigator = /** @class */ (function () {
683
+ function AppNavigator() {
684
+ }
685
+ /**
686
+ * 关闭当前h5应用
687
+ */
688
+ AppNavigator.prototype.closeH5App = function () {
689
+ var appFunc = {
690
+ method: "backToBefore",
691
+ params: {},
692
+ };
693
+ bridge_1.default.postMessage(appFunc).then().catch();
694
+ };
695
+ /**
696
+ * 设置导航栏标题
697
+ * @param params
698
+ */
699
+ AppNavigator.prototype.setNavigatorTitle = function (params) {
700
+ var appFunc = {
701
+ method: "setTitle",
702
+ params: params,
703
+ };
704
+ bridge_1.default.postMessage(appFunc).then().catch();
705
+ };
706
+ /**
707
+ * 设置导航栏样式
708
+ * @param params
709
+ */
710
+ AppNavigator.prototype.setNavigatorStyle = function (params) {
711
+ var appFunc = {
712
+ method: "setStyle",
713
+ params: params,
714
+ };
715
+ bridge_1.default.postMessage(appFunc).then().catch();
716
+ };
717
+ /**
718
+ * 获取导航页和状态栏的frame
719
+ */
720
+ AppNavigator.prototype.getNavigatorFrame = function () {
721
+ var appFunc = {
722
+ method: "getNavigationFrame",
723
+ };
724
+ return bridge_1.default.postMessage(appFunc);
725
+ };
726
+ AppNavigator.prototype.loadUrl = function (params) {
727
+ var appFunc = {
728
+ method: "loadUrl",
729
+ params: params,
730
+ };
731
+ bridge_1.default.postMessage(appFunc).then().catch();
732
+ };
733
+ return AppNavigator;
734
+ }());
735
+ exports.AppNavigator = AppNavigator;
736
+
737
+
738
+ /***/ }),
739
+ /* 14 */
740
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
741
+
742
+
743
+ var __importDefault = (this && this.__importDefault) || function (mod) {
744
+ return (mod && mod.__esModule) ? mod : { "default": mod };
745
+ };
746
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
747
+ exports.AppPay = void 0;
748
+ var bridge_1 = __importDefault(__webpack_require__(6));
749
+ var AppPay = /** @class */ (function () {
750
+ function AppPay() {
751
+ }
752
+ AppPay.prototype.payByWeChat = function (params) {
753
+ var appFunc = {
754
+ method: "payByWeChat",
755
+ params: params,
756
+ };
757
+ return bridge_1.default.postMessage(appFunc);
758
+ };
759
+ AppPay.prototype.payByAli = function (params) {
760
+ var appFunc = {
761
+ method: "payByAli",
762
+ params: params,
763
+ };
764
+ return bridge_1.default.postMessage(appFunc);
765
+ };
766
+ return AppPay;
767
+ }());
768
+ exports.AppPay = AppPay;
769
+
770
+
771
+ /***/ }),
772
+ /* 15 */
773
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
774
+
775
+
776
+ var __importDefault = (this && this.__importDefault) || function (mod) {
777
+ return (mod && mod.__esModule) ? mod : { "default": mod };
778
+ };
779
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
780
+ exports.AppUser = void 0;
781
+ var bridge_1 = __importDefault(__webpack_require__(6));
782
+ var AppUser = /** @class */ (function () {
783
+ function AppUser() {
784
+ }
785
+ /**
786
+ * 调用OAuth2.0 授权接口
787
+ * @param params
788
+ * @returns
789
+ */
790
+ AppUser.prototype.authorize = function (params) {
791
+ var appFunc = {
792
+ method: "authorize",
793
+ params: params,
794
+ };
795
+ return bridge_1.default.postMessage(appFunc);
796
+ };
797
+ return AppUser;
798
+ }());
799
+ exports.AppUser = AppUser;
800
+
801
+
802
+ /***/ })
803
+ /******/ ]);
804
+ /************************************************************************/
805
+ /******/ // The module cache
806
+ /******/ var __webpack_module_cache__ = {};
807
+ /******/
808
+ /******/ // The require function
809
+ /******/ function __webpack_require__(moduleId) {
810
+ /******/ // Check if module is in cache
811
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
812
+ /******/ if (cachedModule !== undefined) {
813
+ /******/ return cachedModule.exports;
814
+ /******/ }
815
+ /******/ // Create a new module (and put it into the cache)
816
+ /******/ var module = __webpack_module_cache__[moduleId] = {
817
+ /******/ // no module.id needed
818
+ /******/ // no module.loaded needed
819
+ /******/ exports: {}
820
+ /******/ };
821
+ /******/
822
+ /******/ // Execute the module function
823
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
824
+ /******/
825
+ /******/ // Return the exports of the module
826
+ /******/ return module.exports;
827
+ /******/ }
828
+ /******/
829
+ /************************************************************************/
830
+ /******/
831
+ /******/ // startup
832
+ /******/ // Load entry module and return exports
833
+ /******/ // This entry module is referenced by other modules so it can't be inlined
834
+ /******/ var __webpack_exports__ = __webpack_require__(0);
835
+ /******/
836
+ /******/ return __webpack_exports__;
837
+ /******/ })()
838
+ ;
839
+ });