@gjzq/sdk 1.3.1-beta.1 → 1.4.0-beta.1

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.
@@ -9,7 +9,7 @@ import { LoginType } from '../utils/const.mjs';
9
9
 
10
10
  function loginWithTokenForWeb(loginType) {
11
11
  return __awaiter(this, void 0, void 0, function () {
12
- var accountType, instantToken, oldInstantToken, fundAccountLoginResult, marginAccountLoginResult, opStation, _a, code, data, _b, code, data;
12
+ var accountType, instantToken, oldInstantToken, fundAccountLoginResult, marginAccountLoginResult, opStation, _a, code_1, data_1, _b, code, data;
13
13
  return __generator(this, function (_c) {
14
14
  switch (_c.label) {
15
15
  case 0:
@@ -25,10 +25,9 @@ function loginWithTokenForWeb(loginType) {
25
25
  // 2025.01.02 经讨论 退登不解绑!!
26
26
  // bindInfo({ pid: null, clientId: null })
27
27
  return [2 /*return*/, false];
28
- } else {
29
- bindInfo(fundAccountLoginResult.data);
30
- return [2 /*return*/, true];
31
28
  }
29
+ bindInfo(fundAccountLoginResult.data);
30
+ return [2 /*return*/, true];
32
31
  case 2:
33
32
  if (!(loginType === LoginType.MARGINACCOUNT)) return [3 /*break*/, 4];
34
33
  return [4 /*yield*/, checkMarginAccountLogin()];
@@ -38,14 +37,15 @@ function loginWithTokenForWeb(loginType) {
38
37
  // 2025.01.02 经讨论 退登不解绑!!
39
38
  // bindInfo({ pid: null, clientId: null })
40
39
  return [2 /*return*/, false];
41
- } else {
42
- bindInfo(marginAccountLoginResult.data);
43
- return [2 /*return*/, true];
44
40
  }
41
+ bindInfo(marginAccountLoginResult.data);
42
+ return [2 /*return*/, true];
45
43
  case 4:
46
44
  return [3 /*break*/, 6];
47
45
  case 5:
48
- instantToken !== 'notoken' ? localStorage.setItem('instant_token', instantToken) : null;
46
+ if (instantToken && instantToken !== 'notoken') {
47
+ localStorage.setItem('instant_token', instantToken);
48
+ }
49
49
  _c.label = 6;
50
50
  case 6:
51
51
  opStation = getQueryString('op_station');
@@ -61,9 +61,9 @@ function loginWithTokenForWeb(loginType) {
61
61
  instant_token: instantToken
62
62
  })];
63
63
  case 7:
64
- _a = _c.sent(), code = _a.code, data = _a.data;
65
- bindInfo(data);
66
- return [2 /*return*/, code === 0];
64
+ _a = _c.sent(), code_1 = _a.code, data_1 = _a.data;
65
+ bindInfo(data_1);
66
+ return [2 /*return*/, code_1 === 0];
67
67
  case 8:
68
68
  return [4 /*yield*/, fundAccountLogin({
69
69
  op_station: opStation,
@@ -9,10 +9,9 @@ import { http } from '../http/index.mjs';
9
9
  */
10
10
  function logoutForWeb(loginType) {
11
11
  if (loginType) {
12
- return http.post(API_URL + "/logout/".concat(loginType));
13
- } else {
14
- return http.post(API_URL + '/logout', {});
12
+ return http.post("".concat(API_URL, "/logout/").concat(loginType));
15
13
  }
14
+ return http.post("".concat(API_URL, "/logout"), {});
16
15
  }
17
16
 
18
17
  export { logoutForWeb };
@@ -8,7 +8,7 @@ import { http } from '../http/index.mjs';
8
8
  * @returns {Promise<HttpResponse> }
9
9
  */
10
10
  function marginAccountLogin(param) {
11
- return http.post(API_URL + '/login/marginAccount', param);
11
+ return http.post("".concat(API_URL, "/login/marginAccount"), param);
12
12
  }
13
13
 
14
14
  export { marginAccountLogin };
@@ -8,9 +8,9 @@ import { pageInit } from '../pageInit/index.mjs';
8
8
  import { getAppId } from '../getAppId/index.mjs';
9
9
 
10
10
  //特殊环境情况可通过全局变量修改
11
- var EVOLUTION_UNIVERSAL_URL = window.EVOLUTION_UNIVERSAL_URL || window.location.toString().indexOf('https://devwebapps.yjbtest.com') > -1 ? "https://linkm.yjbtest.com/download/app-download.html" : "https://linkm.yongjinbao.com.cn/download/app-download.html";
12
- var EVOLUTION_TXAPP_URL = window.EVOLUTION_TXAPP_URL || "https://a.app.qq.com/o/simple.jsp?pkgname=cn.com.gjzq.yjb2";
13
- var EVOLUTION_ANDOWNLOAD_URL = window.EVOLUTION_ANDOWNLOAD_URL || "https://appdl.yongjinbao.com.cn/yjb/android/yongjinbao.apk";
11
+ var EVOLUTION_UNIVERSAL_URL = window.EVOLUTION_UNIVERSAL_URL || window.location.toString().indexOf('https://devwebapps.yjbtest.com') > -1 ? 'https://linkm.yjbtest.com/download/app-download.html' : 'https://linkm.yongjinbao.com.cn/download/app-download.html';
12
+ var EVOLUTION_TXAPP_URL = window.EVOLUTION_TXAPP_URL || 'https://a.app.qq.com/o/simple.jsp?pkgname=cn.com.gjzq.yjb2';
13
+ var EVOLUTION_ANDOWNLOAD_URL = window.EVOLUTION_ANDOWNLOAD_URL || 'https://appdl.yongjinbao.com.cn/yjb/android/yongjinbao.apk';
14
14
  var EVOLUTION_MINIAPP_URL = window.EVOLUTION_MINIAPP_URL || EVOLUTION_UNIVERSAL_URL;
15
15
  /**
16
16
  * 跳转至APP下载并传参
@@ -77,8 +77,8 @@ var openAppForWeb = function openAppForWeb(selector, config, urlConfig) {
77
77
  case 5:
78
78
  oConfig = config || {};
79
79
  /**
80
- * 处理可能存在的url中包含多余分享字段
81
- */
80
+ * 处理可能存在的url中包含多余分享字段
81
+ */
82
82
  if (oConfig && oConfig.param && oConfig.param.url) {
83
83
  url = new CustomURI(oConfig.param.url);
84
84
  url.setQuery({
@@ -91,7 +91,7 @@ var openAppForWeb = function openAppForWeb(selector, config, urlConfig) {
91
91
  try {
92
92
  searchParams = new URLSearchParams(location.search);
93
93
  shareMarkInfo = encodeURIComponent(searchParams.get('shareMarkInfo') || '');
94
- } catch (e) {}
94
+ } catch (e) {/* empty */}
95
95
  schemeUrl = "com.yjb.jy://?action=".concat(action);
96
96
  if (isIos) {
97
97
  //TOTO 地址后面需要灵活配置
@@ -119,7 +119,7 @@ var openAppForWeb = function openAppForWeb(selector, config, urlConfig) {
119
119
  config = JSON.parse(data);
120
120
  if (dataUrl) urlConfig = JSON.parse(dataUrl);
121
121
  setConfigParams(config, urlConfig);
122
- } catch (e) {}
122
+ } catch (e) {/* empty */}
123
123
  }
124
124
  return isIos ? 'yjbapp://' : schemeUrl;
125
125
  }
@@ -164,30 +164,28 @@ var openAppForWeb = function openAppForWeb(selector, config, urlConfig) {
164
164
  var url = "".concat(evolution_universal_url).concat(evolution_universal_url.includes('?') ? '&' : '?', "action=").concat(action, "&shareMarkInfo=").concat(shareMarkInfo);
165
165
  pageInit(evolution_scene_url ? "".concat(url, "&sceneUrl=").concat(encodeURIComponent(evolution_scene_url)) : "".concat(url), false, {});
166
166
  }
167
- } else {
168
- if (isAndroid) {
169
- //原设置为4000
170
- var t_1 = 1000,
171
- hasApp_1 = true;
172
- //设置定时器,判断如果没有呼起app,则调用定时器,跳转下载(至腾讯应用宝 or apk下载)
173
- setTimeout(function () {
174
- if (!hasApp_1) {
175
- var url = evolution_scene_url || (appId === 'insertApp' ? "".concat(evolution_txapp_url, "&android_schema=").concat(encodeURIComponent(schemeUrl)) : evolution_andownload_url);
176
- pageInit("".concat(url), false, {});
177
- }
178
- }, 1500);
179
- var t1_1 = Date.now();
180
- window.location.href = schemeUrl;
181
- setTimeout(function () {
182
- var t2 = Date.now();
183
- if (t2 - t1_1 < t_1 + 100) {
184
- hasApp_1 = false;
185
- }
186
- }, t_1);
187
- } else if (isIos) {
188
- var url = "".concat(evolution_universal_url).concat(evolution_universal_url.includes('?') ? '&' : '?', "action=").concat(action, "&shareMarkInfo=").concat(shareMarkInfo);
189
- pageInit(evolution_scene_url ? "".concat(url, "&sceneUrl=").concat(encodeURIComponent(evolution_scene_url)) : "".concat(url), false, {});
190
- }
167
+ } else if (isAndroid) {
168
+ //原设置为4000
169
+ var t_1 = 1000,
170
+ hasApp_1 = true;
171
+ //设置定时器,判断如果没有呼起app,则调用定时器,跳转下载(至腾讯应用宝 or apk下载)
172
+ setTimeout(function () {
173
+ if (!hasApp_1) {
174
+ var url = evolution_scene_url || (appId === 'insertApp' ? "".concat(evolution_txapp_url, "&android_schema=").concat(encodeURIComponent(schemeUrl)) : evolution_andownload_url);
175
+ pageInit("".concat(url), false, {});
176
+ }
177
+ }, 1500);
178
+ var t1_1 = Date.now();
179
+ window.location.href = schemeUrl;
180
+ setTimeout(function () {
181
+ var t2 = Date.now();
182
+ if (t2 - t1_1 < t_1 + 100) {
183
+ hasApp_1 = false;
184
+ }
185
+ }, t_1);
186
+ } else if (isIos) {
187
+ var url = "".concat(evolution_universal_url).concat(evolution_universal_url.includes('?') ? '&' : '?', "action=").concat(action, "&shareMarkInfo=").concat(shareMarkInfo);
188
+ pageInit(evolution_scene_url ? "".concat(url, "&sceneUrl=").concat(encodeURIComponent(evolution_scene_url)) : "".concat(url), false, {});
191
189
  }
192
190
  };
193
191
  return [2 /*return*/];
@@ -3,6 +3,9 @@ import { LoginType } from '../utils/const.mjs';
3
3
  import { getFundAccountTokenForHybrid, getUserTokenForHybrid } from '../utils/loginFuncs.mjs';
4
4
  import { multiLogin } from '../multiLogin/index.mjs';
5
5
 
6
+ /* eslint-disable @typescript-eslint/no-unused-vars */
7
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
8
+ /* eslint-disable no-async-promise-executor */
6
9
  /**
7
10
  * 客户端与服务端登录态同步
8
11
  * @function syncLoginStatusBetweenNativeAndServer
@@ -19,7 +22,7 @@ function syncLoginStatusBetweenNativeAndServer(syncLoginTypes) {
19
22
  return __generator(this, function (_b) {
20
23
  switch (_b.label) {
21
24
  case 0:
22
- console.log("syncLoginTypes", syncLoginTypes);
25
+ console.log('syncLoginTypes', syncLoginTypes);
23
26
  getLoginParamPromises = [];
24
27
  if (syncLoginTypes.includes(LoginType.FUNDACCOUNT)) {
25
28
  getLoginParamPromises.push(getFundAccountTokenForHybrid());
@@ -8,7 +8,7 @@ import { http } from '../http/index.mjs';
8
8
  * @returns {Promise<HttpResponse>}
9
9
  */
10
10
  function userLoginForWeb(param) {
11
- return http.post(API_URL + '/login/user', param);
11
+ return http.post("".concat(API_URL, "/login/user"), param);
12
12
  }
13
13
 
14
14
  export { userLoginForWeb };
@@ -1,10 +1,7 @@
1
- import { __awaiter, __generator } from '../node_modules/tslib/tslib.es6.mjs';
2
1
  import AES from 'crypto-js/aes.js';
3
2
  import Utf8 from 'crypto-js/enc-utf8.js';
4
3
  import ECB from 'crypto-js/mode-ecb.js';
5
- import { Env, WEBAPPS_HOST, PAYMENT_DOMAIN, HYBRID, WEBAPPS, MESSAGE, ALL_NO_SYSTEM_PARAM_KEYS, envRules } from './const.mjs';
6
- import { nativeIOOperation } from '../nativeIOOperation/index.mjs';
7
- import { ready } from '../ready/index.mjs';
4
+ import { Env, WEBAPPS_HOST, PAYMENT_DOMAIN, HYBRID, WEBAPPS, envRules } from './const.mjs';
8
5
 
9
6
  /**
10
7
  * 判断一个值是否是函数
@@ -215,67 +212,6 @@ var getSysTimeDomain = function getSysTimeDomain() {
215
212
  function isWeixinClient() {
216
213
  return !!navigator.userAgent.match(/MicroMessenger/i);
217
214
  }
218
- /**
219
- * hybrid 读取非系统参数
220
- * @param keys
221
- * @returns
222
- */
223
- function readHybridNoSystemParam() {
224
- return __awaiter(this, arguments, void 0, function (keys) {
225
- if (keys === void 0) {
226
- keys = ALL_NO_SYSTEM_PARAM_KEYS;
227
- }
228
- return __generator(this, function (_a) {
229
- switch (_a.label) {
230
- case 0:
231
- return [4 /*yield*/, ready()];
232
- case 1:
233
- _a.sent();
234
- return [2 /*return*/, nativeIOOperation(4004, {
235
- keys: keys
236
- })];
237
- }
238
- });
239
- });
240
- }
241
- /**
242
- * hybrid 读取系统参数,native异常时,返回空对象
243
- * @param keys
244
- * @returns
245
- */
246
- function readHybridSystemParamIgnoreError(keys) {
247
- var _this = this;
248
- if (keys === void 0) {
249
- keys = ALL_NO_SYSTEM_PARAM_KEYS;
250
- }
251
- return new Promise(function (resolve, reject) {
252
- return __awaiter(_this, void 0, void 0, function () {
253
- var nonSystemParamRes;
254
- return __generator(this, function (_a) {
255
- switch (_a.label) {
256
- case 0:
257
- return [4 /*yield*/, readHybridNoSystemParam(keys)];
258
- case 1:
259
- nonSystemParamRes = _a.sent();
260
- if (nonSystemParamRes.code != 0) {
261
- resolve && resolve({
262
- code: 0,
263
- result: {},
264
- message: nonSystemParamRes.message || MESSAGE.NATIVE_ERROR
265
- });
266
- } else {
267
- resolve && resolve({
268
- code: 0,
269
- result: nonSystemParamRes.result,
270
- message: MESSAGE.SUCCESS
271
- });
272
- }
273
- return [2 /*return*/];
274
- }
275
- });
276
- });
277
- });
278
- }
279
215
  /**
280
216
  * 判断是否是iframe嵌套环境
281
217
  * @returns 是否是iframe嵌套环境
@@ -290,4 +226,4 @@ function iframePostMessage(data) {
290
226
  window.top && window.top.postMessage(data, '*');
291
227
  }
292
228
 
293
- export { decrypt, detectDevice, deviceReady, getApiUrlPath, getEnv, getPreOrderDomain, getSysTimeDomain, getWebappsEnv, getWebappsPath, getWechatAuthDomain, getWechatUserInfoDomain, iframePostMessage, isBridgeReady, isFunction$2 as isFunction, isIframeClient, isObject$1 as isObject, isWKWebView, isWeixinClient, readHybridNoSystemParam, readHybridSystemParamIgnoreError, setWindowObjectValue };
229
+ export { decrypt, detectDevice, deviceReady, getApiUrlPath, getEnv, getPreOrderDomain, getSysTimeDomain, getWebappsEnv, getWebappsPath, getWechatAuthDomain, getWechatUserInfoDomain, iframePostMessage, isBridgeReady, isFunction$2 as isFunction, isIframeClient, isObject$1 as isObject, isWKWebView, isWeixinClient, setWindowObjectValue };
@@ -1,12 +1,22 @@
1
1
  import { __awaiter, __generator, __assign as _assign } from '../node_modules/tslib/tslib.es6.mjs';
2
2
  import { http } from '../http/index.mjs';
3
3
  import { API_URL } from './urls.mjs';
4
- import { LoginType, NO_TOKEN, MESSAGE, CHANNELID, DEFAULT_RESPONSE } from './const.mjs';
5
- import { readHybridNoSystemParam } from './funcs.mjs';
4
+ import { LoginType, NO_TOKEN, MESSAGE, CHANNELID, ALL_NO_SYSTEM_PARAM_KEYS, DEFAULT_RESPONSE } from './const.mjs';
6
5
  import { getUserUKeysByChannelId } from '../getUserUKeysByChannelId/index.mjs';
7
6
  import { nativeIOOperation } from '../nativeIOOperation/index.mjs';
8
- import { ready } from '../ready/index.mjs';
9
7
 
8
+ function readHybridNoSystemParam$1() {
9
+ return __awaiter(this, arguments, void 0, function (keys) {
10
+ if (keys === void 0) {
11
+ keys = ALL_NO_SYSTEM_PARAM_KEYS;
12
+ }
13
+ return __generator(this, function (_a) {
14
+ return [2 /*return*/, nativeIOOperation(4004, {
15
+ keys: keys
16
+ })];
17
+ });
18
+ });
19
+ }
10
20
  function checkFundAccountLoginFromServer() {
11
21
  return http.get(API_URL + '/login/fundAccount');
12
22
  }
@@ -27,13 +37,10 @@ function fetchYJBAPI(param_1) {
27
37
  return __generator(this, function (_a) {
28
38
  switch (_a.label) {
29
39
  case 0:
30
- return [4 /*yield*/, ready()];
31
- case 1:
32
- _a.sent();
33
40
  return [4 /*yield*/, nativeIOOperation(1001, Object.assign({}, options, {
34
41
  param: param
35
42
  }))];
36
- case 2:
43
+ case 1:
37
44
  nativeResponse = _a.sent();
38
45
  if (nativeResponse.code != 0) {
39
46
  //客户端调用失败或网络错误
@@ -100,7 +107,7 @@ function getFundAccountTokenForHybrid() {
100
107
  return __generator(this, function (_a) {
101
108
  switch (_a.label) {
102
109
  case 0:
103
- return [4 /*yield*/, readHybridNoSystemParam(['fundAccount', 'opStation'])];
110
+ return [4 /*yield*/, readHybridNoSystemParam$1(['fundAccount', 'opStation'])];
104
111
  case 1:
105
112
  nonSystemParamRes = _a.sent();
106
113
  if (nonSystemParamRes.code != 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjzq/sdk",
3
- "version": "1.3.1-beta.1",
3
+ "version": "1.4.0-beta.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -111,5 +111,8 @@
111
111
  "./es/pure.mjs"
112
112
  ],
113
113
  "author": "佣金宝前端",
114
- "license": "MIT"
114
+ "license": "MIT",
115
+ "volta": {
116
+ "node": "20.11.1"
117
+ }
115
118
  }