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