@conecli/cone-render 0.10.1-shop3.52 → 0.10.1-shop3.53

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.
@@ -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,