@conecli/cone-render 0.10.1-shop3.3 → 0.10.1-shop3.5

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.
Files changed (32) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  4. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  5. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  6. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  7. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  8. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  9. package/dist/interface/jumpEventReport.ts +1 -1
  10. package/dist/interface/service.ts +1 -1
  11. package/dist/jumpEventReport/base.ts +1 -1
  12. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  13. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  14. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  15. package/dist/jumpEventReport/web/report.ts +1 -1
  16. package/dist/jumpEventReport/web.base.ts +1 -1
  17. package/dist/jumpEventReport/web.jd.ts +1 -1
  18. package/dist/modules/ContainerFloorList/index.h5.module.scss +3 -0
  19. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  20. package/dist/open/api/util.ts +1 -1
  21. package/dist/service/http/colorSign.ts +1 -1
  22. package/dist/service/http/const.ts +1 -1
  23. package/dist/service/requestServer.h5.ts +1 -1
  24. package/dist/service/requestServer.ts +1 -1
  25. package/dist/utils/connectNativeJsBridge.ts +1 -1
  26. package/dist/utils/h5Utils.ts +1 -1
  27. package/dist/utils/index.h5.ts +1 -1
  28. package/dist/utils/index.ts +1 -1
  29. package/dist/utils/index.weapp.ts +1 -1
  30. package/dist/utils/sColor.js +1 -0
  31. package/dist/utils/utils.ts +1 -1
  32. package/package.json +1 -1
@@ -1 +1 @@
1
- import { JdJumpJdApp } from './jdJumpJdApp'
2
1
  reportClick,
3
2
  reportPV,
4
3
  reportToCart,
5
4
  routerInfo: {
6
5
  params: {},
7
6
  },
8
7
  nativeEvent: null,
9
8
  jumpConfig: {
10
9
  venderId: null,
11
10
  shopId: null,
12
11
  sourceValue: '',
13
12
  sourceType: 'App-H5',
14
13
  activityType: 'shopx',
15
14
  moduleId: 'none',
16
15
  entrance: 'none',
17
16
  },
18
17
  logPageParamStr: '',
19
18
  public logPageId: string
20
19
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
21
20
  constructor(opt = {}) {
22
21
  super(opt)
23
22
  this.getConfig(opt)
24
23
  }
25
24
  getConfig(opt = {}) {
26
25
  return Object.assign(this, {}, defaultConfig, opt)
27
26
  }
28
27
  updateInfo(
29
28
  routerInfo,
30
29
  logPname = LogPnameInfo.HOME,
31
30
  pageId = LogPageIdInfo.APP,
32
31
  ) {
33
32
  this.logPageId = pageId
34
33
  this.routerInfo = routerInfo
35
34
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params)
36
35
  this.logPname = logPname
37
36
  }
38
37
  reportInfoPv(
39
38
  pageId = LogPageIdInfo.APP,
40
39
  opt: {
41
40
  pageParam?: any
42
41
  } = {},
43
42
  ) {
44
43
  const { pageParam } = opt
45
44
  this.logPageParamStr = pageParam
46
45
  ? pageParam
47
46
  : this.creatParamToLogStr(this.jumpConfig)
48
47
  .replace(/moduleId/, 'JumpmoduleID')
49
48
  .replace(/entrance/, 'Jumpentrance')
50
49
  reportPV({
51
50
  pageId,
52
51
  pageParam: this.logPageParamStr,
53
52
  ...opt,
54
53
  })
55
54
  }
56
55
 
57
56
  jdJumpToDongDongChatGroup(groupId, source = '4') {
58
57
  this.jdNavigateToNative({
59
58
  category: 'jump',
60
59
  des: 'dongdong_group_chat',
61
60
  source: source,
62
61
  groupId: `${groupId}`,
63
62
  })
64
63
  }
65
64
 
66
65
  jdJumpToWeb(
67
66
  url,
68
67
  logEventInfo,
69
68
  successBack?: Function | undefined,
70
69
  failBack?: Function | undefined,
71
70
  ) {
72
71
  console.log('jd web',this.isOpenJdAppUrl(url),url)
73
72
  if (this.isOpenJdAppUrl(url)) {
74
73
  const getOpenAppParams = this.jdOpenAppParams(url)
75
74
  console.log(
76
75
  'jd web 获取自定义openApp链接解析后的参数结果',
77
76
  getOpenAppParams,
78
77
  )
79
78
  if (getOpenAppParams) {
80
79
  this.jdNavigateToNative(
81
80
  Object.assign({}, getOpenAppParams, {
82
81
  logEventInfo,
83
82
  }),
84
83
  )
85
84
  }
86
85
  } else {
87
86
  let _getLastUrl = url
88
87
  if(/shop\.m\.jd\.com|pages\.jd\.com/.test(url)){
89
88
  _getLastUrl = !/jwebprog=0/.test(url) ? `${url}${url.indexOf("?") !== -1 ? '&jwebprog=0' : '?jwebprog=0'}` : url
90
89
  }
91
90
  super.jdJumpToWeb(
92
91
  _getLastUrl,
93
92
  {
94
93
  ...logEventInfo,
95
94
  },
96
95
  successBack,
97
96
  failBack,
98
97
  )
99
98
  }
100
99
  }
101
100
 
102
101
  jdJumpToWebInner(url, logEventInfo) {
103
102
  this.jdJumpToWeb(url, logEventInfo)
104
103
  }
105
104
 
106
105
  jdJumpConfigUrl(detail, logEventInfo = {}) {
107
106
  const { configDataType, configDataValue } = detail
108
107
  switch (configDataType) {
109
108
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
110
109
  this.jdJumpToShopCategory({
111
110
  ...configDataValue,
112
111
  logEventInfo,
113
112
  })
114
113
  break
115
114
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
116
115
  if(logEventInfo?.jsonParam?.logBaseInfo?.mInfo){
117
116
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds
118
117
  }
119
118
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo)
120
119
  break
121
120
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
122
121
  this.jdJumpToWeb(
123
122
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
124
123
  {},
125
124
  )
126
125
  break
127
126
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
128
127
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
129
128
  const getShopSearchParams = this.jdOpenAppParams(
130
129
  configDataValue.clickUrl,
131
130
  )
132
131
  console.log(
133
132
  'jd web 获取店铺分类链接解析后的参数结果',
134
133
  getShopSearchParams,
135
134
  )
136
135
  getShopSearchParams &&
137
136
  this.jdJumpToShopSearch(
138
137
  Object.assign({}, getShopSearchParams, {
139
138
  logEventInfo,
140
139
  }),
141
140
  )
142
141
  } else {
143
142
  this.jdJumpToShopSearch(
144
143
  configDataValue['cid']
145
144
  ? Object.assign(
146
145
  {},
147
146
  {
148
147
  shopId: global.info.queryInfo.shopId,
149
148
  categoryId: configDataValue.cid,
150
149
  searchType: '5',
151
150
  logEventInfo,
152
151
  },
153
152
  )
154
153
  : {
155
154
  shopId: global.info.queryInfo.shopId,
156
155
  logEventInfo,
157
156
  },
158
157
  )
159
158
  }
160
159
  break
161
160
  case LinkConfigType.CONFIG_TYPE_MEMBER:
162
161
  if(isAppHomeForMarketPage){
163
162
  this.jdJumpToBottomTabBrandMember({
164
163
  logEventInfo
165
164
  })
166
165
  }else {
167
166
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
168
167
  const getShopMemberParams = this.jdOpenAppParams(
169
168
  configDataValue.clickUrl,
170
169
  )
171
170
  getShopMemberParams &&
172
171
  this.jdJumpToShopMember(
173
172
  Object.assign({}, getShopMemberParams, {
174
173
  logEventInfo,
175
174
  }),
176
175
  )
177
176
  } else {
178
177
  this.jdJumpToShopMember({
179
178
  shopId: global.info.queryInfo.shopId,
180
179
  venderId: configDataValue.shopDetail,
181
180
  logEventInfo,
182
181
  })
183
182
  }
184
183
  }
185
184
  break
186
185
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
187
186
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
188
187
  const getShopActivityParams = this.jdOpenAppParams(
189
188
  configDataValue.clickUrl,
190
189
  )
191
190
  getShopActivityParams &&
192
191
  this.jdJumpToShopActivity(
193
192
  Object.assign({}, getShopActivityParams, {
194
193
  logEventInfo,
195
194
  }),
196
195
  )
197
196
  } else if (configDataValue['projectId']) {
198
197
  this.jdJumpToShopActivity({
199
198
  projectId: configDataValue['projectId'],
200
199
  configDataValue,
201
200
  logEventInfo,
202
201
  })
203
202
  }
204
203
  break
205
204
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
206
205
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
207
206
  const _url = configDataValue.linkUrl
208
207
  if (
209
208
  _url.indexOf('to=') === -1 &&
210
209
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
211
210
  ) {
212
211
  const _shopId = _url.match(/\d+/g)[0]
213
212
  this.jdJumpToShopHome({
214
213
  shopId: `${_shopId}`,
215
214
  logEventInfo,
216
215
  })
217
216
  } else if (this.isOpenJdAppUrl(_url)) {
218
217
  const getOpenAppParams = this.jdOpenAppParams(_url)
219
218
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
220
219
  if (getOpenAppParams) {
221
220
  let _changeOpenAppParams = getOpenAppParams
222
221
  if(isAppHomeForMarketPage){
223
222
  const { operation, ...otherOpenAppParams } = getOpenAppParams
224
223
  if(operation && operation === 'jumpTabInner'){
225
224
  _changeOpenAppParams = otherOpenAppParams
226
225
  }
227
226
  }
228
227
  this.jdNavigateToNative(
229
228
  Object.assign({}, _changeOpenAppParams, {
230
229
  logEventInfo,
231
230
  }),
232
231
  )
233
232
  }
234
233
  } else {
235
234
  this.jdJumpToWeb(_url, logEventInfo)
236
235
  }
237
236
  break
238
237
  }
239
238
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
240
239
  this.jdJumpToShopDetail({
241
240
  venderId: global.info.queryInfo.venderId,
242
241
  shopId: global.info.queryInfo.shopId,
243
242
  logEventInfo,
244
243
  })
245
244
  break
246
245
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
247
246
  this.jdJumpToShopHome({
248
247
  ...configDataValue,
249
248
  logEventInfo,
250
249
  })
251
250
  break
252
251
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
253
252
  break
254
253
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
255
254
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
256
255
  const getShoppingGuideParams = this.jdOpenAppParams(
257
256
  configDataValue.clickUrl,
258
257
  )
259
258
  getShoppingGuideParams &&
260
259
  this.jdJumpToShopActivity(
261
260
  Object.assign({}, getShoppingGuideParams, {
262
261
  logEventInfo,
263
262
  }),
264
263
  )
265
264
  }
266
265
  break
267
266
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
268
267
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '')
269
268
  const search = linkUrl.match(/\?.+/)
270
269
  if (search) {
271
270
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
272
271
  parseQueryUrlString(linkUrl)
273
272
  try {
274
273
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param)
275
274
  } catch (e) {
276
275
  console.warn('解析小程序 param 错误:', miniQueryData.param)
277
276
  }
278
277
  this.jdJumpToMiniProgram(miniQueryData)
279
278
  } else {
280
279
  console.warn('小程序地址错误:', linkUrl)
281
280
  }
282
281
  break
283
282
  }
284
283
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
285
284
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
286
285
  const getShopSearchParams = this.jdOpenAppParams(
287
286
  configDataValue.clickUrl,
288
287
  )
289
288
  console.log(
290
289
  'jd web 获取店铺结果落地页链接解析后的参数结果',
291
290
  getShopSearchParams,
292
291
  )
293
292
  getShopSearchParams &&
294
293
  this.jdJumpToShopSearch(
295
294
  Object.assign({}, getShopSearchParams, {
296
295
  logEventInfo,
297
296
  }),
298
297
  )
299
298
  } else {
300
299
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo)
301
300
  }
302
301
  break
303
302
  }
304
303
  default:
305
304
  }
306
305
  }
307
306
 
308
307
  jdNavigateToNative(
309
308
  params: {},
310
309
  url = 'openapp.jdmobile://virtual',
311
310
  successBack?: Function | null,
312
311
  failBack?: Function | null,
313
312
  ) {
314
313
  console.log('[降级H5] jdNavigateToNative web.jd:', params)
315
314
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
316
315
  Object.assign(
317
316
  {},
318
317
  {
319
318
  sourceValue: 'sourceValue_jshopModuleWeb',
320
319
  sourceType: 'sourceType_jshopModuleWeb',
321
320
  param: {},
322
321
  },
323
322
  params,
324
323
  )
325
324
  const { logEventInfo, ...otherParams } = getResParams
326
325
  console.log(
327
326
  'jd web 获取open协议参数 jdNavigateToNative params: ',
328
327
  getResParams,
329
328
  )
330
329
  console.log('logEventInfo params: ', logEventInfo)
331
330
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
332
331
  this.clickEventLog(logEventInfo || getResParams)
333
332
  .then(() => {
334
333
  if (typeof successBack == 'function') {
335
334
  successBack(getResParams)
336
335
  } else {
337
336
  try {
338
337
  const paramsStr = JSON.stringify(otherParams)
339
338
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`)
340
339
  window.location.href = `${url}?params=${paramsStr}`
341
340
  } catch (e) {
342
341
  console.log('跳转异常', e)
343
342
  }
344
343
  }
345
344
  })
346
345
  .catch(() => {
347
346
  typeof failBack == 'function' && failBack(getResParams)
348
347
  })
349
348
  }
350
349
 
351
350
  clickEventLog(
352
351
  opts: JumpEventReportInterFace.OptEventLogParams = {},
353
352
  reportKey = 'click',
354
353
  ) {
355
354
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
356
355
  if (eventId && jsonParam) {
357
356
  const { etModelInfo, logBaseInfo } = jsonParam
358
357
  let getJsonParam = {}
359
358
  if (etModelInfo && logBaseInfo) {
360
359
  getJsonParam = logBaseInfo
361
360
  } else {
362
361
  if (Array.isArray(jsonParam)){
363
362
  getJsonParam = jsonParam
364
363
  } else {
365
364
  getJsonParam = Object.assign(
366
365
  {},
367
366
  {
368
367
  shopid: global.info.queryInfo?.shopId,
369
368
  },
370
369
  jsonParam,
371
370
  )
372
371
  }
373
372
  }
374
373
  if(reportKey === 'exposure' && /^TerminatorNew/.test(eventId) && !Array.isArray(getJsonParam)){
375
374
  getJsonParam = [getJsonParam]
376
375
  }
377
376
  const webLogParams = {
378
377
  eid: eventId,
379
378
  elevel: eventLevel,
380
379
  jsonParam: JSON.stringify(getJsonParam),
381
380
  etModel: JSON.stringify(etModelInfo || {}),
382
381
  pageId: this.logPageId,
383
382
  pageParam: this.logPageParamStr,
384
383
  ...otherParams,
385
384
  }
386
385
  return /click|exposure/.test(reportKey)
387
386
  ? reportClick(webLogParams)
388
387
  : reportToCart(opts,webLogParams)
389
388
  } else {
390
389
  console.log('暂无埋点参数eventId和eventParam')
391
390
  return Promise.resolve(false)
392
391
  }
393
392
  }
394
393
 
395
394
  exposureEventLog(opts) {
396
395
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
397
396
  ? this.clickEventLog(
398
397
  {
399
398
  ...opts,
400
399
  exposureState: true,
401
400
  },
402
401
  'exposure',
403
402
  )
404
403
  : Promise.resolve(false)
405
404
  }
405
+ import { JdJumpJdApp } from './jdJumpJdApp';
406
406
  routerInfo: {
407
407
  params: {},
408
408
  },
409
409
  nativeEvent: null,
410
410
  jumpConfig: {
411
411
  venderId: null,
412
412
  shopId: null,
413
413
  sourceValue: '',
414
414
  sourceType: 'App-H5',
415
415
  activityType: 'shopx',
416
416
  moduleId: 'none',
417
417
  entrance: 'none',
418
418
  },
419
419
  logPageParamStr: '',
420
420
  public logPageId: string;
421
421
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
422
422
  constructor(opt = {}) {
423
423
  super(opt);
424
424
  this.getConfig(opt);
425
425
  }
426
426
  getConfig(opt = {}) {
427
427
  return Object.assign(this, {}, defaultConfig, opt);
428
428
  }
429
429
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
430
430
  this.logPageId = pageId;
431
431
  this.routerInfo = routerInfo;
432
432
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
433
433
  this.logPname = logPname;
434
434
  }
435
435
  reportInfoPv(
436
436
  pageId = LogPageIdInfo.APP,
437
437
  opt: {
438
438
  pageParam?: any;
439
439
  } = {},
440
440
  ) {
441
441
  const { pageParam } = opt;
442
442
  this.logPageParamStr = pageParam
443
443
  ? pageParam
444
444
  : this.creatParamToLogStr(this.jumpConfig)
445
445
  .replace(/moduleId/, 'JumpmoduleID')
446
446
  .replace(/entrance/, 'Jumpentrance');
447
447
  reportPV({
448
448
  pageId,
449
449
  pageParam: this.logPageParamStr,
450
450
  ...opt,
451
451
  });
452
452
  }
453
453
 
454
454
  jdJumpToDongDongChatGroup(groupId, source = '4') {
455
455
  this.jdNavigateToNative({
456
456
  category: 'jump',
457
457
  des: 'dongdong_group_chat',
458
458
  source: source,
459
459
  groupId: `${groupId}`,
460
460
  });
461
461
  }
462
462
 
463
463
  jdJumpToWeb(
464
464
  url,
465
465
  logEventInfo,
466
466
  successBack?: Function | undefined,
467
467
  failBack?: Function | undefined,
468
468
  ) {
469
469
  console.log('jd web', this.isOpenJdAppUrl(url), url);
470
470
  if (this.isOpenJdAppUrl(url)) {
471
471
  const getOpenAppParams = this.jdOpenAppParams(url);
472
472
  console.log('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
473
473
  if (getOpenAppParams) {
474
474
  this.jdNavigateToNative(
475
475
  Object.assign({}, getOpenAppParams, {
476
476
  logEventInfo,
477
477
  }),
478
478
  );
479
479
  }
480
480
  } else {
481
481
  let _getLastUrl = url;
482
482
  if (/shop\.m\.jd\.com|pages\.jd\.com/.test(url)) {
483
483
  _getLastUrl = !/jwebprog=0/.test(url)
484
484
  ? `${url}${url.indexOf('?') !== -1 ? '&jwebprog=0' : '?jwebprog=0'}`
485
485
  : url;
486
486
  }
487
487
  super.jdJumpToWeb(
488
488
  _getLastUrl,
489
489
  {
490
490
  ...logEventInfo,
491
491
  },
492
492
  successBack,
493
493
  failBack,
494
494
  );
495
495
  }
496
496
  }
497
497
 
498
498
  jdJumpToWebInner(url, logEventInfo) {
499
499
  this.jdJumpToWeb(url, logEventInfo);
500
500
  }
501
501
 
502
502
  jdJumpConfigUrl(detail, logEventInfo = {}) {
503
503
  const { configDataType, configDataValue } = detail;
504
504
  switch (configDataType) {
505
505
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
506
506
  this.jdJumpToShopCategory({
507
507
  ...configDataValue,
508
508
  logEventInfo,
509
509
  });
510
510
  break;
511
511
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
512
512
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
513
513
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
514
514
  }
515
515
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
516
516
  break;
517
517
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
518
518
  this.jdJumpToWeb(
519
519
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
520
520
  {},
521
521
  );
522
522
  break;
523
523
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
524
524
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
525
525
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
526
526
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
527
527
  getShopSearchParams &&
528
528
  this.jdJumpToShopSearch(
529
529
  Object.assign({}, getShopSearchParams, {
530
530
  logEventInfo,
531
531
  }),
532
532
  );
533
533
  } else {
534
534
  this.jdJumpToShopSearch(
535
535
  configDataValue['cid']
536
536
  ? Object.assign(
537
537
  {},
538
538
  {
539
539
  shopId: global.info.queryInfo.shopId,
540
540
  categoryId: configDataValue.cid,
541
541
  searchType: '5',
542
542
  logEventInfo,
543
543
  },
544
544
  )
545
545
  : {
546
546
  shopId: global.info.queryInfo.shopId,
547
547
  logEventInfo,
548
548
  },
549
549
  );
550
550
  }
551
551
  break;
552
552
  case LinkConfigType.CONFIG_TYPE_MEMBER:
553
553
  if (isAppHomeForMarketPage) {
554
554
  this.jdJumpToBottomTabBrandMember({
555
555
  logEventInfo,
556
556
  });
557
557
  } else {
558
558
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
559
559
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
560
560
  getShopMemberParams &&
561
561
  this.jdJumpToShopMember(
562
562
  Object.assign({}, getShopMemberParams, {
563
563
  logEventInfo,
564
564
  }),
565
565
  );
566
566
  } else {
567
567
  this.jdJumpToShopMember({
568
568
  shopId: global.info.queryInfo.shopId,
569
569
  venderId: configDataValue.shopDetail,
570
570
  logEventInfo,
571
571
  });
572
572
  }
573
573
  }
574
574
  break;
575
575
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
576
576
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
577
577
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
578
578
  getShopActivityParams &&
579
579
  this.jdJumpToShopActivity(
580
580
  Object.assign({}, getShopActivityParams, {
581
581
  logEventInfo,
582
582
  }),
583
583
  );
584
584
  } else if (configDataValue['projectId']) {
585
585
  this.jdJumpToShopActivity({
586
586
  projectId: configDataValue['projectId'],
587
587
  configDataValue,
588
588
  logEventInfo,
589
589
  });
590
590
  }
591
591
  break;
592
592
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
593
593
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
594
594
  const _url = configDataValue.linkUrl;
595
595
  if (
596
596
  _url.indexOf('to=') === -1 &&
597
597
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
598
598
  ) {
599
599
  const _shopId = _url.match(/\d+/g)[0];
600
600
  this.jdJumpToShopHome({
601
601
  shopId: `${_shopId}`,
602
602
  logEventInfo,
603
603
  });
604
604
  } else if (this.isOpenJdAppUrl(_url)) {
605
605
  const getOpenAppParams = this.jdOpenAppParams(_url);
606
606
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
607
607
  if (getOpenAppParams) {
608
608
  let _changeOpenAppParams = getOpenAppParams;
609
609
  if (isAppHomeForMarketPage) {
610
610
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
611
611
  if (operation && operation === 'jumpTabInner') {
612
612
  _changeOpenAppParams = otherOpenAppParams;
613
613
  }
614
614
  }
615
615
  this.jdNavigateToNative(
616
616
  Object.assign({}, _changeOpenAppParams, {
617
617
  logEventInfo,
618
618
  }),
619
619
  );
620
620
  }
621
621
  } else {
622
622
  this.jdJumpToWeb(_url, logEventInfo);
623
623
  }
624
624
  break;
625
625
  }
626
626
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
627
627
  this.jdJumpToShopDetail({
628
628
  venderId: global.info.queryInfo.venderId,
629
629
  shopId: global.info.queryInfo.shopId,
630
630
  logEventInfo,
631
631
  });
632
632
  break;
633
633
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
634
634
  this.jdJumpToShopHome({
635
635
  ...configDataValue,
636
636
  logEventInfo,
637
637
  });
638
638
  break;
639
639
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
640
640
  break;
641
641
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
642
642
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
643
643
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
644
644
  getShoppingGuideParams &&
645
645
  this.jdJumpToShopActivity(
646
646
  Object.assign({}, getShoppingGuideParams, {
647
647
  logEventInfo,
648
648
  }),
649
649
  );
650
650
  }
651
651
  break;
652
652
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
653
653
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
654
654
  const search = linkUrl.match(/\?.+/);
655
655
  if (search) {
656
656
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
657
657
  parseQueryUrlString(linkUrl);
658
658
  try {
659
659
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
660
660
  } catch (e) {
661
661
  console.warn('解析小程序 param 错误:', miniQueryData.param);
662
662
  }
663
663
  this.jdJumpToMiniProgram(miniQueryData);
664
664
  } else {
665
665
  console.warn('小程序地址错误:', linkUrl);
666
666
  }
667
667
  break;
668
668
  }
669
669
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
670
670
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
671
671
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
672
672
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
673
673
  getShopSearchParams &&
674
674
  this.jdJumpToShopSearch(
675
675
  Object.assign({}, getShopSearchParams, {
676
676
  logEventInfo,
677
677
  }),
678
678
  );
679
679
  } else {
680
680
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
681
681
  }
682
682
  break;
683
683
  }
684
684
  default:
685
685
  }
686
686
  }
687
687
 
688
688
  jdNavigateToNative(
689
689
  params: {},
690
690
  url = 'openapp.jdmobile://virtual',
691
691
  successBack?: Function | null,
692
692
  failBack?: Function | null,
693
693
  ) {
694
694
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
695
695
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
696
696
  {},
697
697
  {
698
698
  sourceValue: 'sourceValue_jshopModuleWeb',
699
699
  sourceType: 'sourceType_jshopModuleWeb',
700
700
  param: {},
701
701
  },
702
702
  params,
703
703
  );
704
704
  const { logEventInfo, ...otherParams } = getResParams;
705
705
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
706
706
  console.log('logEventInfo params: ', logEventInfo);
707
707
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
708
708
  this.clickEventLog(logEventInfo || getResParams)
709
709
  .then(() => {
710
710
  if (typeof successBack === 'function') {
711
711
  successBack(getResParams);
712
712
  } else {
713
713
  try {
714
714
  const paramsStr = JSON.stringify(otherParams);
715
715
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
716
716
  window.location.href = `${url}?params=${paramsStr}`;
717
717
  } catch (e) {
718
718
  console.log('跳转异常', e);
719
719
  }
720
720
  }
721
721
  })
722
722
  .catch(() => {
723
723
  typeof failBack === 'function' && failBack(getResParams);
724
724
  });
725
725
  }
726
726
 
727
727
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
728
728
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts;
729
729
  if (eventId && jsonParam) {
730
730
  const { etModelInfo, logBaseInfo } = jsonParam;
731
731
  let getJsonParam = {};
732
732
  if (etModelInfo && logBaseInfo) {
733
733
  getJsonParam = logBaseInfo;
734
734
  } else {
735
735
  if (Array.isArray(jsonParam)) {
736
736
  getJsonParam = jsonParam;
737
737
  } else {
738
738
  getJsonParam = Object.assign(
739
739
  {},
740
740
  {
741
741
  shopid: global.info.queryInfo?.shopId,
742
742
  },
743
743
  jsonParam,
744
744
  );
745
745
  }
746
746
  }
747
747
  if (
748
748
  reportKey === 'exposure' &&
749
749
  /^TerminatorNew/.test(eventId) &&
750
750
  !Array.isArray(getJsonParam)
751
751
  ) {
752
752
  getJsonParam = [getJsonParam];
753
753
  }
754
754
  const webLogParams = {
755
755
  isExpo: reportKey === 'exposure',
756
756
  eid: eventId,
757
757
  elevel: eventLevel,
758
758
  jsonParam: JSON.stringify(getJsonParam),
759
759
  etModel: JSON.stringify(etModelInfo || {}),
760
760
  pageId: this.logPageId,
761
761
  pageParam: this.logPageParamStr,
762
762
  ...otherParams,
763
763
  };
764
764
  return /click|exposure/.test(reportKey)
765
765
  ? reportClick(webLogParams)
766
766
  : reportToCart(opts, webLogParams);
767
767
  } else {
768
768
  console.log('暂无埋点参数eventId和eventParam');
769
769
  return Promise.resolve(false);
770
770
  }
771
771
  }
772
772
 
773
773
  exposureEventLog(opts) {
774
774
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
775
775
  ? this.clickEventLog(
776
776
  {
777
777
  ...opts,
778
778
  exposureState: true,
779
779
  },
780
780
  'exposure',
781
781
  )
782
782
  : Promise.resolve(false);
783
783
  }