@conecli/cone-render 0.10.1-beta.3 → 0.10.1-beta.5

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 (56) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/common/index.h5.ts +1 -1
  4. package/dist/common/index.weapp.ts +1 -1
  5. package/dist/common/sgmCustomCode.ts +1 -1
  6. package/dist/components/ErrorBoundary.tsx +1 -1
  7. package/dist/components/base/CustomScrollView/index.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/InViewRender/index.weapp.tsx +1 -1
  12. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  13. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  14. package/dist/components/base/LazyLoadImage/index.h5.module.scss +3 -0
  15. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  16. package/dist/components/base/MobileCommonHeader/index.module.scss +8 -0
  17. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  18. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  19. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  20. package/dist/components/decorate/DecorateFloorModule/index.module.scss +11 -0
  21. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  22. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  23. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  24. package/dist/components/floorItem.tsx +1 -1
  25. package/dist/components/remoteFloorItem.tsx +1 -1
  26. package/dist/interface/common.ts +1 -1
  27. package/dist/interface/component.ts +1 -1
  28. package/dist/interface/jumpEventReport.ts +1 -1
  29. package/dist/interface/service.ts +1 -1
  30. package/dist/jumpEventReport/base.ts +1 -1
  31. package/dist/jumpEventReport/const.ts +1 -1
  32. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  33. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  34. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  35. package/dist/jumpEventReport/web.base.ts +1 -1
  36. package/dist/jumpEventReport/web.jd.ts +1 -1
  37. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  38. package/dist/modules/ContainerFloorList/index.h5.module.scss +1 -0
  39. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  40. package/dist/open/api/device.ts +1 -1
  41. package/dist/open/api/request.ts +1 -1
  42. package/dist/open/api/shopMember.ts +1 -1
  43. package/dist/open/api/util.ts +1 -1
  44. package/dist/open/components/index.ts +1 -1
  45. package/dist/sass/app.h5.scss +5 -0
  46. package/dist/sass/base.scss +45 -0
  47. package/dist/service/requestServer.ts +1 -1
  48. package/dist/utils/connectNativeJsBridge.ts +1 -1
  49. package/dist/utils/h5Utils.ts +1 -1
  50. package/dist/utils/index.h5.ts +1 -1
  51. package/dist/utils/index.ts +1 -1
  52. package/dist/utils/index.weapp.ts +1 -1
  53. package/dist/utils/sgmCodeUtils.ts +1 -1
  54. package/dist/utils/taroRenderUtil.ts +1 -1
  55. package/dist/utils/utils.ts +1 -1
  56. package/package.json +24 -23
@@ -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
  TaroEventType,
6
5
  WEBVIEW_STATE,
7
6
  M_H5_ROOT_ELE_NODE,
8
7
  latestFromNativeMsgStorage,
9
8
  getNativePageScrollRes,
10
9
  props: ComponentInterFace.InOrOutViewObserverProps,
11
10
  const {
12
11
  children,
13
12
  style,
14
13
  inViewCallback,
15
14
  outViewCallback,
16
15
  threshold = 0,
17
16
  } = props
18
17
  const [componentShowState, setComponentShowState] = useState(false)
19
18
  const componentObserverRef = useRef<HTMLElement | null>(null)
20
19
  const componentShowStateRef = useRef(false)
21
20
  const needShowHighVersion =
22
21
  isAppClassifyPage ||
23
22
  (isH5AndJdShopViewH5Scroll &&
24
23
  !(
25
24
  global.info.queryInfo?.downgraded &&
26
25
  global.info.queryInfo.downgraded === 'true'
27
26
  ))
28
27
  const rootDom =
29
28
  isH5AndJdShopView && needShowHighVersion
30
29
  ? null
31
30
  : document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
32
31
  if (isH5AndJdShopView && !needShowHighVersion) {
33
32
  console.log('视频========属于app原生滚动')
34
33
  useEffect(() => {
35
34
  const latestRes =
36
35
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
37
36
  dealPageScrollInfo(latestRes)
38
37
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
39
38
  dealPageScrollInfo(res)
40
39
  })
41
40
  Taro.eventCenter.on(
42
41
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
43
42
  state => {
44
43
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
45
44
  },
46
45
  )
47
46
  return function cleanup() {
48
47
  Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, res => {
49
48
  dealPageScrollInfo(res)
50
49
  })
51
50
  Taro.eventCenter.off(
52
51
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
53
52
  state => {
54
53
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
55
54
  },
56
55
  )
57
56
  }
58
57
  }, [])
59
58
  useEffect(() => {
60
59
  if (componentShowState) {
61
60
  typeof inViewCallback === 'function' && inViewCallback()
62
61
  console.log('app=>in可视区域')
63
62
  } else {
64
63
  typeof outViewCallback === 'function' && outViewCallback()
65
64
  console.log('app=>out可视区域')
66
65
  }
67
66
  }, [componentShowState])
68
67
 
69
68
  const handleInOrOutView = (type: boolean) => {
70
69
  componentShowStateRef.current = type
71
70
  setComponentShowState(type)
72
71
  console.log('handleInOrOutView', type)
73
72
  }
74
73
 
75
74
  const dealPageScrollInfo = res => {
76
75
  console.log('dealPageScrollInfo===', res)
77
76
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
78
77
  if (
79
78
  typeof displayHeight === 'undefined' ||
80
79
  typeof offSetY === 'undefined'
81
80
  )
82
81
  return
83
82
  console.log(
84
83
  '处理后dealPageScrollInfo===displayHeight=offSetY',
85
84
  displayHeight,
86
85
  offSetY,
87
86
  )
88
87
  if (componentObserverRef.current) {
89
88
  const eleClientRect = componentObserverRef.current.getBoundingClientRect()
90
89
  const eleOffsetTop = Math.ceil(eleClientRect.top)
91
90
  const eleHeight = Math.ceil(eleClientRect.height)
92
91
  console.log(
93
92
  '==========================eleOffsetTop, eleHeight',
94
93
  eleOffsetTop,
95
94
  eleHeight,
96
95
  )
97
96
  if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
98
97
  const isOutView =
99
98
  offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
100
99
  displayHeight - (eleOffsetTop - offSetY) <
101
100
  Math.ceil(eleHeight * threshold)
102
101
  console.log(
103
102
  '比较isOutView',
104
103
  isOutView,
105
104
  offSetY,
106
105
  eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
107
106
  displayHeight - (eleOffsetTop - offSetY),
108
107
  Math.ceil(eleHeight * threshold),
109
108
  )
110
109
  handleInOrOutView(!isOutView)
111
110
  } else {
112
111
  const isInView =
113
112
  offSetY >
114
113
  eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
115
114
  offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
116
115
  console.log(
117
116
  '比较isInView',
118
117
  isInView,
119
118
  offSetY,
120
119
  eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold),
121
120
  eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
122
121
  )
123
122
  handleInOrOutView(isInView)
124
123
  }
125
124
  }
126
125
  }
127
126
  return (
128
127
  <View ref={componentObserverRef} style={style}>
129
128
  {children}
130
129
  </View>
131
130
  )
132
131
  } else {
133
132
  console.log('视频========h5滚动')
134
133
  const { ref, inView } = useInView({
135
134
  delay: 100,
136
135
  threshold,
137
136
  triggerOnce: false,
138
137
  root: rootDom || null,
139
138
  rootMargin: `0px 0px 0px 0px`,
140
139
  })
141
140
  useEffect(() => {
142
141
  if (inView) {
143
142
  typeof inViewCallback === 'function' && inViewCallback()
144
143
  console.log('其他h5=>in可视区域')
145
144
  } else {
146
145
  typeof outViewCallback === 'function' && outViewCallback()
147
146
  console.log('其他h5=>out可视区域')
148
147
  }
149
148
  }, [inView])
150
149
  return (
151
150
  <View ref={ref} style={style}>
152
151
  {children}
153
152
  </View>
154
153
  )
155
154
  }
156
155
  children: null,
157
156
  style: {},
158
157
  className: '',
159
158
  inViewCallback: null,
160
159
  outViewCallback: null,
161
160
  threshold: 0,
161
+ import Taro from '@tarojs/taro'
162
162
  isH5AndJdShopView,
163
163
  isH5AndJdShopViewH5Scroll,
164
164
  isAppClassifyPage,
165
165
  TaroEventType,
166
166
  WEBVIEW_STATE,
167
167
  M_H5_ROOT_ELE_NODE,
168
168
  latestFromNativeMsgStorage,
169
169
  getNativePageScrollRes,
170
170
  props: ComponentInterFace.InOrOutViewObserverProps,
171
171
  const {
172
172
  children,
173
173
  style,
174
174
  inViewCallback,
175
175
  outViewCallback,
176
176
  threshold = 0,
177
177
  } = props
178
178
  const [componentShowState, setComponentShowState] = useState(false)
179
179
  const componentObserverRef = useRef<HTMLElement | null>(null)
180
180
  const componentShowStateRef = useRef(false)
181
181
  const needShowHighVersion =
182
182
  isAppClassifyPage ||
183
183
  (isH5AndJdShopViewH5Scroll &&
184
184
  !(
185
185
  global.info.queryInfo?.downgraded &&
186
186
  global.info.queryInfo.downgraded === 'true'
187
187
  ))
188
188
  const rootDom =
189
189
  isH5AndJdShopView && needShowHighVersion
190
190
  ? null
191
191
  : document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
192
192
  if (isH5AndJdShopView && !needShowHighVersion) {
193
193
  useEffect(() => {
194
194
  const latestRes =
195
195
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
196
196
  dealPageScrollInfo(latestRes)
197
197
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
198
198
  dealPageScrollInfo(res)
199
199
  })
200
200
  Taro.eventCenter.on(
201
201
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
202
202
  state => {
203
203
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
204
204
  },
205
205
  )
206
206
  return function cleanup() {
207
207
  Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, res => {
208
208
  dealPageScrollInfo(res)
209
209
  })
210
210
  Taro.eventCenter.off(
211
211
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
212
212
  state => {
213
213
  state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
214
214
  },
215
215
  )
216
216
  }
217
217
  }, [])
218
218
  useEffect(() => {
219
219
  if (componentShowState) {
220
220
  typeof inViewCallback === 'function' && inViewCallback()
221
221
  console.log('app=>in可视区域')
222
222
  } else {
223
223
  typeof outViewCallback === 'function' && outViewCallback()
224
224
  console.log('app=>out可视区域')
225
225
  }
226
226
  }, [componentShowState])
227
227
 
228
228
  const handleInOrOutView = (type: boolean) => {
229
229
  componentShowStateRef.current = type
230
230
  setComponentShowState(type)
231
231
  }
232
232
 
233
233
  const dealPageScrollInfo = res => {
234
234
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
235
235
  if (
236
236
  typeof displayHeight === 'undefined' ||
237
237
  typeof offSetY === 'undefined'
238
238
  )
239
239
  return
240
240
  if (componentObserverRef.current) {
241
241
  const eleClientRect = componentObserverRef.current.getBoundingClientRect()
242
242
  const eleOffsetTop = Math.ceil(eleClientRect.top)
243
243
  const eleHeight = Math.ceil(eleClientRect.height)
244
244
  if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
245
245
  const isOutView =
246
246
  offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
247
247
  displayHeight - (eleOffsetTop - offSetY) <
248
248
  Math.ceil(eleHeight * threshold)
249
249
  handleInOrOutView(!isOutView)
250
250
  } else {
251
251
  const isInView =
252
252
  offSetY >
253
253
  eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
254
254
  offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
255
255
  handleInOrOutView(isInView)
256
256
  }
257
257
  }
258
258
  }
259
259
  return (
260
260
  <View ref={componentObserverRef} style={style}>
261
261
  {children}
262
262
  </View>
263
263
  )
264
264
  } else {
265
265
  const { ref, inView } = useInView({
266
266
  delay: 100,
267
267
  threshold,
268
268
  triggerOnce: false,
269
269
  root: rootDom || null,
270
270
  rootMargin: `0px 0px 0px 0px`,
271
271
  })
272
272
  useEffect(() => {
273
273
  if (inView) {
274
274
  typeof inViewCallback === 'function' && inViewCallback()
275
275
  console.log('其他h5=>in可视区域')
276
276
  } else {
277
277
  typeof outViewCallback === 'function' && outViewCallback()
278
278
  console.log('其他h5=>out可视区域')
279
279
  }
280
280
  }, [inView])
281
281
  return (
282
282
  <View ref={ref} style={style}>
283
283
  {children}
284
284
  </View>
285
285
  )
286
286
  }
287
287
  children: null,
288
288
  style: {},
289
289
  className: '',
290
290
  inViewCallback: null,
291
291
  outViewCallback: null,
292
292
  threshold: 0,
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
2
2
  SECTION_HOME_TAB_TYPE,
3
3
  SECTION_HOME_TAB_NAME_TYPE,
4
4
  const {
5
5
  sectionType = SECTION_HOME_TAB_NAME_TYPE[
6
6
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
7
7
  ],
8
8
  type = LazyType.FLOOR,
9
9
  children = null,
10
10
  placeholder = null,
11
11
  height = 200,
12
12
  className = '',
13
13
  lazyNodeClassName = '',
14
14
  containerId,
15
15
  } = props
16
16
  const [componentShowState, setComponentShowState] = useState(false)
17
17
  const componentLazyRef = useRef<HTMLElement | null>(null)
18
18
  const lazyLayoutLoadFloor =
19
19
  'lazy-layout-load-floor' + Math.floor(Math.random() * 10000000)
20
20
  useEffect(() => {
21
21
  Taro.nextTick(() => {
22
22
  const createIntersectionObserver = new intersectionObserver({
23
23
  selector: `.${lazyLayoutLoadFloor}`,
24
24
  context: this,
25
25
  onFinal: () => {
26
26
  setComponentShowState(true)
27
27
  createIntersectionObserver.disconnect()
28
28
  },
29
29
  })
30
30
  createIntersectionObserver.connect()
31
31
  })
32
32
  }, [])
33
33
  return type === LazyType.IMAGE ? (
34
34
  children
35
35
  ) : (
36
36
  <View
37
37
  id={`${containerId}_lazy`}
38
38
  ref={componentLazyRef}
39
39
  className={classNames(
40
40
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
41
41
  'd-app-floor-lazy-load',
42
42
  lazyLayoutLoadFloor,
43
43
  )}
44
44
  style={{
45
45
  minHeight: `${componentShowState ? 'auto' : height + 'px'}`,
46
46
  backgroundColor: componentShowState ? 'transparent' : '#ffffff',
47
47
  }}
48
48
  >
49
49
  {componentShowState ? children : placeholder}
50
50
  </View>
51
51
  )