@conecli/cone-render 0.9.1-shop2.7 → 0.9.1-shop2.9

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