@conecli/cone-render 0.10.1-beta.3 → 0.10.1-isv2.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.
@@ -1 +1 @@
1
- import {
2
1
  isApp,
3
2
  isIOS,
4
3
  getAppVersion,
5
4
  version,
6
5
  getUUID,
7
6
  getUrlQuery,
8
7
  assign,
9
8
  isString,
10
9
  isObject,
11
10
  serialize,
12
11
  isAndroid,
13
12
  versionCompare,
14
13
  CHANNEL_TYPE,
15
14
  JDShopViewBusinessPathType,
16
15
  JDShopViewBusinessPathList,
17
16
  SECTION_HOME_TAB_NAME_TYPE,
18
17
  SECTION_HOME_TAB_TYPE,
19
18
  parseQueryUrlObj,
20
19
  if (window?.__sgm__) {
21
20
  resolve(true)
22
21
  } else {
23
22
  if (isSgmReadyError) {
24
23
  console.log("当前sgm初始化失败")
25
24
  reject(false)
26
25
  } else {
27
26
  ready('__sgm__', 2000).then(() => {
28
27
  isSgmReadyError = false
29
28
  console.log("当前sgm初始化成功")
30
29
  resolve(true)
31
30
  }).catch(() => {
32
31
  isSgmReadyError = true
33
32
  console.log("当前sgm初始化失败")
34
33
  reject(false)
35
34
  })
36
35
  }
37
36
  }
38
37
  try {
39
38
  return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
40
39
  } catch (e) {
41
40
  return {}
42
41
  }
43
42
  isWxMiniH5View && urlCookie['wxapp_type'] == '1'
44
43
  if (isH5AdnJxMini) {
45
44
  return 'jxxcx'
46
45
  } else if (isTJApp) {
47
46
  return 'tjapp'
48
47
  } else if (isTjM) {
49
48
  return 'tjm'
50
49
  } else if (isTjJxM) {
51
50
  return 'jxh5'
52
51
  }
53
52
  return ''
54
53
  if (isJdApp) {
55
54
  isIosDevice
56
55
  ? e && e.stopPropagation()
57
56
  : androidDeviceStopNativeScrollEvent(state)
58
57
  }
59
58
  isJdApp &&
60
59
  isAndroidDevice &&
61
60
  window?.JdAndroid &&
62
61
  window?.JdAndroid.requestEvent(state)
63
62
  if (isH5AndJdShopView) {
64
63
  return (
65
64
  CHANNEL_TYPE[currentChannel] ||
66
65
  CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
67
66
  )
68
67
  }
69
68
  return null
70
69
  isH5 && isJdApp && ['/app/home', '/app/classify', '/member/shopcard','/favorite/list', '/favorite/home'].includes(urlPathname)
71
70
  isH5 && isJdApp && !['/app/home'].includes(urlPathname)
72
71
  return isJdApp ? versionCompare(nowVersion, compareVersion) : -2
73
72
  getSgmReadyPromise().then(() => {
74
73
  const getCustomObj = {
75
74
  type: 1,
76
75
  code: 'all',
77
76
  cost1: 1,
78
77
  ...customObj
79
78
  }
80
79
  try {
81
80
  window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
82
81
  } catch (e) {
83
82
  console.log("当前sgm上报异常, 原始数据为",JSON.stringify(customObj))
84
83
  }
85
84
  }).catch(() => {
86
85
  console.error("当前页面sgm加载异常,无法进行异常上报, 原始数据为",JSON.stringify(customObj))
87
86
  })
88
87
  if(isJdAndAndroidDevice && typeof displayObj === 'object'){
89
88
  const deviceRatio = window?.devicePixelRatio
90
89
  Object.keys(displayObj).forEach(key => {
91
90
  if(key === 'nativeHeaderHeight'){
92
91
  displayObj[key] = Math.ceil(displayObj[key] / (deviceRatio * deviceRatio) - 2)
93
92
  }else {
94
93
  displayObj[key] = Math.ceil(displayObj[key] / deviceRatio)
95
94
  }
96
95
  })
97
96
  }
98
97
  return displayObj
98
+ import {
99
99
  isApp,
100
100
  isIOS,
101
101
  getAppVersion,
102
102
  version,
103
103
  getUUID,
104
104
  getUrlQuery,
105
105
  assign,
106
106
  isString,
107
107
  isObject,
108
108
  serialize,
109
109
  isAndroid,
110
110
  versionCompare,
111
111
  CHANNEL_TYPE,
112
112
  JDShopViewBusinessPathType,
113
113
  JDShopViewBusinessPathList,
114
114
  SECTION_HOME_TAB_NAME_TYPE,
115
115
  SECTION_HOME_TAB_TYPE,
116
116
  parseQueryUrlObj,
117
117
  if (window?.__sgm__) {
118
118
  resolve(true)
119
119
  } else {
120
120
  if (isSgmReadyError) {
121
121
  console.log("当前sgm初始化失败")
122
122
  reject(false)
123
123
  } else {
124
124
  ready('__sgm__', 2000).then(() => {
125
125
  isSgmReadyError = false
126
126
  console.log("当前sgm初始化成功")
127
127
  resolve(true)
128
128
  }).catch(() => {
129
129
  isSgmReadyError = true
130
130
  console.log("当前sgm初始化失败")
131
131
  reject(false)
132
132
  })
133
133
  }
134
134
  }
135
135
  try {
136
136
  return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
137
137
  } catch (e) {
138
138
  return {}
139
139
  }
140
140
  isWxMiniH5View && urlCookie['wxapp_type'] == '1'
141
141
  if (isH5AdnJxMini) {
142
142
  return 'jxxcx'
143
143
  } else if (isTJApp) {
144
144
  return 'tjapp'
145
145
  } else if (isTjM) {
146
146
  return 'tjm'
147
147
  } else if (isTjJxM) {
148
148
  return 'jxh5'
149
149
  }
150
150
  return ''
151
151
  if (isJdApp) {
152
152
  isIosDevice
153
153
  ? e && e.stopPropagation()
154
154
  : androidDeviceStopNativeScrollEvent(state)
155
155
  }
156
156
  isJdApp &&
157
157
  isAndroidDevice &&
158
158
  window?.JdAndroid &&
159
159
  window?.JdAndroid.requestEvent(state)
160
160
  if (isH5AndJdShopView) {
161
161
  return (
162
162
  CHANNEL_TYPE[currentChannel] ||
163
163
  CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
164
164
  )
165
165
  }
166
166
  return null
167
167
  isH5 && isJdApp && ['/app/home', '/app/classify', '/member/shopcard','/favorite/list', '/favorite/home'].includes(urlPathname)
168
168
  isH5 && isJdApp && !['/app/home'].includes(urlPathname)
169
169
  return isJdApp ? versionCompare(nowVersion, compareVersion) : -2
170
170
  getSgmReadyPromise().then(() => {
171
171
  if (
172
172
  customObj.hasOwnProperty('code') &&
173
173
  customObj.code.indexOf(NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG) !== -1
174
174
  ) {
175
175
  const originCode = customObj.code.substring(
176
176
  NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG.length,
177
177
  customObj.code.length,
178
178
  )
179
179
  customObj['code'] = getSgmCustomCode(originCode)
180
180
  }
181
181
  const getCustomObj = {
182
182
  type: 1,
183
183
  code: 'all',
184
184
  cost1: 1,
185
185
  ...customObj
186
186
  }
187
187
  try {
188
188
  window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
189
189
  } catch (e) {
190
190
  console.log("当前sgm上报异常, 原始数据为",JSON.stringify(customObj))
191
191
  }
192
192
  }).catch(() => {
193
193
  console.error("当前页面sgm加载异常,无法进行异常上报, 原始数据为",JSON.stringify(customObj))
194
194
  })
195
195
  if(isJdAndAndroidDevice && typeof displayObj === 'object'){
196
196
  const deviceRatio = window?.devicePixelRatio
197
197
  Object.keys(displayObj).forEach(key => {
198
198
  if(key === 'nativeHeaderHeight'){
199
199
  displayObj[key] = Math.ceil(displayObj[key] / (deviceRatio * deviceRatio) - 2)
200
200
  }else {
201
201
  displayObj[key] = Math.ceil(displayObj[key] / deviceRatio)
202
202
  }
203
203
  })
204
204
  }
205
205
  return displayObj