@conecli/cone-render 0.10.1-shop3.121 → 0.10.1-shop3.122

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, { useEffect, useMemo, useState } from 'react';
2
1
  const getThisLeGaoTagKey = `${tagId}-${tagText}}`;
3
2
  const getLeGaoTagCacheNode = shopLeGaoTagNodeMap.get(getThisLeGaoTagKey) || false;
4
3
  return getLeGaoTagCacheNode
5
4
  ? getLeGaoTagCacheNode
6
5
  : useMemo(() => {
7
6
  const createCanVasTag = (
8
7
  <canvas-tag
9
8
  className={classNames(shopTagStyle['d-tag-item-canvas'])}
10
9
  tagId={tagId}
11
10
  text={tagText}
12
11
  appVersion={getJdAppVersionStr}
13
12
  lang={languageNowType}
14
13
  />
15
14
  );
16
15
  shopLeGaoTagNodeMap.set(getThisLeGaoTagKey, createCanVasTag);
17
16
  return createCanVasTag;
18
17
  }, [tagId, tagText]);
19
18
  const {
20
19
  tagInfoList = [],
21
20
  className,
22
21
  itemClassName,
23
22
  isSkuBaseTag = false,
24
23
  itemClickCallback,
25
24
  } = props;
26
25
  const getTagInfoList = Array.isArray(tagInfoList) ? tagInfoList : [];
27
26
  const getTagInfoListNum = getTagInfoList.length;
28
27
  const isCallBackFn = typeof itemClickCallback === 'function';
29
28
  const needAsyncLoad = useMemo(() => {
30
29
  if (window.CanvasTag) return false;
31
30
  const h5TagJs = taroJdBaseInfo.loadJsSdkList.find((e) => e.fileName === 'h5TagJs');
32
31
  return !!(h5TagJs && h5TagJs.initTriggerType === LoadJsInitTriggerType.NRXT_TICK);
33
32
  }, []);
34
33
  const [loadOver, setLoadOver] = useState(!needAsyncLoad);
35
34
  useEffect(() => {
36
35
  async function loadTagSdk() {
37
36
  try {
38
37
  await taroJdBaseInfo.loadH5tagReayPromise();
39
38
  } catch (error) {}
40
39
  setLoadOver(true);
41
40
  }
42
41
  needAsyncLoad && loadTagSdk();
43
42
  }, []);
44
43
  if (!loadOver) return null;
45
44
  return getTagInfoListNum > 0 ? (
46
45
  <View
47
46
  className={classNames(
48
47
  shopTagStyle['d-shop-tag-list'],
49
48
  {
50
49
  [shopTagStyle['d-shop-sku-tag-list']]: isSkuBaseTag,
51
50
  },
52
51
  className,
53
52
  )}
54
53
  >
55
54
  {}
56
55
  <View style={{ width: '1px', height: '100%' }} />
57
56
  {getTagInfoList.map((item, index) => {
58
57
  const { tagId, tabIconId, tagText, type, tabIconType, tabText } = item;
59
58
  const getTagId = tagId || tabIconId;
60
59
  const getTagType = type || tabIconType;
61
60
  const getTagText = tagText || tabText;
62
61
  return getTagId ? (
63
62
  <View
64
63
  role="text"
65
64
  tabindex="0"
66
65
  aria-label={getTagText}
67
66
  key={getTagId + getTagType + index}
68
67
  className={classNames(shopTagStyle['d-tag-item'], itemClassName)}
69
68
  onClick={isCallBackFn && itemClickCallback.bind(this, item, index)}
70
69
  >
71
70
  <LeGaoTagComponent tagId={getTagId} tagText={getTagText} />
72
71
  </View>
73
72
  ) : null;
74
73
  })}
75
74
  </View>
76
75
  ) : null;
76
+ import React, { useEffect, useMemo, useState } from 'react';
77
77
  const getThisLeGaoTagKey = `${tagId}-${tagText}}`;
78
78
  const getLeGaoTagCacheNode = shopLeGaoTagNodeMap.get(getThisLeGaoTagKey) || false;
79
79
  return getLeGaoTagCacheNode
80
80
  ? getLeGaoTagCacheNode
81
81
  : useMemo(() => {
82
82
  const createCanVasTag = (
83
83
  <canvas-tag
84
84
  className={classNames(shopTagStyle['d-tag-item-canvas'])}
85
85
  tagId={tagId}
86
86
  text={tagText}
87
87
  appVersion={getJdAppVersionStr}
88
88
  lang={languageNowType}
89
89
  />
90
90
  );
91
91
  shopLeGaoTagNodeMap.set(getThisLeGaoTagKey, createCanVasTag);
92
92
  return createCanVasTag;
93
93
  }, [tagId, tagText]);
94
94
  const {
95
95
  tagInfoList = [],
96
96
  className,
97
97
  itemClassName,
98
98
  isSkuBaseTag = false,
99
99
  itemClickCallback,
100
100
  } = props;
101
101
  const getTagInfoList = Array.isArray(tagInfoList) ? tagInfoList : [];
102
102
  const getTagInfoListNum = getTagInfoList.length;
103
103
  const isCallBackFn = typeof itemClickCallback === 'function';
104
104
  const needAsyncLoad = useMemo(() => {
105
105
  if (window.CanvasTag) return false;
106
106
  const h5TagJs = taroJdBaseInfo.loadJsSdkList.find((e) => e.fileName === 'h5TagJs');
107
107
  return !!(h5TagJs && h5TagJs.initTriggerType === LoadJsInitTriggerType.NRXT_TICK);
108
108
  }, []);
109
109
  const [loadOver, setLoadOver] = useState(!needAsyncLoad);
110
110
  useEffect(() => {
111
111
  async function loadTagSdk() {
112
112
  try {
113
113
  await taroJdBaseInfo.loadH5tagReayPromise();
114
114
  } catch (error) {}
115
115
  setLoadOver(true);
116
116
  }
117
117
  needAsyncLoad && loadTagSdk();
118
118
  }, []);
119
119
  if (!loadOver) return null;
120
120
  return getTagInfoListNum > 0 ? (
121
121
  <View
122
122
  className={classNames(
123
123
  shopTagStyle['d-shop-tag-list'],
124
124
  {
125
125
  [shopTagStyle['d-shop-sku-tag-list']]: isSkuBaseTag,
126
126
  },
127
127
  className,
128
128
  )}
129
129
  >
130
130
  {}
131
131
  <View style={{ width: '1px', height: '100%' }} className="d-shop-tag-hide" />
132
132
  {getTagInfoList.map((item, index) => {
133
133
  const { tagId, tabIconId, tagText, type, tabIconType, tabText } = item;
134
134
  const getTagId = tagId || tabIconId;
135
135
  const getTagType = type || tabIconType;
136
136
  const getTagText = tagText || tabText;
137
137
  return getTagId ? (
138
138
  <View
139
139
  role="text"
140
140
  tabindex="0"
141
141
  aria-label={getTagText}
142
142
  key={getTagId + getTagType + index}
143
143
  className={classNames(shopTagStyle['d-tag-item'], itemClassName)}
144
144
  onClick={isCallBackFn && itemClickCallback.bind(this, item, index)}
145
145
  >
146
146
  <LeGaoTagComponent tagId={getTagId} tagText={getTagText} />
147
147
  </View>
148
148
  ) : null;
149
149
  })}
150
150
  </View>
151
151
  ) : null;
@@ -1 +1 @@
1
- import ready from '../../utils/ready';
2
1
  floorId: 'trafficmap_floor_id',
3
2
  positionId: 'trafficmap_position_id',
4
3
  materialId: 'trafficmap_material_id',
5
4
  materialName: 'trafficmap_material_name',
6
5
  aid: 'trafficmap_aid',
7
6
  new Promise((resolve, reject) => {
8
7
  if (window.MPing) {
9
8
  resolve(true);
10
9
  } else {
11
10
  if (isReportReadyError) {
12
11
  reject(false);
13
12
  } else {
14
13
  ready('MPing', 3000)
15
14
  .then(() => {
16
15
  isReportReadyError = false;
17
16
  resolve(true);
18
17
  })
19
18
  .catch(() => {
20
19
  isReportReadyError = true;
21
20
  reject(false);
22
21
  });
23
22
  }
24
23
  }
25
24
  });
26
25
  return new Promise((resolve, reject) => {
27
26
  const {
28
27
  pageId,
29
28
  pageParam,
30
29
  pTag,
31
30
  isSend = true,
32
31
  pvForSpm = false,
33
32
  spmAllCode,
34
33
  spmCodeForB,
35
34
  ...otherParam
36
35
  } = opts;
37
36
  getReportObjReadyPromise()
38
37
  .then(() => {
39
38
  let pvObj: any = null;
40
39
  if (spmAllCode || shopSpmBforMap[pageId] || spmCodeForB) {
41
40
  pvObj = new MPing.inputs.SpmPV({
42
41
  spm: spmAllCode || `${shopSpmA}.${shopSpmBforMap[pageId] || spmCodeForB}`,
43
42
  page_param: pageParam,
44
43
  ...otherParam,
45
44
  });
46
45
  !pvForSpm && pageId && (pvObj.page_id = pageId);
47
46
  } else {
48
47
  pvObj = new MPing.inputs.PV({
49
48
  page_id: pageId,
50
49
  });
51
50
  pvObj.page_param = pageParam;
52
51
  otherParam &&
53
52
  Object.keys(otherParam).forEach((key) => {
54
53
  pvObj[key] = otherParam[key];
55
54
  });
56
55
  }
57
56
  if (isSend) {
58
57
  const mping = new MPing();
59
58
  mping.send(pvObj);
60
59
  setTimeout(() => resolve(true), 200);
61
60
  }
62
61
  })
63
62
  .catch((e) => {
64
63
  reject(e);
65
64
  });
66
65
  }).catch((err) => {
67
66
  draBusinessCustomReport({
68
67
  eventName: 'business',
69
68
  errorName: 'shop_reportPV_error',
70
69
  errorMessage:
71
70
  '埋点js加载异常,导致MPing不存在,pv具体上报参数如下==>' +
72
71
  JSON.stringify(opts) +
73
72
  '==异常参数说明==>' +
74
73
  err,
75
74
  });
76
75
  });
77
76
  return new Promise((resolve, reject) => {
78
77
  const {
79
78
  eid,
80
79
  eparam,
81
80
  jsonParam,
82
81
  pageParam,
83
82
  eventParamOld,
84
83
  flowMapParam = {},
85
84
  elevel,
86
85
  isExpo = false,
87
86
  target = null,
88
87
  pageId = 'TerminatorNew_All',
89
88
  spmAllCode,
90
89
  spmCodeForCD,
91
90
  } = opts;
92
91
  getReportObjReadyPromise()
93
92
  .then(() => {
94
93
  let clickObj: any = null;
95
94
  if (spmAllCode || (shopSpmBforMap[pageId] && (shopSpmCDforCode[eid] || spmCodeForCD))) {
96
95
  const getSpmParams = {
97
96
  target,
98
97
  spm:
99
98
  spmAllCode ||
100
99
  `${shopSpmA}.${shopSpmBforMap[pageId]}.${shopSpmCDforCode[eid] || spmCodeForCD}`,
101
100
  page_name: pageName,
102
101
  json_param: jsonParam,
103
102
  ...flowMapParam,
104
103
  };
105
104
  const getHistoryFlowMapList = Object.keys(flowMapParam);
106
105
  if (getHistoryFlowMapList.length > 0) {
107
106
  getHistoryFlowMapList.forEach((key) => {
108
107
  historyFlowMap[key] && (getSpmParams[historyFlowMap[key]] = flowMapParam[key]);
109
108
  });
110
109
  }
111
110
  eid && (getSpmParams['event_id'] = eid);
112
111
  eid && pageId && (getSpmParams['page_id'] = pageId);
113
112
  eparam && (getSpmParams['event_param'] = jsonParam);
114
113
  pageParam && (getSpmParams['page_param'] = pageParam);
115
114
  isExpo && (getSpmParams['ma_switch_type'] = '1');
116
115
  clickObj = isExpo
117
116
  ? new MPing.inputs.SpmExposure(getSpmParams)
118
117
  : new MPing.inputs.SpmClick(getSpmParams);
119
118
  } else {
120
119
  clickObj = new MPing.inputs.Click(eid, {
121
120
  isExpo,
122
121
  target,
123
122
  ...flowMapParam,
124
123
  });
125
124
  clickObj.json_param = jsonParam;
126
125
  if (eparam) {
127
126
  clickObj.event_param = jsonParam;
128
127
  } else if (eventParamOld) {
129
128
  clickObj.event_param = eventParamOld;
130
129
  }
131
130
  clickObj.page_id = pageId;
132
131
  clickObj.page_name = pageName;
133
132
  pageParam && (clickObj.page_param = pageParam);
134
133
  elevel && (clickObj.event_level = elevel);
135
134
  clickObj.updateEventSeries();
136
135
  }
137
136
  clickObj && new MPing().send(clickObj);
138
137
  setTimeout(() => resolve(true), 200);
139
138
  })
140
139
  .catch((e) => {
141
140
  reject(e);
142
141
  });
143
142
  }).catch((err) => {
144
143
  draBusinessCustomReport({
145
144
  eventName: 'business',
146
145
  errorName: 'shop_reportPV_error',
147
146
  errorMessage:
148
147
  '埋点js加载异常,导致MPing不存在,点击或者曝光具体上报参数如下==>' +
149
148
  JSON.stringify(opts) +
150
149
  '==异常参数说明==>' +
151
150
  err,
152
151
  });
153
152
  });
154
153
  const { jsonParam } = webLogParams;
155
154
  const { skuId } = opts;
156
155
  if (jsonParam && skuId) {
157
156
  try {
158
157
  let jsonObj = JSON.parse(jsonParam);
159
158
  jsonObj['skuid'] = skuId + '';
160
159
  webLogParams.jsonParam = JSON.stringify(jsonObj);
161
160
  } catch (e) {
162
161
  console.log(e);
163
162
  }
164
163
  }
165
164
  return reportClick(webLogParams);
165
+ import ready from '../../utils/ready';
166
166
  floorId: 'trafficmap_floor_id',
167
167
  positionId: 'trafficmap_position_id',
168
168
  materialId: 'trafficmap_material_id',
169
169
  materialName: 'trafficmap_material_name',
170
170
  aid: 'trafficmap_aid',
171
171
  new Promise((resolve, reject) => {
172
172
  if (window.MPing) {
173
173
  resolve(true);
174
174
  } else {
175
175
  if (isReportReadyError) {
176
176
  reject(false);
177
177
  } else {
178
178
  ready('MPing', 3000)
179
179
  .then(() => {
180
180
  isReportReadyError = false;
181
181
  resolve(true);
182
182
  })
183
183
  .catch(() => {
184
184
  isReportReadyError = true;
185
185
  reject(false);
186
186
  });
187
187
  }
188
188
  }
189
189
  });
190
190
  return new Promise((resolve, reject) => {
191
191
  const {
192
192
  pageId,
193
193
  pageParam,
194
194
  pTag,
195
195
  isSend = true,
196
196
  pvForSpm = false,
197
197
  spmAllCode,
198
198
  spmCodeForB,
199
199
  ...otherParam
200
200
  } = opts;
201
201
  getReportObjReadyPromise()
202
202
  .then(() => {
203
203
  let pvObj: any = null;
204
204
  if (spmAllCode || shopSpmBforMap[pageId] || spmCodeForB) {
205
205
  pvObj = new MPing.inputs.SpmPV({
206
206
  spm: spmAllCode || `${shopSpmA}.${shopSpmBforMap[pageId] || spmCodeForB}`,
207
207
  page_param: pageParam,
208
208
  ...otherParam,
209
209
  });
210
210
  !pvForSpm && pageId && (pvObj.page_id = pageId);
211
211
  } else {
212
212
  pvObj = new MPing.inputs.PV({
213
213
  page_id: pageId,
214
214
  });
215
215
  pvObj.page_param = pageParam;
216
216
  otherParam &&
217
217
  Object.keys(otherParam).forEach((key) => {
218
218
  pvObj[key] = otherParam[key];
219
219
  });
220
220
  }
221
221
  if (isSend) {
222
222
  const mping = new MPing();
223
223
  mping.send(pvObj);
224
224
  setTimeout(() => resolve(true), 200);
225
225
  }
226
226
  })
227
227
  .catch((e) => {
228
228
  reject(e);
229
229
  });
230
230
  }).catch((err) => {
231
231
  draBusinessCustomReport({
232
232
  eventName: 'business',
233
233
  errorName: 'shop_reportPV_error',
234
234
  errorMessage:
235
235
  '埋点js加载异常,导致MPing不存在,pv具体上报参数如下==>' +
236
236
  JSON.stringify(opts) +
237
237
  '==异常参数说明==>' +
238
238
  err,
239
239
  });
240
240
  });
241
241
  return new Promise((resolve, reject) => {
242
242
  const {
243
243
  eid,
244
244
  eparam,
245
245
  jsonParam,
246
246
  pageParam,
247
247
  eventParamOld,
248
248
  flowMapParam = {},
249
249
  elevel,
250
250
  isExpo = false,
251
251
  target = null,
252
252
  pageId = 'TerminatorNew_All',
253
253
  spmAllCode,
254
254
  spmCodeForCD,
255
255
  } = opts;
256
256
  getReportObjReadyPromise()
257
257
  .then(() => {
258
258
  let clickObj: any = null;
259
259
  if (spmAllCode || (shopSpmBforMap[pageId] && (shopSpmCDforCode[eid] || spmCodeForCD))) {
260
260
  const getSpmParams = {
261
261
  target,
262
262
  spm:
263
263
  spmAllCode ||
264
264
  `${shopSpmA}.${shopSpmBforMap[pageId]}.${shopSpmCDforCode[eid] || spmCodeForCD}`,
265
265
  page_name: pageName,
266
266
  json_param: jsonParam,
267
267
  ...flowMapParam,
268
268
  };
269
269
  const getHistoryFlowMapList = Object.keys(flowMapParam);
270
270
  if (getHistoryFlowMapList.length > 0) {
271
271
  getHistoryFlowMapList.forEach((key) => {
272
272
  historyFlowMap[key] && (getSpmParams[historyFlowMap[key]] = flowMapParam[key]);
273
273
  });
274
274
  }
275
275
  eid && (getSpmParams['event_id'] = eid);
276
276
  eid && pageId && (getSpmParams['page_id'] = pageId);
277
277
  eparam && (getSpmParams['event_param'] = jsonParam);
278
278
  pageParam && (getSpmParams['page_param'] = pageParam);
279
279
  isExpo && (getSpmParams['ma_switch_type'] = '1');
280
280
  clickObj = isExpo
281
281
  ? new MPing.inputs.SpmExposure(getSpmParams)
282
282
  : new MPing.inputs.SpmClick(getSpmParams);
283
283
  } else {
284
284
  clickObj = new MPing.inputs.Click(eid, {
285
285
  isExpo,
286
286
  target,
287
287
  ...flowMapParam,
288
288
  });
289
289
  clickObj.json_param = jsonParam;
290
290
  if (eparam) {
291
291
  clickObj.event_param = jsonParam;
292
292
  } else if (eventParamOld) {
293
293
  clickObj.event_param = eventParamOld;
294
294
  }
295
295
  clickObj.page_id = pageId;
296
296
  clickObj.page_name = pageName;
297
297
  pageParam && (clickObj.page_param = pageParam);
298
298
  elevel && (clickObj.event_level = elevel);
299
299
  clickObj.updateEventSeries();
300
300
  }
301
301
  clickObj && new MPing().send(clickObj);
302
302
  setTimeout(() => resolve(true), 200);
303
303
  })
304
304
  .catch((e) => {
305
305
  reject(e);
306
306
  });
307
307
  }).catch((err) => {
308
308
  delete opts['target'];
309
309
  draBusinessCustomReport({
310
310
  eventName: 'business',
311
311
  errorName: 'shop_reportPV_error',
312
312
  errorMessage:
313
313
  '埋点js加载异常,导致MPing不存在,点击或者曝光具体上报参数如下==>' +
314
314
  JSON.stringify(opts) +
315
315
  '==异常参数说明==>' +
316
316
  err,
317
317
  });
318
318
  });
319
319
  const { jsonParam } = webLogParams;
320
320
  const { skuId } = opts;
321
321
  if (jsonParam && skuId) {
322
322
  try {
323
323
  let jsonObj = JSON.parse(jsonParam);
324
324
  jsonObj['skuid'] = skuId + '';
325
325
  webLogParams.jsonParam = JSON.stringify(jsonObj);
326
326
  } catch (e) {
327
327
  console.log(e);
328
328
  }
329
329
  }
330
330
  return reportClick(webLogParams);