@conecli/cone-render 0.8.34 → 0.8.35

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