@conecli/cone-render 0.10.1-shop3.8 → 0.10.1-shop3.80

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 (109) hide show
  1. package/README.md +1 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/common/accessibility.h5.ts +1 -0
  4. package/dist/common/accessibility.ts +0 -0
  5. package/dist/common/const.ts +1 -1
  6. package/dist/common/index.h5.ts +1 -1
  7. package/dist/common/index.jd.ts +1 -1
  8. package/dist/common/index.ts +1 -1
  9. package/dist/common/index.weapp.ts +1 -1
  10. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  11. package/dist/common/jssdk.ts +1 -1
  12. package/dist/common/jssdk.weapp.ts +1 -0
  13. package/dist/common/pageType.ts +1 -1
  14. package/dist/common/token/index.h5.ts +1 -1
  15. package/dist/common/token/token.jd.ts +1 -1
  16. package/dist/common/wxappApi.ts +1 -1
  17. package/dist/components/ErrorBoundary.tsx +1 -1
  18. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  19. package/dist/components/base/CountDown/index.tsx +1 -1
  20. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  21. package/dist/components/base/CustomVideo/index.tsx +1 -1
  22. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  23. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  24. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  25. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  26. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  27. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  28. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  29. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  30. package/dist/components/base/NetworkDataError/const.ts +1 -1
  31. package/dist/components/base/NetworkDataError/index.module.scss +118 -72
  32. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  33. package/dist/components/base/Price/Base/index.module.scss +12 -0
  34. package/dist/components/base/Price/Base/index.tsx +1 -1
  35. package/dist/components/base/Price/Double/index.module.scss +24 -0
  36. package/dist/components/base/Price/Double/index.tsx +1 -1
  37. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  38. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  39. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  40. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  41. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  42. package/dist/components/floorItem.tsx +1 -1
  43. package/dist/components/isv/Floor/index.tsx +1 -1
  44. package/dist/components/remoteFloorItem.tsx +1 -1
  45. package/dist/interface/common.ts +1 -1
  46. package/dist/interface/component.ts +1 -1
  47. package/dist/interface/jumpEventReport.ts +1 -1
  48. package/dist/interface/service.ts +1 -1
  49. package/dist/jumpEventReport/base.ts +1 -1
  50. package/dist/jumpEventReport/const.ts +1 -1
  51. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  52. package/dist/jumpEventReport/index.h5.ts +1 -1
  53. package/dist/jumpEventReport/index.jd.ts +1 -1
  54. package/dist/jumpEventReport/index.weapp.ts +1 -1
  55. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  56. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  57. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  58. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  59. package/dist/jumpEventReport/web/report.ts +1 -1
  60. package/dist/jumpEventReport/web.base.ts +1 -1
  61. package/dist/jumpEventReport/web.jd.ts +1 -1
  62. package/dist/jumpEventReport/web.pc.ts +1 -1
  63. package/dist/jumpEventReport/web.tjm.ts +1 -1
  64. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  65. package/dist/language/en_US.json +274 -0
  66. package/dist/language/zh_CN.json +274 -0
  67. package/dist/language/zh_HK.json +274 -0
  68. package/dist/libs/openShopBridge.js +161 -0
  69. package/dist/libs/openShopBridge.min.js +1 -0
  70. package/dist/libs/taroAppReport.js +2 -2
  71. package/dist/modules/ContainerFloorList/index.h5.module.scss +16 -2
  72. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  73. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  74. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  75. package/dist/open/api/environment.ts +1 -1
  76. package/dist/open/api/shopMember.ts +1 -1
  77. package/dist/open/api/shopMember.weapp.ts +1 -0
  78. package/dist/open/api/track.ts +1 -1
  79. package/dist/open/api/util.ts +1 -1
  80. package/dist/open/components/index.ts +1 -1
  81. package/dist/open/index.ts +1 -1
  82. package/dist/sass/app.h5.scss +27 -1
  83. package/dist/service/fetchGateway.ts +1 -1
  84. package/dist/service/fetchGateway.weapp.ts +1 -1
  85. package/dist/service/fetchJsonp.weapp.ts +1 -0
  86. package/dist/service/http/const.ts +1 -1
  87. package/dist/service/http/h5Http.ts +1 -1
  88. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  89. package/dist/service/requestServer.h5.ts +1 -1
  90. package/dist/service/requestServer.ts +1 -1
  91. package/dist/service/requestServer.weapp.ts +1 -1
  92. package/dist/utils/connectNativeJsBridge.ts +1 -1
  93. package/dist/utils/h5Utils.ts +1 -1
  94. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  95. package/dist/utils/harmonyCallRouter.ts +0 -0
  96. package/dist/utils/index.h5.ts +1 -1
  97. package/dist/utils/index.ts +1 -1
  98. package/dist/utils/index.weapp.ts +1 -1
  99. package/dist/utils/jumpExtMapUtil.ts +1 -0
  100. package/dist/utils/log.ts +1 -0
  101. package/dist/utils/{sColor.js → sColor.ts} +1 -1
  102. package/dist/utils/sColor.weapp.ts +1 -0
  103. package/dist/utils/utils.ts +1 -1
  104. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  105. package/dist/wxapp/common/user_info.js +1 -1
  106. package/package.json +162 -141
  107. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  108. package/dist/utils/priceUtils.js +0 -1
  109. /package/dist/utils/{jumpExtMapUtil.js → jumpExtMapUtil.h5.ts} +0 -0
@@ -0,0 +1 @@
1
+ const CustomVideo = (props) => {
2
  console.log('CustomVideo 小程序端 暂无实现',props)
1
3
  return null
@@ -1 +1 @@
1
- import React, { useMemo } from 'react';
2
1
  const {
3
2
  type,
4
3
  className,
5
4
  reportData,
6
5
  customReportDataKey,
7
6
  customReportDataFn,
8
7
  trackCallback,
9
8
  markPoint,
10
9
  innerRef,
11
10
  } = props;
12
11
  const isCustomReport = customReportDataKey && customReportDataFn;
13
12
  const isViewOnlineState = taroJdBaseInfo.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE;
14
13
  const showRenderState = isCustomReport ? true : reportData;
15
14
  const inViewCallback = () => {
16
15
  const getInsertFlowMapEle =
17
16
  innerRef?.current?.querySelector('.d-report-exposure-point') || createDefaultFlowMapEle;
18
17
  if (!isCustomReport) {
19
18
  addReportData(reportData, getInsertFlowMapEle);
20
19
  typeof trackCallback === 'function' && trackCallback(reportData);
21
20
  } else {
22
21
  if (typeof customReportDataFn === 'function') {
23
22
  const getReportData = customReportDataFn(customReportDataKey);
24
23
  getReportData &&
25
24
  getReportData?.eventId &&
26
25
  getReportData?.jsonParam &&
27
26
  track.reportExposureEventLog({
28
27
  ...getReportData,
29
28
  target: getInsertFlowMapEle,
30
29
  });
31
30
  }
32
31
  }
33
32
  };
34
33
  let chartPointClassName = '';
35
34
 
36
35
  if (isChartH5 && markPoint && Array.isArray(reportData)) {
37
36
  const [floorData, mInfo] = reportData;
38
37
  if (floorData && mInfo && mInfo.hasOwnProperty('pos')) {
39
38
  chartPointClassName = track.getFloorPointIndexClassName(floorData, mInfo.pos);
40
39
  }
41
40
  } else if (isCustomReport) {
42
41
  chartPointClassName = `J_custom_${customReportDataKey}`;
43
42
  }
44
43
  return isViewOnlineState && showRenderState ? (
45
44
  <InViewRender
46
45
  className={classNames(
47
46
  'd-report-exposure-point',
48
47
  {
49
48
  [exposureStyle['d-report-point']]: type === TrackType.point,
50
49
  },
51
50
  {
52
51
  [exposureStyle['d-report-floor']]: type === TrackType.floor,
53
52
  },
54
53
  {
55
54
  'd-report-exposure-jd-point': isJdApp,
56
55
  },
57
56
  className,
58
57
  chartPointClassName,
59
58
  )}
60
59
  height={'100%'}
61
60
  inViewCallback={inViewCallback}
62
61
  ></InViewRender>
63
62
  ) : null;
64
63
  return useMemo(() => {
65
64
  return <Exposure {...props} />;
66
65
  }, []);
67
66
  reportData: null,
68
67
  trackCallback: null,
69
68
  type: TrackType.point,
70
69
  markPoint: false,
70
+ import React, { useMemo } from 'react';
71
71
  const {
72
72
  type,
73
73
  className,
74
74
  reportData,
75
75
  customReportDataKey,
76
76
  customReportDataFn,
77
77
  trackCallback,
78
78
  markPoint,
79
79
  innerRef,
80
80
  } = props;
81
81
  const isCustomReport = customReportDataKey && customReportDataFn;
82
82
  const isViewOnlineState = taroJdBaseInfo.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE;
83
83
  const showRenderState = isCustomReport ? true : reportData;
84
84
  const inViewCallback = () => {
85
85
  const getInsertFlowMapEle =
86
86
  innerRef?.current?.querySelector('.d-report-exposure-point') || createDefaultFlowMapEle;
87
87
  if (!isCustomReport) {
88
88
  addReportData(reportData, getInsertFlowMapEle);
89
89
  typeof trackCallback === 'function' && trackCallback(reportData);
90
90
  } else {
91
91
  if (typeof customReportDataFn === 'function') {
92
92
  const getReportData = customReportDataFn(customReportDataKey);
93
93
  if(getReportData){
94
94
  const { eventId, spmAllCode, spmCodeForCD, jsonParam } = getReportData;
95
95
  (eventId || spmAllCode || spmCodeForCD) &&
96
96
  jsonParam &&
97
97
  track.reportExposureEventLog({
98
98
  ...getReportData,
99
99
  target: getInsertFlowMapEle,
100
100
  });
101
101
  }
102
102
  }
103
103
  }
104
104
  };
105
105
  let chartPointClassName = '';
106
106
 
107
107
  if (isChartH5 && markPoint && Array.isArray(reportData)) {
108
108
  const [floorData, mInfo] = reportData;
109
109
  if (floorData && mInfo && mInfo.hasOwnProperty('pos')) {
110
110
  chartPointClassName = track.getFloorPointIndexClassName(floorData, mInfo.pos);
111
111
  }
112
112
  } else if (isCustomReport) {
113
113
  chartPointClassName = `J_custom_${customReportDataKey}`;
114
114
  }
115
115
  return isViewOnlineState && showRenderState ? (
116
116
  <InViewRender
117
117
  className={classNames(
118
118
  'd-report-exposure-point',
119
119
  {
120
120
  [exposureStyle['d-report-point']]: type === TrackType.point,
121
121
  },
122
122
  {
123
123
  [exposureStyle['d-report-floor']]: type === TrackType.floor,
124
124
  },
125
125
  {
126
126
  'd-report-exposure-jd-point': isJdApp,
127
127
  },
128
128
  className,
129
129
  chartPointClassName,
130
130
  )}
131
131
  height={'100%'}
132
132
  inViewCallback={inViewCallback}
133
133
  ></InViewRender>
134
134
  ) : null;
135
135
  return useMemo(() => {
136
136
  return <Exposure {...props} />;
137
137
  }, []);
138
138
  reportData: null,
139
139
  trackCallback: null,
140
140
  type: TrackType.point,
141
141
  markPoint: false,
@@ -1 +1 @@
1
- import track from '../../../open/api/track';
2
1
  const { arr: arrTask, startWaitTime } = floorTask;
3
2
  const isTimeout = startWaitTime != 0 && Date.now() - startWaitTime >= 1000;
4
3
  const arrTaskNum = arrTask.length;
5
4
  const isOverMax = arrTaskNum >= 10;
6
5
  const hasData = arrTaskNum > 0;
7
6
  if (hasData && (isTimeout || isOverMax)) {
8
7
  const reduceData = connactData(arrTask);
9
8
  track.reportExposureEventLog(reduceData);
10
9
  floorTask.arr = [];
11
10
  floorTask.startWaitTime = 0;
12
11
  clearTimeout(floorTask.timer);
13
12
  }
14
13
  const initData = JSON.parse(JSON.stringify(arr[0]));
15
14
  if (initData.jsonParam.etModelInfo) {
16
15
  initData.jsonParam.logBaseInfo = [];
17
16
  initData.jsonParam.etModelInfo.lstms = [];
18
17
  return arr.reduce((acc, cur) => {
19
18
  acc.jsonParam.logBaseInfo.push(cur.jsonParam.logBaseInfo);
20
19
  return acc;
21
20
  }, initData);
22
21
  } else {
23
22
  return arr.reduce((acc) => {
24
23
  return acc;
25
24
  });
26
25
  }
27
26
  if (!Array.isArray(data)) {
28
27
  console.log('坑位曝光埋点原始数据参类型错误,期望是数组,实际是:', data);
29
28
  return;
30
29
  }
31
30
  const [floorData, mInfo, etModelInfo] = data;
32
31
  if (floorData && mInfo && etModelInfo) {
33
32
  const isIsvReportModule = isvReportModuleTypeList.includes(floorData?.floorExtInfo?.moduleFlag);
34
33
  try {
35
34
  const reportJson = track.getExposureInfo(
36
35
  floorData,
37
36
  mInfo,
38
37
  etModelInfo,
39
38
  true,
40
39
  isIsvReportModule,
41
40
  );
42
41
  console.log(`${floorData?.floorExtInfo?.moduleFlag}===reportJson===`, reportJson);
43
42
  const { floorIdx } = floorData;
44
43
  if (!task[floorIdx]) {
45
44
  task[floorIdx] = {
46
45
  arr: [],
47
46
  startWaitTime: 0,
48
47
  timer: 0,
49
48
  };
50
49
  }
51
50
  const floorTask = task[floorIdx];
52
51
  if (floorTask.arr.length === 0) {
53
52
  floorTask.startWaitTime = Date.now();
54
53
  }
55
54
  if (reportJson) {
56
55
  floorTask.arr.push(reportJson);
57
56
  clearTimeout(floorTask.timer);
58
57
  floorTask.timer = setTimeout(() => {
59
58
  check(floorTask);
60
59
  }, 1000);
61
60
  check(floorTask);
62
61
  }
63
62
  } catch (e) {
64
63
  {
65
64
  console.log('坑位曝光埋点出错啦', e);
66
65
  }
67
66
  }
68
67
  } else {
69
68
  console.log(
70
69
  '坑位曝光埋点原始数据参数缺失,期望是[floorData, mInfo, etModelInfo],实际是:',
71
70
  data,
72
71
  );
73
72
  }
73
+ import track from '../../../open/api/track';
74
74
  if (!Array.isArray(data)) {
75
75
  console.log('坑位曝光埋点原始数据参类型错误,期望是数组,实际是:', data);
76
76
  return;
77
77
  }
78
78
  const [floorData, mInfo, etModelInfo] = data;
79
79
  if (floorData && mInfo && etModelInfo) {
80
80
  const isIsvReportModule = isvReportModuleTypeList.includes(floorData?.floorExtInfo?.moduleFlag);
81
81
  try {
82
82
  const reportJson = track.getExposureInfo(
83
83
  floorData,
84
84
  mInfo,
85
85
  etModelInfo,
86
86
  true,
87
87
  isIsvReportModule,
88
88
  );
89
89
  reportJson['target'] = target;
90
90
  console.log(`${floorData?.floorExtInfo?.moduleFlag}===reportJson===`, reportJson);
91
91
  track.reportExposureEventLog(reportJson);
92
92
  } catch (e) {
93
93
  console.log('坑位曝光埋点出错啦', e);
94
94
  }
95
95
  } else {
96
96
  console.log(
97
97
  '坑位曝光埋点原始数据参数缺失,期望是[floorData, mInfo, etModelInfo],实际是:',
98
98
  data,
99
99
  );
100
100
  }
@@ -0,0 +1 @@
1
+ const InOrOutViewObserver = (props) => {
2
  console.log('InOrOutViewObserver props 暂无实现', props)
1
3
  return null
@@ -1 +1 @@
1
- import React, { useRef } from 'react';
2
1
  const {
3
2
  className,
4
3
  pointClassName,
5
4
  children,
6
5
  reportData,
7
6
  customReportDataKey,
8
7
  customReportDataFn,
9
8
  trackCallback,
10
9
  ...otherProps
11
10
  } = props;
12
11
  const itemViewExposureRef = useRef(null);
13
12
  const isCustomReport = customReportDataKey && customReportDataFn;
14
13
  const checkReportData = Array.isArray(reportData);
15
14
  const [floorData, mInfo] = checkReportData ? reportData : [];
16
15
  const checkReportDataState = isCustomReport ? true : floorData && mInfo;
17
16
 
18
17
  floorData && mInfo && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0);
19
18
  return (
20
19
  <View
21
20
  ref={itemViewExposureRef}
22
21
  className={classNames(itemViewExposureSmartStyle['d-item-point-layout'], className)}
23
22
  {...otherProps}
24
23
  >
25
24
  {children ? children : null}
26
25
  {checkReportDataState && (
27
26
  <ExposureSmart
28
27
  className={classNames(pointClassName, {
29
28
  [itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
30
29
  })}
31
30
  innerRef={itemViewExposureRef}
32
31
  reportData={reportData}
33
32
  trackCallback={trackCallback}
34
33
  customReportDataFn={customReportDataFn}
35
34
  customReportDataKey={customReportDataKey}
36
35
  markPoint
37
36
  />
38
37
  )}
39
38
  </View>
40
39
  );
41
40
  reportData: [],
42
41
  customReportDataKey: null,
43
42
  customReportDataFn: null,
44
43
  customReportDataForMapFn: null,
44
+ import React, { useRef, useEffect } from 'react';
45
45
  const {
46
46
  className,
47
47
  pointClassName,
48
48
  children,
49
49
  reportData,
50
50
  customReportDataKey,
51
51
  customReportDataFn,
52
52
  trackCallback,
53
53
  ...otherProps
54
54
  } = props;
55
55
  const itemViewExposureRef = useRef(null);
56
56
  const isCustomReport = customReportDataKey && customReportDataFn;
57
57
  const checkReportData = Array.isArray(reportData);
58
58
  const [floorData, mInfo] = checkReportData ? reportData : [];
59
59
  const checkReportDataState = isCustomReport ? true : floorData && mInfo;
60
60
 
61
61
  floorData && mInfo && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0);
62
62
  return (
63
63
  <View
64
64
  ref={itemViewExposureRef}
65
65
  className={classNames(itemViewExposureSmartStyle['d-item-point-layout'], className)}
66
66
  {...otherProps}
67
67
  >
68
68
  {children ? children : null}
69
69
  {checkReportDataState && (
70
70
  <ExposureSmart
71
71
  className={classNames(pointClassName, {
72
72
  [itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
73
73
  })}
74
74
  innerRef={itemViewExposureRef}
75
75
  reportData={reportData}
76
76
  trackCallback={trackCallback}
77
77
  customReportDataFn={customReportDataFn}
78
78
  customReportDataKey={customReportDataKey}
79
79
  markPoint
80
80
  />
81
81
  )}
82
82
  </View>
83
83
  );
84
84
  reportData: [],
85
85
  customReportDataKey: null,
86
86
  customReportDataFn: null,
87
87
  customReportDataForMapFn: null,
@@ -1 +1 @@
1
- import Taro, { useRouter } from '@tarojs/taro'
2
1
  isH5AndJdShopView,
3
2
  isH5AndJdShopViewH5Scroll,
4
3
  sgmCustomReport,
5
4
  getSgmCustomCode,
6
5
  SECTION_HOME_TAB_TYPE,
7
6
  SECTION_HOME_TAB_NAME_TYPE,
8
7
  TaroEventType,
9
8
  latestFromNativeMsgStorage,
10
9
  nativePageRegisterMessage,
11
10
  Message_Type,
12
11
  getNativePageScrollRes,
13
12
  const {
14
13
  sectionType = SECTION_HOME_TAB_NAME_TYPE[
15
14
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
16
15
  ],
17
16
  type = LazyType.FLOOR,
18
17
  children = null,
19
18
  placeholder = null,
20
19
  height = 200,
21
20
  className = '',
22
21
  lazyNodeClassName = '',
23
22
  containerId,
24
23
  floorData = {},
25
24
  } = props
26
25
  const getRouterInfo = useRouter()
27
26
  const getQueryData = getRouterInfo?.params || {}
28
27
  const [componentShowState, setComponentShowState] = useState(false)
29
28
  const [componentRenderShowState, setComponentRenderShowState] =
30
29
  useState(false)
31
30
  const componentLazyRef = useRef<HTMLElement | null>(null)
32
31
  const componentShowStateRef = useRef(false)
33
32
  const needShowHighVersion =
34
33
  isH5AndJdShopViewH5Scroll &&
35
34
  !(
36
35
  global.info.queryInfo?.downgraded &&
37
36
  global.info.queryInfo.downgraded === 'true'
38
37
  )
39
38
  const rootDom =
40
39
  isH5AndJdShopView && needShowHighVersion
41
40
  ? null
42
41
  : document.querySelector('#J_shopHomeRoot')
43
42
  const { ref, inView } = useInView({
44
43
  threshold: 0,
45
44
  triggerOnce: true,
46
45
  root: rootDom,
47
46
  rootMargin: `0px 0px ${window.innerHeight}px 0px`,
48
47
  })
49
48
  useEffect(() => {
50
49
  if (needShowHighVersion || !isH5AndJdShopView) return
51
50
  if (type === LazyType.FLOOR) {
52
51
  const latestRes =
53
52
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
54
53
  !componentShowStateRef.current && dealPageScrollInfo(latestRes, false)
55
54
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
56
55
  !componentShowStateRef.current && dealPageScrollInfo(res, true)
57
56
  })
58
57
  }
59
58
  }, [])
60
59
  useEffect(() => {
61
60
  if (
62
61
  (!needShowHighVersion && componentShowState === true) ||
63
62
  (needShowHighVersion && inView && isH5AndJdShopView)
64
63
  ) {
65
64
  console.log(
66
65
  '>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!',
67
66
  )
68
67
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult
69
68
  const modularPackResultObj =
70
69
  typeof modularPackResult === 'string'
71
70
  ? JSON.parse(modularPackResult)
72
71
  : modularPackResult
73
72
  if (modularPackResultObj && modularPackResultObj.bundleUrl) {
74
73
  const { bundleUrl } = modularPackResultObj
75
74
  nativePageRegisterMessage(Message_Type.NATIVE_INJECT_JS_FILE, {
76
75
  data: {
77
76
  bundleUrl: [bundleUrl],
78
77
  },
79
78
  })
80
79
  }
81
80
  }
82
81
  }, [componentShowState, inView])
83
82
 
84
83
  const dealPageScrollInfo = (res, pageScrollTrigger) => {
85
84
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
86
85
  if (
87
86
  typeof displayHeight === 'undefined' ||
88
87
  typeof offSetY === 'undefined'
89
88
  ) {
90
89
  const shopId = floorData?.floorExtInfo?.shopId
91
90
  if (!lazyLayoutLoadErrorShopId[`${shopId}`] && pageScrollTrigger) {
92
91
  const opt = {
93
92
  msg: `店铺楼层懒加载失败。楼层顺序-floorIdx: ${floorData?.floorIdx}。`,
94
93
  uid: floorData?.uid,
95
94
  floorIdx: floorData?.floorIdx,
96
95
  shopId: shopId,
97
96
  moduleId: floorData?.moduleId,
98
97
  moduleName: floorData?.moduleName,
99
98
  middleTemplateId: floorData?.middleTemplateId,
100
99
  }
101
100
  sgmCustomReport({
102
101
  code: getSgmCustomCode(SgmCustomCode.FLOORLAZYLOAD_DATA),
103
102
  msg: opt,
104
103
  })
105
104
  lazyLayoutLoadErrorShopId[`${shopId}`] = true
106
105
  }
107
106
  return
108
107
  }
109
108
  if (componentLazyRef.current) {
110
109
  const eleClientRect = componentLazyRef.current.getBoundingClientRect()
111
110
  const getContainerHeightOffSetY = displayHeight + offSetY
112
111
  const eleOffsetTop = Math.ceil(eleClientRect.top)
113
112
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
114
113
  const eleOffsetTopHeight = eleOffsetTop + eleOffsetHeight
115
114
  if (!componentShowStateRef.current) {
116
115
  if (getContainerHeightOffSetY > eleOffsetTop) {
117
116
  componentShowStateRef.current = true
118
117
  setComponentShowState(true)
119
118
  Taro.nextTick(() => {
120
119
  setComponentRenderShowState(true)
121
120
  })
122
121
  }
123
122
  }
124
123
  }
125
124
  }
126
125
  return isH5AndJdShopView && !needShowHighVersion ? (
127
126
  <div
128
127
  id={`${containerId}_lazy`}
129
128
  ref={componentLazyRef}
130
129
  className={classNames(
131
130
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
132
131
  'd-app-floor-lazy-load',
133
132
  )}
134
133
  style={{
135
134
  minHeight: `${componentRenderShowState ? 'auto' : height + 'px'}`,
136
135
  backgroundColor: componentRenderShowState ? 'transparent' : '#ffffff',
137
136
  }}
138
137
  >
139
138
  {componentShowState ? children : placeholder}
140
139
  </div>
141
140
  ) : (
142
141
  <div
143
142
  id={`${containerId}_lazy`}
144
143
  className={classNames(
145
144
  lazyLayoutLoadStyle['d-mobile-floor-lazy-layout-load'],
146
145
  'd-mobile-floor-lazy-load',
147
146
  lazyNodeClassName,
148
147
  )}
149
148
  ref={ref}
150
149
  style={{
151
150
  minHeight: `${inView ? 'auto' : height + 'px'}`,
152
151
  backgroundColor: inView ? 'transparent' : '#ffffff',
153
152
  }}
154
153
  >
155
154
  {inView ? children : placeholder}
156
155
  </div>
157
156
  )
157
+ import Taro, { useRouter } from '@tarojs/taro'
158
158
  isH5AndJdShopView,
159
159
  isH5AndJdShopViewH5Scroll,
160
160
  getSgmCustomCode,
161
161
  draBusinessCustomReport
162
162
  SECTION_HOME_TAB_TYPE,
163
163
  SECTION_HOME_TAB_NAME_TYPE,
164
164
  TaroEventType,
165
165
  latestFromNativeMsgStorage,
166
166
  nativePageRegisterMessage,
167
167
  Message_Type,
168
168
  getNativePageScrollRes,
169
169
  const {
170
170
  sectionType = SECTION_HOME_TAB_NAME_TYPE[
171
171
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
172
172
  ],
173
173
  type = LazyType.FLOOR,
174
174
  children = null,
175
175
  placeholder = null,
176
176
  height = 200,
177
177
  className = '',
178
178
  lazyNodeClassName = '',
179
179
  containerId,
180
180
  floorData = {},
181
181
  } = props
182
182
  const getRouterInfo = useRouter()
183
183
  const getQueryData = getRouterInfo?.params || {}
184
184
  const [componentShowState, setComponentShowState] = useState(false)
185
185
  const [componentRenderShowState, setComponentRenderShowState] =
186
186
  useState(false)
187
187
  const componentLazyRef = useRef<HTMLElement | null>(null)
188
188
  const componentShowStateRef = useRef(false)
189
189
  const needShowHighVersion =
190
190
  isH5AndJdShopViewH5Scroll &&
191
191
  !(
192
192
  global.info.queryInfo?.downgraded &&
193
193
  global.info.queryInfo.downgraded === 'true'
194
194
  )
195
195
  const rootDom =
196
196
  isH5AndJdShopView && needShowHighVersion
197
197
  ? null
198
198
  : document.querySelector('#J_shopHomeRoot')
199
199
  const { ref, inView } = useInView({
200
200
  threshold: 0,
201
201
  triggerOnce: true,
202
202
  root: rootDom,
203
203
  rootMargin: `0px 0px ${window.innerHeight}px 0px`,
204
204
  })
205
205
  useEffect(() => {
206
206
  if (needShowHighVersion || !isH5AndJdShopView) return
207
207
  if (type === LazyType.FLOOR) {
208
208
  const latestRes =
209
209
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
210
210
  !componentShowStateRef.current && dealPageScrollInfo(latestRes, false)
211
211
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
212
212
  !componentShowStateRef.current && dealPageScrollInfo(res, true)
213
213
  })
214
214
  }
215
215
  }, [])
216
216
  useEffect(() => {
217
217
  if (
218
218
  (!needShowHighVersion && componentShowState === true) ||
219
219
  (needShowHighVersion && inView && isH5AndJdShopView)
220
220
  ) {
221
221
  console.log(
222
222
  '>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!',
223
223
  )
224
224
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult
225
225
  const modularPackResultObj =
226
226
  typeof modularPackResult === 'string'
227
227
  ? JSON.parse(modularPackResult)
228
228
  : modularPackResult
229
229
  if (modularPackResultObj && modularPackResultObj.bundleUrl) {
230
230
  const { bundleUrl } = modularPackResultObj
231
231
  nativePageRegisterMessage(Message_Type.NATIVE_INJECT_JS_FILE, {
232
232
  data: {
233
233
  bundleUrl: [bundleUrl],
234
234
  },
235
235
  })
236
236
  }
237
237
  }
238
238
  }, [componentShowState, inView])
239
239
 
240
240
  const dealPageScrollInfo = (res, pageScrollTrigger) => {
241
241
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
242
242
  if (
243
243
  typeof displayHeight === 'undefined' ||
244
244
  typeof offSetY === 'undefined'
245
245
  ) {
246
246
  const shopId = floorData?.floorExtInfo?.shopId
247
247
  if (!lazyLayoutLoadErrorShopId[`${shopId}`] && pageScrollTrigger) {
248
248
  const opt = {
249
249
  msg: `店铺楼层懒加载失败。楼层顺序-floorIdx: ${floorData?.floorIdx}。`,
250
250
  uid: floorData?.uid,
251
251
  floorIdx: floorData?.floorIdx,
252
252
  shopId: shopId,
253
253
  moduleId: floorData?.moduleId,
254
254
  moduleName: floorData?.moduleName,
255
255
  middleTemplateId: floorData?.middleTemplateId,
256
256
  }
257
257
  draBusinessCustomReport({
258
258
  eventName: 'business',
259
259
  errorName: getSgmCustomCode(SgmCustomCode.FLOORLAZYLOAD_DATA),
260
260
  errorMessage: `店铺楼层懒加载失败。楼层顺序-floorIdx: ${floorData?.floorIdx}。`,
261
261
  extraData: JSON.stringify(opt)
262
262
  })
263
263
  lazyLayoutLoadErrorShopId[`${shopId}`] = true
264
264
  }
265
265
  return
266
266
  }
267
267
  if (componentLazyRef.current) {
268
268
  const eleClientRect = componentLazyRef.current.getBoundingClientRect()
269
269
  const getContainerHeightOffSetY = displayHeight + offSetY
270
270
  const eleOffsetTop = Math.ceil(eleClientRect.top)
271
271
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
272
272
  const eleOffsetTopHeight = eleOffsetTop + eleOffsetHeight
273
273
  if (!componentShowStateRef.current) {
274
274
  if (getContainerHeightOffSetY > eleOffsetTop) {
275
275
  componentShowStateRef.current = true
276
276
  setComponentShowState(true)
277
277
  Taro.nextTick(() => {
278
278
  setComponentRenderShowState(true)
279
279
  })
280
280
  }
281
281
  }
282
282
  }
283
283
  }
284
284
  return isH5AndJdShopView && !needShowHighVersion ? (
285
285
  <div
286
286
  id={`${containerId}_lazy`}
287
287
  ref={componentLazyRef}
288
288
  className={classNames(
289
289
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
290
290
  'd-app-floor-lazy-load',
291
291
  )}
292
292
  style={{
293
293
  minHeight: `${componentRenderShowState ? 'auto' : height + 'px'}`,
294
294
  backgroundColor: componentRenderShowState ? 'transparent' : '#ffffff',
295
295
  }}
296
296
  >
297
297
  {componentShowState ? children : placeholder}
298
298
  </div>
299
299
  ) : (
300
300
  <div
301
301
  id={`${containerId}_lazy`}
302
302
  className={classNames(
303
303
  lazyLayoutLoadStyle['d-mobile-floor-lazy-layout-load'],
304
304
  'd-mobile-floor-lazy-load',
305
305
  lazyNodeClassName,
306
306
  )}
307
307
  ref={ref}
308
308
  style={{
309
309
  minHeight: `${inView ? 'auto' : height + 'px'}`,
310
310
  backgroundColor: inView ? 'transparent' : '#ffffff',
311
311
  }}
312
312
  >
313
313
  {inView ? children : placeholder}
314
314
  </div>
315
315
  )