@conecli/cone-render 0.8.20-shop.21 → 0.8.20-shop.211
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.
- package/README.md +7 -1
- package/dist/api/index.ts +1 -1
- package/dist/assets/icon_blue_info.svg +1 -0
- package/dist/common/const.ts +1 -1
- package/dist/common/environmentType.ts +1 -0
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/common/jdplayerSdk.ts +1 -0
- package/dist/common/jssdk.ts +1 -0
- package/dist/common/pageType.ts +1 -0
- package/dist/common/sgmCustomCode.ts +1 -0
- package/dist/common/token/index.h5.ts +1 -1
- package/dist/common/token/token.jd.ts +1 -1
- package/dist/common/token/token.ts +1 -1
- package/dist/common/wxappApi.jd.ts +1 -0
- package/dist/common/wxappApi.ts +1 -1
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CountDown/index.module.scss +49 -44
- package/dist/components/base/CountDown/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
- package/dist/components/base/CustomScrollView/index.module.scss +7 -0
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/CustomVideo/common.ts +1 -0
- package/dist/components/base/CustomVideo/index.module.scss +1 -1
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +16 -0
- package/dist/components/base/Dialog/index.tsx +1 -1
- package/dist/components/base/Exposure/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/const.ts +1 -0
- package/dist/components/base/ExposureSmart/index.h5.module.scss +30 -6
- package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.module.scss +20 -9
- package/dist/components/base/ExposureSmart/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
- package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
- package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
- package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
- package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
- package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
- package/dist/components/base/LazyLoadImage/const.ts +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.module.scss +24 -20
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
- package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +125 -69
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/Base/index.module.scss +12 -0
- package/dist/components/base/Price/Base/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.module.scss +32 -0
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/components/base/Price/index.tsx +1 -1
- package/dist/components/base/Skeleton/index.tsx +1 -1
- package/dist/components/debug/DebugLayout/index.module.scss +67 -0
- package/dist/components/debug/DebugLayout/index.tsx +1 -0
- package/dist/components/debug/DebugLayout/utils.ts +1 -0
- package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
- package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
- package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
- package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
- package/dist/components/floorItem.jd.tsx +1 -1
- package/dist/components/floorItem.tsx +1 -1
- package/dist/components/floorItem.weapp.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/components/remoteFloorItem.tsx +1 -0
- package/dist/interface/common.ts +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/interface/jumpEventReport.ts +1 -1
- package/dist/interface/service.ts +1 -1
- package/dist/interface/utils.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/index.h5.ts +1 -1
- package/dist/jumpEventReport/index.jd.ts +1 -1
- package/dist/jumpEventReport/index.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/jumpEventReport/web/report.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/dist/jumpEventReport/web.jdb.ts +1 -1
- package/dist/jumpEventReport/web.jdjch.ts +1 -0
- package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
- package/dist/jumpEventReport/web.pc.ts +1 -0
- package/dist/jumpEventReport/web.tjapp.ts +1 -0
- package/dist/jumpEventReport/web.tjm.ts +1 -0
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/language/en_US.json +178 -0
- package/dist/language/zh_CN.json +178 -0
- package/dist/language/zh_HK.json +178 -0
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -27
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/open/api/device.ts +1 -1
- package/dist/open/api/environment.ts +1 -1
- package/dist/open/api/index.ts +1 -1
- package/dist/open/api/jump/business.ts +1 -0
- package/dist/open/api/jump/index.ts +1 -0
- package/dist/open/api/jump/minPath.ts +1 -0
- package/dist/open/api/jump/side.ts +1 -0
- package/dist/open/api/jump/webUrl.ts +1 -0
- package/dist/open/api/jump copy.ts +1 -0
- package/dist/open/api/request.ts +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/open/api/track.ts +1 -1
- package/dist/open/api/util.ts +1 -1
- package/dist/open/components/index.ts +1 -1
- package/dist/sass/app.h5.scss +289 -212
- package/dist/sass/base.scss +195 -137
- package/dist/service/bMallConst.ts +1 -1
- package/dist/service/fetchGateway.ts +1 -1
- package/dist/service/fetchGateway.weapp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -1
- package/dist/service/http/const.ts +1 -1
- package/dist/service/http/h5Http.ts +1 -0
- package/dist/service/http/index.h5.ts +1 -0
- package/dist/service/requestServer.h5.ts +1 -0
- package/dist/service/requestServer.ts +1 -1
- package/dist/service/requestServer.weapp.ts +1 -0
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
- package/dist/utils/draExceptionAndProfile.ts +1 -1
- package/dist/utils/h5Utils.ts +1 -1
- package/dist/utils/index.h5.ts +1 -1
- package/dist/utils/index.ts +1 -1
- package/dist/utils/index.weapp.ts +1 -1
- package/dist/utils/intersectionObserver.ts +1 -1
- package/dist/utils/jm-common.js +1 -1
- package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
- package/dist/utils/jumpExtMapUtil.ts +1 -0
- package/dist/utils/sColor.js +1 -0
- package/dist/utils/sgmCodeUtils.ts +1 -0
- package/dist/utils/taroRenderUtil.ts +1 -0
- package/dist/utils/utils.ts +1 -1
- package/dist/wxapp/api/helper.js +1 -0
- package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
- package/dist/wxapp/common/user_info.js +1 -1
- package/dist/wxapp/components/launch-app/index.js +1 -0
- package/dist/wxapp/components/launch-app/index.json +5 -0
- package/dist/wxapp/components/launch-app/index.wxml +0 -0
- package/dist/wxapp/components/launch-app/index.wxss +0 -0
- package/dist/wxapp/components/subscribe-guider/helper.js +1 -0
- package/dist/wxapp/components/subscribe-guider/index.js +1 -0
- package/dist/wxapp/components/subscribe-guider/index.json +5 -0
- package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
- package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
- package/package.json +148 -115
- package/dist/components/base/Skeleton/old.tsx +0 -1
- package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
- package/dist/open/api/jump.ts +0 -1
- package/dist/utils/memberFormatUtils.js +0 -1
- /package/dist/service/{bMallConst.wxapp.ts → bMallConst.weapp.ts} +0 -0
- /package/dist/service/http/{colorSign.wxapp.ts → colorSign.weapp.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
const inViewCallback = () => {
|
|
3
2
|
console.log('埋点收到进入可视区域的回到啦!', reportData)
|
|
4
3
|
addReportData(reportData)
|
|
5
4
|
}
|
|
6
5
|
exposureStyle.root,
|
|
7
6
|
className,
|
|
8
7
|
)} height={'100%'} inViewCallback={inViewCallback}></InViewRender>
|
|
8
|
+
import React, { useMemo } from 'react';
|
|
9
9
|
const {
|
|
10
10
|
type,
|
|
11
11
|
className,
|
|
12
12
|
reportData,
|
|
13
13
|
customReportDataKey,
|
|
14
14
|
customReportDataFn,
|
|
15
15
|
trackCallback,
|
|
16
16
|
markPoint,
|
|
17
17
|
innerRef,
|
|
18
18
|
} = props;
|
|
19
19
|
const isCustomReport = customReportDataKey && customReportDataFn;
|
|
20
20
|
const isViewOnlineState = taroJdBaseInfo.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE;
|
|
21
21
|
const showRenderState = isCustomReport ? true : reportData;
|
|
22
22
|
const inViewCallback = () => {
|
|
23
23
|
const getInsertFlowMapEle =
|
|
24
24
|
innerRef?.current?.querySelector('.d-report-exposure-point') || createDefaultFlowMapEle;
|
|
25
25
|
if (!isCustomReport) {
|
|
26
26
|
addReportData(reportData, getInsertFlowMapEle);
|
|
27
27
|
typeof trackCallback === 'function' && trackCallback(reportData);
|
|
28
28
|
} else {
|
|
29
29
|
if (typeof customReportDataFn === 'function') {
|
|
30
30
|
const getReportData = customReportDataFn(customReportDataKey);
|
|
31
31
|
getReportData &&
|
|
32
32
|
getReportData?.eventId &&
|
|
33
33
|
getReportData?.jsonParam &&
|
|
34
34
|
track.reportExposureEventLog({
|
|
35
35
|
...getReportData,
|
|
36
36
|
target: getInsertFlowMapEle,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
let chartPointClassName = '';
|
|
42
42
|
|
|
43
43
|
if (isChartH5 && markPoint && Array.isArray(reportData)) {
|
|
44
44
|
const [floorData, mInfo] = reportData;
|
|
45
45
|
if (floorData && mInfo && mInfo.hasOwnProperty('pos')) {
|
|
46
46
|
chartPointClassName = track.getFloorPointIndexClassName(floorData, mInfo.pos);
|
|
47
47
|
}
|
|
48
48
|
} else if (isCustomReport) {
|
|
49
49
|
chartPointClassName = `J_custom_${customReportDataKey}`;
|
|
50
50
|
}
|
|
51
51
|
return isViewOnlineState && showRenderState ? (
|
|
52
52
|
<InViewRender
|
|
53
53
|
className={classNames(
|
|
54
54
|
'd-report-exposure-point',
|
|
55
55
|
{
|
|
56
56
|
[exposureStyle['d-report-point']]: type === TrackType.point,
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
[exposureStyle['d-report-floor']]: type === TrackType.floor,
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
'd-report-exposure-jd-point': isJdApp,
|
|
63
63
|
},
|
|
64
64
|
className,
|
|
65
65
|
chartPointClassName,
|
|
66
66
|
)}
|
|
67
67
|
height={'100%'}
|
|
68
68
|
inViewCallback={inViewCallback}
|
|
69
69
|
></InViewRender>
|
|
70
70
|
) : null;
|
|
71
71
|
return useMemo(() => {
|
|
72
72
|
return <Exposure {...props} />;
|
|
73
73
|
}, []);
|
|
74
74
|
reportData: null,
|
|
75
75
|
trackCallback: null,
|
|
76
76
|
type: TrackType.point,
|
|
77
77
|
markPoint: false,
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
//坑位曝光
|
|
3
|
+
.d-report-point {
|
|
4
|
+
position: absolute;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
opacity: 0;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
z-index: -1;
|
|
12
|
+
}
|
|
13
|
+
//楼层曝光
|
|
14
|
+
.d-report-floor {
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
right: 0;
|
|
19
|
+
height: 1px;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
z-index: -1;
|
|
11
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
2
2
|
const { type, className, reportData, customReportDataKey, customReportDataFn, trackCallback } = props
|
|
3
3
|
const isViewOnlineState =
|
|
4
4
|
taroJdBaseInfo.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
|
|
5
5
|
const isCustomReport = customReportDataKey && customReportDataFn
|
|
6
6
|
const checkReportData = Array.isArray(reportData)
|
|
7
7
|
const [floorData, mInfo] = checkReportData ? reportData : []
|
|
8
8
|
const showRenderState = isCustomReport ? true : floorData && mInfo
|
|
9
9
|
const getFloorPointClassName = isCustomReport ? `J_custom_${customReportDataKey}` : `J_floor_${floorData?.uid}_index_${mInfo?.pos}`
|
|
10
10
|
const getTaroSelector = isCustomReport ? `#J_miniShopRoot >>> .${getFloorPointClassName}` : `#J_floor_${floorData?.uid} >>> .${getFloorPointClassName}`
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
if (isViewOnlineState && reportData) {
|
|
13
13
|
Taro.nextTick(() => {
|
|
14
14
|
if (
|
|
15
15
|
!taroJdBaseInfo.info.pageInfo.floorExposureInfo[
|
|
16
16
|
getFloorPointClassName
|
|
17
17
|
]
|
|
18
18
|
){
|
|
19
19
|
const createIntersectionObserver = new intersectionObserver({
|
|
20
20
|
selector: getTaroSelector,
|
|
21
21
|
context: this,
|
|
22
22
|
onFinal: (res) => {
|
|
23
23
|
taroJdBaseInfo.info.pageInfo.floorExposureInfo[
|
|
24
24
|
getFloorPointClassName
|
|
25
25
|
] = true
|
|
26
26
|
console.log('小程序曝光埋点收到进入可视区域啦!', getFloorPointClassName, reportData, res)
|
|
27
27
|
if(!isCustomReport){
|
|
28
28
|
addReportData(reportData)
|
|
29
29
|
typeof trackCallback === 'function' && trackCallback(reportData)
|
|
30
30
|
}else {
|
|
31
31
|
typeof customReportDataFn === 'function' && customReportDataFn(customReportDataKey)
|
|
32
32
|
}
|
|
33
33
|
createIntersectionObserver.disconnect()
|
|
34
34
|
},
|
|
35
35
|
})
|
|
36
36
|
createIntersectionObserver.connect()
|
|
37
37
|
}
|
|
38
38
|
})
|
|
39
39
|
}
|
|
40
40
|
}, [])
|
|
41
41
|
return (showRenderState ? (
|
|
42
42
|
<View
|
|
43
43
|
className={classNames(
|
|
44
44
|
{
|
|
45
45
|
[exposureStyle['d-report-point']]: type === TrackType.point,
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
[exposureStyle['d-report-floor']]: type === TrackType.floor,
|
|
49
49
|
},
|
|
50
50
|
getFloorPointClassName,
|
|
51
51
|
className,
|
|
52
52
|
)}
|
|
53
53
|
/>
|
|
54
54
|
) : null
|
|
55
55
|
)
|
|
56
56
|
return useMemo(() => {
|
|
57
57
|
return <ExposureFloor {...props} />
|
|
58
58
|
}, [])
|
|
59
59
|
reportData: null,
|
|
60
60
|
trackCallback: null,
|
|
61
61
|
type: TrackType.point,
|
|
@@ -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 isOverMax = arrTask.length >= 10
|
|
5
4
|
const hasData = arrTask.length > 0
|
|
6
5
|
if(hasData && (isTimeout || isOverMax)){
|
|
7
6
|
const reduceData = connactData(arrTask)
|
|
8
7
|
track.reportExposureEventLog(reduceData)
|
|
9
8
|
floorTask.arr = []
|
|
10
9
|
floorTask.startWaitTime = 0
|
|
11
10
|
clearTimeout(floorTask.timer)
|
|
12
11
|
}
|
|
13
12
|
const initData = JSON.parse(JSON.stringify(arr[0]))
|
|
14
13
|
initData.jsonParam.logBaseInfo = []
|
|
15
14
|
initData.jsonParam.etModelInfo.lstms = []
|
|
16
15
|
return arr.reduce((acc, cur) => {
|
|
17
16
|
cur.jsonParam.etModelInfo.lstms[0].la_p = cur.jsonParam.logBaseInfo.mInfo?.pos
|
|
18
17
|
acc.jsonParam.logBaseInfo.push(cur.jsonParam.logBaseInfo)
|
|
19
18
|
acc.jsonParam.etModelInfo.lstms.push(cur.jsonParam.etModelInfo.lstms)
|
|
20
19
|
return acc
|
|
21
20
|
}, initData)
|
|
22
21
|
if(!Array.isArray(data)){
|
|
23
22
|
console.log('坑位曝光埋点原始数据参类型错误,期望是数组,实际是:', data)
|
|
24
23
|
return
|
|
25
24
|
}
|
|
26
25
|
const [floorData, mInfo, etModelInfo] = data
|
|
27
26
|
if(floorData && mInfo && etModelInfo){
|
|
28
27
|
const reportJson = track.getIsvExposureInfo(floorData, mInfo, etModelInfo)
|
|
29
28
|
const { floorIdx } = floorData
|
|
30
29
|
if(!task[floorIdx]){
|
|
31
30
|
task[floorIdx] = {
|
|
32
31
|
arr: [],
|
|
33
32
|
startWaitTime: 0,
|
|
34
33
|
timer : 0
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
const floorTask = task[floorIdx]
|
|
38
37
|
if(floorTask.arr.length === 0){
|
|
39
38
|
floorTask.startWaitTime = Date.now()
|
|
40
39
|
}
|
|
41
40
|
if(reportJson){
|
|
42
41
|
floorTask.arr.push(reportJson)
|
|
43
42
|
clearTimeout(floorTask.timer)
|
|
44
43
|
floorTask.timer = setTimeout(() => {
|
|
45
44
|
check(floorTask)
|
|
46
45
|
}, 1000)
|
|
47
46
|
check(floorTask)
|
|
48
47
|
}
|
|
49
48
|
}else{
|
|
50
49
|
console.log('坑位曝光埋点原始数据参数缺失,期望是[floorData, mInfo, etModelInfo],实际是:', data)
|
|
51
50
|
}
|
|
51
|
+
import track from '../../../open/api/track';
|
|
52
52
|
const { arr: arrTask, startWaitTime } = floorTask;
|
|
53
53
|
const isTimeout = startWaitTime != 0 && Date.now() - startWaitTime >= 1000;
|
|
54
54
|
const arrTaskNum = arrTask.length;
|
|
55
55
|
const isOverMax = arrTaskNum >= 10;
|
|
56
56
|
const hasData = arrTaskNum > 0;
|
|
57
57
|
if (hasData && (isTimeout || isOverMax)) {
|
|
58
58
|
const reduceData = connactData(arrTask);
|
|
59
59
|
track.reportExposureEventLog(reduceData);
|
|
60
60
|
floorTask.arr = [];
|
|
61
61
|
floorTask.startWaitTime = 0;
|
|
62
62
|
clearTimeout(floorTask.timer);
|
|
63
63
|
}
|
|
64
64
|
const initData = JSON.parse(JSON.stringify(arr[0]));
|
|
65
65
|
if (initData.jsonParam.etModelInfo) {
|
|
66
66
|
initData.jsonParam.logBaseInfo = [];
|
|
67
67
|
initData.jsonParam.etModelInfo.lstms = [];
|
|
68
68
|
return arr.reduce((acc, cur) => {
|
|
69
69
|
acc.jsonParam.logBaseInfo.push(cur.jsonParam.logBaseInfo);
|
|
70
70
|
return acc;
|
|
71
71
|
}, initData);
|
|
72
72
|
} else {
|
|
73
73
|
return arr.reduce((acc) => {
|
|
74
74
|
return acc;
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
if (!Array.isArray(data)) {
|
|
78
78
|
console.log('坑位曝光埋点原始数据参类型错误,期望是数组,实际是:', data);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
const [floorData, mInfo, etModelInfo] = data;
|
|
82
82
|
if (floorData && mInfo && etModelInfo) {
|
|
83
83
|
const isIsvReportModule = isvReportModuleTypeList.includes(floorData?.floorExtInfo?.moduleFlag);
|
|
84
84
|
try {
|
|
85
85
|
const reportJson = track.getExposureInfo(
|
|
86
86
|
floorData,
|
|
87
87
|
mInfo,
|
|
88
88
|
etModelInfo,
|
|
89
89
|
true,
|
|
90
90
|
isIsvReportModule,
|
|
91
91
|
);
|
|
92
92
|
console.log(`${floorData?.floorExtInfo?.moduleFlag}===reportJson===`, reportJson);
|
|
93
93
|
const { floorIdx } = floorData;
|
|
94
94
|
if (!task[floorIdx]) {
|
|
95
95
|
task[floorIdx] = {
|
|
96
96
|
arr: [],
|
|
97
97
|
startWaitTime: 0,
|
|
98
98
|
timer: 0,
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
const floorTask = task[floorIdx];
|
|
102
102
|
if (floorTask.arr.length === 0) {
|
|
103
103
|
floorTask.startWaitTime = Date.now();
|
|
104
104
|
}
|
|
105
105
|
if (reportJson) {
|
|
106
106
|
floorTask.arr.push(reportJson);
|
|
107
107
|
clearTimeout(floorTask.timer);
|
|
108
108
|
floorTask.timer = setTimeout(() => {
|
|
109
109
|
check(floorTask);
|
|
110
110
|
}, 1000);
|
|
111
111
|
check(floorTask);
|
|
112
112
|
}
|
|
113
113
|
} catch (e) {
|
|
114
114
|
{
|
|
115
115
|
console.log('坑位曝光埋点出错啦', e);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
} else {
|
|
119
119
|
console.log(
|
|
120
120
|
'坑位曝光埋点原始数据参数缺失,期望是[floorData, mInfo, etModelInfo],实际是:',
|
|
121
121
|
data,
|
|
122
122
|
);
|
|
123
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
TaroEventType,
|
|
3
2
|
WEBVIEW_STATE,
|
|
4
3
|
M_H5_ROOT_ELE_NODE,
|
|
5
4
|
latestFromNativeMsgStorage,
|
|
6
5
|
getNativePageScrollRes,
|
|
7
6
|
props: ComponentInterFace.InOrOutViewObserverProps,
|
|
8
7
|
const {
|
|
9
8
|
children,
|
|
10
9
|
style,
|
|
11
10
|
inViewCallback,
|
|
12
11
|
outViewCallback,
|
|
13
12
|
threshold = 0,
|
|
14
13
|
} = props
|
|
15
14
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
16
15
|
const componentObserverRef = useRef<HTMLElement | null>(null)
|
|
17
16
|
const componentShowStateRef = useRef(false)
|
|
18
17
|
if (isH5AndJdShopView) {
|
|
19
18
|
useEffect(() => {
|
|
20
19
|
const latestRes =
|
|
21
20
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
22
21
|
dealPageScrollInfo(latestRes)
|
|
23
22
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
24
23
|
dealPageScrollInfo(res)
|
|
25
24
|
})
|
|
26
25
|
Taro.eventCenter.on(
|
|
27
26
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
28
27
|
(state) => {
|
|
29
28
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
30
29
|
},
|
|
31
30
|
)
|
|
32
31
|
return function cleanup() {
|
|
33
32
|
Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, (res) => {
|
|
34
33
|
dealPageScrollInfo(res)
|
|
35
34
|
})
|
|
36
35
|
Taro.eventCenter.off(
|
|
37
36
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
38
37
|
(state) => {
|
|
39
38
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
40
39
|
},
|
|
41
40
|
)
|
|
42
41
|
}
|
|
43
42
|
}, [])
|
|
44
43
|
useEffect(() => {
|
|
45
44
|
if (componentShowState) {
|
|
46
45
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
47
46
|
console.log('app=>in可视区域')
|
|
48
47
|
} else {
|
|
49
48
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
50
49
|
console.log('app=>out可视区域')
|
|
51
50
|
}
|
|
52
51
|
}, [componentShowState])
|
|
53
52
|
|
|
54
53
|
const handleInOrOutView = (type: boolean) => {
|
|
55
54
|
componentShowStateRef.current = type
|
|
56
55
|
setComponentShowState(type)
|
|
57
56
|
console.log('handleInOrOutView', type)
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
const dealPageScrollInfo = (res) => {
|
|
61
60
|
console.log('dealPageScrollInfo===', res)
|
|
62
61
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
63
62
|
if (
|
|
64
63
|
typeof displayHeight === 'undefined' ||
|
|
65
64
|
typeof offSetY === 'undefined'
|
|
66
65
|
)
|
|
67
66
|
return
|
|
68
67
|
console.log(
|
|
69
68
|
'处理后dealPageScrollInfo===displayHeight=offSetY',
|
|
70
69
|
displayHeight,
|
|
71
70
|
offSetY,
|
|
72
71
|
)
|
|
73
72
|
if (componentObserverRef.current) {
|
|
74
73
|
const eleClientRect =
|
|
75
74
|
componentObserverRef.current.getBoundingClientRect()
|
|
76
75
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
77
76
|
const eleHeight = Math.ceil(eleClientRect.height)
|
|
78
77
|
console.log(
|
|
79
78
|
'==========================eleOffsetTop, eleHeight',
|
|
80
79
|
eleOffsetTop,
|
|
81
80
|
eleHeight,
|
|
82
81
|
)
|
|
83
82
|
if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
|
|
84
83
|
const isOutView =
|
|
85
84
|
offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
|
|
86
85
|
displayHeight - (eleOffsetTop - offSetY) <
|
|
87
86
|
Math.ceil(eleHeight * threshold)
|
|
88
87
|
console.log(
|
|
89
88
|
'比较isOutView',
|
|
90
89
|
isOutView,
|
|
91
90
|
offSetY,
|
|
92
91
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
93
92
|
displayHeight - (eleOffsetTop - offSetY),
|
|
94
93
|
Math.ceil(eleHeight * threshold),
|
|
95
94
|
)
|
|
96
95
|
handleInOrOutView(!isOutView)
|
|
97
96
|
} else {
|
|
98
97
|
const isInView =
|
|
99
98
|
offSetY >
|
|
100
99
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
|
|
101
100
|
offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
|
|
102
101
|
console.log(
|
|
103
102
|
'比较isInView',
|
|
104
103
|
isInView,
|
|
105
104
|
offSetY,
|
|
106
105
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold),
|
|
107
106
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
108
107
|
)
|
|
109
108
|
handleInOrOutView(isInView)
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
112
|
return (
|
|
114
113
|
<View ref={componentObserverRef} style={style}>
|
|
115
114
|
{children}
|
|
116
115
|
</View>
|
|
117
116
|
)
|
|
118
117
|
} else {
|
|
119
118
|
const rootDom = document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
|
|
120
119
|
const { ref, inView } = useInView({
|
|
121
120
|
threshold,
|
|
122
121
|
triggerOnce: false,
|
|
123
122
|
root: rootDom || null,
|
|
124
123
|
rootMargin: `0px 0px 0px 0px`,
|
|
125
124
|
})
|
|
126
125
|
useEffect(() => {
|
|
127
126
|
if (inView) {
|
|
128
127
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
129
128
|
console.log('其他h5=>in可视区域')
|
|
130
129
|
} else {
|
|
131
130
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
132
131
|
console.log('其他h5=>out可视区域')
|
|
133
132
|
}
|
|
134
133
|
}, [inView])
|
|
135
134
|
return (
|
|
136
135
|
<View ref={ref} style={style}>
|
|
137
136
|
{children}
|
|
138
137
|
</View>
|
|
139
138
|
)
|
|
140
139
|
}
|
|
141
140
|
children: null,
|
|
142
141
|
style: {},
|
|
143
142
|
className: '',
|
|
144
143
|
inViewCallback: null,
|
|
145
144
|
outViewCallback: null,
|
|
146
145
|
threshold: 0,
|
|
146
|
+
import Taro from '@tarojs/taro'
|
|
147
147
|
isH5AndJdShopView,
|
|
148
148
|
isH5AndJdShopViewH5Scroll,
|
|
149
149
|
isAppClassifyPage,
|
|
150
150
|
TaroEventType,
|
|
151
151
|
WEBVIEW_STATE,
|
|
152
152
|
M_H5_ROOT_ELE_NODE,
|
|
153
153
|
latestFromNativeMsgStorage,
|
|
154
154
|
getNativePageScrollRes,
|
|
155
155
|
props: ComponentInterFace.InOrOutViewObserverProps,
|
|
156
156
|
const {
|
|
157
157
|
children,
|
|
158
158
|
style,
|
|
159
159
|
inViewCallback,
|
|
160
160
|
outViewCallback,
|
|
161
161
|
threshold = 0,
|
|
162
162
|
} = props
|
|
163
163
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
164
164
|
const componentObserverRef = useRef<HTMLElement | null>(null)
|
|
165
165
|
const componentShowStateRef = useRef(false)
|
|
166
166
|
const needShowHighVersion =
|
|
167
167
|
isAppClassifyPage ||
|
|
168
168
|
(isH5AndJdShopViewH5Scroll &&
|
|
169
169
|
!(
|
|
170
170
|
global.info.queryInfo?.downgraded &&
|
|
171
171
|
global.info.queryInfo.downgraded === 'true'
|
|
172
172
|
))
|
|
173
173
|
const rootDom =
|
|
174
174
|
isH5AndJdShopView && needShowHighVersion
|
|
175
175
|
? null
|
|
176
176
|
: document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
|
|
177
177
|
if (isH5AndJdShopView && !needShowHighVersion) {
|
|
178
178
|
console.log('视频========属于app原生滚动')
|
|
179
179
|
useEffect(() => {
|
|
180
180
|
const latestRes =
|
|
181
181
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
182
182
|
dealPageScrollInfo(latestRes)
|
|
183
183
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
|
|
184
184
|
dealPageScrollInfo(res)
|
|
185
185
|
})
|
|
186
186
|
Taro.eventCenter.on(
|
|
187
187
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
188
188
|
state => {
|
|
189
189
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
190
190
|
},
|
|
191
191
|
)
|
|
192
192
|
return function cleanup() {
|
|
193
193
|
Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, res => {
|
|
194
194
|
dealPageScrollInfo(res)
|
|
195
195
|
})
|
|
196
196
|
Taro.eventCenter.off(
|
|
197
197
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
198
198
|
state => {
|
|
199
199
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
200
200
|
},
|
|
201
201
|
)
|
|
202
202
|
}
|
|
203
203
|
}, [])
|
|
204
204
|
useEffect(() => {
|
|
205
205
|
if (componentShowState) {
|
|
206
206
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
207
207
|
console.log('app=>in可视区域')
|
|
208
208
|
} else {
|
|
209
209
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
210
210
|
console.log('app=>out可视区域')
|
|
211
211
|
}
|
|
212
212
|
}, [componentShowState])
|
|
213
213
|
|
|
214
214
|
const handleInOrOutView = (type: boolean) => {
|
|
215
215
|
componentShowStateRef.current = type
|
|
216
216
|
setComponentShowState(type)
|
|
217
217
|
console.log('handleInOrOutView', type)
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
const dealPageScrollInfo = res => {
|
|
221
221
|
console.log('dealPageScrollInfo===', res)
|
|
222
222
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
223
223
|
if (
|
|
224
224
|
typeof displayHeight === 'undefined' ||
|
|
225
225
|
typeof offSetY === 'undefined'
|
|
226
226
|
)
|
|
227
227
|
return
|
|
228
228
|
console.log(
|
|
229
229
|
'处理后dealPageScrollInfo===displayHeight=offSetY',
|
|
230
230
|
displayHeight,
|
|
231
231
|
offSetY,
|
|
232
232
|
)
|
|
233
233
|
if (componentObserverRef.current) {
|
|
234
234
|
const eleClientRect = componentObserverRef.current.getBoundingClientRect()
|
|
235
235
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
236
236
|
const eleHeight = Math.ceil(eleClientRect.height)
|
|
237
237
|
console.log(
|
|
238
238
|
'==========================eleOffsetTop, eleHeight',
|
|
239
239
|
eleOffsetTop,
|
|
240
240
|
eleHeight,
|
|
241
241
|
)
|
|
242
242
|
if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
|
|
243
243
|
const isOutView =
|
|
244
244
|
offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
|
|
245
245
|
displayHeight - (eleOffsetTop - offSetY) <
|
|
246
246
|
Math.ceil(eleHeight * threshold)
|
|
247
247
|
console.log(
|
|
248
248
|
'比较isOutView',
|
|
249
249
|
isOutView,
|
|
250
250
|
offSetY,
|
|
251
251
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
252
252
|
displayHeight - (eleOffsetTop - offSetY),
|
|
253
253
|
Math.ceil(eleHeight * threshold),
|
|
254
254
|
)
|
|
255
255
|
handleInOrOutView(!isOutView)
|
|
256
256
|
} else {
|
|
257
257
|
const isInView =
|
|
258
258
|
offSetY >
|
|
259
259
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
|
|
260
260
|
offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
|
|
261
261
|
console.log(
|
|
262
262
|
'比较isInView',
|
|
263
263
|
isInView,
|
|
264
264
|
offSetY,
|
|
265
265
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold),
|
|
266
266
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
267
267
|
)
|
|
268
268
|
handleInOrOutView(isInView)
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
return (
|
|
273
273
|
<View ref={componentObserverRef} style={style}>
|
|
274
274
|
{children}
|
|
275
275
|
</View>
|
|
276
276
|
)
|
|
277
277
|
} else {
|
|
278
278
|
console.log('视频========h5滚动')
|
|
279
279
|
const { ref, inView } = useInView({
|
|
280
280
|
delay: 100,
|
|
281
281
|
threshold,
|
|
282
282
|
triggerOnce: false,
|
|
283
283
|
root: rootDom || null,
|
|
284
284
|
rootMargin: `0px 0px 0px 0px`,
|
|
285
285
|
})
|
|
286
286
|
useEffect(() => {
|
|
287
287
|
if (inView) {
|
|
288
288
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
289
289
|
console.log('其他h5=>in可视区域')
|
|
290
290
|
} else {
|
|
291
291
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
292
292
|
console.log('其他h5=>out可视区域')
|
|
293
293
|
}
|
|
294
294
|
}, [inView])
|
|
295
295
|
return (
|
|
296
296
|
<View ref={ref} style={style}>
|
|
297
297
|
{children}
|
|
298
298
|
</View>
|
|
299
299
|
)
|
|
300
300
|
}
|
|
301
301
|
children: null,
|
|
302
302
|
style: {},
|
|
303
303
|
className: '',
|
|
304
304
|
inViewCallback: null,
|
|
305
305
|
outViewCallback: null,
|
|
306
306
|
threshold: 0,
|