@conecli/cone-render 0.8.35 → 0.9.1-shop-beta.0

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 (36) hide show
  1. package/README.md +7 -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/CustomScrollView/index.tsx +1 -1
  9. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  10. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  11. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  12. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  13. package/dist/components/base/Skeleton/index.tsx +1 -1
  14. package/dist/components/remoteFloorItem.tsx +1 -1
  15. package/dist/interface/common.ts +1 -1
  16. package/dist/jumpEventReport/base.ts +1 -1
  17. package/dist/jumpEventReport/web.base.ts +1 -1
  18. package/dist/jumpEventReport/web.jd.ts +1 -1
  19. package/dist/utils/h5Utils.ts +1 -1
  20. package/dist/utils/index.h5.ts +1 -1
  21. package/dist/utils/index.ts +1 -1
  22. package/dist/utils/index.weapp.ts +1 -1
  23. package/dist/utils/taroRenderUtil.ts +1 -0
  24. package/dist/utils/utils.ts +1 -1
  25. package/dist/wxapp/api/helper.js +1 -0
  26. package/dist/wxapp/components/launch-app/index.js +1 -0
  27. package/dist/wxapp/components/launch-app/index.json +5 -0
  28. package/dist/wxapp/components/launch-app/index.wxml +0 -0
  29. package/dist/wxapp/components/launch-app/index.wxss +0 -0
  30. package/dist/wxapp/components/subscribe-guider/helper.js +1 -0
  31. package/dist/wxapp/components/subscribe-guider/index.js +1 -0
  32. package/dist/wxapp/components/subscribe-guider/index.json +5 -0
  33. package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
  34. package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
  35. package/package.json +47 -31
  36. package/dist/components/base/Skeleton/old.tsx +0 -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
  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
  if(logEventInfo?.jsonParam?.logBaseInfo?.mInfo){
103
102
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds
104
103
  }
105
104
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo)
106
105
  break
107
106
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
108
107
  this.jdJumpToWeb(
109
108
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
110
109
  {},
111
110
  )
112
111
  break
113
112
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
114
113
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
115
114
  const getShopSearchParams = this.jdOpenAppParams(
116
115
  configDataValue.clickUrl,
117
116
  )
118
117
  console.log(
119
118
  'jd web 获取店铺分类链接解析后的参数结果',
120
119
  getShopSearchParams,
121
120
  )
122
121
  getShopSearchParams &&
123
122
  this.jdJumpToShopSearch(
124
123
  Object.assign({}, getShopSearchParams, {
125
124
  logEventInfo,
126
125
  }),
127
126
  )
128
127
  } else {
129
128
  this.jdJumpToShopSearch(
130
129
  configDataValue['cid']
131
130
  ? Object.assign(
132
131
  {},
133
132
  {
134
133
  shopId: global.info.queryInfo.shopId,
135
134
  categoryId: configDataValue.cid,
136
135
  searchType: '5',
137
136
  logEventInfo,
138
137
  },
139
138
  )
140
139
  : {
141
140
  shopId: global.info.queryInfo.shopId,
142
141
  logEventInfo,
143
142
  },
144
143
  )
145
144
  }
146
145
  break
147
146
  case LinkConfigType.CONFIG_TYPE_MEMBER:
148
147
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
149
148
  const getShopMemberParams = this.jdOpenAppParams(
150
149
  configDataValue.clickUrl,
151
150
  )
152
151
  getShopMemberParams &&
153
152
  this.jdJumpToShopMember(
154
153
  Object.assign({}, getShopMemberParams, {
155
154
  logEventInfo,
156
155
  }),
157
156
  )
158
157
  } else {
159
158
  this.jdJumpToShopMember({
160
159
  shopId: global.info.queryInfo.shopId,
161
160
  venderId: configDataValue.shopDetail,
162
161
  logEventInfo,
163
162
  })
164
163
  }
165
164
  break
166
165
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
167
166
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
168
167
  const getShopActivityParams = this.jdOpenAppParams(
169
168
  configDataValue.clickUrl,
170
169
  )
171
170
  getShopActivityParams &&
172
171
  this.jdJumpToShopActivity(
173
172
  Object.assign({}, getShopActivityParams, {
174
173
  logEventInfo,
175
174
  }),
176
175
  )
177
176
  } else if (configDataValue['projectId']) {
178
177
  this.jdJumpToShopActivity({
179
178
  projectId: configDataValue['projectId'],
180
179
  configDataValue,
181
180
  logEventInfo,
182
181
  })
183
182
  }
184
183
  break
185
184
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
186
185
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
187
186
  const _url = configDataValue.linkUrl
188
187
  if (
189
188
  _url.indexOf('to=') === -1 &&
190
189
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
191
190
  ) {
192
191
  const _shopId = _url.match(/\d+/g)[0]
193
192
  this.jdJumpToShopHome({
194
193
  shopId: `${_shopId}`,
195
194
  logEventInfo,
196
195
  })
197
196
  } else if (this.isOpenJdAppUrl(_url)) {
198
197
  const getOpenAppParams = this.jdOpenAppParams(_url)
199
198
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
200
199
  if (getOpenAppParams) {
201
200
  this.jdNavigateToNative(
202
201
  Object.assign({}, getOpenAppParams, {
203
202
  logEventInfo,
204
203
  }),
205
204
  )
206
205
  }
207
206
  } else {
208
207
  this.jdJumpToWeb(_url, logEventInfo)
209
208
  }
210
209
  break
211
210
  }
212
211
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
213
212
  this.jdJumpToShopDetail({
214
213
  venderId: global.info.queryInfo.venderId,
215
214
  shopId: global.info.queryInfo.shopId,
216
215
  logEventInfo,
217
216
  })
218
217
  break
219
218
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
220
219
  this.jdJumpToShopHome({
221
220
  ...configDataValue,
222
221
  logEventInfo,
223
222
  })
224
223
  break
225
224
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
226
225
  break
227
226
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
228
227
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
229
228
  const getShoppingGuideParams = this.jdOpenAppParams(
230
229
  configDataValue.clickUrl,
231
230
  )
232
231
  getShoppingGuideParams &&
233
232
  this.jdJumpToShopActivity(
234
233
  Object.assign({}, getShoppingGuideParams, {
235
234
  logEventInfo,
236
235
  }),
237
236
  )
238
237
  }
239
238
  break
240
239
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
241
240
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '')
242
241
  const search = linkUrl.match(/\?.+/)
243
242
  if (search) {
244
243
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
245
244
  parseQueryUrlString(linkUrl)
246
245
  try {
247
246
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param)
248
247
  } catch (e) {
249
248
  console.warn('解析小程序 param 错误:', miniQueryData.param)
250
249
  }
251
250
  this.jdJumpToMiniProgram(miniQueryData)
252
251
  } else {
253
252
  console.warn('小程序地址错误:', linkUrl)
254
253
  }
255
254
  break
256
255
  }
257
256
  default:
258
257
  }
259
258
  }
260
259
 
261
260
  jdNavigateToNative(
262
261
  params: {},
263
262
  url = 'openapp.jdmobile://virtual',
264
263
  successBack?: Function | null,
265
264
  failBack?: Function | null,
266
265
  ) {
267
266
  console.log('[降级H5] jdNavigateToNative web.jd:', params)
268
267
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
269
268
  Object.assign(
270
269
  {},
271
270
  {
272
271
  sourceValue: 'sourceValue_jshopModuleWeb',
273
272
  sourceType: 'sourceType_jshopModuleWeb',
274
273
  param: {},
275
274
  },
276
275
  params,
277
276
  )
278
277
  const { logEventInfo, ...otherParams } = getResParams
279
278
  console.log(
280
279
  'jd web 获取open协议参数 jdNavigateToNative params: ',
281
280
  getResParams,
282
281
  )
283
282
  console.log('logEventInfo params: ', logEventInfo)
284
283
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
285
284
  this.clickEventLog(logEventInfo || getResParams)
286
285
  .then(() => {
287
286
  if (typeof successBack == 'function') {
288
287
  successBack(getResParams)
289
288
  } else {
290
289
  try {
291
290
  const paramsStr = JSON.stringify(otherParams)
292
291
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`)
293
292
  window.location.href = `${url}?params=${paramsStr}`
294
293
  } catch (e) {
295
294
  console.log('跳转异常', e)
296
295
  }
297
296
  }
298
297
  })
299
298
  .catch(() => {
300
299
  typeof failBack == 'function' && failBack(getResParams)
301
300
  })
302
301
  }
303
302
 
304
303
  clickEventLog(
305
304
  opts: JumpEventReportInterFace.OptEventLogParams = {},
306
305
  reportKey = 'click',
307
306
  ) {
308
307
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
309
308
  if (eventId && jsonParam) {
310
309
  const { etModelInfo, logBaseInfo } = jsonParam
311
310
  const webLogParams = {
312
311
  eid: eventId,
313
312
  elevel: eventLevel,
314
313
  jsonParam: JSON.stringify(logBaseInfo || jsonParam),
315
314
  etModel: JSON.stringify(etModelInfo || {}),
316
315
  pageId: this.logPageId,
317
316
  pageParam: this.logPageParamStr,
318
317
  ...otherParams,
319
318
  }
320
319
  return /click|exposure/.test(reportKey)
321
320
  ? reportClick(webLogParams)
322
321
  : reportToCart(opts,webLogParams)
323
322
  } else {
324
323
  console.log('暂无埋点参数eventId和eventParam')
325
324
  return Promise.resolve(false)
326
325
  }
327
326
  }
328
327
 
329
328
  exposureEventLog(opts) {
330
329
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
331
330
  ? this.clickEventLog(
332
331
  {
333
332
  ...opts,
334
333
  exposureState: true,
335
334
  },
336
335
  'exposure',
337
336
  )
338
337
  : Promise.resolve(false)
339
338
  }
339
+ import { JdJumpJdApp } from './jdJumpJdApp'
340
340
  reportClick,
341
341
  reportPV,
342
342
  reportToCart,
343
343
  routerInfo: {
344
344
  params: {},
345
345
  },
346
346
  nativeEvent: null,
347
347
  jumpConfig: {
348
348
  venderId: null,
349
349
  shopId: null,
350
350
  sourceValue: '',
351
351
  sourceType: 'App-H5',
352
352
  activityType: 'shopx',
353
353
  moduleId: 'none',
354
354
  entrance: 'none',
355
355
  },
356
356
  logPageParamStr: '',
357
357
  public logPageId: string
358
358
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
359
359
  constructor(opt = {}) {
360
360
  super(opt)
361
361
  this.getConfig(opt)
362
362
  }
363
363
  getConfig(opt = {}) {
364
364
  return Object.assign(this, {}, defaultConfig, opt)
365
365
  }
366
366
  updateInfo(
367
367
  routerInfo,
368
368
  logPname = LogPnameInfo.HOME,
369
369
  pageId = LogPageIdInfo.APP,
370
370
  ) {
371
371
  this.logPageId = pageId
372
372
  this.routerInfo = routerInfo
373
373
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params)
374
374
  this.logPname = logPname
375
375
  }
376
376
  reportInfoPv(
377
377
  pageId = LogPageIdInfo.APP,
378
378
  opt: {
379
379
  pageParam?: any
380
380
  } = {},
381
381
  ) {
382
382
  const { pageParam } = opt
383
383
  this.logPageParamStr = pageParam
384
384
  ? pageParam
385
385
  : this.creatParamToLogStr(this.jumpConfig)
386
386
  .replace(/moduleId/, 'JumpmoduleID')
387
387
  .replace(/entrance/, 'Jumpentrance')
388
388
  reportPV({
389
389
  pageId,
390
390
  pageParam: this.logPageParamStr,
391
391
  ...opt,
392
392
  })
393
393
  }
394
394
 
395
395
  jdJumpToDongDongChatGroup(groupId, source = '4') {
396
396
  this.jdNavigateToNative({
397
397
  category: 'jump',
398
398
  des: 'dongdong_group_chat',
399
399
  source: source,
400
400
  groupId: `${groupId}`,
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
  }