@taole/dev-helper 0.1.24 → 0.1.25

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.
@@ -37,6 +37,25 @@
37
37
  };
38
38
  // OpenInstall 初始化对应页面访问,多个组件共用同一个实例。
39
39
  const openInstallInstances = new Map();
40
+ function resolveOpenInstallData() {
41
+ const data = {};
42
+ const match = window.location.search.substr(1).match(/(^|&)bizInfo=([^&]*)(&|$)/i);
43
+ let bizInfo = match && match[2];
44
+ if (bizInfo) {
45
+ try {
46
+ bizInfo = decodeURIComponent(bizInfo);
47
+ } catch (error) {}
48
+ try {
49
+ bizInfo = JSON.parse(bizInfo);
50
+ } catch (error) {
51
+ bizInfo = null;
52
+ }
53
+ data.bizInfo = (bizInfo && bizInfo.data) || '';
54
+ data.bizShowTime = Date.now();
55
+ data.url = window.location.href;
56
+ }
57
+ return data;
58
+ }
40
59
  function resolveOpenInstall(appInfo) {
41
60
  const key = appInfo && appInfo.openinstall_app_key;
42
61
  if (!key || !appInfo.openinstall_script) {
@@ -50,7 +69,7 @@
50
69
  try {
51
70
  if (!window.OpenInstall) throw new Error('OpenInstall SDK is unavailable');
52
71
  new window.OpenInstall({ appKey: key, onready: function () { clearTimeout(timer); resolve(this); } },
53
- window.OpenInstall.parseUrlParams());
72
+ resolveOpenInstallData());
54
73
  } catch (error) { fail(error); }
55
74
  };
56
75
  if (window.OpenInstall) {
@@ -32,6 +32,25 @@ const appInfoMap = {
32
32
  }
33
33
  // OpenInstall 初始化对应页面访问,多个组件共用同一个实例。
34
34
  const openInstallInstances = new Map();
35
+ function resolveOpenInstallData() {
36
+ const data = {};
37
+ const match = window.location.search.substr(1).match(/(^|&)bizInfo=([^&]*)(&|$)/i);
38
+ let bizInfo = match && match[2];
39
+ if (bizInfo) {
40
+ try {
41
+ bizInfo = decodeURIComponent(bizInfo);
42
+ } catch (error) {}
43
+ try {
44
+ bizInfo = JSON.parse(bizInfo);
45
+ } catch (error) {
46
+ bizInfo = null;
47
+ }
48
+ data.bizInfo = (bizInfo && bizInfo.data) || '';
49
+ data.bizShowTime = Date.now();
50
+ data.url = window.location.href;
51
+ }
52
+ return data;
53
+ }
35
54
  function resolveOpenInstall(appInfo) {
36
55
  const key = appInfo && appInfo.openinstall_app_key;
37
56
  if (!key || !appInfo.openinstall_script) {
@@ -45,7 +64,7 @@ function resolveOpenInstall(appInfo) {
45
64
  try {
46
65
  if (!window.OpenInstall) throw new Error('OpenInstall SDK is unavailable');
47
66
  new window.OpenInstall({ appKey: key, onready: function () { clearTimeout(timer); resolve(this); } },
48
- window.OpenInstall.parseUrlParams());
67
+ resolveOpenInstallData());
49
68
  } catch (error) { fail(error); }
50
69
  };
51
70
  if (window.OpenInstall) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/dev-helper",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "dev-helper": "./bin/dev-helper.js"