@conecli/cone-render 0.10.1-shop3.107 → 0.10.1-shop3.109

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 global from '../common';
2
1
  BUSINESS_TYPE,
3
2
  SHOP_MENU_ID_TYPE,
4
3
  SHOP_MENU_ID_NAME,
5
4
  SECTION_HOME_TAB_TYPE,
6
5
  SECTION_HOME_TAB_NAME_TYPE,
7
6
  LogPageIdInfo,
8
7
  LogPnameInfo,
9
8
  PcShopSpmA,
10
9
  PcShopSpmBforMap,
11
10
  routerInfo: {
12
11
  params: {},
13
12
  },
14
13
  nativeEvent: null,
15
14
  jumpConfig: {
16
15
  venderId: null,
17
16
  shopId: null,
18
17
  sourceValue: '',
19
18
  sourceType: 'M-H5',
20
19
  activityType: 'shopx',
21
20
  moduleId: 'none',
22
21
  entrance: 'none',
23
22
  },
24
23
  logPageParamStr: '',
25
24
  new Promise((resolve, reject) => {
26
25
  if (window.spmPV) {
27
26
  resolve(true);
28
27
  } else {
29
28
  if (isReportReadyError) {
30
29
  reject(false);
31
30
  } else {
32
31
  ready('spmPV', 3000)
33
32
  .then(() => {
34
33
  isReportReadyError = false;
35
34
  resolve(true);
36
35
  })
37
36
  .catch(() => {
38
37
  isReportReadyError = true;
39
38
  reject(false);
40
39
  });
41
40
  }
42
41
  }
43
42
  });
44
43
  public logPageId: string;
45
44
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
46
45
  getConfig(opt) {
47
46
  return Object.assign(this, {}, defaultConfig, opt);
48
47
  }
49
48
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
50
49
  this.routerInfo = routerInfo;
51
50
  this.logPname = logPname;
52
51
  this.jumpConfig = Object.assign(
53
52
  {},
54
53
  this.jumpConfig,
55
54
  filterUrlQueryData(routerInfo?.params || {}),
56
55
  );
57
56
  this.logPageId = pageId;
58
57
  }
59
58
 
60
59
  jdNavigateToNative(
61
60
  url: string,
62
61
  params: {
63
62
  logEventInfo?: object;
64
63
  } = {},
65
64
  successBack?: Function | undefined,
66
65
  failBack?: Function | undefined,
67
66
  ) {
68
67
  const { logEventInfo } = params;
69
68
  const getEparam = logEventInfo || params;
70
69
  console.log(`url:::::::${url}`);
71
70
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
72
71
  this.clickEventLog(getEparam)
73
72
  .then(() => {
74
73
  typeof successBack === 'function' ? successBack(url) : window.open(url, '_blank');
75
74
  })
76
75
  .catch(() => {
77
76
  typeof failBack === 'function' && failBack(url);
78
77
  });
79
78
  }
80
79
 
81
80
  reportInfoPv(
82
81
  pageId = LogPageIdInfo.APP,
83
82
  opt: {
84
83
  pageParam?: any;
85
84
  } = {},
86
85
  ): Promise<any> {
87
86
  console.log('web.pc.ts - reportInfoPv', pageId, opt);
88
87
  return new Promise((resolve, reject) => {
89
88
  const { pageParam } = opt;
90
89
  const pageParamStr = typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam;
91
90
  getReportObjReadyPromise()
92
91
  .then(() => {
93
92
  window.spmPV({
94
93
  spm: `${PcShopSpmA}.${PcShopSpmBforMap[pageId]}`,
95
94
  page_id: pageId,
96
95
  page_param: pageParamStr,
97
96
  });
98
97
  resolve(true);
99
98
  })
100
99
  .catch((e) => {
101
100
  reject(e);
102
101
  });
103
102
  }).catch((err) => {
104
103
  console.log('pc sgm 浏览pv埋点上报异常', err);
105
104
  });
106
105
  }
107
106
 
108
107
  clickEventLog(opts): Promise<any> {
109
108
  console.log('web.pc.ts - clickEventLog opts: ', opts);
110
109
  return new Promise((resolve, reject) => {
111
110
  const { spmAll, spmCd, pageId, pageParam, ...otherParam } = opts;
112
111
  const pageParamStr = typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam;
113
112
  getReportObjReadyPromise()
114
113
  .then(() => {
115
114
  window.spmLog({
116
115
  spm: spmAll ? spmAll : `${PcShopSpmA}.${PcShopSpmBforMap[pageId]}.${spmCd}`,
117
116
  biz_type: '',
118
117
  page_id: pageId,
119
118
  event_param: '',
120
119
  json_param: pageParamStr,
121
120
  t1: '',
122
121
  t2: '',
123
122
  p0: '',
124
123
  ...otherParam,
125
124
  });
126
125
  resolve(true);
127
126
  })
128
127
  .catch((e) => {
129
128
  reject(e);
130
129
  });
131
130
  }).catch((err) => {
132
131
  console.log('pc sgm 点击埋点上报异常', err);
133
132
  });
134
133
  }
135
134
 
136
135
  exposureEventLog(opts): Promise<any> {
137
136
  console.log('web.pc.ts - exposureEventLog opts: ', opts);
138
137
  return new Promise((resolve, reject) => {
139
138
  const { spmAll, spmCd, pageId, pageParam, ...otherParam } = opts;
140
139
  const pageParamStr = typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam;
141
140
  getReportObjReadyPromise()
142
141
  .then(() => {
143
142
  window.spmExposure({
144
143
  spm: spmAll ? spmAll : `${PcShopSpmA}.${PcShopSpmBforMap[pageId]}.${spmCd}`,
145
144
  biz_type: '',
146
145
  page_id: pageId,
147
146
  event_param: '',
148
147
  json_param: pageParamStr,
149
148
  t1: '',
150
149
  t2: '',
151
150
  p0: '',
152
151
  ...otherParam,
153
152
  });
154
153
  resolve(true);
155
154
  })
156
155
  .catch((e) => {
157
156
  reject(e);
158
157
  });
159
158
  }).catch((err) => {
160
159
  console.log('pc sgm 曝光埋点上报异常', err);
161
160
  });
162
161
  }
163
162
 
164
163
  jdJumpToProduct(skuIds, logEventInfo) {
165
164
  skuIds = skuIds.toString().trim();
166
165
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds;
167
166
  let url = `${this.jumpWebUrl.pcDetail}${getSkuId}.html`;
168
167
  this.jdNavigateToNative(url, logEventInfo);
169
168
  }
170
169
 
171
170
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
172
171
  const getSkuId = skuInfo?.skuId;
173
172
  this.jdJumpToProduct(getSkuId, logEventInfo);
174
173
  }
175
174
 
176
175
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
177
176
  const currentShopInfo = {
178
177
  shopId: global.info.queryInfo.shopId,
179
178
  venderId: global.info.queryInfo.venderId,
180
179
  };
181
180
  const restParams =
182
181
  (shopInfo?.shopId && shopInfo.shopId !== currentShopInfo.shopId) ||
183
182
  (shopInfo?.venderId && shopInfo.venderId !== currentShopInfo.venderId)
184
183
  ? {}
185
184
  : currentShopInfo;
186
185
  const getInfo = Object.assign({}, restParams, shopInfo);
187
186
  let url = `${this.jumpWebUrl.pages}/index-${getInfo.shopId}.html`;
188
187
  this.jdNavigateToNative(url, {
189
188
  ...getInfo,
190
189
  });
191
190
  }
192
191
 
193
192
  getPcSearchUrl = (searchInfo: { categoryId: string; keyWord: string }) => {
194
193
  const { categoryId, keyWord } = searchInfo;
195
194
  const flag = document.querySelector('#JSHOP_CHANNEL_FLAG')?.value;
196
195
  const appId =
197
196
  document.querySelector('#J_AppId')?.value ||
198
197
  document.querySelector('#pageInstance_appId')?.value;
199
198
  const searchUrl = categoryId
200
199
  ? this.jumpWebUrl.pages + '/view_search-' + appId + '-' + categoryId + '-99-1-20-1.html'
201
200
  : `${this.jumpWebUrl.pages}/view_search-${appId}.html?keyword=${keyWord}`;
202
201
  return flag === 'yao'
203
202
  ? this.jumpWebUrl.pages + '/view_shop_search-' + appId + '.html'
204
203
  : searchUrl;
205
204
  };
206
205
 
207
206
  jdJumpToShopSearch(shopInfo) {
208
207
  const getInfo = Object.assign(
209
208
  {},
210
209
  {
211
210
  shopId: global.info.queryInfo.shopId,
212
211
  venderId: global.info.queryInfo.venderId,
213
212
  },
214
213
  shopInfo,
215
214
  );
216
215
  const { categoryId = '', keyWord = '' } = getInfo;
217
216
  const url = `${this.getPcSearchUrl({ categoryId, keyWord })}`;
218
217
  this.jdJumpToWeb(url, getInfo);
219
218
  }
220
219
 
221
220
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
222
221
  console.log('web.base.ts - jdJumpToTabAllProduct');
223
222
  if (typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId;
224
223
  if (typeof venderId === 'undefined') venderId = global.info.queryInfo.venderId;
225
224
  const url = `${this.jumpWebUrl.pages}/index-${shopId}.html`;
226
225
  this.jdJumpToWeb(url, logEventInfo);
227
226
  }
228
227
 
229
228
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
230
229
  const url = `${this.jumpWebUrl.couponSearch}?couponbatch=${couponId}&sceneval=2`;
231
230
  this.jdJumpToWeb(url, logEventInfo);
232
231
  }
232
+ import global from '../common';
233
233
  BUSINESS_TYPE,
234
234
  LogPageIdInfo,
235
235
  LogPnameInfo,
236
236
  PcShopSpmA,
237
237
  PcShopSpmBforMap,
238
238
  shopSpmCDforCode,
239
239
  routerInfo: {
240
240
  params: {},
241
241
  },
242
242
  nativeEvent: null,
243
243
  jumpConfig: {
244
244
  venderId: null,
245
245
  shopId: null,
246
246
  sourceValue: '',
247
247
  sourceType: 'M-H5',
248
248
  activityType: 'shopx',
249
249
  moduleId: 'none',
250
250
  entrance: 'none',
251
251
  },
252
252
  logPageParamStr: '',
253
253
  new Promise((resolve, reject) => {
254
254
  if (window.spmPV) {
255
255
  resolve(true);
256
256
  } else {
257
257
  if (isReportReadyError) {
258
258
  reject(false);
259
259
  } else {
260
260
  ready('spmPV', 3000)
261
261
  .then(() => {
262
262
  isReportReadyError = false;
263
263
  resolve(true);
264
264
  })
265
265
  .catch(() => {
266
266
  isReportReadyError = true;
267
267
  reject(false);
268
268
  });
269
269
  }
270
270
  }
271
271
  });
272
272
  public logPageId: string;
273
273
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
274
274
  getConfig(opt) {
275
275
  return Object.assign(this, {}, defaultConfig, opt);
276
276
  }
277
277
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
278
278
  this.routerInfo = routerInfo;
279
279
  this.logPname = logPname;
280
280
  this.jumpConfig = Object.assign(
281
281
  {},
282
282
  this.jumpConfig,
283
283
  filterUrlQueryData(routerInfo?.params || {}),
284
284
  );
285
285
  this.logPageId = pageId;
286
286
  }
287
287
 
288
288
  jdNavigateToNative(
289
289
  url: string,
290
290
  params: {
291
291
  logEventInfo?: object;
292
292
  } = {},
293
293
  successBack?: Function | undefined,
294
294
  failBack?: Function | undefined,
295
295
  ) {
296
296
  const { logEventInfo } = params;
297
297
  const getEparam = logEventInfo || params;
298
298
  console.log(`url:::::::${url}`);
299
299
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
300
300
  this.clickEventLog(getEparam)
301
301
  .then(() => {
302
302
  typeof successBack === 'function' ? successBack(url) : window.open(url, '_blank');
303
303
  })
304
304
  .catch(() => {
305
305
  typeof failBack === 'function' && failBack(url);
306
306
  });
307
307
  }
308
308
 
309
309
  reportInfoPv(
310
310
  pageId = LogPageIdInfo.APP,
311
311
  opt: {
312
312
  pageParam?: any;
313
313
  } = {},
314
314
  ): Promise<any> {
315
315
  console.log('web.pc.ts - reportInfoPv', pageId, opt);
316
316
  return new Promise((resolve, reject) => {
317
317
  const { pageParam } = opt;
318
318
  const pageParamStr = typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam;
319
319
  getReportObjReadyPromise()
320
320
  .then(() => {
321
321
  window.spmPV({
322
322
  spm: `${PcShopSpmA}.${PcShopSpmBforMap[pageId]}`,
323
323
  page_id: pageId,
324
324
  page_param: pageParamStr,
325
325
  });
326
326
  this.logPageId = pageId;
327
327
  this.logPageParamStr = pageParamStr;
328
328
  resolve(true);
329
329
  })
330
330
  .catch((e) => {
331
331
  reject(e);
332
332
  });
333
333
  }).catch((err) => {
334
334
  console.log('pc sgm 浏览pv埋点上报异常', err);
335
335
  });
336
336
  }
337
337
 
338
338
  reportClick(opts,reportKey = 'click'){
339
339
  console.log(`web.pc.ts - ${reportKey}EventLog opts: `, opts);
340
340
  return new Promise((resolve, reject) => {
341
341
  const { spmAll, spmAllCode, spmCodeForCD, spmCd, pageId, pageParam, jsonParam = {}, eventId, target, ...otherParam } = opts;
342
342
  const getSpmAllCode = spmAll || spmAllCode;
343
343
  const getSpmCodeForCD = spmCd || spmCodeForCD;
344
344
  const getPageId = pageId || this.logPageId;
345
345
  const pageParamStr = typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam || this.logPageParamStr;
346
346
  const { etModelInfo, logBaseInfo } = jsonParam;
347
347
  let getJsonParam = {};
348
348
  if (etModelInfo && logBaseInfo) {
349
349
  getJsonParam = logBaseInfo;
350
350
  } else {
351
351
  if (Array.isArray(jsonParam)) {
352
352
  getJsonParam = jsonParam;
353
353
  } else {
354
354
  getJsonParam = Object.assign(
355
355
  {},
356
356
  {
357
357
  shopid: global?.info?.queryInfo?.shopId,
358
358
  },
359
359
  jsonParam,
360
360
  );
361
361
  }
362
362
  }
363
363
  if (
364
364
  reportKey === 'exposure' &&
365
365
  /^TerminatorNew/.test(eventId) &&
366
366
  !Array.isArray(getJsonParam)
367
367
  ) {
368
368
  getJsonParam = [getJsonParam];
369
369
  }
370
370
  getReportObjReadyPromise()
371
371
  .then(() => {
372
372
  const getSpmParams = {
373
373
  spm: getSpmAllCode ? getSpmAllCode : `${PcShopSpmA}.${PcShopSpmBforMap[getPageId]}.${getSpmCodeForCD || shopSpmCDforCode[eventId]}`,
374
374
  biz_type: '',
375
375
  page_id: getPageId,
376
376
  page_param: pageParamStr,
377
377
  event_id: eventId,
378
378
  event_param: '',
379
379
  json_param: JSON.stringify(getJsonParam),
380
380
  t1: '',
381
381
  t2: '',
382
382
  p0: '',
383
383
  ...otherParam,
384
384
  }
385
385
  console.log(`pc sgm ${reportKey}埋点最终参数`, getSpmParams);
386
386
  reportKey === 'exposure' ? window.spmExposure(getSpmParams) : window.spmLog(getSpmParams);
387
387
  resolve(true);
388
388
  })
389
389
  .catch((e) => {
390
390
  reject(e);
391
391
  });
392
392
  }).catch((err) => {
393
393
  console.log(`pc sgm ${reportKey === 'exposure' ? '曝光' : '点击'}埋点上报异常`, err);
394
394
  });
395
395
  }
396
396
 
397
397
  clickEventLog(opts): Promise<any> {
398
398
  console.log('web.pc.ts - clickEventLog opts: ', opts);
399
399
  return this.reportClick(opts,"click");
400
400
  }
401
401
 
402
402
  exposureEventLog(opts): Promise<any> {
403
403
  return this.reportClick(opts,"exposure");
404
404
  }
405
405
 
406
406
  jdJumpToProduct(skuIds, logEventInfo) {
407
407
  skuIds = skuIds.toString().trim();
408
408
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds;
409
409
  let url = `${this.jumpWebUrl.pcDetail}${getSkuId}.html`;
410
410
  this.jdNavigateToNative(url, logEventInfo);
411
411
  }
412
412
 
413
413
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
414
414
  const getSkuId = skuInfo?.skuId;
415
415
  this.jdJumpToProduct(getSkuId, logEventInfo);
416
416
  }
417
417
 
418
418
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
419
419
  const currentShopInfo = {
420
420
  shopId: global.info.queryInfo.shopId,
421
421
  venderId: global.info.queryInfo.venderId,
422
422
  };
423
423
  const restParams =
424
424
  (shopInfo?.shopId && shopInfo.shopId !== currentShopInfo.shopId) ||
425
425
  (shopInfo?.venderId && shopInfo.venderId !== currentShopInfo.venderId)
426
426
  ? {}
427
427
  : currentShopInfo;
428
428
  const getInfo = Object.assign({}, restParams, shopInfo);
429
429
  let url = `${this.jumpWebUrl.pages}/index-${getInfo.shopId}.html`;
430
430
  this.jdNavigateToNative(url, {
431
431
  ...getInfo,
432
432
  });
433
433
  }
434
434
 
435
435
  getPcSearchUrl = (searchInfo: { categoryId: string; keyWord: string }) => {
436
436
  const { categoryId, keyWord } = searchInfo;
437
437
  const flag = document.querySelector('#JSHOP_CHANNEL_FLAG')?.value;
438
438
  const appId =
439
439
  document.querySelector('#J_AppId')?.value ||
440
440
  document.querySelector('#pageInstance_appId')?.value;
441
441
  const keywordStr = keyWord && keyWord !== "" ? `?keyword=${keyWord}` : ''
442
442
  const searchUrl = categoryId
443
443
  ? this.jumpWebUrl.pages + '/view_search-' + appId + '-' + categoryId + '-99-1-20-1.html'
444
444
  : `${this.jumpWebUrl.pages}/view_search-${appId}.html${keywordStr}`;
445
445
  return flag === 'yao'
446
446
  ? this.jumpWebUrl.pages + '/view_shop_search-' + appId + '.html'
447
447
  : searchUrl;
448
448
  };
449
449
 
450
450
  jdJumpToShopSearch(shopInfo) {
451
451
  const getInfo = Object.assign(
452
452
  {},
453
453
  {
454
454
  shopId: global.info.queryInfo.shopId,
455
455
  venderId: global.info.queryInfo.venderId,
456
456
  },
457
457
  shopInfo,
458
458
  );
459
459
  const { categoryId = '', keyWord = '' } = getInfo;
460
460
  const url = `${this.getPcSearchUrl({ categoryId, keyWord })}`;
461
461
  this.jdJumpToWeb(url, getInfo);
462
462
  }
463
463
 
464
464
  jdJumpToShopCategory(shopInfo) {
465
465
  this.jdJumpToShopSearch(shopInfo)
466
466
  }
467
467
 
468
468
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
469
469
  console.log('web.base.ts - jdJumpToTabAllProduct');
470
470
  if (typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId;
471
471
  if (typeof venderId === 'undefined') venderId = global.info.queryInfo.venderId;
472
472
  const url = `${this.jumpWebUrl.pages}/index-${shopId}.html`;
473
473
  this.jdJumpToWeb(url, logEventInfo);
474
474
  }
475
475
 
476
476
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
477
477
  const url = `${this.jumpWebUrl.couponSearch}?couponbatch=${couponId}&sceneval=2`;
478
478
  this.jdJumpToWeb(url, logEventInfo);
479
479
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conecli/cone-render",
3
- "version": "0.10.1-shop3.107",
3
+ "version": "0.10.1-shop3.109",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist/"
@@ -87,7 +87,6 @@
87
87
  ],
88
88
  "author": "conecli",
89
89
  "dependencies": {
90
- "@babel/runtime": "7.24.4",
91
90
  "@tarojs/components": "4.1.2",
92
91
  "@tarojs/helper": "4.1.2",
93
92
  "@tarojs/plugin-framework-react": "4.1.2",
@@ -119,6 +118,7 @@
119
118
  "@babel/plugin-proposal-class-properties": "7.14.5",
120
119
  "@babel/plugin-transform-strict-mode": "^7.16.7",
121
120
  "@babel/preset-react": "^7.24.1",
121
+ "@babel/runtime": "7.24.4",
122
122
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
123
123
  "@tarojs/cli": "4.1.2",
124
124
  "@tarojs/taro-loader": "4.1.2",
@@ -158,6 +158,7 @@
158
158
  },
159
159
  "resolutions": {
160
160
  "@babel/runtime": "7.24.4",
161
+ "@babel/core": "7.24.4",
161
162
  "@tarojs/cli": "4.1.2",
162
163
  "@tarojs/helper": "4.1.2",
163
164
  "minimatch": "9.0.5",