@conecli/cone-render 0.10.1-shop3.43 → 0.10.1-shop3.45

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 { sgmCustomReport } from '../../utils';
2
1
  new Promise((resolve, reject) => {
3
2
  if (window.MPing) {
4
3
  resolve(true);
5
4
  } else {
6
5
  if (isReportReadyError) {
7
6
  reject(false);
8
7
  } else {
9
8
  ready('MPing', 3000)
10
9
  .then(() => {
11
10
  isReportReadyError = false;
12
11
  resolve(true);
13
12
  })
14
13
  .catch(() => {
15
14
  isReportReadyError = true;
16
15
  reject(false);
17
16
  });
18
17
  }
19
18
  }
20
19
  });
21
20
  return new Promise((resolve, reject) => {
22
21
  const { pageId, pageParam, pTag, isSend = true, ...otherParam } = opts;
23
22
  getReportObjReadyPromise()
24
23
  .then(() => {
25
24
  let pvObj: any = null;
26
25
  if (shopSpmBforMap[pageId]) {
27
26
  pvObj = new MPing.inputs.SpmPV({
28
27
  spm: `${shopSpmA}.${shopSpmBforMap[pageId]}`,
29
28
  page_id: pageId,
30
29
  page_param: pageParam,
31
30
  ...otherParam,
32
31
  });
33
32
  } else {
34
33
  pvObj = new MPing.inputs.PV({
35
34
  page_id: pageId,
36
35
  });
37
36
  pvObj.page_param = pageParam;
38
37
  otherParam &&
39
38
  Object.keys(otherParam).forEach((key) => {
40
39
  pvObj[key] = otherParam[key];
41
40
  });
42
41
  }
43
42
  if (isSend) {
44
43
  const mping = new MPing();
45
44
  mping.send(pvObj);
46
45
  setTimeout(() => resolve(true), 200);
47
46
  }
48
47
  })
49
48
  .catch((e) => {
50
49
  reject(e);
51
50
  });
52
51
  }).catch((err) => {
53
52
  console.log('上报异常', err);
54
53
  sgmCustomReport({
55
54
  code: 'reportErr',
56
55
  msg:
57
56
  '埋点js加载异常,导致MPing不存在,pv具体上报参数如下==>' +
58
57
  JSON.stringify(opts) +
59
58
  '==异常参数说明==>' +
60
59
  err,
61
60
  });
62
61
  });
63
62
  return new Promise((resolve, reject) => {
64
63
  const {
65
64
  eid,
66
65
  eparam,
67
66
  jsonParam,
68
67
  pageParam,
69
68
  flowMapParam = {},
70
69
  elevel,
71
70
  isExpo = false,
72
71
  target = null,
73
72
  pageId = 'TerminatorNew_All',
74
73
  } = opts;
75
74
  getReportObjReadyPromise()
76
75
  .then(() => {
77
76
  let clickObj: any = null;
78
77
  if (shopSpmCDforCode[eid] && shopSpmBforMap[pageId]) {
79
78
  const getSpmParams = {
80
79
  target,
81
80
  spm: `${shopSpmA}.${shopSpmBforMap[pageId]}.${shopSpmCDforCode[eid]}`,
82
81
  event_id: eid,
83
82
  page_id: pageId,
84
83
  page_name: pageName,
85
84
  json_param: jsonParam,
86
85
  ...flowMapParam,
87
86
  };
88
87
  eparam && (getSpmParams['event_param'] = jsonParam);
89
88
  pageParam && (getSpmParams['page_param'] = pageParam);
90
89
  isExpo && (getSpmParams['ma_switch_type'] = '1');
91
90
  clickObj = isExpo
92
91
  ? new MPing.inputs.SpmExposure(getSpmParams)
93
92
  : new MPing.inputs.SpmClick(getSpmParams);
94
93
  } else {
95
94
  clickObj = new MPing.inputs.Click(eid, {
96
95
  isExpo,
97
96
  target,
98
97
  ...flowMapParam,
99
98
  });
100
99
  clickObj.json_param = jsonParam;
101
100
  if (eparam) {
102
101
  clickObj.event_param = jsonParam;
103
102
  }
104
103
  clickObj.page_id = pageId;
105
104
  clickObj.page_name = pageName;
106
105
  pageParam && (clickObj.page_param = pageParam);
107
106
  elevel && (clickObj.event_level = elevel);
108
107
  clickObj.updateEventSeries();
109
108
  }
110
109
  clickObj && new MPing().send(clickObj);
111
110
  setTimeout(() => resolve(true), 200);
112
111
  })
113
112
  .catch((e) => {
114
113
  reject(e);
115
114
  });
116
115
  }).catch((err) => {
117
116
  console.log('上报异常', err);
118
117
  sgmCustomReport({
119
118
  code: 'reportErr',
120
119
  msg:
121
120
  '埋点js加载异常,导致MPing不存在,点击或者曝光具体上报参数如下==>' +
122
121
  JSON.stringify(opts) +
123
122
  '==异常参数说明==>' +
124
123
  err,
125
124
  });
126
125
  });
127
126
  const { jsonParam } = webLogParams;
128
127
  const { skuId } = opts;
129
128
  if (jsonParam && skuId) {
130
129
  try {
131
130
  let jsonObj = JSON.parse(jsonParam);
132
131
  jsonObj['skuid'] = skuId + '';
133
132
  webLogParams.jsonParam = JSON.stringify(jsonObj);
134
133
  } catch (e) {
135
134
  console.log(e);
136
135
  }
137
136
  }
138
137
  return reportClick(webLogParams);
138
+ import { sgmCustomReport } from '../../utils';
139
139
  new Promise((resolve, reject) => {
140
140
  if (window.MPing) {
141
141
  resolve(true);
142
142
  } else {
143
143
  if (isReportReadyError) {
144
144
  reject(false);
145
145
  } else {
146
146
  ready('MPing', 3000)
147
147
  .then(() => {
148
148
  isReportReadyError = false;
149
149
  resolve(true);
150
150
  })
151
151
  .catch(() => {
152
152
  isReportReadyError = true;
153
153
  reject(false);
154
154
  });
155
155
  }
156
156
  }
157
157
  });
158
158
  return new Promise((resolve, reject) => {
159
159
  const { pageId, pageParam, pTag, isSend = true, spmAllCode, spmCodeForB, ...otherParam } = opts;
160
160
  getReportObjReadyPromise()
161
161
  .then(() => {
162
162
  let pvObj: any = null;
163
163
  if (spmAllCode || shopSpmBforMap[pageId] || spmCodeForB) {
164
164
  pvObj = new MPing.inputs.SpmPV({
165
165
  spm: spmAllCode || `${shopSpmA}.${shopSpmBforMap[pageId] || spmCodeForB}`,
166
166
  page_id: pageId,
167
167
  page_param: pageParam,
168
168
  ...otherParam,
169
169
  });
170
170
  } else {
171
171
  pvObj = new MPing.inputs.PV({
172
172
  page_id: pageId,
173
173
  });
174
174
  pvObj.page_param = pageParam;
175
175
  otherParam &&
176
176
  Object.keys(otherParam).forEach((key) => {
177
177
  pvObj[key] = otherParam[key];
178
178
  });
179
179
  }
180
180
  if (isSend) {
181
181
  const mping = new MPing();
182
182
  mping.send(pvObj);
183
183
  setTimeout(() => resolve(true), 200);
184
184
  }
185
185
  })
186
186
  .catch((e) => {
187
187
  reject(e);
188
188
  });
189
189
  }).catch((err) => {
190
190
  console.log('上报异常', err);
191
191
  sgmCustomReport({
192
192
  code: 'reportErr',
193
193
  msg:
194
194
  '埋点js加载异常,导致MPing不存在,pv具体上报参数如下==>' +
195
195
  JSON.stringify(opts) +
196
196
  '==异常参数说明==>' +
197
197
  err,
198
198
  });
199
199
  });
200
200
  return new Promise((resolve, reject) => {
201
201
  const {
202
202
  eid,
203
203
  eparam,
204
204
  jsonParam,
205
205
  pageParam,
206
206
  flowMapParam = {},
207
207
  elevel,
208
208
  isExpo = false,
209
209
  target = null,
210
210
  pageId = 'TerminatorNew_All',
211
211
  spmAllCode,
212
212
  spmCodeForCD,
213
213
  } = opts;
214
214
  getReportObjReadyPromise()
215
215
  .then(() => {
216
216
  let clickObj: any = null;
217
217
  if (spmAllCode || (shopSpmBforMap[pageId] && (shopSpmCDforCode[eid] || spmCodeForCD))) {
218
218
  const getSpmParams = {
219
219
  target,
220
220
  spm:
221
221
  spmAllCode ||
222
222
  `${shopSpmA}.${shopSpmBforMap[pageId]}.${shopSpmCDforCode[eid] || spmCodeForCD}`,
223
223
  event_id: eid,
224
224
  page_id: pageId,
225
225
  page_name: pageName,
226
226
  json_param: jsonParam,
227
227
  ...flowMapParam,
228
228
  };
229
229
  eparam && (getSpmParams['event_param'] = jsonParam);
230
230
  pageParam && (getSpmParams['page_param'] = pageParam);
231
231
  isExpo && (getSpmParams['ma_switch_type'] = '1');
232
232
  clickObj = isExpo
233
233
  ? new MPing.inputs.SpmExposure(getSpmParams)
234
234
  : new MPing.inputs.SpmClick(getSpmParams);
235
235
  } else {
236
236
  clickObj = new MPing.inputs.Click(eid, {
237
237
  isExpo,
238
238
  target,
239
239
  ...flowMapParam,
240
240
  });
241
241
  clickObj.json_param = jsonParam;
242
242
  if (eparam) {
243
243
  clickObj.event_param = jsonParam;
244
244
  }
245
245
  clickObj.page_id = pageId;
246
246
  clickObj.page_name = pageName;
247
247
  pageParam && (clickObj.page_param = pageParam);
248
248
  elevel && (clickObj.event_level = elevel);
249
249
  clickObj.updateEventSeries();
250
250
  }
251
251
  clickObj && new MPing().send(clickObj);
252
252
  setTimeout(() => resolve(true), 200);
253
253
  })
254
254
  .catch((e) => {
255
255
  reject(e);
256
256
  });
257
257
  }).catch((err) => {
258
258
  console.log('上报异常', err);
259
259
  sgmCustomReport({
260
260
  code: 'reportErr',
261
261
  msg:
262
262
  '埋点js加载异常,导致MPing不存在,点击或者曝光具体上报参数如下==>' +
263
263
  JSON.stringify(opts) +
264
264
  '==异常参数说明==>' +
265
265
  err,
266
266
  });
267
267
  });
268
268
  const { jsonParam } = webLogParams;
269
269
  const { skuId } = opts;
270
270
  if (jsonParam && skuId) {
271
271
  try {
272
272
  let jsonObj = JSON.parse(jsonParam);
273
273
  jsonObj['skuid'] = skuId + '';
274
274
  webLogParams.jsonParam = JSON.stringify(jsonObj);
275
275
  } catch (e) {
276
276
  console.log(e);
277
277
  }
278
278
  }
279
279
  return reportClick(webLogParams);