@conecli/cone-render 0.8.38-beta.0 → 0.8.38

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