@conecli/cone-render 0.9.1-shop2.13 → 0.9.1-shop2.14

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 (35) hide show
  1. package/dist/common/const.ts +1 -1
  2. package/dist/common/index.h5.ts +1 -1
  3. package/dist/common/index.weapp.ts +1 -1
  4. package/dist/common/sgmCustomCode.ts +1 -1
  5. package/dist/components/ErrorBoundary.tsx +1 -1
  6. package/dist/components/base/CustomVideo/index.tsx +1 -1
  7. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  8. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  9. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  10. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  11. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  12. package/dist/components/remoteFloorItem.tsx +1 -1
  13. package/dist/interface/component.ts +1 -1
  14. package/dist/jumpEventReport/base.ts +1 -1
  15. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  16. package/dist/jumpEventReport/web.base.ts +1 -1
  17. package/dist/jumpEventReport/web.jd.ts +1 -1
  18. package/dist/modules/ContainerFloorList/index.h5.module.scss +1 -0
  19. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  20. package/dist/open/api/device.ts +1 -1
  21. package/dist/open/api/request.ts +1 -1
  22. package/dist/open/api/shopMember.ts +1 -1
  23. package/dist/open/api/util.ts +1 -1
  24. package/dist/open/components/index.ts +1 -1
  25. package/dist/sass/app.h5.scss +5 -0
  26. package/dist/service/requestServer.ts +1 -1
  27. package/dist/utils/connectNativeJsBridge.ts +1 -1
  28. package/dist/utils/h5Utils.ts +1 -1
  29. package/dist/utils/index.h5.ts +1 -1
  30. package/dist/utils/index.ts +1 -1
  31. package/dist/utils/index.weapp.ts +1 -1
  32. package/dist/utils/sgmCodeUtils.ts +1 -1
  33. package/dist/utils/taroRenderUtil.ts +1 -1
  34. package/dist/utils/utils.ts +1 -1
  35. package/package.json +1 -1
@@ -1 +1 @@
1
- import Taro, { useRouter } from '@tarojs/taro'
2
1
  SECTION_HOME_TAB_TYPE,
3
2
  SECTION_HOME_TAB_NAME_TYPE,
4
3
  TaroEventType,
5
4
  const {
6
5
  children,
7
6
  containerId,
8
7
  type,
9
8
  placeholder,
10
9
  height,
11
10
  floorData = {},
12
11
  sectionType,
13
12
  lazyNodeClassName,
14
13
  } = props
15
14
  const getRouterInfo = useRouter()
16
15
  const getQueryData = getRouterInfo?.params || {}
17
16
  const [componentShowState, setComponentShowState] = useState(false)
18
17
  const [componentRenderShowState, setComponentRenderShowState] =
19
18
  useState(false)
20
19
  const componentLazyRef = useRef<HTMLElement | null>(null)
21
20
  const componentShowStateRef = useRef(false)
22
21
  const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
23
22
  const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
24
23
  const { ref, inView } = useInView({
25
24
  threshold: 0,
26
25
  triggerOnce: true,
27
26
  root: rootDom,
28
27
  rootMargin: `0px 0px ${window.innerHeight}px 0px`,
29
28
  })
30
29
  useEffect(() => {
31
30
  if(needShowHighVersion || !isH5AndJdShopView) return
32
31
  if (type === LazyType.FLOOR) {
33
32
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
34
33
  !componentShowStateRef.current && dealPageScrollInfo(latestRes,false)
35
34
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
36
35
  !componentShowStateRef.current && dealPageScrollInfo(res,true)
37
36
  })
38
37
  }
39
38
  }, [])
40
39
  useEffect(() => {
41
40
  if((!needShowHighVersion && componentShowState === true) ||
42
41
  (needShowHighVersion && inView && isH5AndJdShopView)
43
42
  ) {
44
43
  console.log('>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!')
45
44
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult
46
45
  const modularPackResultObj = typeof modularPackResult === 'string' ? JSON.parse(modularPackResult) : modularPackResult
47
46
  if (modularPackResultObj && modularPackResultObj.bundleUrl) {
48
47
  const { bundleUrl } = modularPackResultObj
49
48
  nativePageRegisterMessage(
50
49
  Message_Type.NATIVE_INJECT_JS_FILE,
51
50
  {
52
51
  data: {
53
52
  "bundleUrl": [bundleUrl]
54
53
  },
55
54
  },
56
55
  )
57
56
  }
58
57
  }
59
58
  }, [componentShowState,inView])
60
59
 
61
60
  const dealPageScrollInfo = (res,pageScrollTrigger) => {
62
61
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
63
62
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') {
64
63
  const shopId = floorData?.floorExtInfo?.shopId
65
64
  if(!lazyLayoutLoadErrorShopId[`${shopId}`] && pageScrollTrigger) {
66
65
  const opt = {
67
66
  msg: `店铺楼层懒加载失败。楼层顺序-floorIdx: ${floorData?.floorIdx}。`,
68
67
  uid: floorData?.uid,
69
68
  floorIdx: floorData?.floorIdx,
70
69
  shopId: shopId,
71
70
  moduleId: floorData?.moduleId,
72
71
  moduleName: floorData?.moduleName,
73
72
  middleTemplateId: floorData?.middleTemplateId,
74
73
  modularPackResult: typeof floorData?.floorExtInfo?.modularPackResult == 'string' ? JSON.parse(floorData?.floorExtInfo?.modularPackResult) : floorData?.floorExtInfo?.modularPackResult,
75
74
  }
76
75
  sgmCustomReport({
77
76
  code: getSgmCustomCode(SgmCustomCode.FLOORLAZYLOAD_DATA),
78
77
  msg: opt,
79
78
  })
80
79
  lazyLayoutLoadErrorShopId[`${shopId}`] = true
81
80
  }
82
81
  return
83
82
  }
84
83
  if (componentLazyRef.current) {
85
84
  const eleClientRect =
86
85
  componentLazyRef.current.getBoundingClientRect()
87
86
  const getContainerHeightOffSetY = displayHeight + offSetY
88
87
  const eleOffsetTop = Math.ceil(eleClientRect.top)
89
88
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
90
89
  const eleOffsetTopHeight = eleOffsetTop + eleOffsetHeight
91
90
  if (!componentShowStateRef.current) {
92
91
  if (getContainerHeightOffSetY > eleOffsetTop) {
93
92
  componentShowStateRef.current = true
94
93
  setComponentShowState(true)
95
94
  Taro.nextTick(() => {
96
95
  setComponentRenderShowState(true)
97
96
  })
98
97
  }
99
98
  }
100
99
  }
101
100
  }
102
101
  return isH5AndJdShopView && !needShowHighVersion ? (
103
102
  <div
104
103
  id={`${containerId}_lazy`}
105
104
  ref={componentLazyRef}
106
105
  className={classNames(
107
106
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
108
107
  'd-app-floor-lazy-load',
109
108
  )}
110
109
  style={{
111
110
  minHeight: `${
112
111
  componentRenderShowState ? 'auto' : height + 'px'
113
112
  }`,
114
113
  backgroundColor: componentRenderShowState
115
114
  ? 'transparent'
116
115
  : '#ffffff',
117
116
  }}
118
117
  >
119
118
  {componentShowState ? children : placeholder}
120
119
  </div>
121
120
  ) : (
122
121
  <div
123
122
  id={`${containerId}_lazy`}
124
123
  className={classNames(
125
124
  lazyLayoutLoadStyle["d-mobile-floor-lazy-layout-load"],
126
125
  "d-mobile-floor-lazy-load",
127
126
  lazyNodeClassName,
128
127
  )}
129
128
  ref={ref}
130
129
  style={{
131
130
  minHeight: `${inView ? 'auto' : height + 'px'}`,
132
131
  backgroundColor: inView ? 'transparent' : '#ffffff',
133
132
  }}
134
133
  >
135
134
  {inView ? children : placeholder}
136
135
  </div>
137
136
  );
138
137
  sectionType:
139
138
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
140
139
  type: LazyType.FLOOR,
141
140
  children: null,
142
141
  placeholder: null,
143
142
  height: 200,
144
143
  className: '',
145
144
  lazyNodeClassName: '',
145
+ import Taro, { useRouter } from '@tarojs/taro'
146
146
  SECTION_HOME_TAB_TYPE,
147
147
  SECTION_HOME_TAB_NAME_TYPE,
148
148
  TaroEventType,
149
149
  const {
150
150
  children,
151
151
  containerId,
152
152
  type,
153
153
  placeholder,
154
154
  height,
155
155
  floorData = {},
156
156
  sectionType,
157
157
  lazyNodeClassName,
158
158
  } = props
159
159
  const getRouterInfo = useRouter()
160
160
  const getQueryData = getRouterInfo?.params || {}
161
161
  const [componentShowState, setComponentShowState] = useState(false)
162
162
  const [componentRenderShowState, setComponentRenderShowState] =
163
163
  useState(false)
164
164
  const componentLazyRef = useRef<HTMLElement | null>(null)
165
165
  const componentShowStateRef = useRef(false)
166
166
  const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
167
167
  const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
168
168
  const { ref, inView } = useInView({
169
169
  threshold: 0,
170
170
  triggerOnce: true,
171
171
  root: rootDom,
172
172
  rootMargin: `0px 0px ${window.innerHeight}px 0px`,
173
173
  })
174
174
  useEffect(() => {
175
175
  if(needShowHighVersion || !isH5AndJdShopView) return
176
176
  if (type === LazyType.FLOOR) {
177
177
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
178
178
  !componentShowStateRef.current && dealPageScrollInfo(latestRes,false)
179
179
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
180
180
  !componentShowStateRef.current && dealPageScrollInfo(res,true)
181
181
  })
182
182
  }
183
183
  }, [])
184
184
  useEffect(() => {
185
185
  if((!needShowHighVersion && componentShowState === true) ||
186
186
  (needShowHighVersion && inView && isH5AndJdShopView)
187
187
  ) {
188
188
  console.log('>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!')
189
189
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult
190
190
  const modularPackResultObj = typeof modularPackResult === 'string' ? JSON.parse(modularPackResult) : modularPackResult
191
191
  if (modularPackResultObj && modularPackResultObj.bundleUrl) {
192
192
  const { bundleUrl } = modularPackResultObj
193
193
  nativePageRegisterMessage(
194
194
  Message_Type.NATIVE_INJECT_JS_FILE,
195
195
  {
196
196
  data: {
197
197
  "bundleUrl": [bundleUrl]
198
198
  },
199
199
  },
200
200
  )
201
201
  }
202
202
  }
203
203
  }, [componentShowState,inView])
204
204
 
205
205
  const dealPageScrollInfo = (res,pageScrollTrigger) => {
206
206
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
207
207
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') {
208
208
  const shopId = floorData?.floorExtInfo?.shopId
209
209
  if(!lazyLayoutLoadErrorShopId[`${shopId}`] && pageScrollTrigger) {
210
210
  const opt = {
211
211
  msg: `店铺楼层懒加载失败。楼层顺序-floorIdx: ${floorData?.floorIdx}。`,
212
212
  uid: floorData?.uid,
213
213
  floorIdx: floorData?.floorIdx,
214
214
  shopId: shopId,
215
215
  moduleId: floorData?.moduleId,
216
216
  moduleName: floorData?.moduleName,
217
217
  middleTemplateId: floorData?.middleTemplateId
218
218
  }
219
219
  sgmCustomReport({
220
220
  code: getSgmCustomCode(SgmCustomCode.FLOORLAZYLOAD_DATA),
221
221
  msg: opt,
222
222
  })
223
223
  lazyLayoutLoadErrorShopId[`${shopId}`] = true
224
224
  }
225
225
  return
226
226
  }
227
227
  if (componentLazyRef.current) {
228
228
  const eleClientRect =
229
229
  componentLazyRef.current.getBoundingClientRect()
230
230
  const getContainerHeightOffSetY = displayHeight + offSetY
231
231
  const eleOffsetTop = Math.ceil(eleClientRect.top)
232
232
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
233
233
  const eleOffsetTopHeight = eleOffsetTop + eleOffsetHeight
234
234
  if (!componentShowStateRef.current) {
235
235
  if (getContainerHeightOffSetY > eleOffsetTop) {
236
236
  componentShowStateRef.current = true
237
237
  setComponentShowState(true)
238
238
  Taro.nextTick(() => {
239
239
  setComponentRenderShowState(true)
240
240
  })
241
241
  }
242
242
  }
243
243
  }
244
244
  }
245
245
  return isH5AndJdShopView && !needShowHighVersion ? (
246
246
  <div
247
247
  id={`${containerId}_lazy`}
248
248
  ref={componentLazyRef}
249
249
  className={classNames(
250
250
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
251
251
  'd-app-floor-lazy-load',
252
252
  )}
253
253
  style={{
254
254
  minHeight: `${
255
255
  componentRenderShowState ? 'auto' : height + 'px'
256
256
  }`,
257
257
  backgroundColor: componentRenderShowState
258
258
  ? 'transparent'
259
259
  : '#ffffff',
260
260
  }}
261
261
  >
262
262
  {componentShowState ? children : placeholder}
263
263
  </div>
264
264
  ) : (
265
265
  <div
266
266
  id={`${containerId}_lazy`}
267
267
  className={classNames(
268
268
  lazyLayoutLoadStyle["d-mobile-floor-lazy-layout-load"],
269
269
  "d-mobile-floor-lazy-load",
270
270
  lazyNodeClassName,
271
271
  )}
272
272
  ref={ref}
273
273
  style={{
274
274
  minHeight: `${inView ? 'auto' : height + 'px'}`,
275
275
  backgroundColor: inView ? 'transparent' : '#ffffff',
276
276
  }}
277
277
  >
278
278
  {inView ? children : placeholder}
279
279
  </div>
280
280
  );
281
281
  sectionType:
282
282
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
283
283
  type: LazyType.FLOOR,
284
284
  children: null,
285
285
  placeholder: null,
286
286
  height: 200,
287
287
  className: '',
288
288
  lazyNodeClassName: '',