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

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