@conecli/cone-render 0.8.41 → 0.8.43

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 (42) hide show
  1. package/dist/common/const.ts +1 -1
  2. package/dist/common/index.h5.ts +1 -1
  3. package/dist/common/index.jd.ts +1 -1
  4. package/dist/common/index.ts +1 -1
  5. package/dist/common/index.weapp.ts +1 -1
  6. package/dist/common/sgmCustomCode.ts +1 -1
  7. package/dist/components/ErrorBoundary.tsx +1 -1
  8. package/dist/components/base/CustomVideo/index.tsx +1 -1
  9. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  10. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  11. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  12. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  13. package/dist/components/base/MobileCommonHeader/index.module.scss +8 -0
  14. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  15. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  16. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  17. package/dist/components/remoteFloorItem.tsx +1 -1
  18. package/dist/interface/component.ts +1 -1
  19. package/dist/jumpEventReport/base.ts +1 -1
  20. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  21. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  22. package/dist/jumpEventReport/web.base.ts +1 -1
  23. package/dist/jumpEventReport/web.jd.ts +1 -1
  24. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  25. package/dist/modules/ContainerFloorList/index.h5.module.scss +1 -0
  26. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  27. package/dist/open/api/device.ts +1 -1
  28. package/dist/open/api/request.ts +1 -1
  29. package/dist/open/api/shopMember.ts +1 -1
  30. package/dist/open/api/util.ts +1 -1
  31. package/dist/open/components/index.ts +1 -1
  32. package/dist/sass/app.h5.scss +10 -0
  33. package/dist/service/requestServer.ts +1 -1
  34. package/dist/utils/connectNativeJsBridge.ts +1 -1
  35. package/dist/utils/h5Utils.ts +1 -1
  36. package/dist/utils/index.h5.ts +1 -1
  37. package/dist/utils/index.ts +1 -1
  38. package/dist/utils/index.weapp.ts +1 -1
  39. package/dist/utils/sgmCodeUtils.ts +1 -1
  40. package/dist/utils/taroRenderUtil.ts +1 -1
  41. package/dist/utils/utils.ts +1 -1
  42. package/package.json +1 -1
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  const { type, className, reportData, customReportDataKey, customReportDataFn, trackCallback } = props
3
2
  const isViewOnlineState =
4
3
  taroJdBaseInfo.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
5
4
  const isCustomReport = customReportDataKey && customReportDataFn
6
5
  const checkReportData = Array.isArray(reportData)
7
6
  const [floorData, mInfo] = checkReportData ? reportData : []
8
7
  const showRenderState = isCustomReport ? true : floorData && mInfo
9
8
  const getFloorPointClassName = isCustomReport ? `J_custom_${customReportDataKey}` : `J_floor_${floorData?.uid}_index_${mInfo?.pos}`
10
9
  const getTaroSelector = isCustomReport ? `#J_miniShopRoot >>> ${getFloorPointClassName}` : `#J_floor_${floorData?.uid} >>> .${getFloorPointClassName}`
11
10
  useEffect(() => {
12
11
  if (isViewOnlineState && reportData) {
13
12
  Taro.nextTick(() => {
14
13
  if (
15
14
  !taroJdBaseInfo.info.pageInfo.floorExposureInfo[
16
15
  getFloorPointClassName
17
16
  ]
18
17
  ){
19
18
  const createIntersectionObserver = new intersectionObserver({
20
19
  selector: getTaroSelector,
21
20
  context: this,
22
21
  onFinal: (res) => {
23
22
  taroJdBaseInfo.info.pageInfo.floorExposureInfo[
24
23
  getFloorPointClassName
25
24
  ] = true
26
25
  console.log('小程序曝光埋点收到进入可视区域啦!', getFloorPointClassName, reportData, res)
27
26
  if(!isCustomReport){
28
27
  addReportData(reportData)
29
28
  typeof trackCallback === 'function' && trackCallback(reportData)
30
29
  }else {
31
30
  typeof customReportDataFn === 'function' && customReportDataFn(customReportDataKey)
32
31
  }
33
32
  createIntersectionObserver.disconnect()
34
33
  },
35
34
  })
36
35
  createIntersectionObserver.connect()
37
36
  }
38
37
  })
39
38
  }
40
39
  }, [])
41
40
  return (showRenderState ? (
42
41
  <View
43
42
  className={classNames(
44
43
  {
45
44
  [exposureStyle['d-report-point']]: type === TrackType.point,
46
45
  },
47
46
  {
48
47
  [exposureStyle['d-report-floor']]: type === TrackType.floor,
49
48
  },
50
49
  getFloorPointClassName,
51
50
  className,
52
51
  )}
53
52
  />
54
53
  ) : null
55
54
  )
56
55
  return useMemo(() => {
57
56
  return <ExposureFloor {...props} />
58
57
  }, [])
59
58
  reportData: null,
60
59
  trackCallback: null,
61
60
  type: TrackType.point,
61
+ import Taro from '@tarojs/taro'
62
62
  const { type, className, reportData, customReportDataKey, customReportDataFn, trackCallback } = props
63
63
  const isViewOnlineState =
64
64
  taroJdBaseInfo.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
65
65
  const isCustomReport = customReportDataKey && customReportDataFn
66
66
  const checkReportData = Array.isArray(reportData)
67
67
  const [floorData, mInfo] = checkReportData ? reportData : []
68
68
  const showRenderState = isCustomReport ? true : floorData && mInfo
69
69
  const getFloorPointClassName = isCustomReport ? `J_custom_${customReportDataKey}` : `J_floor_${floorData?.uid}_index_${mInfo?.pos}`
70
70
  const getTaroSelector = isCustomReport ? `#J_miniShopRoot >>> .${getFloorPointClassName}` : `#J_floor_${floorData?.uid} >>> .${getFloorPointClassName}`
71
71
  useEffect(() => {
72
72
  if (isViewOnlineState && reportData) {
73
73
  Taro.nextTick(() => {
74
74
  if (
75
75
  !taroJdBaseInfo.info.pageInfo.floorExposureInfo[
76
76
  getFloorPointClassName
77
77
  ]
78
78
  ){
79
79
  const createIntersectionObserver = new intersectionObserver({
80
80
  selector: getTaroSelector,
81
81
  context: this,
82
82
  onFinal: (res) => {
83
83
  taroJdBaseInfo.info.pageInfo.floorExposureInfo[
84
84
  getFloorPointClassName
85
85
  ] = true
86
86
  console.log('小程序曝光埋点收到进入可视区域啦!', getFloorPointClassName, reportData, res)
87
87
  if(!isCustomReport){
88
88
  addReportData(reportData)
89
89
  typeof trackCallback === 'function' && trackCallback(reportData)
90
90
  }else {
91
91
  typeof customReportDataFn === 'function' && customReportDataFn(customReportDataKey)
92
92
  }
93
93
  createIntersectionObserver.disconnect()
94
94
  },
95
95
  })
96
96
  createIntersectionObserver.connect()
97
97
  }
98
98
  })
99
99
  }
100
100
  }, [])
101
101
  return (showRenderState ? (
102
102
  <View
103
103
  className={classNames(
104
104
  {
105
105
  [exposureStyle['d-report-point']]: type === TrackType.point,
106
106
  },
107
107
  {
108
108
  [exposureStyle['d-report-floor']]: type === TrackType.floor,
109
109
  },
110
110
  getFloorPointClassName,
111
111
  className,
112
112
  )}
113
113
  />
114
114
  ) : null
115
115
  )
116
116
  return useMemo(() => {
117
117
  return <ExposureFloor {...props} />
118
118
  }, [])
119
119
  reportData: null,
120
120
  trackCallback: null,
121
121
  type: TrackType.point,
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  isH5AndJdShopView,
3
2
  isH5AndJdShopViewH5Scroll,
4
3
  isAppClassifyPage,
5
4
  lodashThrottle,
6
5
  TaroEventType,
7
6
  WEBVIEW_STATE,
8
7
  M_H5_ROOT_ELE_NODE,
9
8
  latestFromNativeMsgStorage,
10
9
  getNativePageScrollRes,
11
10
  props: ComponentInterFace.InOrOutViewObserverProps,
12
11
  const {
13
12
  children,
14
13
  style,
15
14
  inViewCallback,
16
15
  outViewCallback,
17
16
  threshold = 0,
18
17
  } = props
19
18
  const [componentShowState, setComponentShowState] = useState(false)
20
19
  const componentObserverRef = useRef<HTMLElement | null>(null)
21
20
  const componentShowStateRef = useRef(false)
22
21
  const needShowHighVersion =
23
22
  isAppClassifyPage ||
24
23
  (isH5AndJdShopViewH5Scroll &&
25
24
  !(
26
25
  global.info.queryInfo?.downgraded &&
27
26
  global.info.queryInfo.downgraded === 'true'
28
27
  ))
29
28
  const rootDom =
30
29
  isH5AndJdShopView && needShowHighVersion
31
30
  ? null
32
31
  : document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
33
32
  if (isH5AndJdShopView && !needShowHighVersion) {
34
33
  console.log('视频========属于app原生滚动')
35
34
  useEffect(() => {
36
35
  const latestRes =
37
36
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
38
37
  dealPageScrollInfo(latestRes)
39
38
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
40
39
  dealPageScrollInfo(res)
41
40
  })
42
41
  Taro.eventCenter.on(
43
42
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
44
43
  state => {
45
44
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
46
45
  },
47
46
  )
48
47
  return function cleanup() {
49
48
  Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, res => {
50
49
  dealPageScrollInfo(res)
51
50
  })
52
51
  Taro.eventCenter.off(
53
52
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
54
53
  state => {
55
54
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
56
55
  },
57
56
  )
58
57
  }
59
58
  }, [])
60
59
  useEffect(() => {
61
60
  if (componentShowState) {
62
61
  typeof inViewCallback === 'function' && inViewCallback()
63
62
  console.log('app=>in可视区域')
64
63
  } else {
65
64
  typeof outViewCallback === 'function' && outViewCallback()
66
65
  console.log('app=>out可视区域')
67
66
  }
68
67
  }, [componentShowState])
69
68
 
70
69
  const handleInOrOutView = (type: boolean) => {
71
70
  componentShowStateRef.current = type
72
71
  setComponentShowState(type)
73
72
  console.log('handleInOrOutView', type)
74
73
  }
75
74
 
76
75
  const dealPageScrollInfo = res => {
77
76
  console.log('dealPageScrollInfo===', res)
78
77
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
79
78
  if (
80
79
  typeof displayHeight === 'undefined' ||
81
80
  typeof offSetY === 'undefined'
82
81
  )
83
82
  return
84
83
  console.log(
85
84
  '处理后dealPageScrollInfo===displayHeight=offSetY',
86
85
  displayHeight,
87
86
  offSetY,
88
87
  )
89
88
  if (componentObserverRef.current) {
90
89
  const eleClientRect = componentObserverRef.current.getBoundingClientRect()
91
90
  const eleOffsetTop = Math.ceil(eleClientRect.top)
92
91
  const eleHeight = Math.ceil(eleClientRect.height)
93
92
  console.log(
94
93
  '==========================eleOffsetTop, eleHeight',
95
94
  eleOffsetTop,
96
95
  eleHeight,
97
96
  )
98
97
  if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
99
98
  const isOutView =
100
99
  offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
101
100
  displayHeight - (eleOffsetTop - offSetY) <
102
101
  Math.ceil(eleHeight * threshold)
103
102
  console.log(
104
103
  '比较isOutView',
105
104
  isOutView,
106
105
  offSetY,
107
106
  eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
108
107
  displayHeight - (eleOffsetTop - offSetY),
109
108
  Math.ceil(eleHeight * threshold),
110
109
  )
111
110
  handleInOrOutView(!isOutView)
112
111
  } else {
113
112
  const isInView =
114
113
  offSetY >
115
114
  eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
116
115
  offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
117
116
  console.log(
118
117
  '比较isInView',
119
118
  isInView,
120
119
  offSetY,
121
120
  eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold),
122
121
  eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
123
122
  )
124
123
  handleInOrOutView(isInView)
125
124
  }
126
125
  }
127
126
  }
128
127
  return (
129
128
  <View ref={componentObserverRef} style={style}>
130
129
  {children}
131
130
  </View>
132
131
  )
133
132
  } else {
134
133
  console.log('视频========h5滚动')
135
134
  const { ref, inView } = useInView({
136
135
  delay: 100,
137
136
  threshold,
138
137
  triggerOnce: false,
139
138
  root: rootDom || null,
140
139
  rootMargin: `0px 0px 0px 0px`,
141
140
  })
142
141
  const throttledViewChanged: ViewChangeHandler = useCallback<
143
142
  ViewChangeHandler
144
143
  >(
145
144
  lodashThrottle(
146
145
  (inView: boolean) => {
147
146
  if (inView) {
148
147
  typeof inViewCallback === 'function' && inViewCallback()
149
148
  console.log('其他h5=>in可视区域')
150
149
  } else {
151
150
  typeof outViewCallback === 'function' && outViewCallback()
152
151
  console.log('其他h5=>out可视区域')
153
152
  }
154
153
  },
155
154
  300,
156
155
  { leading: false, trailing: true },
157
156
  ),
158
157
  [],
159
158
  )
160
159
  useEffect(() => {
161
160
  throttledViewChanged(inView)
162
161
  }, [inView])
163
162
  return (
164
163
  <View ref={ref} style={style}>
165
164
  {children}
166
165
  </View>
167
166
  )
168
167
  }
169
168
  children: null,
170
169
  style: {},
171
170
  className: '',
172
171
  inViewCallback: null,
173
172
  outViewCallback: null,
174
173
  threshold: 0,
174
+ import Taro from '@tarojs/taro'
175
175
  isH5AndJdShopView,
176
176
  isH5AndJdShopViewH5Scroll,
177
177
  isAppClassifyPage,
178
178
  TaroEventType,
179
179
  WEBVIEW_STATE,
180
180
  M_H5_ROOT_ELE_NODE,
181
181
  latestFromNativeMsgStorage,
182
182
  getNativePageScrollRes,
183
183
  props: ComponentInterFace.InOrOutViewObserverProps,
184
184
  const {
185
185
  children,
186
186
  style,
187
187
  inViewCallback,
188
188
  outViewCallback,
189
189
  threshold = 0,
190
190
  } = props
191
191
  const [componentShowState, setComponentShowState] = useState(false)
192
192
  const componentObserverRef = useRef<HTMLElement | null>(null)
193
193
  const componentShowStateRef = useRef(false)
194
194
  const needShowHighVersion =
195
195
  isAppClassifyPage ||
196
196
  (isH5AndJdShopViewH5Scroll &&
197
197
  !(
198
198
  global.info.queryInfo?.downgraded &&
199
199
  global.info.queryInfo.downgraded === 'true'
200
200
  ))
201
201
  const rootDom =
202
202
  isH5AndJdShopView && needShowHighVersion
203
203
  ? null
204
204
  : document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
205
205
  if (isH5AndJdShopView && !needShowHighVersion) {
206
206
  console.log('视频========属于app原生滚动')
207
207
  useEffect(() => {
208
208
  const latestRes =
209
209
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
210
210
  dealPageScrollInfo(latestRes)
211
211
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
212
212
  dealPageScrollInfo(res)
213
213
  })
214
214
  Taro.eventCenter.on(
215
215
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
216
216
  state => {
217
217
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
218
218
  },
219
219
  )
220
220
  return function cleanup() {
221
221
  Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, res => {
222
222
  dealPageScrollInfo(res)
223
223
  })
224
224
  Taro.eventCenter.off(
225
225
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
226
226
  state => {
227
227
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
228
228
  },
229
229
  )
230
230
  }
231
231
  }, [])
232
232
  useEffect(() => {
233
233
  if (componentShowState) {
234
234
  typeof inViewCallback === 'function' && inViewCallback()
235
235
  console.log('app=>in可视区域')
236
236
  } else {
237
237
  typeof outViewCallback === 'function' && outViewCallback()
238
238
  console.log('app=>out可视区域')
239
239
  }
240
240
  }, [componentShowState])
241
241
 
242
242
  const handleInOrOutView = (type: boolean) => {
243
243
  componentShowStateRef.current = type
244
244
  setComponentShowState(type)
245
245
  console.log('handleInOrOutView', type)
246
246
  }
247
247
 
248
248
  const dealPageScrollInfo = res => {
249
249
  console.log('dealPageScrollInfo===', res)
250
250
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
251
251
  if (
252
252
  typeof displayHeight === 'undefined' ||
253
253
  typeof offSetY === 'undefined'
254
254
  )
255
255
  return
256
256
  console.log(
257
257
  '处理后dealPageScrollInfo===displayHeight=offSetY',
258
258
  displayHeight,
259
259
  offSetY,
260
260
  )
261
261
  if (componentObserverRef.current) {
262
262
  const eleClientRect = componentObserverRef.current.getBoundingClientRect()
263
263
  const eleOffsetTop = Math.ceil(eleClientRect.top)
264
264
  const eleHeight = Math.ceil(eleClientRect.height)
265
265
  console.log(
266
266
  '==========================eleOffsetTop, eleHeight',
267
267
  eleOffsetTop,
268
268
  eleHeight,
269
269
  )
270
270
  if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
271
271
  const isOutView =
272
272
  offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
273
273
  displayHeight - (eleOffsetTop - offSetY) <
274
274
  Math.ceil(eleHeight * threshold)
275
275
  console.log(
276
276
  '比较isOutView',
277
277
  isOutView,
278
278
  offSetY,
279
279
  eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
280
280
  displayHeight - (eleOffsetTop - offSetY),
281
281
  Math.ceil(eleHeight * threshold),
282
282
  )
283
283
  handleInOrOutView(!isOutView)
284
284
  } else {
285
285
  const isInView =
286
286
  offSetY >
287
287
  eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
288
288
  offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
289
289
  console.log(
290
290
  '比较isInView',
291
291
  isInView,
292
292
  offSetY,
293
293
  eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold),
294
294
  eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
295
295
  )
296
296
  handleInOrOutView(isInView)
297
297
  }
298
298
  }
299
299
  }
300
300
  return (
301
301
  <View ref={componentObserverRef} style={style}>
302
302
  {children}
303
303
  </View>
304
304
  )
305
305
  } else {
306
306
  console.log('视频========h5滚动')
307
307
  const { ref, inView } = useInView({
308
308
  delay: 100,
309
309
  threshold,
310
310
  triggerOnce: false,
311
311
  root: rootDom || null,
312
312
  rootMargin: `0px 0px 0px 0px`,
313
313
  })
314
314
  useEffect(() => {
315
315
  if (inView) {
316
316
  typeof inViewCallback === 'function' && inViewCallback()
317
317
  console.log('其他h5=>in可视区域')
318
318
  } else {
319
319
  typeof outViewCallback === 'function' && outViewCallback()
320
320
  console.log('其他h5=>out可视区域')
321
321
  }
322
322
  }, [inView])
323
323
  return (
324
324
  <View ref={ref} style={style}>
325
325
  {children}
326
326
  </View>
327
327
  )
328
328
  }
329
329
  children: null,
330
330
  style: {},
331
331
  className: '',
332
332
  inViewCallback: null,
333
333
  outViewCallback: null,
334
334
  threshold: 0,