xctc-utils 1.6.68 → 1.6.70

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.
@@ -23,28 +23,28 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.onlinePay = exports.shareReady = exports.configReady = exports.getCode = exports.envSDK = exports.getUrlCode = exports.loadWeiXinSDK = void 0;
26
+ exports.onlinePay = exports.shareReady = exports.configReady = exports.getCode = exports.envSDK = exports.getUrlCode = exports.initWeixinConfig = exports.loadWeiXinSDK = void 0;
27
27
  // import * as weixin from 'weixin-js-sdk' // 引入微信SDK
28
28
  // const weixin = require("weixin-js-sdk")
29
- var utils_1 = require("../utils");
30
- var crypto_1 = require("../crypto");
31
- var params = __importStar(require("../params"));
32
- var is_1 = require("../is");
33
- var index_1 = require("../storage/index");
34
- var utils_2 = require("../utils");
35
- var w = window;
36
- var loc = w.location;
37
- var defaultKey = "5uMz4R8r0926DkC8";
38
- var defaultIv = "5uMz4R8r0926DkC8";
29
+ const utils_1 = require("../utils");
30
+ const crypto_1 = require("../crypto");
31
+ const params = __importStar(require("../params"));
32
+ const is_1 = require("../is");
33
+ const index_1 = require("../storage/index");
34
+ const utils_2 = require("../utils");
35
+ const w = window;
36
+ const loc = w.location;
37
+ const defaultKey = "5uMz4R8r0926DkC8";
38
+ const defaultIv = "5uMz4R8r0926DkC8";
39
39
  var weixinConfig = {};
40
- var weixinUrl = "https://res.wx.qq.com/open/js/jweixin-1.6.0.js";
41
- var weixinJsSource = "";
40
+ let weixinUrl = "https://res.wx.qq.com/open/js/jweixin-1.6.0.js";
41
+ let weixinJsSource = "";
42
42
  function loadWeiXinSDK(url, callback) {
43
- var win = window;
43
+ const win = window;
44
44
  if (url) {
45
45
  weixinUrl = url;
46
46
  }
47
- (0, utils_2.loadScript)(weixinUrl, function () {
47
+ (0, utils_2.loadScript)(weixinUrl, () => {
48
48
  weixinJsSource = (win === null || win === void 0 ? void 0 : win.wx) || "";
49
49
  if (typeof callback === "function") {
50
50
  callback();
@@ -52,39 +52,35 @@ function loadWeiXinSDK(url, callback) {
52
52
  });
53
53
  }
54
54
  exports.loadWeiXinSDK = loadWeiXinSDK;
55
- function getUrlCode(config) {
55
+ function initWeixinConfig(config) {
56
56
  var _a;
57
- if (!(0, utils_1.weixinBrowser)()) {
58
- console.error("非微信环境下,该函数将终止执行!");
59
- return;
60
- }
61
57
  config = config || {};
62
- var appId = (config === null || config === void 0 ? void 0 : config.appId) || "";
58
+ let appId = (config === null || config === void 0 ? void 0 : config.appId) || "";
63
59
  if (!appId)
64
60
  return;
65
61
  weixinConfig = config;
66
- var scope = (config === null || config === void 0 ? void 0 : config.scope) || "snsapi_userinfo";
67
- var codeKey = (config === null || config === void 0 ? void 0 : config.codeKey) || "weixinAuthCode";
68
- var stateKey = (config === null || config === void 0 ? void 0 : config.stateKey) || "weixinAuthState";
62
+ let scope = (config === null || config === void 0 ? void 0 : config.scope) || "snsapi_userinfo";
63
+ let codeKey = (config === null || config === void 0 ? void 0 : config.codeKey) || "weixinAuthCode";
64
+ let stateKey = (config === null || config === void 0 ? void 0 : config.stateKey) || "weixinAuthState";
69
65
  weixinConfig['scope'] = scope;
70
66
  weixinConfig['codeKey'] = codeKey;
71
67
  weixinConfig['stateKey'] = stateKey;
72
68
  (0, index_1.useSessionStorage)("weixinConfig", weixinConfig);
73
- var _b = weixinConfig.cryptoiv, cryptoiv = _b === void 0 ? defaultIv : _b, _c = weixinConfig.cryptokey, cryptokey = _c === void 0 ? defaultKey : _c, _d = weixinConfig.debuggerStatus, debuggerStatus = _d === void 0 ? false : _d;
69
+ let { cryptoiv = defaultIv, cryptokey = defaultKey, debuggerStatus = false } = weixinConfig;
74
70
  initSdk(); // 加载微信sdk环境
75
71
  // 默认第一次通过链接进入系统,没有code和state
76
- var codeIndex = -1;
77
- var stateIndex = -1;
78
- var msgStr = "";
79
- var isAuth = false; // 是否完成 code 授权
80
- var search = loc.search; // ?code=0916SzFa1KH9TA0Ke7Ha1AQx6446SzFr&state=123
72
+ let codeIndex = -1;
73
+ let stateIndex = -1;
74
+ let msgStr = "";
75
+ let isAuth = false; // 是否完成 code 授权
76
+ let search = loc.search; // ?code=0916SzFa1KH9TA0Ke7Ha1AQx6446SzFr&state=123
81
77
  if (search) {
82
78
  codeIndex = search.indexOf("code=");
83
79
  stateIndex = search.indexOf("state=");
84
80
  isAuth = search.includes("state=state");
85
81
  }
86
82
  // 获取地址栏返回 code 参数值
87
- var localParamsData = (0, index_1.getSessionStorage)("urlParamsData") || "";
83
+ const localParamsData = (0, index_1.getSessionStorage)("urlParamsData") || "";
88
84
  // 本地未存储微信授权 code 值, 并且地址栏携带有 code 值 ,则先存储该值
89
85
  if (codeIndex != -1 && isAuth) {
90
86
  params.get({ keys: ['code'], cache: "session", key: cryptokey, iv: cryptoiv });
@@ -107,8 +103,8 @@ function getUrlCode(config) {
107
103
  }
108
104
  else {
109
105
  // 当前系统本地没有存储 code,流程为用户只需微信授权登录后返回系统,此时通过 CODE 执行微信登录
110
- var urlParamsData = (0, index_1.getSessionStorage)("urlParamsData") || "";
111
- var codeData = ((_a = urlParamsData === null || urlParamsData === void 0 ? void 0 : urlParamsData.code) === null || _a === void 0 ? void 0 : _a.str) || ""; // 第一次进入系统为空
106
+ const urlParamsData = (0, index_1.getSessionStorage)("urlParamsData") || "";
107
+ const codeData = ((_a = urlParamsData === null || urlParamsData === void 0 ? void 0 : urlParamsData.code) === null || _a === void 0 ? void 0 : _a.str) || ""; // 第一次进入系统为空
112
108
  login(codeData);
113
109
  }
114
110
  return;
@@ -130,6 +126,16 @@ function getUrlCode(config) {
130
126
  return getCode();
131
127
  }
132
128
  }
129
+ exports.initWeixinConfig = initWeixinConfig;
130
+ function getUrlCode(config) {
131
+ if (!(0, utils_1.weixinBrowser)()) {
132
+ console.error("非微信环境下,该函数将终止执行!");
133
+ return;
134
+ }
135
+ loadWeiXinSDK("", () => {
136
+ initWeixinConfig(config);
137
+ });
138
+ }
133
139
  exports.getUrlCode = getUrlCode;
134
140
  function cryptoConfig(key, iv) {
135
141
  if (!key)
@@ -143,8 +149,7 @@ function cryptoConfig(key, iv) {
143
149
  }
144
150
  // 执行微信登录
145
151
  function login(code) {
146
- var _a;
147
- var appId = weixinConfig.appId, http = weixinConfig.http, redirectUri = weixinConfig.redirectUri, _b = weixinConfig.appIdKey, appIdKey = _b === void 0 ? "app_id" : _b, _c = weixinConfig.jsCodeKey, jsCodeKey = _c === void 0 ? "js_code" : _c, _d = weixinConfig.cb, cb = _d === void 0 ? "" : _d, _e = weixinConfig.debuggerStatus, debuggerStatus = _e === void 0 ? false : _e;
152
+ let { appId, http, redirectUri, appIdKey = "app_id", jsCodeKey = "js_code", cb = "", debuggerStatus = false } = weixinConfig;
148
153
  if (debuggerStatus) {
149
154
  alert("地址栏携带code已完成本地存储 ,执行微信授权逻辑");
150
155
  }
@@ -160,17 +165,17 @@ function login(code) {
160
165
  console.error("未正常传入微信授权登录http函数");
161
166
  return;
162
167
  }
163
- var obj = (_a = {},
164
- _a[appIdKey] = appId,
165
- _a[jsCodeKey] = code,
166
- _a);
168
+ let obj = {
169
+ [appIdKey]: appId,
170
+ [jsCodeKey]: code
171
+ };
167
172
  (0, index_1.useSessionStorage)("loginParams", JSON.stringify(obj));
168
173
  // 调试字段 isPassLogin ,为true 时不继续执行微信登录,前端可拿到 code 给后端测试
169
174
  // if(weixinConfig['isPassLogin']) return
170
- weixinConfig === null || weixinConfig === void 0 ? void 0 : weixinConfig.http(obj).then(function (res) {
175
+ weixinConfig === null || weixinConfig === void 0 ? void 0 : weixinConfig.http(obj).then((res) => {
171
176
  var _a;
172
177
  (0, index_1.useSessionStorage)("loginRes", res);
173
- var code = -1;
178
+ let code = -1;
174
179
  if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("code")) {
175
180
  code = res.code;
176
181
  }
@@ -185,7 +190,7 @@ function login(code) {
185
190
  // 未登录则先执行登录
186
191
  return getCode();
187
192
  }
188
- var data = {};
193
+ let data = {};
189
194
  if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("data")) {
190
195
  data = res.data;
191
196
  }
@@ -196,44 +201,44 @@ function login(code) {
196
201
  console.error("http响应数据格式必须是:res:{code:xx,data:{}}");
197
202
  return;
198
203
  }
199
- for (var key in data) {
200
- var item = data[key];
204
+ for (let key in data) {
205
+ let item = data[key];
201
206
  if (item instanceof Object) {
202
207
  item = JSON.stringify(item);
203
208
  }
204
209
  (0, index_1.useSessionStorage)(key, item);
205
210
  (0, index_1.useLocalStorage)(key, item);
206
211
  }
207
- var url = loc.origin;
212
+ let url = loc.origin;
208
213
  if (redirectUri) {
209
214
  url = encodeURIComponent(redirectUri);
210
215
  }
211
- var hashVal = loc.hash;
212
- var urlParamsData = (0, index_1.getSessionStorage)("urlParamsData") || "";
213
- var stateData = ((_a = urlParamsData === null || urlParamsData === void 0 ? void 0 : urlParamsData.state) === null || _a === void 0 ? void 0 : _a.data) || ""; // 默认有值,链接携带
214
- var str = "";
216
+ const hashVal = loc.hash;
217
+ const urlParamsData = (0, index_1.getSessionStorage)("urlParamsData") || "";
218
+ const stateData = ((_a = urlParamsData === null || urlParamsData === void 0 ? void 0 : urlParamsData.state) === null || _a === void 0 ? void 0 : _a.data) || ""; // 默认有值,链接携带
219
+ let str = "";
215
220
  if ((0, is_1.isObject)(stateData)) {
216
- for (var key in stateData) {
221
+ for (let key in stateData) {
217
222
  if (key == "path") {
218
223
  if (stateData[key][0] == "/") {
219
- url = "".concat(url, "/#").concat(stateData.path);
224
+ url = `${url}/#${stateData.path}`;
220
225
  }
221
226
  else {
222
- url = "".concat(url, "/#/").concat(stateData.path);
227
+ url = `${url}/#/${stateData.path}`;
223
228
  }
224
229
  }
225
230
  else {
226
- str += "".concat(key, "=").concat(stateData[key], "&");
231
+ str += `${key}=${stateData[key]}&`;
227
232
  }
228
233
  }
229
234
  if (stateData === null || stateData === void 0 ? void 0 : stateData.path) {
230
235
  if (str) {
231
- url = "".concat(url, "?").concat(str);
236
+ url = `${url}?${str}`;
232
237
  }
233
238
  }
234
239
  }
235
240
  else if (hashVal) {
236
- url = "".concat(url, "/").concat(hashVal);
241
+ url = `${url}/${hashVal}`;
237
242
  }
238
243
  if (weixinConfig['isPassLogin']) {
239
244
  console.log("不执行跳转操作");
@@ -246,7 +251,7 @@ function login(code) {
246
251
  loc.replace(url);
247
252
  }
248
253
  }
249
- }).catch(function (err) {
254
+ }).catch((err) => {
250
255
  (0, index_1.useSessionStorage)("loginError", err);
251
256
  });
252
257
  }
@@ -255,21 +260,20 @@ function login(code) {
255
260
  * 获取地址栏中的 search 参数,将参数转换为数组,最终返回地址栏参数数组
256
261
  * keys 需要截取字符串开始字符
257
262
  */
258
- function formatSearch(search, keys) {
259
- if (search === void 0) { search = ""; }
263
+ function formatSearch(search = "", keys) {
260
264
  if (!search)
261
265
  return false;
262
- var index = search.indexOf(keys);
266
+ let index = search.indexOf(keys);
263
267
  search = search.substr(index);
264
268
  if (search.startsWith("?")) {
265
269
  search = search.substring(1);
266
270
  }
267
- var urlArr = search.split("&");
271
+ let urlArr = search.split("&");
268
272
  return urlArr;
269
273
  }
270
274
  // 加载当前微信sdk环境
271
275
  function initSdk() {
272
- var wx = null;
276
+ let wx = null;
273
277
  if (w.wx && w.wx.ready) {
274
278
  wx = w.wx;
275
279
  }
@@ -286,14 +290,14 @@ function initSdk() {
286
290
  }
287
291
  // 返回微信环境 sdk
288
292
  function envSDK() {
289
- var env = initSdk() || {};
293
+ const env = initSdk() || {};
290
294
  return env;
291
295
  }
292
296
  exports.envSDK = envSDK;
293
297
  // 前往微信授权登录页面
294
298
  function getCode(appId, scope) {
295
299
  if ((0, utils_1.weixinBrowser)()) {
296
- var id = "";
300
+ let id = "";
297
301
  if (weixinConfig['appId']) {
298
302
  id = weixinConfig['appId'];
299
303
  }
@@ -304,20 +308,20 @@ function getCode(appId, scope) {
304
308
  console.log("调用跳转微信授权方法时getCode,请传入参数:appId");
305
309
  return;
306
310
  }
307
- var scopeVal = "snsapi_userinfo";
311
+ let scopeVal = "snsapi_userinfo";
308
312
  if (weixinConfig['scope']) {
309
313
  scopeVal = weixinConfig.scope;
310
314
  }
311
315
  else if (scope) {
312
316
  scopeVal = scope;
313
317
  }
314
- var uri = encodeURIComponent(loc.origin);
318
+ let uri = encodeURIComponent(loc.origin);
315
319
  if (weixinConfig['redirectUri']) {
316
320
  uri = encodeURIComponent(weixinConfig.redirectUri);
317
321
  }
318
- var base = "https://open.weixin.qq.com/connect/oauth2/authorize?";
319
- var config = "appid=".concat(id, "&redirect_uri=").concat(uri, "&response_type=code&scope=").concat(scopeVal, "&state=state#wechat_redirect");
320
- var wxJumpURL = base + config;
322
+ let base = "https://open.weixin.qq.com/connect/oauth2/authorize?";
323
+ let config = `appid=${id}&redirect_uri=${uri}&response_type=code&scope=${scopeVal}&state=state#wechat_redirect`;
324
+ let wxJumpURL = base + config;
321
325
  loc.replace(wxJumpURL);
322
326
  }
323
327
  else {
@@ -326,20 +330,20 @@ function getCode(appId, scope) {
326
330
  }
327
331
  }
328
332
  exports.getCode = getCode;
329
- var defaultJsApiList = [
333
+ const defaultJsApiList = [
330
334
  'updateAppMessageShareData', 'updateTimelineShareData', "onMenuShareWeibo", "onMenuShareQZone", "startRecord", "stopRecord", "closeWindow", "scanQRCode", "chooseWXPay", "chooseCard", "openCard",
331
335
  "onVoiceRecordEnd", "playVoice", "pauseVoice", "stopVoice", "onVoicePlayEnd", "uploadVoice", "downloadVoice", "chooseImage", "previewImage", "uploadImage", "openProductSpecificView", "addCard",
332
336
  "downloadImage", "translateVoice", "getNetworkType", "openLocation", "getLocation", "hideOptionMenu", "showOptionMenu", "hideMenuItems", "showMenuItems", "hideAllNonBaseMenuItem", "showAllNonBaseMenuItem",
333
337
  ];
334
- var defaultOpenTagList = [
338
+ const defaultOpenTagList = [
335
339
  "wx-open-subscribe", "wx-open-launch-app", "wx-open-launch-weapp",
336
340
  "wx-open-audio"
337
341
  ];
338
- var isContinue = function (dataType) {
339
- var localCodeData = (0, index_1.getSessionStorage)("urlParamsData") || "";
340
- var wxInfo = (0, index_1.getLocalStorage)("WxInfo") || "";
341
- var search = loc.search; // ?code=0916SzFa1KH9TA0Ke7Ha1AQx6446SzFr&state=123
342
- var codeIndex = -1;
342
+ const isContinue = (dataType) => {
343
+ const localCodeData = (0, index_1.getSessionStorage)("urlParamsData") || "";
344
+ let wxInfo = (0, index_1.getLocalStorage)("WxInfo") || "";
345
+ let search = loc.search; // ?code=0916SzFa1KH9TA0Ke7Ha1AQx6446SzFr&state=123
346
+ let codeIndex = -1;
343
347
  if (search) {
344
348
  codeIndex = search.indexOf("code=");
345
349
  }
@@ -360,33 +364,32 @@ var isContinue = function (dataType) {
360
364
  }
361
365
  };
362
366
  function configReady(config) {
363
- var _a;
364
367
  if (!isContinue(config === null || config === void 0 ? void 0 : config.dataType)) {
365
368
  console.error("还未执行微信登录流程");
366
369
  return;
367
370
  }
368
- var _b = config || {}, appId = _b.appId, url = _b.url, _c = _b.urlKey, urlKey = _c === void 0 ? "url" : _c, _d = _b.appIdKey, appIdKey = _d === void 0 ? "appId" : _d, cb = _b.cb, _e = _b.jsApiList, jsApiList = _e === void 0 ? [] : _e, _f = _b.openTagList, openTagList = _f === void 0 ? [] : _f, _g = _b.http, http = _g === void 0 ? "" : _g;
371
+ const { appId, url, urlKey = "url", appIdKey = "appId", cb, jsApiList = [], openTagList = [], http = "" } = config || {};
369
372
  if (!http)
370
373
  return;
371
- var currentUrl = loc.origin;
374
+ let currentUrl = loc.origin;
372
375
  if (url) {
373
376
  currentUrl = url;
374
377
  }
375
- var param = (_a = {},
376
- _a[urlKey] = currentUrl,
377
- _a[appIdKey] = appId,
378
- _a);
379
- var jsApiListData = defaultJsApiList;
380
- var openTagListData = defaultOpenTagList;
378
+ let param = {
379
+ [urlKey]: currentUrl,
380
+ [appIdKey]: appId,
381
+ };
382
+ let jsApiListData = defaultJsApiList;
383
+ let openTagListData = defaultOpenTagList;
381
384
  if (jsApiList === null || jsApiList === void 0 ? void 0 : jsApiList.length) {
382
385
  jsApiListData = jsApiListData;
383
386
  }
384
387
  if (openTagList === null || openTagList === void 0 ? void 0 : openTagList.length) {
385
388
  openTagListData = openTagList;
386
389
  }
387
- config.http(param).then(function (res) {
390
+ config.http(param).then((res) => {
388
391
  if (res) {
389
- var data = {};
392
+ let data = {};
390
393
  if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("data")) {
391
394
  data = res.data;
392
395
  }
@@ -397,15 +400,15 @@ function configReady(config) {
397
400
  console.error("http响应数据格式必须是:res:{data:{appid:xx,timestamp:xx,noncestr:xx,signature:xx}}");
398
401
  return;
399
402
  }
400
- for (var key in data) {
401
- var newKey = key.toLowerCase();
403
+ for (let key in data) {
404
+ const newKey = key.toLowerCase();
402
405
  data[newKey] = data[key];
403
406
  }
404
407
  if (!(data === null || data === void 0 ? void 0 : data.appid)) {
405
408
  console.error("后端响应的data数据中缺乏appid或者appId或者AppId字段!");
406
409
  return;
407
410
  }
408
- var obj = {
411
+ let obj = {
409
412
  jsApiList: jsApiListData,
410
413
  openTagList: openTagListData,
411
414
  debug: false,
@@ -414,7 +417,7 @@ function configReady(config) {
414
417
  nonceStr: data === null || data === void 0 ? void 0 : data.noncestr,
415
418
  signature: data === null || data === void 0 ? void 0 : data.signature, //必填,生成的签名
416
419
  };
417
- var wx = initSdk();
420
+ const wx = initSdk();
418
421
  console.log("wx.config.data:", obj);
419
422
  wx.config(obj);
420
423
  wx.ready(function (res) {
@@ -434,27 +437,27 @@ function shareReady(options) {
434
437
  console.error("还未执行微信登录流程");
435
438
  return;
436
439
  }
437
- var title = "微信分享标题";
440
+ let title = "微信分享标题";
438
441
  if (options['title'])
439
442
  title = options.title;
440
- var desc = "微信分享描述";
443
+ let desc = "微信分享描述";
441
444
  if (options['desc'])
442
445
  desc = options.desc;
443
- var link = loc.origin;
446
+ let link = loc.origin;
444
447
  if (options['link'])
445
448
  link = options.link;
446
- var imgUrl = "";
449
+ let imgUrl = "";
447
450
  if (options['imgUrl'])
448
451
  imgUrl = options.imgUrl;
449
452
  if (options && typeof options == "object") {
450
- var state = "";
453
+ let state = "";
451
454
  if (options['data']) {
452
- var data = options.data;
453
- var key = options['key'] || defaultKey;
454
- var iv = options['iv'] || defaultIv;
455
- var cryptoObj = cryptoConfig(key, iv);
455
+ let data = options.data;
456
+ const key = options['key'] || defaultKey;
457
+ const iv = options['iv'] || defaultIv;
458
+ const cryptoObj = cryptoConfig(key, iv);
456
459
  state = (0, crypto_1.encrypt)(data, cryptoObj.key, cryptoObj.iv);
457
- link = "".concat(link, "?state=").concat(state);
460
+ link = `${link}?state=${state}`;
458
461
  }
459
462
  }
460
463
  if (options['shareUrl'])
@@ -462,7 +465,7 @@ function shareReady(options) {
462
465
  if (options === null || options === void 0 ? void 0 : options.dbug) {
463
466
  alert(JSON.stringify(options));
464
467
  }
465
- var wx = initSdk();
468
+ const wx = initSdk();
466
469
  (0, index_1.useSessionStorage)("weixinShareUrl", link);
467
470
  wx.ready(function () {
468
471
  (0, index_1.useSessionStorage)("shareReady", "success");
@@ -493,7 +496,7 @@ function shareReady(options) {
493
496
  }
494
497
  });
495
498
  });
496
- wx.error(function (res) {
499
+ wx.error((res) => {
497
500
  console.log("配置进入错误:", res);
498
501
  });
499
502
  }
@@ -503,9 +506,9 @@ function onlinePay(config) {
503
506
  console.error("还未执行微信登录流程");
504
507
  return;
505
508
  }
506
- var wx = initSdk();
509
+ const wx = initSdk();
507
510
  // let { timeStamp,signType,prepay_id,paySign,package,nonceStr,appId } = params
508
- var cb = "";
511
+ let cb = "";
509
512
  if (config['cb'] && typeof config.cb === "function")
510
513
  cb = config.cb;
511
514
  wx.chooseWXPay({
@@ -515,7 +518,7 @@ function onlinePay(config) {
515
518
  signType: config.signType,
516
519
  paySign: config.paySign,
517
520
  success: function (res) {
518
- var obj = {
521
+ const obj = {
519
522
  status: "success",
520
523
  data: res,
521
524
  };
@@ -523,7 +526,7 @@ function onlinePay(config) {
523
526
  cb(obj);
524
527
  },
525
528
  cancel: function (cancel) {
526
- var obj = {
529
+ const obj = {
527
530
  status: "cancel",
528
531
  data: cancel,
529
532
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
3
  "private": false,
4
- "version": "1.6.68",
4
+ "version": "1.6.70",
5
5
  "description": "localStorage存储\r ```\r sessionStorage存储\r ```\r crypto-js加密、解密\r ```\r 微信授权登录、微信分享\r ```\r 设备环境获取\r ```\r 是否是微信浏览器\r ```\r 时间戳转时间,字符串转时间戳",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -13,11 +13,12 @@
13
13
  "author": "dyb",
14
14
  "license": "ISC",
15
15
  "devDependencies": {
16
+ "@types/crypto-js": "^4.2.2",
16
17
  "@types/node": "^18.11.19",
17
18
  "typescript": "^4.9.5"
18
19
  },
19
20
  "dependencies": {
20
-
21
+ "crypto-js": "^4.2.0"
21
22
  },
22
23
  "repository": {
23
24
  "type": "git",
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es5",
3
+ "target": "es2018",
4
4
  "module": "commonjs",
5
5
  "declaration": true,
6
6
  "outDir": "./dist",